[jboss-user] [JBoss Seam] - Re: Trouble Using <s:convertEntity/> on Glassfish

soluble do-not-reply at jboss.com
Thu Jun 7 19:31:50 EDT 2007


epbernard, thank you for your advice. I had a go but it did not seem to fix my problem. The Glassfish log file just came up with another error again resulting in a Context startup failed due to previous errors.

However, I did manage to get <s:convertEntity/> working on the Glassfish example in jboss-seam-1.2.1.GA! In the process it did expose peculiar behaviour of Glassfish and/or Seam which I though might be beneficial to share.

Apart from adding an EVENT scoped stateless bean, persistence entity and facelet file to test the <s:convertEntity/> the only changes I made to the example configuration were as follows:

1) persistence.xml - I added a transaction type and transaction manager to the persistence unit:


  | ...
  |   <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.cache.provider_class" 
  |               value="org.hibernate.cache.HashtableCacheProvider"/>
  |               <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
  |       </properties>
  |    </persistence-unit>
  | ...   
  | 

2) components.xml - I added the config to create an entity manager factory, create an entity manager and then pass it to the entity converter. (Looking at the code, I probably do not need to pass the entity manager to the entity converter.)

  | ...
  |    <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}"/>
  | ...   
  |    


You may realise that this is almost the setup I had with the first post of this thread (apart from the transaction manager). The peculiar behaviour is that in order to add the changes I wanted to the components.xml file, I cannot simply rebuild the app with ant and do the following:

asadmin undeploy jboss-seam-glassfish
asadmin deploy jboss-seam-glassfish.ear

This always produces a Context startup failed due to previous errors with varying stack traces in the Glassfish server.log.

I must do the following to guarantee successful deployment:

asadmin undeploy jboss-seam-glassfish
asadmin stop-domain
<Manually delete \glassfish\domains\domain1\applications\j2ee-apps\jboss-seam-glassfish directory>
asadmin start-domain
asadmin deploy jboss-seam-glassfish.ear

Therefore I cannot hot deploy. To me it seems like a bug in Glassfish which Seam exposes that forces me to stop and start the domain in order to redeploy the application. Something is probably remaining within Glassfish after the undeploy command. Is anyone able to reproduce this problem? (Just get the glassfish example, add the transaction manager to the persistence.xml file and deploy to glassfish. Then add the changes to the components.xml file and redeploy without restarting. The example should fail to work.)

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

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



More information about the jboss-user mailing list