Announcement Announcement Module
Collapse
No announcement yet.
NoClassDefFoundError - org/aspectj/lang/Signature Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoClassDefFoundError - org/aspectj/lang/Signature

    Hi,

    I've got a working Spring Web MVC application and now I want to implement Spring Security for protected websites.

    For the applicationContext-security.xml I use the following code:

    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
        xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                            http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">

        <global-method-security secured-annotations="enabled">
            <!-- AspectJ pointcut expression that locates our "post" method and applies security that way
            <protect-pointcut expression="execution(* bigbank.*Service.post*(..))" access="ROLE_TELLER"/>
            -->
        </global-method-security>

        <http auto-config="true">
            <intercept-url pattern="/registrieren.html" access="ROLE_SUPERVISOR"/>
            <intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED" />
            <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        </http>

        <!--
        Usernames/Passwords are
            rod/koala
            dianne/emu
            scott/wombat
            peter/opal
        -->
        <authentication-provider>
            <password-encoder hash="md5"/>
            <user-service>
                <user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER" />
                <user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER,ROLE_TELLER" />
                <user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" />
                <user name="peter" password="22b5c9accc6e1ba628cedc63a72d57f8" authorities="ROLE_USER" />
            </user-service>
        </authentication-provider>

    </beans:beans>
    But everytime I want to deploy my web-application, the GlassFish v3 Domain console of NetBeans 6.8 tells me the following:
    Code:
    SCHWERWIEGEND: Class [ org/aspectj/lang/Signature ] not found. Error while 
    
    loading [ class 
    
    org.springframework.security.annotation.Jsr250MethodDefinitionSource ]
    WARNUNG: Error in annotation processing: java.lang.NoClassDefFoundError: 
    
    org/aspectj/lang/Signature
    
    WARNUNG: java.lang.IllegalStateException: ContainerBase.addChild: start: 
    
    org.apache.catalina.LifecycleException: 
    
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected 
    
    exception parsing XML document from ServletContext resource [/WEB-
    
    INF/applicationContext-security.xml]; nested exception is 
    
    java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
    java.lang.IllegalStateException: ContainerBase.addChild: start: 
    
    org.apache.catalina.LifecycleException: 
    
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected 
    
    exception parsing XML document from ServletContext resource [/WEB-
    
    INF/applicationContext-security.xml]; nested exception is 
    
    java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
    I've added Spring 2.5 (incl. MVC) and the following libraries to my classpath:
    • aspectj-1.5.4.jar
    • mysql-connector-java-5.1.6-bin.jar
    • spring-security-acl-2.0.5.RELEASE.jar
    • spring-security-core-2.0.5.RELEASE.jar
    • spring-security-core-tiger-2.0.5.RELEASE.jar
    • spring-security-taglibs-2.0.5.RELEASE.jar

    So I don't know why the application-server tells me that "org/aspectj/lang/Signature" isn't found. Isn't it included in "aspectj-1.5.4.jar"?

    Maybe you can help me.

    Greetings

    Benny

  • #2
    Originally posted by bennyn View Post

    So I don't know why the application-server tells me that "org/aspectj/lang/Signature" isn't found. Isn't it included in "aspectj-1.5.4.jar"?
    It is easy to check the jar file contents for a particular class. Use "jar -tf" to list the classes (or you can use a zip tool).

    There are two aspectj jars: aspectjrt and aspectjweaver. Make sure you are using the correct one (or both). You might also want to use a more up to date version.

    Comment


    • #3
      Hey, you're right. I had to extract the "aspectj-1.5.4.jar" to get "aspectjrt.jar" and "aspectjweaver.jar".
      After I added the "aspectjweaver.jar" to my Libraries the "Class not found"-error has gone. Thank you!

      But now I have the following error: (spring-aop.jar is part of my libraries)

      Code:
      org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Ljava/lang/Object;)"
      I use Spring 2.5 because it comes with NetBeans 6.8 and I read that newer versions of Spring Security need Spring 3.0.1.
      That's why I am using Spring Security 2.0.5 and not the latest one.

      I am grateful for every help.
      Last edited by bennyn; Jun 15th, 2010, 06:16 AM.

      Comment


      • #4
        It's always a good idea to try google when you get an exception message. That would lead you here:

        http://forum.springsource.org/showthread.php?t=52739

        or here

        http://jira.springframework.org/browse/SPR-4459

        Plus lots of other references. So make sure you are using Spring 2.5.2 or later.

        Comment


        • #5
          I now use the following applicationContext-security.xml which works:
          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:security="http://www.springframework.org/schema/security"
                  xsi:schemaLocation="
                     http://www.springframework.org/schema/beans
                     http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                     http://www.springframework.org/schema/security
                     http://www.springframework.org/schema/security/spring-security-2.0.xsd">
          
              <security:http auto-config="true">
                  <security:intercept-url pattern="/login.html" filters="none" />
                  <security:intercept-url pattern="/index.html" filters="none" />
                  <security:intercept-url pattern="/register.html" filters="none" />
                  <security:intercept-url pattern="/**" access="ROLE_USER" />
                  <security:form-login login-page="/login.html" authentication-failure-url="/login.jsp?login_error=1" />
                  <security:logout logout-url="/logout" logout-success-url="/logoutSuccess.jsp" />
              </security:http>
          
              <!-- Configure the authentication provider -->
              <security:authentication-provider>
                  <security:user-service>
                    <security:user name="user"        password="user"         authorities="ROLE_USER" />
                    <security:user name="supervisor"  password="supervisor"   authorities="ROLE_SUPERVISOR" />
                    <security:user name="admin"       password="admin"        authorities="ROLE_ADMIN" />
                  </security:user-service>
              </security:authentication-provider>
          </beans>

          Comment

          Working...
          X