【问题标题】:Weblogic 12c Spring Boot 2.0.1 jersey deploy errorWeblogic 12c Spring Boot 2.0.1 jersey deploy 错误
【发布时间】:2018-10-03 03:23:40
【问题描述】:

使用 Spring Boot 2.0.1 部署 Weblogic 12,Jersey

以下是日志内容。

  • Weblogic 部署详细日志。

[错误] [HTTP] [BEA-101216] [Servlet]:“com.precursor.config.JerseyConfig”无法在 Web 应用程序启动时预加载:“oasSvr2.war”。 java.lang.AbstractMethodError 在 org.glassfish.jersey.server.ApplicationHandler$4.get(ApplicationHandler.java:408) 在 org.glassfish.jersey.server.ApplicationHandler$4.get(ApplicationHandler.java:399) 在 org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340) 在 org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:366) 在 org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:342)

截断。查看完整堆栈跟踪的日志文件

你知道我为什么会收到这个错误吗?

请有人帮帮我。

以下是源代码。

这里是 pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <org.slf4j-version>1.7.25</org.slf4j-version>
        <logback.version>1.2.3</logback.version>
        <cxf.version>3.2.4</cxf.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>24.1-jre</version>
        </dependency>

        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-jersey2-jaxrs</artifactId>
            <version>1.5.0</version>
        </dependency>

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>12.2.0.1</version>
        </dependency>

        <!-- test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>   

        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>1.1-groovy-2.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>oasSvr2</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

这里是 Application.java

@ComponentScan
@SpringBootApplication
public class PilotJerseyCxfApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
    public static void main(String[] args) {
        SpringApplication.run(PilotJerseyCxfApplication.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(PilotJerseyCxfApplication.class);
    }
}

这里是Interface.java

@Path("/bank")
public interface ICustomerService {
    @GET
    @Path("/list")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response getCustomerList();
}

这里是 JerseyConfig.java

@Configuration
@ApplicationPath("/")
public class JerseyConfig extends ResourceConfig {
    public JerseyConfig(){
        register(WadlResource.class);
        register(CustomerService.class);
    }
}

这里是 weblogic.xml

    <wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>org.slf4j.*</wls:package-name>
            <wls:package-name>org.springframework.*</wls:package-name>
            <wls:package-name>com.fasterxml.jackson.*</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>

【问题讨论】:

    标签: java rest spring-boot jersey-2.0 weblogic12c


    【解决方案1】:

    我遇到了完全相同的问题。尝试从 weblogic 中排除球衣

    how to disable Jersey from weblogic 12.2.1

    它对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-28
      • 2016-11-04
      • 1970-01-01
      • 2014-05-03
      相关资源
      最近更新 更多