CRUD Generator - Deployment Problem
phicorp Feb 12, 2006 8:02 AMHello All,
I have installed Seam beta 2 and the booking example is working as expected.
However when I use the CRUD generator in Eclipse JBoss IDE 1.5 I am unable to deploy the generated application.
To generate the application I create a new Java 5.0 project, a Hibernate configuration file, and a Hibernate console configuration, and then run the code generator to generate a Seam skeleton app via reverse engineering using a JDBC connection.
The generator runs without any errors or warning messages, and when I look at the generated JSPs and Java code, the JSPs look fine and all the generated Java classes look fine.
I then carry out the instructions in the generated readme.txt and run the build.xml file which compiles all of the source code successfully and reports that the build finished successfully.
I now start jboss-4.0.4RC1 but JBoss cannot deploy the application successfully. The error messages that I get from JBoss are as follows:
FATAL [org.hibernate.ejb.packaging.PersistenceXmlLoader] bookingDatabase JTA // The Seam booking example now not working
FATAL [org.hibernate.ejb.packaging.PersistenceXmlLoader] entityManager JTA // The CRUD application
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seamapp]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
java.lang.IllegalArgumentException: java.beans.IntrospectionException: Method not found: isJndiName
ERROR [org.jboss.deployment.MainDeployer] Could not start deployment: file:/C:/jboss-4.0.4RC1/server/default/tmp/deploy/tmp5889seamapp.ear-contents/seamapp.war
org.jboss.deployment.DeploymentException: URL file:/C:/jboss-4.0.4RC1/server/default/tmp/deploy/tmp5889seamapp.ear-contents/seamapp-exp.war/ deployment failed
I also note that there is no correlation between the Hibernate configuration file that I specified in the project and the persistence.xml file that was generated by the Hibernate generator.
The Hibernate configuration file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name="hibernate.connection.password">phicorp_booking_dev_user</property> <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/phicorp_booking_development</property> <property name="hibernate.connection.username">phicorp_booking_dev_user</property> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> </session-factory> </hibernate-configuration>
The generated persistence.xml file:
<entity-manager> <persistence-unit name="entityManager"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/DefaultDS</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> <property name="hibernate.transaction.flush_before_completion" value="true"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManager"/> </properties> </persistence-unit> </entity-manager>
I have tried to correct the problem by changing the generated persistence.xml file and by creating a phicorp-booking-ds.xml file in the JBoss server/default/deploy directory, but I still get the error message which states that JBoss cannot deploy the war file.
The changed persistence.xml file:
<entity-manager> <persistence-unit name="entityManager"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/phicorpBookingDataSource</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> <property name="hibernate.transaction.flush_before_completion" value="true"/> <!-- property name="hibernate.hbm2ddl.auto" value="create-drop"/ --> <!-- property name="hibernate.show_sql" value="true"/ --> <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManager"/> </properties> </persistence-unit> </entity-manager>
phicorp-booking-ds.xml:
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>phicorpBookingDataSource</jndi-name> <connection-url>jdbc:postgresql://localhost:5432/phicorp_booking_development</connection-url> <driver-class>org.postgresql.Driver</driver-class> <user-name>phicorp_booking_dev_user</user-name> <password>phicorp_booking_dev_user</password> </local-tx-datasource> </datasources>
Any help on resolving the problems that I have encountered will be much appreciated.
I do not understand:
(1) Why there is no correlation between the Hibernate configuration file and the generated persistence.xml file?
(2) Why JBoss cannot deploy the war file successfully?
Many thanks,
Bruce.