8 Replies Latest reply on Aug 30, 2012 9:31 AM by andypickler

    jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2

    andypickler

      Platform: Ubuntu 12.04 64-bit

      JDK: OpenJDK 7 (1.7.0_03)

      Eclipse: 4.2 (Juno)

      JBoss Tools: 3.? (Nightly build...updated every day as prompted)

      JBoss Server: 7.1.1 Final (full profile)

       

      I generated a basic Java EE multi-module Maven project using the jboss-javaee6-webapp-ear-archetype archetype.  If I build on the command line using "mvn clean package jboss-as:deploy", it deploys and works fine.  However, if I import the project into Eclipse and deploy to the same JBoss server (configured within Eclipse and deployed internally as "Run on server"), I get the following error:

       

      12:00:15,391 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-8) HHH000227: Running hbm2ddl schema export
      12:00:15,403 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-8) HHH000231: Schema export unsuccessful: org.hibernate.tool.hbm2ddl.ImportScriptException: Error during statement execution (file: '/import.sql'): insert into Registrant(id, name, email, phone_number) values (0, 'John Smith', 'john.smith@mailinator.com', '2125551212')
          at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:451) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:378) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:304) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:293) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:487) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]
          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
      Caused by: org.h2.jdbc.JdbcSQLException: Table "REGISTRANT" not found; SQL statement:
      insert into Registrant(id, name, email, phone_number) values (0, 'John Smith', 'john.smith@mailinator.com', '2125551212') [42102-161]
          at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
          at org.h2.message.DbException.get(DbException.java:169)
          at org.h2.message.DbException.get(DbException.java:146)
          at org.h2.command.Parser.readTableOrView(Parser.java:4749)
          at org.h2.command.Parser.readTableOrView(Parser.java:4727)
          at org.h2.command.Parser.parseInsert(Parser.java:949)
          at org.h2.command.Parser.parsePrepared(Parser.java:375)
          at org.h2.command.Parser.parse(Parser.java:279)
          at org.h2.command.Parser.parse(Parser.java:251)
          at org.h2.command.Parser.prepareCommand(Parser.java:217)
          at org.h2.engine.Session.prepareLocal(Session.java:415)
          at org.h2.engine.Session.prepareCommand(Session.java:364)
          at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1119)
          at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:121)
          at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:110)
          at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:371)
          at org.hibernate.tool.hbm2ddl.DatabaseExporter.export(DatabaseExporter.java:64) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:446) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
          ... 16 more
      
      12:00:15,417 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-8) HHH000230: Schema export complete
      
        • 1. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
          dgolovin

          Does it work for you if you create the same project out of JBoss Central using "JavaEE Project" archetype (org.jboss.spec.archetypes:jboss-javaee6-webapp-ear-archetype:7.1.1.Beta3) and then run it on JBoss AS 7.1.1.Final?

          Works for me for both in JBoss Tools 3.3.1 with Open JDK6 and in latest nightly JBoss Tools 3.4.0 with Open JDK 6/7 under Ubuntu 12.04 LTS 64-bit.

           

          What is the full as log?

          • 2. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
            andypickler

            Indeed, that seemed to work just fine.  I can now deploy to JBoss AS 7.1.1 in Eclipse and start/stop the app with the server.

             

            I don't have the "JBoss Central" tab available in Eclipse (maybe because I didn't install all of the JBoss Tools plugins in Eclipse), but under Help...Project Examples I was able to find this.  Originally I had used "mvn archteype:generate" in a shell to create the project.  I'm not exactly sure why that didn't work.  I guess it's also possible that the POM modifications I did subsequently (Maven best practices like specifying all the plugin versions, adding in the URL to our Artifactory instance, etc) might have caused my problems.  I'll slowly add back in the POM changes from my original project and see if any of that breaks the Eclipse-JBoss app deploy.  Our team has to have this working in order to be most productive possible (especially with whatever hot deploy we can get without using JRebel).

             

            Thanks for your help.

            • 3. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
              dgolovin

              Andy, what version of org.jboss.spec.archetypes:jboss-javaee6-webapp-ear-archetype was used?

               

              Here are the options archetype:generate gives me:

              # 7.0.2.CR2

              # 7.1.1.Beta1

              # 7.1.1.Beta2

              # 7.1.1.Beta3

              # 7.1.1.CR1

              • 4. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
                andypickler

                I believe at the time I generated this (about 3 weeks ago) I used the latest version (my normal practice), which I'm guessing would've been 7.1.1.CR1.

                 

                Interesting things I've found today...I re-installed Eclipse 4.2 from a fresh download (using the "Eclipse IDE for Java EE Developers" (linux 64-bit).  Then I installed the JBoss Tools plugins, and basically selected everything "Maven"-related as well as everything related to Seam (2), CDI, JSF, and JBoss AS.  Then I ran a "mvn eclipse:clean" on the project I was having problems, re-imported it into Eclipse...and now I can deploy to my local JBoss AS 7.1.1 server just fine with no problems on startup.

                 

                I'm guessing, then, that maybe one of the plugins I installed before might've been causing problems with the JBoss Tools plugins I had before.  I do believe I had the latest version of m2e (0.16) installed, so maybe that's a culprit with the JBoss Maven plugins?

                • 5. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
                  dgolovin

                  Andy Pickler wrote:

                   

                  I believe at the time I generated this (about 3 weeks ago) I used the latest version (my normal practice), which I'm guessing would've been 7.1.1.CR1.

                  I've tried 7.1.1.Beta3 and 7.1.1.CR1. I went trough archetype:generate, Import maven project into eclipse and finally "Run As ..." for ear project. Both work without a problem.

                  Andy Pickler wrote:

                   

                  I'm guessing, then, that maybe one of the plugins I installed before might've been causing problems with the JBoss Tools plugins I had before.  I do believe I had the latest version of m2e (0.16) installed, so maybe that's a culprit with the JBoss Maven plugins?

                  It could be an issue with JBoss Maven Integration plugins, but I doubt we are able to find out why that happend. If you have it again let us know.

                  • 6. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
                    andypickler

                    Will do.  Thanks for the help.

                    • 7. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
                      maxandersen

                      running mvn eclipse:clean basically means "delete all eclipse settings" and then on reimport m2e/m2e-wtp would regnerate these settings based on your pom.xml.

                       

                      My guess is you had some bad settings somewhere, maybe you ran mvn eclipse:eclipse which is just asking for troubles these days

                      • 8. Re: jboss-javaee6-webapp-ear-archetype: Doesn't deploy in Eclipse 4.2
                        andypickler

                        Yes, I wanted to "delete all Eclipse settings" and then re-import the projects.  I definitely did not run "mvn eclipse:eclipse", as I learned that lesson a while back.  Nowadays, I just right-click in Package Explorer and select Import->Maven->"Existing Maven Project" in order for it to find the parent/children POMs and import that way.