Announcement Announcement Module
Collapse
No announcement yet.
ConfigurableWebApplicationContext.setConfigLocatio n error with nosuchmethoderror Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ConfigurableWebApplicationContext.setConfigLocatio n error with nosuchmethoderror

    I am trying to use Spring with CXF where in the web.xml has following config
    <servlet>
    <servlet-name>myapp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>myapp</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    And I have myapp-servlet.xml in /WEB-INF as application context. But for some reason I am getting below error, any ideas what might be wrong?

    NFO: FrameworkServlet 'myapp': initialization started
    Apr 6, 2008 9:50:02 PM org.apache.catalina.core.ApplicationContext log
    SEVERE: StandardWrapper.Throwable
    java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApp licationContext.setConfigLocation(Ljava/lang/StringV
    at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 50)
    at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:292 )
    at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:262)
    at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1139)
    at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:966)
    at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3956)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4230)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:448)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:700)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:433)

  • #2
    did you check your classpath? seems, that the spring.jar is missing.

    Comment


    • #3
      I am having the same problem. I have tried with 2.5.2 and the latest 2.5.4, with no success.

      The spring jars are all in my WEB-INF\lib directory.

      Any ideas?

      Edit: This is the tomcat output:


      HTTP Status 500 -

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception
      org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
      org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
      org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
      java.lang.Thread.run(Thread.java:619)

      root cause

      java.lang.NoSuchMethodError: setConfigLocation
      org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 98)
      org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:316 )
      org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:282)
      org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
      javax.servlet.GenericServlet.init(GenericServlet.j ava:215)
      org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
      org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
      org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
      java.lang.Thread.run(Thread.java:619)

      note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

      Edit2:

      When checking the class I found that the method (surprize surprize :P) does not exist. Could it be that on this line: FrameworkServlet.java:398 they are calling setConfigLocation instead of setContextConfigLocation? Unfortunately I do not have the source code here, and I can not download it either.
      Last edited by compres; May 8th, 2008, 08:05 AM.

      Comment


      • #4
        did you check that all jar's from earlier releases are removed? maybe there is an old version of spring-*module* in your classpath.

        Comment


        • #5
          I am guessing you mean the jar files in the WAR and/or generated lib directory of the deployed project. If so, then yes I have verified that.

          Comment


          • #6
            I think, we cannot have spring-2.5.jar and spring-webmvc-2.5.4.jar together,I got same error, I deleted spring-2.5.jar, now I am able to compile

            Thanks
            Ram

            Comment


            • #7
              I had the same problem with the spring version 2.5.1. When I switched to 2.5.5. the problem disappeared.

              Comment


              • #8
                Problem with Spring 2.5.5

                Hello,

                I have a similar problem when using spring 2.5.5


                ava.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApp licationContext.setConfigLocation(Ljava/lang/StringV

                in the jar exists only the parameter-less method and the Method setConfigLoations(....)

                I do not really understand the problem, as the invoker of this not existing method is inside the same jar. At least it seems so in the log:


                Code:
                java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setConfigLocation(Ljava/lang/String;)V
                	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:398)
                	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
                	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
                	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:1161)
                	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
                	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4071)
                	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4375)
                	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
                	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
                Here are the whole spring-dependencies:

                Code:
                <spring.version>2.5.5</spring.version>
                		<spring-ws.version>1.5.4</spring-ws.version>
                		<spring-ws-core.version>1.5.4</spring-ws-core.version>
                		<spring-oxm.version>1.5.4</spring-oxm.version>

                could you please give me a hint how to solve this?

                Thanks
                Louisa
                Last edited by louisa; Oct 29th, 2008, 10:56 AM.

                Comment


                • #9
                  In addition the web.xml, as it might be relevant:


                  Code:
                  <servlet>
                     
                      <display-name>spring-ws</display-name>
                      <servlet-name>spring-ws</servlet-name>
                      <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
                      
                      <load-on-startup>2</load-on-startup>
                    </servlet>
                  
                    <servlet-mapping>
                      <servlet-name>spring-ws</servlet-name>
                      <url-pattern>/*</url-pattern>
                    </servlet-mapping>

                  Comment


                  • #10
                    Originally posted by louisa View Post
                    In addition the web.xml, as it might be relevant:


                    Code:
                    <servlet>
                       
                        <display-name>spring-ws</display-name>
                        <servlet-name>spring-ws</servlet-name>
                        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
                        
                        <load-on-startup>2</load-on-startup>
                      </servlet>
                    
                      <servlet-mapping>
                        <servlet-name>spring-ws</servlet-name>
                        <url-pattern>/*</url-pattern>
                      </servlet-mapping>
                    I was getting the same issue with maven and jetty.
                    I used the following dependency and it worked.

                    <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                    <version>2.5.6</version>
                    </dependency>

                    Comment

                    Working...
                    X