springtomcatservletsweb-deploymentoracle-application-server

Servlet initialization error after deployment on Oracle AS 10g


I have a web application which runs perfectly on my local environment [http://localhost:8080/myApp/] within Apache Tomcat 7.0.47. I am using Spring Framework.

The problem arises after I deploy my web application to Oracle Application Server 10g, version 10.1.3.4.0. The application is successfully deployed on AS. But when I try to request my application the server responds:


500 Internal Server Error

Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.


Let me provide my diagnosis:

  1. The Web Container successfully deploys myApp.ear
  2. After deployment the Web Container performs:
    • LOADS Servlet Class
    • INSTANTIATES the loaded Servlet Class
    • EXECUTES the init() method of instance ----> IT FAILS HERE

Here is my application log snippet:

14/02/18 09:26:56.617 etrr: Initializing Spring FrameworkServlet 'spring'
14/02/18 09:26:57.105 etrr: Error initializing servlet
java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.registerResolvableDependency
    (Ljava/lang/Class;Ljava/lang/Object;)V
    at org.springframework.web.context.support.WebApplicationContextUtils.registerWebApplicationScopes(WebApplicationContextUtils
    .java:156)
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext
    .java:143)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:332)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.loadServlet(HttpApplication.java:2379
    )
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.findServlet(HttpApplication.java:4830
    )
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.findServlet(HttpApplication.java:4754
    )
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication
    .java:3412)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler
    .java:738)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler
    .java:453)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor
    .java:303)
    at java.lang.Thread.run(Thread.java:595)

Perhaps it is right to mention that my OC4J container loads the classes packaged in my web application thus overriding System classes or classes in the higher level of my OC4J container. I wrote the following two properties in my ../WEB-INF/orion-web.xml file. (see @drorb's answer for more detail)

<web-app-class-loader search-local-classes-first="true" 
                      include-war-manifest-class-path="true" />

Thank you in advance for your help.


Solution

  • It looks like a classloading issue. The stacktrace indicated that you have an older version of Spring somewhere in your application classpath. The classloader is loading an older version of org.springframework.beans.factory.config.ConfigurableListableBeanFactory which does not have the registerResolvableDependency method with the requested signature.
    This class is part of the spring-beans jar. In older versions it was part of spring-core.

    For tracing OC4J classloading you can use the class.load.trace system property. Take a look at this answer in the OTN community for more details.