Spring Boot 异常:无法打开 ServletContext 资源 [/WEB-INF/dispatcherServlet-servlet.xml] [英] Spring Boot exception: Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
问题描述
我已经开发了这个概念证明 https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic 用于测试Spring Boot应用在Weblogic 12c (12.2.1)中的部署.
I have developed this proof of concept https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic to test the deployment of Spring Boot applications in Weblogic 12c (12.2.1).
应用程序部署并成功启动,但是当我尝试连接到它时(即/accounts?number=1234)显示以下错误:
The application deploys and starts successfully, but when I try to connect to it (i.e. /accounts?number=1234) the error below is shown:
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it
from fulfilling the request.
并且日志文件有异常:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run
我错过了什么吗?
谢谢,
推荐答案
我已经使用 spring-boot-sample-war (带有额外的 weblogic.xml 来处理日志记录).还尝试了最新的补丁集(WLS PATCH SET UPDATE 12.2.1.0.160419),但问题仍然存在.
I've reproduced this issue with WebLogic 12.2.1.0 (plain new install) using spring-boot-sample-war (with an additional weblogic.xml to handle logging). Also tried the latest patchset (WLS PATCH SET UPDATE 12.2.1.0.160419), but the issue remains.
出于某种原因,WebLogic 决定它需要在您访问/上可用的应用程序后立即使用它自己的配置创建 DispatcherServlet.
For some reason WebLogic decides it needs to create the DispatcherServlet using it's own configuration as soon as you access the application available on /.
我已向 Oracle 支持部门提出了服务请求,我们将看看他们对此问题的看法.
I've put in a service request to Oracle Support and we'll see what they think about this issue.
更新:补丁 23124727:由于 JAVA.IO.FILENOTFOUNDEXCEPTION,无法在 12.2.1 上部署 SPRING BOOT .WAR"可用于 Oracle WebLogic Server 12.2.1.0.0 并与 spring-boot-sample-war 一起使用以及更高级的应用程序.
Update: 'Patch 23124727: CANNOT DEPLOY SPRING BOOT .WAR ON 12.2.1 DUE TO JAVA.IO.FILENOTFOUNDEXCEPTION' is available for Oracle WebLogic Server 12.2.1.0.0 and works with both the spring-boot-sample-war as well as a more advanced application.
这篇关于Spring Boot 异常:无法打开 ServletContext 资源 [/WEB-INF/dispatcherServlet-servlet.xml]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!