Maven generated ear file fails during deploying weblogic server

百般思念 提交于 2019-12-11 06:07:28

问题


I use JDeveloper 12.1.2.0.0 with Oracle Weblogic Server. Java version is 1.7.0_15. I have got a project based on Oracle ADF. I have to mavenize it. First of all I click on deploy the application ear file has created and working well on the server. In my application there is Model and ViewController projects. To mavenize I've just created Maven POM for project to every projects and finally an Application POM to the application. The end product should be ear file to deploy on remote server with administration console so I modified a little the application POM (removed the Model and ViewController modules and then I could change the packaging from pom to ear). When I maven install all of them build has ended successfully. During deploying ear file to the Weblogic Server I got

java.lang.ClassNotFoundException: org.apache.myfaces.trinidad.webapp.ResourceServlet

I added these lines to my ViewController pom.xml:

<dependency>
    <groupId>org.apache.myfaces.core</groupId>
    <artifactId>myfaces-api</artifactId>
    <version>2.2.4</version>
</dependency>
<dependency>
    <groupId>org.apache.myfaces.core</groupId>
    <artifactId>myfaces-impl</artifactId>
    <version>2.2.4</version>
</dependency>

Deploying again I got this error and don't have idea what to do:

Caused by: java.lang.NullPointerException
at weblogic.servlet.internal.WebAnnotationProcessor.processMultipartConfigAnnotation(WebAnnotationProcessor.java:286)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationForClasses(AnnotationProcessingManager.java:169)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:114)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationsOutsideWebFragment(AnnotationProcessingManager.java:141)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:102)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:79)
at weblogic.servlet.tools.WARModule.processAnnotations(WARModule.java:491)
at weblogic.servlet.tools.WARModule.processAnnotations(WARModule.java:578)
at weblogic.servlet.tools.WARModule.merge(WARModule.java:526)
at weblogic.application.compiler.ToolsModuleWrapper.merge(ToolsModuleWrapper.java:96)
at weblogic.application.utils.CustomModuleManager.merge(CustomModuleManager.java:78)
at weblogic.application.compiler.flow.MergeModuleFlow.compile(MergeModuleFlow.java:38)
at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:70)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:37)
at weblogic.application.compiler.BaseMerger.merge(BaseMerger.java:20)
at weblogic.application.compiler.flow.AppMergerFlow.mergeInput(AppMergerFlow.java:75)
at weblogic.application.compiler.flow.AppMergerFlow.compile(AppMergerFlow.java:40)
at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:70)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:37)
... 75 more

By the way I compared the deployed (right click on application -> deploy) and created by maven ear file. I found some differences: Maven generated ear file contains Model-1.0-SNAPSHOT.jar in WEB-INF\lib\ altough deployed has got the Modell project's class files in WEB-INF\classes.

Anyway when I update the dependecies section in pom.xml after first maven install nothing happens (it adds the new dependecies, but if I remove some of them after maven install it contains them. ?maven clean package?).

Any help would be highly appreciated.


回答1:


To get around this issue, I used the following in my web layer pom.xml:

<dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.13</version>
    </dependency>
    <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.13</version>
    </dependency>
    <dependency>
            <groupId>javax.el</groupId>
            <artifactId>el-api</artifactId>
            <version>2.2</version>
    </dependency>
    <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>el-impl</artifactId>
            <version>2.2</version>
    </dependency>
    <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>2.2.1</version>
    </dependency>
    <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>javax.faces-api</artifactId>
            <version>2.2</version>
    </dependency>

and the following weblogic-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application
    xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
    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/javaee_5.xsd
        http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.4/weblogic-application.xsd">

    <prefer-application-packages>
            <package-name>javax.el.*</package-name>
            <package-name>javax.faces.*</package-name>
            <package-name>com.sun.el.*</package-name>
            <package-name>com.sun.faces.*</package-name>
            <package-name>com.bea.faces.*</package-name>
        </prefer-application-packages>

        <prefer-application-resources>
            <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
            <resource-name>META-INF/services/com.sun.faces.*</resource-name>
        </prefer-application-resources>

</weblogic-application>

There are more details in this post: Deploying a JSF 2.2 to WebLogic 12.1.3



来源:https://stackoverflow.com/questions/25061963/maven-generated-ear-file-fails-during-deploying-weblogic-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!