org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener失败:java.lang.IllegalArgumentException:无效的源

时间:2019-06-28 08:53:40

标签: java spring-boot weblogic11g

我正在尝试将Spring引导Web应用程序部署到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等)

任何帮助将不胜感激。谢谢

0 个答案:

没有答案