0

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.

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I know there are still a lot of things I do not understand but when I build EAR (Enterprise Archive) Ant takes care of "packing" all of the necessary org.springframework.<X>-3.0.2.RELEASE.jar within an application. Or am I wrong? I mean classloader should not have a option to load classes from two different spring versions.
It really depends on the classloading policy Oracle is applying for your application. Classloaders have hierarchy, so the class might come from one of the parent classloaders. For example, there might be a version of Spring available for all apps running in the app server (take a look at this document - oracle.com/technetwork/topics/oracleas-spring-faq-128523.pdf)
I'll figure it out :) Thank you for your answer/advice.
0

I found out the source of my problem.

Under ../myWebApp/WEB-INF/lib all my org.springframework.X-3.0.2.RELEASE JARs are located. But there is another spring.jar inside as well. Its MANIFEST file says Spring v. 2.0.7, thus conflicts between different Spring versions.

Since I am not the author of this application I simply overlooked this spring JAR library. I resolved this error with modifying ANT script i.e. excluding the mentioned JAR file when building Enterprise ARchive.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.