views:

185

answers:

1

I can't seem to get a web application running with the embedded glassfish plugin:

Plugin Configuration:

<plugin>
                <groupId>org.glassfish</groupId>
                <artifactId>maven-embedded-glassfish-plugin</artifactId>
                <version>${glassfish.version}</version>
                <configuration>
                    <port>${http.port}</port>

                    <autoDelete>true</autoDelete>
                    <app>${project.build.directory}/${maven.war.final.name}</app>
                    <containerType>web</containerType>
                    <!--
                    <goalPrefix>glassfish</goalPrefix>

                    <configFile>${project.build.directory}/${finalName}/WEB-INF/domain.xml</configFile>

                    <instanceRoot>${project.build.directory}/glassfish/${glassfish.version}</instanceRoot>
                    <installRoot>${project.build.directory}/glassfish/${glassfish.version}</installRoot>
                    -->

                    <!--
                    <contextRoot>test</contextRoot>
                    -->
                </configuration>
            </plugin>

Configuration:

<properties>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <maven.war.final.name>${finalName}.war</maven.war.final.name>
        <http.port>80</http.port>
        <glassfish.version>3.0</glassfish.version>
    </properties>

Command Line:

mvn clean package embedded-glassfish:run

Output:

INFO: GlassFish v3 (74.2) startup time : Embedded(323ms) startup services(323ms) total(646ms)
Aug 21, 2010 2:04:10 PM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
Aug 21, 2010 2:04:11 PM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService: JMXConnector system is disabled, skipping.
Aug 21, 2010 2:04:11 PM AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
Aug 21, 2010 2:04:11 PM org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator null
Aug 21, 2010 2:04:11 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
Aug 21, 2010 2:04:16 PM com.sun.common.util.logging.LoggingConfigImpl openPropFile
INFO: Cannot read logging.properties file. 
Aug 21, 2010 2:04:16 PM com.sun.enterprise.web.WebContainer createHttpListener
INFO: Created HTTP listener embedded-listener on port 80
Aug 21, 2010 2:04:16 PM com.sun.enterprise.web.WebContainer configureHttpServiceProperties
WARNING: pewebcontainer.invalid_http_service_property
Aug 21, 2010 2:04:16 PM com.sun.enterprise.web.WebContainer createHosts
INFO: Created virtual server server
Aug 21, 2010 2:04:16 PM com.sun.enterprise.web.WebContainer loadSystemDefaultWebModules
INFO: Virtual server server loaded system default web module
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.SecurityLifecycle <init>
INFO: security.secmgroff
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.ssl.SSLUtils checkCertificateDates
SEVERE: java_security.expired_certificate
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.SecurityLifecycle onInitialization
INFO: Security startup service called
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.PolicyLoader loadPolicy
INFO: policy.loading
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.
Aug 21, 2010 2:04:18 PM com.sun.enterprise.security.SecurityLifecycle onInitialization
INFO: Security service(s) started successfully....
classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@756095fc
Aug 21, 2010 2:04:20 PM org.jboss.weld.bootstrap.WeldBootstrap <clinit>
INFO: WELD-000900 SNAPSHOT
Aug 21, 2010 2:04:20 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
nullID: /mnt/projects/github.com/prettyfaces-tests/gfembed4134153095470013496tmp/applications/prettyfaces-demo-0.0.1-SNAPSHOT/ CLASSES: [class de.chkal.prettytest.WelcomeBean, class de.chkal.prettytest.GreetingBean, class de.chkal.prettytest.WelcomeBean2]

Aug 21, 2010 2:04:20 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/prettyfaces-demo-0.0.1-SNAPSHOT'
Aug 21, 2010 2:04:22 PM com.sun.enterprise.web.WebApplication start
INFO: Loading application prettyfaces-demo-0.0.1-SNAPSHOT at /prettyfaces-demo-0.0.1-SNAPSHOT
Hit ENTER to redeploy, X to exit

Netstat -an | grep 80 doesn't list anything:

netstat -an | grep :80

This configuration has worked for me in the past, I don't see any log messages or exceptions. What am I missing?

A: 

I don't have the full explanation (and I'm too lazy to find the real cause of the problem tonight) but it seems the maven-glassfish-embedded-plugin doesn't like the port 80, it just works with, say, 8080.

By the way, I'd recommend using the version 3.0.1.

<properties>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <maven.war.final.name>${finalName}.war</maven.war.final.name>
    <http.port>8080</http.port>
    <glassfish.version>3.0.1</glassfish.version>
</properties>
Pascal Thivent
Cool, I will check that now. I guess that makes sense, I'm running on linux, there are ports below a certain number that are privileged and require superuser to listen on those ports. That might be within that range, lemme try 8080.
Sweet, that was it. I'll try to keep this in mind when using port 80 in the future.
@Walter That must be it, ports below 1024 require root privilege. I should have thought it was because of this.
Pascal Thivent