Results 1 to 5 of 5

Thread: Problem with @Configuration and CGLIB

  1. #1
    Join Date
    Apr 2011
    Location
    Estonia
    Posts
    3

    Default Problem with @Configuration and CGLIB

    Hello,

    I have read tutorials Putting the Spring in Your Step and Getting Started with Spring ....
    So i am trying to get examples work.

    1. I'm using STS and created new project using Spring MVC Template (as usual pom.xml build file and Spring built-in server).

    2. Added cglib-2.2.2.jar to build path (Referenced Libraries).

    3. Created file CrmConfiguration.java and written inside:
    package cglib.is.bad;
    import org.springframework.context.annotation.Configurati on;

    @Configuration
    public class CrmConfiguration {
    }
    4. Running server and getting exception:
    java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions: [crmConfiguration]
    ...
    What should i do to get @Configuration work?
    Thank you for your answers!

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    You should use maven to add the dependency and not add it manually to the build path.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Apr 2011
    Location
    Estonia
    Posts
    3

    Default

    Quote Originally Posted by Marten Deinum View Post
    You should use maven to add the dependency and not add it manually to the build path.
    Thank you for advice, now i've read more about Maven and dependencies, interesting stuff.

    Added to pom.xml file following rows:
    <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-full</artifactId>
    <version>2.0.2</version>
    </dependency>
    And the exception about CGLIB did not occur anymore.

    However a new exception have risen.
    Searching for a new solution now.
    ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed
    java.lang.IllegalStateException: Cannot load configuration class: one.more.spring.CrmConfiguration
    Last edited by sometimes; Apr 22nd, 2011 at 07:55 AM.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    For cglib you should use the nodep version (and probably the 2.2 version). Class cannot be loaded either class not found or some error related to dynamic class generation. Enable debug logging for spring and check the spring log files.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Oct 2012
    Posts
    3

    Default Thank you

    Quote Originally Posted by sometimes View Post
    <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-full</artifactId>
    <version>2.0.2</version>
    </dependency>
    Thank you, sometimes, this solved my problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •