[jboss-user] [JBoss Seam] - Re: Glassfish example and the entity converter.

soluble do-not-reply at jboss.com
Tue Jun 19 11:15:17 EDT 2007


Hi hongzhang, the instructions to reproduce the problem are as follows:

1) Download and install Glassfish v2 https://glassfish.dev.java.net/downloads/v2-b48.html. I am using the Windows version build 48.

2) Download and extract JBoss Seam 1.2.1 GA http://labs.jboss.com/jbossseam/download.

On my computer Glassfish is in c:\glassfish and Seam is in c:\java\jboss-seam-1.2.1.GA.

3) Start glassfish and its JavaDB if not started. Using the command line this is:

  | c:\glassfish\bin\asadmin start-domain
  | c:\glassfish\bin\asadmin start-database
  | 

4) Build the Glassfish example in seam using ant:

  | cd c:\java\jboss-seam-1.2.1.GA\examples\glassfish
  | c:\glassfish\bin\asant
  | 

5) Deploy the ear file to Glassfish:

  | cd c:\java\jboss-seam-1.2.1.GA\examples\glassfish
  | c:\glassfish\bin\asadmin deploy build\jboss-seam-glassfish.ear
  | 

With this step, the application should work fine and you should be able to login via a web browser http://localhost:8080/jboss-seam-glassfish/. Username demo, password demo. Note that due to a bug in the example, it will not work successfully with Firefox.

Now to reproduce the problems I am having:

1) You will need to add the following component config to your components.xml file located in c:\java\jboss-seam-1.2.1.GA\examples\glassfish\resources\WEB-INF:

  | <core:entity-manager-factory name="dbFactory" 
  |     		persistence-unit-name="bookingDatabase"/>
  |     <core:managed-persistence-context name="entityManager" 
  |     		auto-create="true" entity-manager-factory="#{dbFactory}"/>
  |     <core:entity-converter entity-manager="${entityManager}"/>
  | 

2) Add a Hibernate JTA factory by replacing your persistence.xml file content located in c:\java\jboss-seam-1.2.1.GA\examples\glassfish\resources\META-INF with:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
  |              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |              xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
  |              	http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
  |              version="1.0">
  |    <persistence-unit name="bookingDatabase"  transaction-type="JTA">
  |       <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |       <jta-data-source>jdbc/__default</jta-data-source>
  |       <properties>        
  |          <property name="hibernate.dialect" 
  |               value="org.hibernate.dialect.DerbyDialect"/>
  |          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
  |          <property name="hibernate.show_sql" value="true"/>
  |          <property name="hibernate.transaction.flush_before_completion" value="true"/>
  |          <property name="hibernate.transaction.manager_lookup_class" 
  |          	value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
  |          <property name="hibernate.cache.provider_class" 
  |               	value="org.hibernate.cache.HashtableCacheProvider"/>              
  |       </properties>
  |    </persistence-unit>
  | </persistence>
  | 

3) Clean, rebuild and redeploy the example:

  | cd c:\java\jboss-seam-1.2.1.GA\examples\glassfish
  | c:\glassfish\bin\asant clean
  | c:\glassfish\bin\asant
  | c:\glassfish\bin\asadmin deploy build\jboss-seam-glassfish.ear
  | 
This should also allow the app to work.

4) However, try and redeploy again without making any changes:

  | cd c:\java\jboss-seam-1.2.1.GA\examples\glassfish
  | c:\glassfish\bin\asadmin deploy build\jboss-seam-glassfish.ear
  | 
You will find that the application will not start complaining of the errors I indicated in my previous posts. The only way I have found to get the example working again is to undeploy, restart glassfish and then deploy:


  | cd c:\java\jboss-seam-1.2.1.GA\examples\glassfish
  | c:\glassfish\bin\asadmin undeploy jboss-seam-glassfish
  | c:\glassfish\bin\asadmin stop-domain
  | c:\glassfish\bin\asadmin start-domain
  | c:\glassfish\bin\asadmin deploy build\jboss-seam-glassfish.ear
  | 

At the request of epbernard I tried using the latest version of HEM with the example but that didn't seem to make much difference. I hope all these instructions make sense to you!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055679#4055679

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055679



More information about the jboss-user mailing list