0

Eclipse version: Indigo

Target Application server: Weblogic 10.3.5 (11gR1)

I am having trouble building and deploying a multi-module POM project (packaged as an EAR) to my WebLogic server, within Eclipse.

Despite the parent POM building an EAR file successfully outside of the IDE, I am receiving the following error when trying to deploy the UI WAR to the Application Server:

java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
    at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
    at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:486)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1466)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:898)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:686)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:539)
    at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
    at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3027)
    at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:341)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: weblogic.application.ModuleException: Failed to load webapp: 'lerp-ui'
    at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:393)
    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)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
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:305)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at weblogic.servlet.internal.WebAnnotationProcessorImpl.processServlets(WebAnnotationProcessorImpl.java:225)
    at weblogic.servlet.internal.WebAnnotationProcessorImpl.processJ2eeAnnotations(WebAnnotationProcessorImpl.java:209)
    at weblogic.servlet.internal.WebAnnotationProcessorImpl.processAnnotations(WebAnnotationProcessorImpl.java:105)
    at weblogic.servlet.internal.WebAppServletContext.processAnnotations(WebAppServletContext.java:1368)
    at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:449)
    at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:493)
    at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:418)
    at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:972)
    at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:382)

This is despite having the jsf-api dependency in both the Maven POM and referenced in the .classpath file for the UI WAR project:

Snippet of the POM for the UI WAR project:

<dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0.3</version>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.0.3</version>
        </dependency>

.classpath for UI WAR Project:

<classpathentry kind="var" path="M2_REPO/javax/faces/jsf-api/2.0.3/jsf-api-2.0.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/sun/faces/jsf-impl/2.0.3/jsf-impl-2.0.3.jar"/>

Below follows the entire parent POM of the multi-module project:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>uk.co.acme</groupId>
    <artifactId>multiModulePOMProject</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>acme troublesome project</name>


    <modules>
        <module>../../Business/common</module>
        <module>../../Business/svccom</module>
        <module>../../Business/busctl</module>
        <module>../../Client/ui</module>
        <module>../../Business/ear</module>
        <module>../../Business/talend/java/businessrules</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <properties>
        
        <project.ui.version>1.0-SNAPSHOT</project.ui.version>
        <project.common.version>1.0-SNAPSHOT</project.common.version>
        <project.svccom.version>1.0-SNAPSHOT</project.svccom.version>
        <project.busctl.version>1.0-SNAPSHOT</project.busctl.version>
                        
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <webapp.filter>development</webapp.filter>
        <spring.version>3.0.5.RELEASE</spring.version>      
        <eclipselink.version>2.1.3</eclipselink.version>
        <persistence.version>2.0.0</persistence.version>
        <spring.cdi.version>1.0.0</spring.cdi.version>
        
        <weblogic.adminurl>t3://localhost:7050</weblogic.adminurl>
        <weblogic.user>weblogic</weblogic.user>
        <weblogic.password>welcome1</weblogic.password>
        <weblogic.target>acmeLocalDomain</weblogic.target>
        <weblogic.source>../../Business/ear/target/${parent.artifactId}.${packaging}</weblogic.source>              
        
    </properties>

    <profiles>
        <profile>
            <id>production</id>
            <properties>
                <webapp.filter>production</webapp.filter>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.2</version>
            </plugin>
        </plugins>
    </build>
</project>

It's clear that this is some classpathing issue, but I have gone scrollbind from staring at it over the course of two days and have decided that the time has come to wave the white flag and appeal for help!

The end goal is to take my EAR project (which currently is hampered from an annoying need to undeploy/redeploy on the command line for every little change) and get it so that I can perform hot fixes within a deployment which is run inside the IDE.

Thanks

Update:

By adding the offending dependency to the domains\<domain>\lib folder of the application server, and restarting the application server, I have now started getting ClassNotFoundExceptions for other WAR dependencies. It is clear now that Eclipse is not respecting the classpath of the WAR project - and I still don't understand why or how :-(

4

2 回答 2

2

To package dependencies into your lib directory, add this to your EAR packaging pom:

<build>
   <plugins>
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-ear-plugin</artifactId>
         <version>2.5</version>
         <configuration>
            <version>6</version>
            <defaultLibBundleDir>lib</defaultLibBundleDir>
            <modules>
               [Your EJB and Web modules here]
            </modules>
          </configuration>
       </plugin>
   </plugins>
</build>

Notice the defaultLibBundleDir tag.

于 2013-01-25T09:29:42.313 回答
0

After building the EAR using File > Export in Eclipse, I was able to compare the EAR to the one produced by my Maven POM.

I found that Eclipse did not contain references to the Maven Dependencies build path items in the Deployment Assembly (I discovered that simply adding the Projects as dependencies wasn't enough).

Reading around the subject, I found that it was neccessary to add the Maven Dependencies of the child WAR and JARs to their respective WAR and JAR projects, but with a destination of

../lib

This is declared on each WAR and JAR refers to the lib folder of the parent EAR.

Using a combination of this menu (and alternatively by editing each of the corresponding .settings/org.eclipse.wst.common.component files for each affected WAR and JAR in turn) I was able to build up a version of the EAR which matched the one produced via my Maven script.

I hope this helps someone.

于 2013-01-04T17:09:54.977 回答