Maven 3 upgrage - Maven ear插件包的不同版本的libs - ClassNotFoundException weblogic。

时间:2022-09-03 22:52:38

I have a maven multi module project. In which there are few web projects and ejb projects. There are no cheange in the source code of the entire project. Just I upgraded to Maven 3 and built my project. The resulting ear file has libraries of different versions than the ear file built using maven 2. Some older version of particular libs and some newer version of particular libs.

我有一个maven的多模块项目。其中很少有web项目和ejb项目。在整个项目的源代码中没有cheange。我只是升级到Maven 3,并构建了我的项目。生成的ear文件具有不同版本的库,而不是使用maven 2构建的ear文件。一些较老版本的特定libs和一些新版本的特定libs。

for eg: commons-logging-1.1.1 was with maven2 but wiht maven 3 it resolved to commons-logging-1.0.3

例如:common -logging-1.1.1与maven2有关,但wiht maven 3已解析为common -logging-1.0.3。

The real problem is, when I try to deploy the ear created with maven 3 into weblogic server, I get ClassNotFoundException for spring classes. But the spring classes are there in the ear file. I double checked it. The ear file of the same source code built with maven 2 deploys successfully.

真正的问题是,当我尝试将maven 3创建的ear部署到weblogic服务器时,我得到了spring类的ClassNotFoundException。但是在ear文件中有spring类。我双重检查。使用maven 2构建的同一源代码的ear文件成功部署。

<Mar 24, 2014 11:42:17 AM IST> <Error> <HTTP> <BEA-101371> <There was a failure when processing annotations for application C:\weblogic\appsrv\domains\mydomain\servers\admin\tmp\_WL_user\myApp-ear\1697udy\app-control.war. Please make sure that the annotations are valid. The error is org.springframework.web.context.support.HttpRequestHandlerServlet>
<Mar 24, 2014 11:42:17 AM IST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application 'mayApp-ear' due to error weblogic.application.ModuleException: Failed to load webapp: '/app-control-war'.
weblogic.application.ModuleException: Failed to load webapp: '/app-control-war'
        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:387)
        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:180)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:388)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
        Truncated. see log file for complete stacktrace
java.lang.ClassNotFoundException: org.springframework.web.context.support.HttpRequestHandlerServlet
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        Truncated. see log file for complete stacktrace

If I upgrade maven, is there something I need to tell to application server?

如果我升级maven,是否需要告诉应用服务器?

Update: I see there is no classpath entry in one of my ejb module's manifest file. That may be the cause of the issue. But why is it missing when everything fine with maven2 build? There is no change in any pom file at all.

更新:我看到在我的ejb模块的清单文件中没有类路径条目。这可能是造成这一问题的原因。但是为什么在maven2构建的时候,它会丢失呢?任何pom文件都没有变化。

1 个解决方案

#1


0  

It turned out to be a bug with Maven 3.0.3 https://jira.codehaus.org/i#browse/MEJB-53

它原来是一个Maven 3.0.3 https://jira.codehaus.org/i#browse/MEJB-53的错误。

As a workaround, added maven-jar-plugin to generate manifest file with class path entries and added manifestFile property to maven-ejb-plugin

作为一个工作区,添加了maven-jar-plugin来生成带有类路径条目的清单文件,并将manifest文件属性添加到maven-ejb-plugin中。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
            </manifest>
        </archive>
    </configuration>
</plugin>
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-ejb-plugin</artifactId>
   <configuration>
       <ejbVersion>3.0</ejbVersion>
       <archive>
        <manifestFile>target/generated-resources/META-INF/MANIFEST.MF</manifestFile>
       </archive>
  </configuration>

#1


0  

It turned out to be a bug with Maven 3.0.3 https://jira.codehaus.org/i#browse/MEJB-53

它原来是一个Maven 3.0.3 https://jira.codehaus.org/i#browse/MEJB-53的错误。

As a workaround, added maven-jar-plugin to generate manifest file with class path entries and added manifestFile property to maven-ejb-plugin

作为一个工作区,添加了maven-jar-plugin来生成带有类路径条目的清单文件,并将manifest文件属性添加到maven-ejb-plugin中。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
            </manifest>
        </archive>
    </configuration>
</plugin>
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-ejb-plugin</artifactId>
   <configuration>
       <ejbVersion>3.0</ejbVersion>
       <archive>
        <manifestFile>target/generated-resources/META-INF/MANIFEST.MF</manifestFile>
       </archive>
  </configuration>