dev@glassfish.java.net

Re: How to use the embedded glassfish maven plugin for a fast and homogeneous deployment of my JSF application?

From: Ed Burns <edward.burns_at_oracle.com>
Date: Wed, 7 Sep 2011 14:24:42 -0700

>>>>> On Fri, 2 Sep 2011 14:37:29 -0400, Laird Nelson <ljnelson_at_gmail.com> said:

LN> On Fri, Sep 2, 2011 at 2:05 PM, Ed Burns <edward.burns_at_oracle.com> wrote:
>> Unfortunately, I get this exception
>> when the embedded glassfish instance starts to run:
>>
>> java.lang.NoClassDefFoundError: org/osgi/framework/ServiceException
>>

LN> I believe that Bhavani noted this in another email somewhere; it is
LN> apparently a warning and should be ignored. I've found you can make it go
LN> away by adding the right OSGI dependency (meaninglessly) to the plugin.

Thank you for your followup.

I'm not sure what sugar to put in my pom that uses the embedded plugin
to avoid that error.

Can you please take a look at the attached pom and suggest the necessary
changes?

Thank you very much. Your changes will quickly find their way into
maven central in this new archetype:
javax.faces-war-embedded-glassfish-archetype.

Ed



<?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>foo</groupId>
    <artifactId>bar</artifactId>
    <version>1</version>
    <packaging>war</packaging>
    <name>${project.artifactId}</name>
    <description>A simple project with war packaging that depends on JSF 2.1 and
        javaee 6, in that order. This archetype includes the use of
        maven-embedded-glassfish-plugin. To use it, simply invoke
        mvn package embedded-glassfish:run</description>
    <url>http://jsf-spec.java.net/</url>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
             <plugin>
                <groupId>org.glassfish</groupId>
                <artifactId>maven-embedded-glassfish-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <app>target/${project.artifactId}.war</app>
                    <name>${project.artifactId}</name>
                    <ports>
                        <http-listener>8080</http-listener>
                        <https-listener>8181</https-listener>
                    </ports>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>start</goal> <!-- this will run during pre-integration-test phase -->
                            <goal>deploy</goal> <!-- this will run during pre-integration-test phase -->
                            <goal>undeploy</goal> <!-- this will run during post-integration-test phase -->
                            <goal>stop</goal> <!-- this will run during post-integration-test phase -->
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                  <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.extras</groupId>
            <artifactId>glassfish-embedded-all</artifactId>
            <version>3.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>javax.faces-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>




-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage:               | http://ridingthecrest.com/
| 13 business days until JSF 2.2 Early Draft Review
| 17 business days until JavaOne 2011