users@glassfish.java.net

Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)

From: Mirea Vasile <mirea_vasile_at_yahoo.com>
Date: Wed, 14 Mar 2012 12:49:58 +0000 (GMT)

Hi Bhavani,

The class HqlToken
  is defined in the package org.hibernate.hql.internal.ast who is included in the library:
   <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>4.0.1.Final</version>
    </dependency>


I am using in my project the following dependency directly:
      <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>4.0.1.Final</version>
    </dependency>

who is automatically including the hibernate-core library.
Automatically is included the hibernate-jpa-2.0-api-1.0.1.Final.jar library too, I am not using other JPA implementations/libraries.
All this 3 libraries are in the WEB-INF/lib/ directory (or in the jar file).

What is maybe important too is that I am using the Spring Framework 3.1.0.RELEASE.


Try to reproduce with this version of hibernate I am using(4.0.1.Final) to see if you can.

Thanks,
   Vasile.



________________________________
 Von: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
An: Mirea Vasile <mirea_vasile_at_yahoo.com>
CC: "users_at_embedded-glassfish.java.net" <users_at_embedded-glassfish.java.net>; "users_at_glassfish.java.net" <users_at_glassfish.java.net>; Sakshi Jain <sakshi.jain_at_oracle.com>
Gesendet: 8:27 Mittwoch, 14.März 2012
Betreff: Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)
 

Hi Vasile,

We (Sakshi more specifically), created the application as per the
    instructions you have provided. The spring application is based on [1]
The application runs successfully with embedded GlassFish
    (deployment done through 'admin' goal of embedded plugin).

As part of the application, we included WEB-INF/sun-web.xml that
    reads:

<?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD
      Application Server 9.0 Servlet 2.5//EN"
>  "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
><sun-web-app error-url="">
>  <class-loader delegate="false"/>
></sun-web-app>
>
The JPA classes are bundled in a separate JAR file and the JPA jar is bundled inside spring application's WEB-INF/lib. Also, hibernate-3.2.2.ga.jar is bundled with the application.

When the application runs, org.hibernate.hql.ast.HqlToken indeed get
    loaded from WEB-INF/lib/hibernate-3.2.2.ga.jar

But in your case, the app seems to be trying to load
    org.hibernate.hql.internal.ast.HqlToken. Which JAR this class is supposed to come from?

Thanks,

Bhavani

[1] http://www.springsource.org/download/community?project=Spring%2520Web%2520Services

On 02/24/2012 03:22 PM, Mirea Vasile wrote:

>
>
>
>Hi Bhavani,
>
>
>In this moment I am stuck with the plugin and if the bugfixing takes longer I have no other option then trying to deploy using the maven cargo plugin.
>
>
>Until the bug will be fixed, there is maybe a work around like specifying a library in the classpath of the application with the admin goal ?
>Actually the application deployed with the admin goal cannot find the library where the JPA classes are defined, if I find a way to specify the lib directory in the classpath then it should work.
>Any idea how to do that ?
>
>
>Any idea how long it will take the bugfix?
>
>
>
>Thanks,
>   Vasile
>
>
>
>
>________________________________
> Von: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
>An: Mirea Vasile <mirea_vasile_at_yahoo.com>
>Cc: "users_at_embedded-glassfish.java.net" <users_at_embedded-glassfish.java.net>; "users_at_glassfish.java.net" <users_at_glassfish.java.net>
>Gesendet: 6:16 Donnerstag, 23.Februar 2012
>Betreff: Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)
>
>
>Hi Vasile,
>
>Ok I will try to create a test case and log an issue.
                Will get back to you if I could not reproduce the issue.
>
>Thanks,
>
>Bhavani
>
>On 02/22/2012 04:25 PM, Mirea Vasile wrote:
>
>>
>>Hi Bhavani,
>>
>>
>>I tryed this solution to set the memory options for maven.
It helps.
>>Now I get on Widnows 7 and on linux the same error:
>>
>>org.springframework.ws.soap.client.SoapFaultClientException: org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.internal.ast.HqlToken [select count(*) from com.ws.web.persistence.jpa.DdClass where ipAddress = ?] at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:37) at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:774) at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:600) at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:537) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:384) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378) at
 org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:370)
Seems the deployment doenst work corectly using the admin goal.
>>
>>Maybe you can create a issue for this problem too.
>>
>>A use-case will be:
>>  the deployed application is a spring ws
                    application who is using JPA and Hibernate for
                    persistence.
>>The JPA classes are located in another jar file who
                    is in the dependecies of the web service application
                    and the file is found in the glassfish directory.
>>Still the embedded-glassfish is not able to locate
                    the JPA classes.
>>The client of the web service is normally deployed
                    with the embedded-glassfish(it is a Spring MVC web
                    application).
>>
>>I cannot provide a sample project because I use
                    database connections and to modify it, it takes to
                    much time.
>>Maybe this use-case helps you to make an idea and to
                    fix the problem.
>>I tryed with version 3.1 and with version 3.1.1 and
                    I have the same problem.
>>
>>
>> Regards,
>>   Vasile.
>>
>>
>>
>>
>>
>>
>>________________________________
>> Von: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
>>An: Mirea Vasile <mirea_vasile_at_yahoo.com>
>>Cc: "users_at_embedded-glassfish.java.net" <users_at_embedded-glassfish.java.net>; "users_at_glassfish.java.net" <users_at_glassfish.java.net>
>>Gesendet: 18:21 Dienstag, 21.Februar 2012
>>Betreff: Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)
>>
>>
>>Hi Vasile,
>>
>>You can try setting higher PermGen space
                            using MAVEN_OPTS environment variable,
                            something like:
>>
>>MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
>>
>>Thanks,
>>
>>Bhavani
>>
>>On 02/21/2012 10:32 PM, Mirea Vasile wrote:
>>
>>>
>>>
>>>
>>>Hi Bhavani,
>>>
>>>
>>>trying to run the same application under linux I get the following issue :
>>> 
>>>21.02.2012 17:44:01 org.glassfish.api.ActionReport failure
SCHWERWIEGEND: Exception while preparing the app
21.02.2012 17:44:01 com.sun.enterprise.v3.server.ApplicationLifecycle deploy
SCHWERWIEGEND: PermGen space
java.lang.OutOfMemoryError: PermGen space at org.hibernate.event.service.internal.EventListenerRegistryImpl.prepareListenerMap(EventListenerRegistryImpl.java:235) at org.hibernate.event.service.internal.EventListenerRegistryImpl.<init>(EventListenerRegistryImpl.java:97) at org.hibernate.event.service.internal.EventListenerServiceInitiator.initiateService(EventListenerServiceInitiator.java:51) at org.hibernate.event.service.internal.EventListenerServiceInitiator.initiateService(EventListenerServiceInitiator.java:38) at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:177) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) at
 org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyHibernateListeners(BeanValidationIntegrator.java:292) at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:134) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at
 org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:205) at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:119) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:214) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:483) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:221) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:167) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:872) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410) 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)
Build timed out. Aborting It seems the deploy command it generates some issues to glassfish under linux.
What should I do in this situation ?
>>>
>>>
>>>Thanks,
>>>  Vasile.
>>>
>>>
>>>
>>>________________________________
>>> Von: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
>>>An: Mirea Vasile <mirea_vasile_at_yahoo.com>
>>>Cc: "users_at_embedded-glassfish.java.net" <users_at_embedded-glassfish.java.net>; "users_at_glassfish.java.net" <users_at_glassfish.java.net>
>>>Gesendet: 18:13 Montag, 20.Februar 2012
>>>Betreff: Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)
>>>
>>>
>>>Hi Vasile,
>>>
>>>"\" characters getting replaced
                                        on Windows seems to be bug.
                                        Please file a bug for it in
                                        issuetracker[1]
>>>
>>>Since
                                        "glassfish.embedded.tmpdir"
                                        system property is the way of
                                        specifying where the temp.
                                        domain dir should get created,
                                        what you are seeing is the right
                                        behaviour.
>>>
>>>For the second application
                                        deployment, you should ideally
                                        file an enhancement request in
                                        issuetracker[1]. But as a workaround, you can use admin goal[2] of the plugin. For you reference, I have attached pom.xml snippet which can do this.
>>>
>>>Thanks,
>>>
>>>Bhavani
>>>
>>>[1] http://java.net/jira/browse/GLASSFISH
>>>[2] http://embedded-glassfish.java.net/nonav/plugindocs/3.1/admin-mojo.html
>>>
>>>
>>>On 02/20/2012 10:02 PM, Mirea
                                        Vasile wrote:
>>>
>>>>
>>>>
>>>>
>>>>Hi Bhavani,
>>>>
>>>>
>>>>Thank you very much for the answer.
>>>>Unfortunately is not working properly.
>>>>The path ${project.build.directory}/glassfish is replaced with :
>>>>
>>>>
>>>>  T:\workspace2\slave-server-webui\target/glassfish
>>>>
>>>>
>>>>Unfortunately the plugin replace all "\" and the path remains like:
>>>>  Set system property [glassfish.embedded.tmpdir = T:workspace2slave-server-webui
>>>>arget/glassfish]
>>>>
>>>>
>>>>Maybe you can correct this bug(my build runs on windows 7).
>>>>
>>>>
>>>>I found a workaround in my case:
>>>>I use target/glassfish and then the plugin use this path additional to the app path and then the plugin deploy glassfish under:
>>>>   T:\workspace2\slave-server-webui\target\glassfish\
>>>>Then the glassfish directory will be:
>>>>
>>>>
>>>> 
T:\workspace2\slave-server-webui\target\glassfish\gfembed8580213734252944528tmp
>>>>
>>>>
>>>>
>>>>
>>>>Now my question is why this tmp directory is additionally generated ?
>>>>My problem is I want to copy another application in the autodeploy directory of embedded glassfish.
>>>>My integration tests for my application slave-server-webui are using another application ( a web service)
>>>>I need to copy in the pre-integration pfase this additional web service application in the embedded glassfish otherwise my application slave-server-webui and his integration tests won't work.
>>>>
>>>>
>>>>Maybe you can suggest me a better solution for my case.
>>>>I describe my problem here :
>>>>
>>>>  http://stackoverflow.com/questions/9280413/maven-embedded-glassfish-plugin-deploying-2-applications
>>>>
>>>>
>>>>Unfortunattly I got no answer to my question, so my only idea was to copy in the autodeploy directory on the embedded glassfish my second application(the web service).
>>>>Thanks for helping with using embeded glassfish plugin for maven.
>>>>
>>>>
>>>>
>>>>Regards,
>>>>
>>>>  Vasile
>>>>
>>>>
>>>>________________________________
>>>> Von: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
>>>>An: Mirea Vasile <mirea_vasile_at_yahoo.com>
>>>>Cc: "users_at_glassfish.java.net" <users_at_glassfish.java.net>; "users_at_embedded-glassfish.java.net" <users_at_embedded-glassfish.java.net>
>>>>Gesendet: 7:25 Montag, 20.Februar 2012
>>>>Betreff: Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)
>>>>
>>>>
>>>>Hi,
>>>>
>>>>With 3.1 (onwards)
                                                    you should set the
                                                    instanceRoot iff you
                                                    have pre-created
                                                    domain directory.
>>>>
>>>>Otherwise, if you
                                                    intend to make the
                                                    embedded GlassFish
                                                    use a different
                                                    temp. directory for
                                                    its tiny instance
                                                    root creation, then
                                                    you should set this
                                                    in embedded plugin
                                                    configuration:
>>>>
>>>><configuration>
>>>>
>>>>...
>>>><systemProperties>
>>>>>
>>>>><property>glassfish.embedded.tmpdir=${project.build.directory}/glassfish</property>
>>>>>>
</systemProperties>
>>>>>
>>>>...
</configuration>
>>>>
>>>>HTH,
>>>>
>>>>Bhavani
>>>>
>>>>On 02/15/2012 04:04
                                                    PM, Mirea Vasile
                                                    wrote:
>>>>
>>>>>
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>>  I have the following issue:
>>>>>
>>>>>
>>>>>  I am using the maven-embedded-glassfish-plugin .
>>>>>  I am having the following configuration in maven for it:
>>>>>   
>>>>>
>>>>> <plugin>
>>>>>           
                                                          <groupId>org.glassfish</groupId>
>>>>>           
                                                          <artifactId>maven-embedded-glassfish-plugin</artifactId>
>>>>>           
                                                          <version>3.0</version>
>>>>>            
>>>>>           
                                                          <configuration>
>>>>>             
<goalPrefix>embedded-glassfish</goalPrefix>
>>>>>         
                                                          <serverID>localhost</serverID>
>>>>>         
                                                          <name>${build.finalName}</name>
>>>>>         
                                                          <app>${project.build.directory}/${build.finalName}.war</app>
>>>>>         
                                                          <port>8080</port>
>>>>> 
>>>>>         
<instanceRoot>${project.build.directory}/glassfish</instanceRoot>
>>>>>
>>>>>         
                                                          <autoDelete>true</autoDelete>
>>>>>
>>>>>       
                                                          </configuration>
>>>>>
>>>>>           
                                                          <executions>
>>>>>              
<execution>
>>>>>       
                                                                   
                                                          <id>start-glassfish</id>
>>>>>       
                                                                   
                                                          <phase>pre-integration-test</phase>
>>>>>       
                                                                   
                                                          <goals>
>>>>>       
                                                                      
                                                          <goal>start</goal>
>>>>>       
                                                                   
                                                          </goals>
>>>>>              
</execution>
>>>>>              
<execution>
>>>>>       
                                                                   
                                                          <id>glassfish-deploy</id>
>>>>>       
                                                                   
                                                          <phase>pre-integration-test</phase>
>>>>>       
                                                                   
                                                          <goals>
>>>>>       
                                                                      
                                                          <goal>deploy</goal>
>>>>>       
                                                                   
                                                          </goals>
>>>>>              
</execution>
>>>>>              
<execution>
>>>>>       
                                                                   
                                                          <id>glassfish-undeploy</id>
>>>>>       
                                                                   
                                                          <phase>post-integration-test</phase>
>>>>>       
                                                                   
                                                          <goals>
>>>>>       
                                                                      
                                                          <goal>undeploy</goal>
>>>>>       
                                                                   
                                                          </goals>
>>>>>              
</execution>
>>>>>              
<execution>
>>>>>       
                                                                   
                                                          <id>stop-glassfish</id>
>>>>>       
                                                                   
                                                          <phase>post-integration-test</phase>
>>>>>       
                                                                   
                                                          <goals>
>>>>>       
                                                                      
                                                          <goal>stop</goal>
>>>>>       
                                                                   
                                                          </goals>
>>>>>              
</execution>
>>>>>           
                                                          </executions>
>>>>>         
                                                          </plugin> 
>>>>>
>>>>>
>>>>>This configuration works just fine in the version 3.0.
>>>>>Important is the option:
<instanceRoot>
>>>>>
>>>>>
>>>>>In the Version 3.1 I am getting a strange error:
>>>>>  15.02.2012 11:30:48 com.sun.enterprise.v3.server.DomainXmlPersistence getPidFile
>>>>>
>>>>>ERROR: Cannot
                                                          obtain
                                                          lockfile
                                                          location
                                                          T:\workspace2\web-app\
>>>>>target\glassfish\config\lockfile,


                                                          configuration
                                                          changes will
                                                          not be
                                                          persisted
>>>>>java.io.IOException:
                                                          The System
                                                          cannot find
                                                          the specied
                                                          path.
>>>>>        at
                                                          java.io.WinNTFileSystem.createFileExclusively(Native
                                                          Method)
>>>>>        at
                                                          java.io.File.createNewFile(File.java:883)
>>>>>        at
                                                          com.sun.enterprise.v3.server.DomainXmlPersistence.getPidFile(DomainXm
>>>>>lPersistence.java:92)
>>>>>        at
                                                          com.sun.enterprise.v3.server.DomainXmlPersistence.accessRead(DomainXm
>>>>>lPersistence.java:114)
>>>>>        at
                                                          org.glassfish.config.support.DomainXml.parseDomainXml(DomainXml.java:
>>>>>210)
>>>>>
>>>>>  ...
>>>>>
>>>>>
>>>>>In the version 3.0 the directory structure will be created by the plugin, in the version 3.1 not any more and then I get this errors.
>>>>>Something change in the new version or it is a bug ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>>  Vasile.
>>>>>
>>>>> 
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>