我有一个 Web 应用程序,可以在Apache Tomcat 7.0.47内的本地环境 [http://localhost:8080/myApp/] 上完美运行。我正在使用Spring 框架。
在我将Web 应用程序部署到Oracle Application Server 10g, version 10.1.3.4.0后,问题就出现了。应用成功部署在AS上。但是当我尝试请求我的应用程序时,服务器会响应:
500内部服务器错误
Servlet 错误:发生异常。当前的应用程序部署描述符不允许将其包含在此响应中。详情请查阅申请日志。
让我提供我的诊断:
- Web 容器成功部署 myApp.ear
- 部署后,Web 容器执行:
- 加载Servlet 类
- 实例化加载的 Servlet 类
- 执行实例的 init() 方法---->这里失败
这是我的应用程序日志片段:
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)
也许值得一提的是,我的 OC4J 容器加载了打包在我的 Web 应用程序中的类,从而覆盖了系统类或更高级别的 OC4J 容器中的类。我在../WEB-INF/orion-web.xml文件中编写了以下两个属性。(有关更多详细信息,请参阅@drorb的答案)
<web-app-class-loader search-local-classes-first="true"
include-war-manifest-class-path="true" />
预先感谢您的帮助。