我正在使用Maven构建一个java ear文件。当我们将耳朵部署到Weblogic时,我们得到以下异常,这使我认为需要将依赖关系添加到ear文件(由maven打包到耳中):
<Feb 2, 2015 3:20:30 PM EST> <Error> <HTTP> <BEA-101371> <There was a failure when processing annotations for application /6v09bd/Develapp-0.1.war. Please make sure that the annotations are valid. The error is javax.faces.webapp.FacesServlet>
<Feb 2, 2015 3:20:30 PM EST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1422908423000' for task '18'. Error is: 'weblogic.application.ModuleException: Failed to load webapp: '/Develapp''
weblogic.application.ModuleException: Failed to load webapp: '/Develapp'
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:395)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Truncated. see log file for complete stacktrace
根据this SO solution,我试图添加maven插件“jar-with-dependencies”。但我得到插件的下载错误,maven将无法编译pom.xml。我不确定这个插件是否真的适用于耳文件。
基本上,我需要知道如何将战争的所有依赖关系融入其中,以便Weblogic对耳朵感到满意,如果这是有意义的话。
答案 0 :(得分:2)
我猜你没有使用maven-war-plugin来构建你的战争..因为这个插件可以满足你的要求..它将你的战争依赖项复制到lib文件夹。
请记住,不会复制提供的范围依赖关系。
答案 1 :(得分:0)
你需要在war / pom.xml中有这样的东西
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
</configuration>
</plugin>
</plugins>
</build>
并且不要忘记ear / pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<modules>
<webModule>
<moduleId>YOURService</moduleId>
<groupId>YOURGroupId</groupId>
<artifactId>YOURArtifactId</artifactId>
<contextRoot>/DevelApp</contextRoot>
</webModule>
</modules>
<defaultLibBundleDir>APP-INF/lib</defaultLibBundleDir>
<skinnyWars>true</skinnyWars>
</configuration>
</plugin>
</plugins>
</build>
如果你有一些特殊的课程,想要强制进入网络应用程序,你总是可以使用这个插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-my-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>another.groupId</groupId>
<artifactId>another.artifactId</artifactId>
<version>another.version</version>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/APP-INF/classes
</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<includes>**/*.class</includes>
</configuration>
</execution>
</executions>
</plugin>
您可以随时将依赖关系传递给您的战争,只需将其标记为<scope>runtime</scope>
(请参阅:maven dependency scope)