java - org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener 失败:java.lang.IllegalArgumentException:源无效
问题描述
我正在尝试将 Spring Boot webapp 部署到 WebLogic Server。该代码在本地运行时在 Tomcat 中运行良好。但是当我构建 jar 并将其部署到 WebLogic 时,我得到了异常。
<Jun 28, 2019 1:24:05 PM IST> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener failed: java.lang.IllegalArgumentException: Invalid source 'com.example.MyApplication'.
java.lang.IllegalArgumentException: Invalid source 'com.example.MyApplication'
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:218)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:144)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:703)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:366)
Truncated. see log file for complete stacktrace
>
<Jun 28, 2019 1:24:05 PM IST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1561708384317' for task '5'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalArgumentException: Invalid source 'com.xample.MyApplication'
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:218)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:144)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:703)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:366)
Truncated. see log file for complete stacktrace
>
<Jun 28, 2019 1:24:05 PM IST> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 9 task for the application 'Application'.>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.example.MyApplication</param-value>
</context-param>
<listener>
<listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
只是为了澄清几件事,
-对于 weblogic 服务器,我需要同时拥有 web.xml 和 weblogic.xml 吗?
- 为什么框架不能从我的注释中识别组件(过滤器、servlet 等)
任何帮助将不胜感激。谢谢
解决方案
推荐阅读
- javascript - 如何将视图中的表中的模型列表传递给控制器?
- java - 如何让这两段代码互相看到
- c++ - “xvalue 有身份”,为什么我不能找到它的地址
- html - 搜索栏中的按钮 CSS 样式在桌面上可以正常工作,但在 iPhone 上不行
- jquery - 需要 Jquery 的帮助单击个人资料并显示 Bio 内容
- c++ - 找不到“公共语言运行时支持”设置
- apache-spark - 运行 spark-submit 时出错:java.lang.NoClassDefFoundError: kafka/common/TopicAndPartition
- c# - 范围数据注释不起作用(实体框架)
- c# - MSBuild 不解析路径内的参数
- scikit-learn - 从 RandomForestRegressor() 或 RandomForestClassifier() 获取 feature_importances_ 以解决回归和分类问题