![](/img/trans.png)
[英]Not able to deploy a Spring Boot application(non-web) war file on weblogic 12c
[英]WebLogic failing starting the application - not able to find spring config file
我在web.xml中定义了以下内容
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:p360UiSpringConfig/p360UiDispatcherServlet-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>p360UiDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
以下是我的网络信息的外观:
在WebLogic中启动应用程序时,出现以下错误:
错误java.io.FileNotFoundException:无法打开ServletContext资源[/WEB-INF/p360UiDispatcherServlet-servlet.xml]
问题是当我定义了contextConfigLocation时,为什么要在Web-Inf中寻找spring config文件?
如下所示在web.xml
编辑contextConfigLocation
。
编辑
发生的事情是Spring容器尝试通过WEB-INF文件夹中的<Dispatcher Servlet Name>-servlet.xml
查找上下文。 这是因为尚未为调度程序servlet p360UiDispatcherServlet
指定<init-param>
。 <context-param>
用于指定其他常见的上下文路径,例如DAO,安全性等。理想情况下,这应该可以解决您的问题。 请检查修改后的web.xml
<!-- Any Common Additional Context Paths -->
<!--<context-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</context-param>-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>p360UiDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/p360UiSpringConfig/p360UiDispatcherServlet-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.