首页 > 解决方案 > 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 等)

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

标签: javaspring-bootweblogic11g

解决方案


推荐阅读