Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NoSuchMethodError for addApplicationListener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.NoSuchMethodError for addApplicationListener

    Hi

    I'm having a problem with Spring v2.0.6.

    I have a webapp, built using MyEclipse 5.1.1, deployed using Ant 1.7.0 onto Tomcat 5.5. However, I am seeing the following error in the Tomcat log whenever I try to start the application. I use the spring.jar from 2.0.6 in my project classpath, but when I expand org.springframework.web.context.ConfigurableWebApp licationContext I cannot see the method addApplictionListener().

    Does anyone have any idea what I am doing wrong? Do I have the wrong jar file?

    Thanks
    PHP Code:
    2007-07-09 14:38:53,925 INFO [org.springframework.core.CollectionFactory] - <Commons Collections 3.x available>
    2007-07-09 14:38:53,925 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/springapp]] - <Initializing Spring FrameworkServlet 'springapp'>
    2007-07-09 14:38:53,925 INFO [org.springframework.web.servlet.DispatcherServlet] - <FrameworkServlet 'springapp'initialization started>
    2007-07-09 14:38:53,940 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/springapp]] - <StandardWrapper.Throwable>
    java.lang.NoSuchMethodErrororg.springframework.web.context.ConfigurableWebApplicationContext.addApplicationListener(Lorg/springframework/context/ApplicationListener;)V
        at org
    .springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:328)
        
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:265)
        
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:235)
        
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
        
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
        
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
        
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
        
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
        
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1176)
        
    at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:369)
        
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
        
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
        
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        
    at java.lang.Thread.run(Unknown Source)
    2007-07-09 14:38:53,940 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/springapp]] - <Servlet /springapp threw load() exception>
    java.lang.NoSuchMethodErrororg.springframework.web.context.ConfigurableWebApplicationContext.addApplicationListener(Lorg/springframework/context/ApplicationListener;)V
        at org
    .springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:328)
        
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:265)
        
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:235)
        
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
        
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
        
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
        
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
        
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
        
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1176)
        
    at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:369)
        
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
        
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
        
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        
    at java.lang.Thread.run(Unknown Source

  • #2
    Make sure that you don't have multiple versions of Spring jars on your classpath.

    Comment


    • #3
      Thanks for the quick reply!

      Checking in Eclipse - I have not added spring.jar to the installed JRE, but I have added the 2.0.6 spring.jar, spring-aspects.jar and spring-mock.jar to the project build path.

      Checking the deployed project, I have the following in lib:-
      Code:
      09/07/2007  12:24    <DIR>          .
      09/07/2007  12:24    <DIR>          ..
      09/07/2007  12:24            32,057 commons-attributes-api.jar
      09/07/2007  12:24            25,274 commons-attributes-compiler.jar
      09/07/2007  12:24           164,143 commons-beanutils.jar
      09/07/2007  12:24           491,066 commons-collections.jar
      09/07/2007  12:24           150,755 commons-digester.jar
      09/07/2007  12:24           180,405 commons-lang.jar
      09/07/2007  12:24            52,915 commons-logging.jar
      09/07/2007  12:24           262,530 dom4j-1.6.jar
      09/07/2007  12:24           206,815 jaxen-1.1-beta-4.jar
      09/07/2007  12:24           319,135 log4j-1.2.13.jar
      09/07/2007  12:24           367,444 log4j-1.2.14.jar
      09/07/2007  12:24           205,105 spring-beans.jar
      09/07/2007  12:24            96,932 spring-context.jar
      09/07/2007  12:24           106,789 spring-core.jar
      09/07/2007  12:24         2,694,014 spring.jar
                    15 File(s)      5,355,379 bytes
                     2 Dir(s)  39,476,260,864 bytes free
      
      C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springapp\WEB-IN\lib>

      Comment


      • #4
        Which indicates that you have multiple version of spring in your classpath .

        Code:
        09/07/2007  12:24           205,105 spring-beans.jar
        09/07/2007  12:24            96,932 spring-context.jar
        09/07/2007  12:24           106,789 spring-core.jar
        09/07/2007  12:24         2,694,014 spring.jar
        The spring.jar is all you need, ommit the other 3 spring jars, they probably are from the MyEclipse Spring integration and are added automatically to your classpath/build path.

        Comment


        • #5
          Thanks for that, you were right. I've removed the Eclipse added jars and things now start up without error.

          Excuse the problems of a newbie!

          Comment


          • #6
            Glad it worked. We had the same issues with MyEclipse.

            Comment


            • #7
              Hi,

              I am having the same issue. I'm setting up my environment. I am using Ant 1.9.2, Spring 3.2.5, Kepler, Glassfish and Java 7. I have only started doing a simple hello world apps. When I tried to deploy it, it gave me this error.


              [sun-appserv-deploy] Running command deploy --contextroot=batch_processing buil
              d/war/batch_processing.war
              [sun-appserv-deploy] remote failure: Error occurred during deployment: Exception
              while loading the app : java.lang.IllegalStateException: ContainerBase.addChild
              : start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleEx
              ception: java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolv
              er.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class[Ljava/lang/Class;. P
              lease see server.log for more details.

              These are the jars I have in my build path and lib dir:

              commons-logging-1.1.3.jar
              spring-aspects-3.2.5.RELEASE.jar
              spring-beans-3.2.5.RELEASE.jar
              spring-context-3.2.5.RELEASE.jar
              spring-core-3.2.5.RELEASE.jar
              spring-expression-3.2.5.RELEASE.jar
              spring-web-3.2.5.RELEASE.jar
              spring-webmd-3.2.5.RELEASE.jar

              Any help will be great! Thanks!





              Comment

              Working...
              X