7 Replies Latest reply on Apr 7, 2009 2:19 PM by Daniel Kluge

    Seam Gen 2.1.2

    Daniel Kluge Newbie

      Hi all,


      I've tried to generate a project with Seam Gen 2.1.2 Nightly Build. The generation of the application was not the problem, but it deploys it not correctly. The ear is in the jboss-5.0.1.GA/server/mydomain folder.
      As I started the server my application isn't accessible.
      Moreover there is no problem with Seam Gen 2.1.1.


      Is there a explanation of this problem? Maybe the support of both AS (JBoss and Glassfish)?


      Any help appreciated.


      Regards

        • 1. Re: Seam Gen 2.1.2
          d sailer Newbie

          jboss-5.0.1.GA/server/mydomain? Shouldn't it be jboss-5.0.1.GA/server/default/deploy/mydomain? If you use seam to deploy to jboss, or just the ant build.xml file seam gen created, it should deploy to the correct place. Watch the log file to see if the app deploys correctly.  You also should maybe try your first deployment with an example seam app.

          • 2. Re: Seam Gen 2.1.2
            Daniel Kluge Newbie

            Thx for your hints. Of course it should be jboss-5.0.1.GA/server/default/deploy/mydomain, but it deploys at jboss-5.0.1.GA/server/mydomain. SeamGen 2.1.1 deploys it at jboss-5.0.1.GA/server/default/deploy/mydomain, moreover SeamGen 2.1.2 deploys it at the wrong place (jboss-5.0.1.GA/server/mydomain).
            Thats the key. I checked every setting. The settings were both exactly the same.
            Thats why I am confused.


            Its a very simply helloworld project to check the right project generation of SeamGen.


            • 3. Re: Seam Gen 2.1.2
              Daniel Kluge Newbie

              The solution of this problem for JBoss:


              In the build.properties the jboss.domain must be set to default.

              • 4. Re: Seam Gen 2.1.2
                Dan Allen Master

                Yes, exactly. What was it set to before you changed it? I want to make sure the build is backwards compatible if it happens to be missing.

                • 5. Re: Seam Gen 2.1.2
                  Daniel Kluge Newbie

                  The seam setup of SeamGen2.1.2 asks you about the name of the domain.
                  I called it helloworlddomain.


                  This was a mistake, although I'm using JBoss 5.0.1.GA.
                  The jboss.domain in the build.properties was set to helloworlddomain, but default is the right setting.

                  • 6. Re: Seam Gen 2.1.2
                    Daniel Kluge Newbie

                    One question to execute a TestNG database test of the generated SeamGen project:


                    I've changed the persistence-test.xml to the following:



                    <?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="helloWorldTest">
                         <provider>org.hibernate.ejb.HibernatePersistence</provider>
                             <class>com.mydomain.helloworld.TestEntity</class>
                    <properties>
                    
                     <property name="hibernate.archive.autodetection" value="class, hbm" /> 
                      <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /> 
                      <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
                      <property name="hibernate.connection.url" value="jdbc:hsqldb:." />
                      <property name="hibernate.connection.username" value="sa" /> 
                      <property name="hibernate.connection.password" value="" /> 
                      <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 
                      <property name="hibernate.jdbc.batch_size" value="20" />
                      <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
                      <property name="jta.UserTransaction" value="UserTransaction"/> 
                    
                      </properties>
                      </persistence-unit>
                      
                    </persistence>



                    This test is very simple:


                    import javax.persistence.EntityManager;
                    import javax.persistence.EntityManagerFactory;
                    import javax.persistence.Persistence;
                    
                    import org.jboss.seam.mock.SeamTest;
                    import org.testng.annotations.Test;
                    
                    public class HelloWorldTest extends SeamTest {
                         
                         @Test
                         public void sayHello()
                         {
                              System.out.println("Hello");
                              assert true;
                         }
                    
                         @Test
                         public EntityManager createEntityManager() throws Exception
                         {
                              EntityManagerFactory emf = Persistence.createEntityManagerFactory("helloWorldTest");
                              EntityManager em = emf.createEntityManager();
                              assert em.isOpen();
                              return em;
                         }
                    }



                    In my opinion the configuration of the persistence-test.xml has the right settings to test the database.


                    But if I'm executing the test, I get the following exception:


                    [testng] persistence.units:jar=test-build.jar,unitName=helloWorldTest -> java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a jta-data-source for a JTA enabled persistence context named: helloWorldTest
                       [testng]      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
                       [testng]      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
                       [testng]      at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128)
                       [testng]      at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
                       [testng]      at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15)
                       [testng]      at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1024)
                       [testng]      at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:915)
                       [testng]      at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
                       [testng] ... Removed 15 stack frames




                    Do you have any idea whats going wrong?

                    • 7. Re: Seam Gen 2.1.2
                      Daniel Kluge Newbie

                      This settings solved this problem:



                      <?xml version="1.0" encoding="UTF-8"?>
                      <!-- Persistence deployment descriptor for tests -->
                      <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="helloWorldTest" transaction-type="RESOURCE_LOCAL">
                         
                            <provider>org.hibernate.ejb.HibernatePersistence</provider>
                            <non-jta-data-source>java:/DefaultDS</non-jta-data-source>
                            <properties>
                               <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                               <property name="hibernate.show_sql" value="true"/>
                               <property name="hibernate.cache.use_second_level_cache" value="false"/>
                               <property name="jboss.entity.manager.factory.jndi.name" value="java:/helloworldEntityManagerFactory"/>
                            </properties>
                         </persistence-unit>
                          
                      </persistence>