Camunda BPM Spring 引导无法在 weblogic 中启动 - 可能是球衣问题

Camunda BPM Spring boot can't start in weblogic - maybe jersey issue

我有使用 camunda 和 spring 启动的应用程序 ,并使用嵌入式 tomcat。但现在我需要将应用程序安装为 war.
使用独立 tomcat 一切正常,但使用 weblogic 我无法启动应用程序。 我收到以下错误:

<Sep 5, 2018 9:59:42,539 PM MSK> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "24521744092298" for task "1" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: java.lang.AbstractMethodError"
weblogic.application.ModuleException: java.lang.AbstractMethodError
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.AbstractMethodError
    at org.glassfish.jersey.server.ApplicationHandler.get(ApplicationHandler.java:408)
    at org.glassfish.jersey.server.ApplicationHandler.get(ApplicationHandler.java:399)
    at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340)
    at org.glassfish.jersey.server.ApplicationHandler.call(ApplicationHandler.java:350)
    at org.glassfish.jersey.server.ApplicationHandler.call(ApplicationHandler.java:347)
    Truncated. see log file for complete stacktrace
> 
<Sep 5, 2018 9:59:42,543 PM MSK> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 9 task for the application "order-management-service_war_exploded" on [partition-name: DOMAIN].> 
<Sep 5, 2018 9:59:42,545 PM MSK> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application "order-management-service_war_exploded".> 
<Sep 5, 2018 9:59:42,545 PM MSK> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: java.lang.AbstractMethodError
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.AbstractMethodError
    at org.glassfish.jersey.server.ApplicationHandler.get(ApplicationHandler.java:408)
    at org.glassfish.jersey.server.ApplicationHandler.get(ApplicationHandler.java:399)
    at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340)
    at org.glassfish.jersey.server.ApplicationHandler.call(ApplicationHandler.java:350)
    at org.glassfish.jersey.server.ApplicationHandler.call(ApplicationHandler.java:347)
    Truncated. see log file for complete stacktrace

没关系,我用camunda企业版还是标准版。 我的 pom 包含以下依赖项:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.camunda.bpm.springboot</groupId>
        <artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

我该如何解决这个问题?

编辑
据我了解,整个问题可能出在球衣上,它在依赖项 camunda 内。 我编辑了我的 weblogic.xml,他是这样出来的:

<?xml version="1.0" encoding="UTF-8"?>

<wls:weblogic-web-app
        xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">

    <wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>org.apache.taglibs.*</wls:package-name>
            <wls:package-name>org.springframework.*</wls:package-name>
            <!--<wls:package-name>org.glassfish.*</wls:package-name>-->
            <wls:package-name>javax.persistence.*</wls:package-name>
            <wls:package-name>org.hibernate.*</wls:package-name>
            <wls:package-name>javax.validation.*</wls:package-name>
            <wls:package-name>javax.validation.bootstrap.*</wls:package-name>
            <wls:package-name>javax.validation.constraints.*</wls:package-name>
            <wls:package-name>javax.validation.groups.*</wls:package-name>
            <wls:package-name>javax.validation.metadata.*</wls:package-name>
            <wls:package-name>javax.validation.spi.*</wls:package-name>
            <wls:package-name>com.fasterxml.jackson.*</wls:package-name>
            <wls:package-name>org.slf4j.*</wls:package-name>
            <wls:package-name>org.apache.logging.*</wls:package-name>

            <!-- jsr311 -->
            <wls:package-name>javax.ws.rs.*</wls:package-name>
            <!-- javassist -->
            <wls:package-name>javassist.*</wls:package-name>
            <!-- aop repackaged -->
            <wls:package-name>org.aopalliance.*</wls:package-name>

            <!-- jersey 2 -->
            <wls:package-name>jersey.repackaged.*</wls:package-name>
            <wls:package-name>org.glassfish.jersey.*</wls:package-name>
            <wls:package-name>com.sun.research.ws.wadl.*</wls:package-name>
            <wls:package-name>com.sun.ws.rs.ext.*</wls:package-name>

            <!-- media providers -->
            <wls:package-name>org.eclipse.persistence.*</wls:package-name>
            <wls:package-name>org.codehaus.jackson.*</wls:package-name>
            <wls:package-name>org.codehaus.jettison.*</wls:package-name>

            <!-- hk2 -->
            <wls:package-name>org.glassfish.hk2.*</wls:package-name>
            <wls:package-name>org.jvnet.hk2.*</wls:package-name>
            <wls:package-name>org.jvnet.tiger_types.*</wls:package-name>

            <wls:package-name>org.objectweb.asm.*</wls:package-name>
            <wls:package-name>antlr.*</wls:package-name>


            <wls:package-name>com.sun.jersey.*</wls:package-name>

            <wls:package-name>jersey.repackaged.org.objectweb.asm.*</wls:package-name>

        </wls:prefer-application-packages>
        <wls:prefer-application-resources>
            <wls:resource-name>org.apache.taglibs.*</wls:resource-name>
            <wls:resource-name>org.springframework.*</wls:resource-name>
            <wls:resource-name>javax.persistence.*</wls:resource-name>
            <wls:resource-name>javax.validation.*</wls:resource-name>
            <wls:resource-name>org.hibernate.*</wls:resource-name>
            <wls:resource-name>com.fasterxml.jackson.*</wls:resource-name>
        </wls:prefer-application-resources>
    </wls:container-descriptor>
</wls:weblogic-web-app>

但它也不起作用,我得到这个错误:

ogic.application.ModuleException: java.lang.ClassCastException: weblogic.jaxrs.server.media.multipart.Jersey1MultiPartSupport cannot be cast to org.glassfish.jersey.internal.spi.AutoDiscoverable
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassCastException: weblogic.jaxrs.server.media.multipart.Jersey1MultiPartSupport cannot be cast to org.glassfish.jersey.internal.spi.AutoDiscoverable
    at java.util.TreeMap.put(TreeMap.java:552)
    at java.util.TreeSet.add(TreeSet.java:255)
    at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
    at java.util.TreeSet.addAll(TreeSet.java:312)
    at org.glassfish.jersey.model.internal.CommonConfig.configureAutoDiscoverableProviders(CommonConfig.java:599)
    Truncated. see log file for complete stacktrace
> 

我使用了最新的 weblogic 12.2.1.3,spring boot 2.0.4 和 camunda 7.9.0 (starter 3.0.0)

我找到了解决办法。 我将 weblogic.xml 编辑为:

<?xml version="1.0" encoding="UTF-8"?>

<wls:weblogic-web-app
        xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">

    <wls:context-root>/order</wls:context-root>
    <wls:container-descriptor>

        <wls:prefer-application-packages>
            <wls:package-name>org.apache.taglibs.*</wls:package-name>
            <wls:package-name>org.springframework.*</wls:package-name>
            <wls:package-name>javax.persistence.*</wls:package-name>
            <wls:package-name>org.hibernate.*</wls:package-name>
            <wls:package-name>javax.validation.*</wls:package-name>
            <wls:package-name>javax.validation.bootstrap.*</wls:package-name>
            <wls:package-name>javax.validation.constraints.*</wls:package-name>
            <wls:package-name>javax.validation.groups.*</wls:package-name>
            <wls:package-name>javax.validation.metadata.*</wls:package-name>
            <wls:package-name>javax.validation.spi.*</wls:package-name>
            <wls:package-name>com.fasterxml.jackson.*</wls:package-name>
            <!--<wls:package-name>org.slf4j.*</wls:package-name>-->
            <wls:package-name>org.apache.logging.*</wls:package-name>

            <!-- jsr311 -->
            <wls:package-name>javax.ws.rs.*</wls:package-name>
            <!-- javassist -->
            <wls:package-name>javassist.*</wls:package-name>
            <!-- aop repackaged -->
            <wls:package-name>org.aopalliance.*</wls:package-name>

            <!-- jersey 2 -->
            <wls:package-name>jersey.repackaged.*</wls:package-name>
            <wls:package-name>org.glassfish.jersey.*</wls:package-name>
            <wls:package-name>com.sun.research.ws.wadl.*</wls:package-name>
            <wls:package-name>com.sun.ws.rs.ext.*</wls:package-name>

            <!-- media providers -->
            <wls:package-name>org.eclipse.persistence.*</wls:package-name>
            <wls:package-name>org.codehaus.jackson.*</wls:package-name>
            <wls:package-name>org.codehaus.jettison.*</wls:package-name>

            <!-- hk2 -->
            <wls:package-name>org.glassfish.hk2.*</wls:package-name>
            <wls:package-name>org.jvnet.hk2.*</wls:package-name>
            <wls:package-name>org.jvnet.tiger_types.*</wls:package-name>

            <wls:package-name>org.objectweb.asm.*</wls:package-name>
            <wls:package-name>antlr.*</wls:package-name>

            <wls:package-name>jersey.repackaged.org.objectweb.asm.*</wls:package-name>

        </wls:prefer-application-packages>
        <wls:prefer-application-resources>
            <wls:resource-name>org.apache.taglibs.*</wls:resource-name>
            <wls:resource-name>org.springframework.*</wls:resource-name>
            <wls:resource-name>javax.persistence.*</wls:resource-name>
            <wls:resource-name>javax.validation.*</wls:resource-name>
            <wls:resource-name>org.hibernate.*</wls:resource-name>
            <wls:resource-name>com.fasterxml.jackson.*</wls:resource-name>


            <!-- apis -->
            <wls:resource-name>javax.ws.rs.*</wls:resource-name>
            <!-- jersey -->
            <wls:resource-name>META-INF/services/org.glassfish.jersey.*</wls:resource-name>
            <wls:resource-name>com.sun.jersey.*</wls:resource-name>
            <wls:resource-name>org.glassfish.jersey.*</wls:resource-name>
            <wls:resource-name>jersey.repackaged.*</wls:resource-name>
            <!-- hk2 -->
            <wls:resource-name>META-INF/services/org.glassfish.hk2.*</wls:resource-name>
            <wls:resource-name>org.glassfish.hk2.*</wls:resource-name>
            <wls:resource-name>org.jvnet.hk2.*</wls:resource-name>
            <wls:resource-name>org.jvnet.hk2.tiger_types.*</wls:resource-name>

        </wls:prefer-application-resources>
    </wls:container-descriptor>
</wls:weblogic-web-app>

并在 pom.xml:

中为 starter webapp 添加了 starter rest(我不知道为什么,但它有效)并排除了 jersey-container-servlet
            <dependency>
                <groupId>org.camunda.bpm.springboot</groupId>
                <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
                <version>${camunda.spring.boot.starter.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.glassfish.jersey.containers</groupId>
                        <artifactId>jersey-container-servlet</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.camunda.bpm.springboot</groupId>
                <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
                <version>${camunda.spring.boot.starter.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.glassfish.jersey.containers</groupId>
                        <artifactId>jersey-container-servlet</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>