Skip to main content

(resolved) Glassfish embedded 3.1.1 won't deploy existing war file (deploys fine in embedded tomcat 6

7 replies [Last post]
jakorsme
Offline
Joined: 2009-01-01
Points: 0

Our existing war file will not deploy in embedded glassfish 3.1.1

This war was functioning fine in an embedded Tomcat 6 instance for a couple of years.

I migrated to embedded glassfish 3.1.1 and I can bring up embedded glassfish just fine and it will listen on my custom port of 9090. If I browse to 9090, glassfish answers and gives its 404 error page just fine.

As soon as I add a deploy statement to the code, I get errors.

( code is at the bottom )

error_log below without the deploy:

-------------------------------------------------------
Sep 29, 2011 4:30:58 PM com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.
Sep 29, 2011 4:30:58 PM org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator null
Sep 29, 2011 4:30:58 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
Sep 29, 2011 4:30:58 PM com.sun.enterprise.v3.services.impl.GrizzlyService createNetworkProxy
INFO: Network listener https-listener on port 0 disabled per domain.xml
Sep 29, 2011 4:30:58 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish Server Open Source Edition 3.1.1 (12) startup time : Embedded (774ms), startup services(315ms), total(1,089ms)
Sep 29, 2011 4:30:58 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy$2$1 onReady
INFO: Grizzly Framework 1.9.36 started in: 68ms - bound to [0.0.0.0:9090]
Sep 29, 2011 4:30:59 PM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService: JMXConnector system is disabled, skipping.
----------------------------------------------------------------------

Error_log, as soon as I try to deploy the war file.

----------------------------------------------------------------------
Sep 29, 2011 5:49:04 PM com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.
Sep 29, 2011 5:49:04 PM org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator null
Sep 29, 2011 5:49:04 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
Sep 29, 2011 5:49:04 PM com.sun.enterprise.v3.services.impl.GrizzlyService createNetworkProxy
INFO: Network listener https-listener on port 0 disabled per domain.xml
Sep 29, 2011 5:49:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish Server Open Source Edition 3.1.1 (12) startup time : Embedded (797ms), startup services(304ms), total(1,101ms)
Sep 29, 2011 5:49:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy$2$1 onReady
INFO: Grizzly Framework 1.9.36 started in: 66ms - bound to [0.0.0.0:9090]
Sep 29, 2011 5:49:04 PM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService: JMXConnector system is disabled, skipping.
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.SecurityLifecycle <init>
INFO: SEC1002: Security Manager is OFF.
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.SecurityLifecycle onInitialization
INFO: SEC1010: Entering Security Startup Service
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.PolicyLoader loadPolicy
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.jacc.provider.SimplePolicyProvider.
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
Sep 29, 2011 5:49:05 PM com.sun.enterprise.security.SecurityLifecycle onInitialization
INFO: SEC1011: Security Service(s) Started Successfully
Sep 29, 2011 5:49:05 PM com.sun.enterprise.v3.server.ApplicationLifecycle startContainers
SEVERE: Cannot start container web
org.jvnet.hk2.component.ComponentException: Failed to create class com.sun.enterprise.web.WebContainer
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:71)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:80)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.glassfish.internal.data.EngineInfo.getContainer(EngineInfo.java:93)
at com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(ApplicationLifecycle.java:957)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:667)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
at com.pop3gateway.HttpServer.deploy(HttpServer.java:135)
at com.pop3gateway.HttpServer.run(HttpServer.java:107)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.VerifyError: class com.sun.enterprise.web.WebModule overrides final method start.()V
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:65)
... 20 more

Sep 29, 2011 5:49:06 PM org.glassfish.api.ActionReport failure
SEVERE: Aborting, Failed to start container com.sun.enterprise.web.WebContainer
Sep 29, 2011 5:49:06 PM org.glassfish.api.ActionReport failure
SEVERE: Exception while deploying the app [emp]
Sep 29, 2011 5:49:06 PM com.sun.enterprise.v3.server.ApplicationLifecycle deploy
SEVERE: Aborting, Failed to start container com.sun.enterprise.web.WebContainer
java.lang.Exception: Aborting, Failed to start container com.sun.enterprise.web.WebContainer
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:670)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
at com.pop3gateway.HttpServer.deploy(HttpServer.java:135)
at com.pop3gateway.HttpServer.run(HttpServer.java:107)
at java.lang.Thread.run(Unknown Source)

Sep 29, 2011 5:49:06 PM org.glassfish.deployment.admin.DeployCommand execute
SEVERE: Exception while deploying the app [emp] : Aborting, Failed to start container com.sun.enterprise.web.WebContainer
---------------------------------------------------------------------------------------

Source code controlling this all

----------------------------------------------------------------------

// glassfish & deployer are global

try {
GlassFishProperties glassFishProperties = new GlassFishProperties();
glassFishProperties.setPort("http-listener", 9090);

glassfish = GlassFishRuntime.bootstrap().newGlassFish(glassFishProperties);
glassfish.start();
deployer = glassfish.getDeployer();
/
deploy("C:\\emp.war");

}

public void deploy(String file) {
try {
deployer.deploy(new File(file));
} catch (GlassFishException ex) {
Logger.getLogger(HttpServer.class.getName()).log(Level.SEVERE, null, ex);
}
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
amyroh
Offline
Joined: 2004-05-06
Points: 0

Which jar are you using? What is in your CLASSPATH?

Amy

On 9/29/11 6:20 PM, forums@java.net wrote:
> Our existing war file will not deploy in embedded glassfish 3.1.1
> This war was functioning fine in an embedded Tomcat 6 instance for a
> couple
> of years.
> I migrated to embedded glassfish 3.1.1 and I can bring up embedded
> glassfish
> just fine and it will listen on my custom port of 9090. If I browse to
> 9090,
> glassfish answers and gives its 404 error page just fine.
> As soon as I add a deploy statement to the code, I get errors.
> ( code is at the bottom )
> error_log below without the deploy:

Yongqin Xu Guest
Offline
Joined: 2011-09-26
Points: 0

Hello,

In my runtime, i got this connection instance with type com.sun.gjc.spi.jdbc40.ConnectionWrapper40,
, i need to unwrap it to OracleConnection instance type, has any of you done this before? I tried
ConnectionWrapper40.unwrap(), it give me back ConnectionWrapper40 still.

jakorsme
Offline
Joined: 2009-01-01
Points: 0

<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.1</version>
</dependency>

Oh, and the war deploys just fine in a standalone version of glassfish 3.1.1 from the admin screens.

It's not really feasible to give you a listing of the generated classpath, as the classpath is built by an install4j installer.

John

amyroh
Offline
Joined: 2004-05-06
Points: 0

You may have some stale jars being picked up from local maven local
repo. Try cleaning all com.sun.enterprise.* and org.glassfish.*
artifacts from local repo and run it again.

http://markmail.org/message/yaglrydzkatz3ciq#query:+page:1+mid:svmzpkh2h...

On 10/1/11 12:11 AM, forums@java.net wrote:
>
> org.glassfish.extras
> glassfish-embedded-all
> 3.1.1
>
>
>
> Oh, and the war deploys just fine in a standalone version of glassfish
> 3.1.1
> from the admin screens.
>
> It's not really feasible to give you a listing of the generated
> classpath, as
> the classpath is built by an install4j installer.
>
> John
>
>
>
>
> --
>
> [Message sent by forum member 'jakorsme']
>
> View Post: http://forums.java.net/node/848612
>
>

jakorsme
Offline
Joined: 2009-01-01
Points: 0

It was in fact picking up some stale jars in the deployed lib folder, even though I had gotten rid of them on new builds. It was jars that I had put there to try to get rid of a rash of errors (which it resolved down to the last one I posted here).

Upon removing it, the application deploys fine.

John

amyroh
Offline
Joined: 2004-05-06
Points: 0

GlassFish relies on the user environment to locate a full JDK 1.6 so you
need to make sure
that JAVA_HOME is correct and that java or javac is in the exec path.

On 10/3/11 1:08 PM, forums@java.net wrote:
> It was in fact picking up some stale jars in the deployed lib folder,
> even
> though I had gotten rid of them on new builds. It was jars that I had put
> there to try to get rid of a rash of errors (which it resolved down to
> the
> last one I posted here).
>
> Upon removing it, the application deploys fine.
>
> However now when trying to browse to the application
> at: http://localhost/emp
>
> I get the error:
>
> org.apache.jasper.JasperException: PWC6345: There is an error in invoking
> javac. A full JDK (not just JRE) is required
> This is very concerning because this is a Glassfish embedded instance
> within
> a JSE application (running a webapp).
>
> The overall application has to just install and run (it has an
> embedded JRE)
> without the end-user having to be concerned about installing a JDK or
> configuring anything in our application to point to it.
>
> I didn't get this error with embedded tomcat (the war is exactly the same
> code that tomcat was executing).
>
> Maybe I somehow got around this with Tomcat, but I can't find any jars I
> added to include javac for instance.
>
>
>
> John
>
>
> --
>
> [Message sent by forum member 'jakorsme']
>
> View Post: http://forums.java.net/node/848612
>
>

jakorsme
Offline
Joined: 2009-01-01
Points: 0

amyroh wrote:
GlassFish relies on the user environment to locate a full JDK 1.6 so you need to make sure that JAVA_HOME is correct and that java or javac is in the exec path. On 10/3/11 1:08 PM, forums@java.net wrote: > It was in fact picking up some stale jars in the deployed lib folder, > even > though I had gotten rid of them on new builds. It was jars that I had put > there to try to get rid of a rash of errors (which it resolved down to > the > last one I posted here). > > Upon removing it, the application deploys fine. > > However now when trying to browse to the application > at: http://localhost/emp > > I get the error: > > org.apache.jasper.JasperException: PWC6345: There is an error in invoking > javac. A full JDK (not just JRE) is required > This is very concerning because this is a Glassfish embedded instance > within > a JSE application (running a webapp). > > The overall application has to just install and run (it has an > embedded JRE) > without the end-user having to be concerned about installing a JDK or > configuring anything in our application to point to it. > > I didn't get this error with embedded tomcat (the war is exactly the same > code that tomcat was executing). > > Maybe I somehow got around this with Tomcat, but I can't find any jars I > added to include javac for instance. > > > > John > > > -- > > [Message sent by forum member 'jakorsme'] > > View Post: http://forums.java.net/node/848612 > >

Thanks, yes typically.

However, I deploy through Install4j which permits bundling a JRE, so one doesn't have to worry about whether a JRE is present.

I also put tools.jar in the classpath, so I don't have to worry about glassfish needing a JDK installed.

John