Question

I have a JEE6 webapp based on https://netbeans.org/kb/docs/javaee/maven-entapp.html with the structure below.

foo
foo/foo-ear
foo/foo-web
foo/foo-ejb

Where the top level project is an aggregator and the others are ear/war/ejb types respectively.

I have the ear plugin configured in foo-ear:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <version>6</version>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <modules>
                    <ejbModule>
                        <groupId>com.foo</groupId>
                        <artifactId>foo-ejb</artifactId>
                    </ejbModule>
                    <webModule>
                        <groupId>com.foo</groupId>
                        <artifactId>foo-web</artifactId>
                    </webModule>
                </modules>
            </configuration>

        </plugin>

Everything builds fine when running a mvn clean install.

An application.xml is generated:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"     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/application_6.xsd" version="6">
<display-name>foo-ear</display-name>
<module>
    <ejb>foo-ejb-0.1.0-SNAPSHOT.jar</ejb>
</module>
<module>
    <web>
        <web-uri>foo-web-0.1.0-SNAPSHOT.war</web-uri>
        <context-root>/foo-web</context-root>
    </web>
</module>
<library-directory>lib</library-directory>
</application>

After adding the ear to the GlassFish 3.1.2 Server in Eclipse I see the following logs:

INFO: keepstate options resolved to true, saving appId 89891727150219264 for application foo-ear.
INFO: EJB5181:Portable JNDI names for EJB UserService: [java:global/foo-ear/foo-ejb-0.1.0-SNAPSHOT/UserService!com.foo.user.service.UserService, java:global/foo-ear/foo-ejb-0.1.0-SNAPSHOT/UserService]
INFO: foo-ear was successfully deployed in 78 milliseconds.

Any kind of interaction with the sever results in a resource not found. I've run vanilla webapps before and recall seeing JSF/Facelets log output when starting up.

On other occasions I get a

SEVERE: Exception while deploying the app [foo-ear] : Could not find sub module [foo-web-0.1.0-SNAPSHOT.war] as defined in application.xml

But I can see under target that the war exists.

The EAR deploys correctly when manually deploying using the admin console - so is there something amiss with the m2e-WTP plugin perhaps? It just doesn't seem to recognize the web-module unfortunately.

Was it helpful?

Solution

Just to be clear what the resolution for this was.

Restart eclipse, problem solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top