5 Replies Latest reply on Sep 15, 2015 5:36 AM by citb

    My issue with EAP 6.4 - possible java_home or version issue

    citb

      Hej,

      I have a problem when deploying (running) a very simple hello world program connected to an empty but created EJB project.

      This is what I get:

       

      The server log says this:

      The server "JBoss EAP 6.1+" requires a JDK to run properly. The VM used to launch this server is not recognized as a valid JDK. C:\Program Files\Java\jre1.8.0_60

       

      Java_home is C:\Program Files\Java\jdk1.8.0_60  - so why does it use the JRE ???  - I have double checked java_home and PATH.  I cannot change this attribute via the console either.

       

      What to do ? Any help is welcome

       

      The error log  / console says this:

       

      20:51:06,240 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 53) MSC000001: Failed to start service jboss.persistenceunit."HandlingsPlan.ear/HandlingsPlanEJB.jar#HandlingsPlanEJB": org.jboss.msc.service.StartException in service jboss.persistenceunit."HandlingsPlan.ear/HandlingsPlanEJB.jar#HandlingsPlanEJB": javax.persistence.PersistenceException: [PersistenceUnit: HandlingsPlanEJB] Unable to build EntityManagerFactory

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_60]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_60]

        at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_60]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: HandlingsPlanEJB] Unable to build EntityManagerFactory

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:925)

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900)

        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]

        ... 4 more

      Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set

        at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:98)

        at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:68)

        at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:174)

        at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:85)

        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:184)

        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:156)

        at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1827)

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1785)

        at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)

        ... 9 more

       

      I

        • 1. Re: My issue with EAP 6.4 - possible java_home or version issue
          jaysensharma

          "JBoss EAP 6.1+" requires a JDK to run properly. The VM used to launch this server is not recognized as a valid JDK. C:\Program Files\Java\jre1.8.0_60

           

          The above error which you are getting is very normal and expected, Because the "JDK 1.8 ** support only with JBoss EAP 6.3.3 update" and above, Where as you are trying to start EAP 6.1 with JDK 1.8.  See [1] for more details: https://access.redhat.com/articles/111663

          • 2. Re: My issue with EAP 6.4 - possible java_home or version issue
            jaysensharma

            What error do you get when you try starting your JBoss EAP 6.1 with JDK 1.7 ?    

             

             

            The hibernate error which you are getting [Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set]  Can you please share your persistence.xml file sothat we can see if that is correct.

            • 3. Re: My issue with EAP 6.4 - possible java_home or version issue
              citb

              Hello Jay Kumar.

              Thanks for your response. I did solve the persistenceunit issue by declaring the "jta-data-source" in the persistence.xml. See below.

               

              And thank you also for the JDK issue. I am actuall uysing EAP 6.4, so why it writes 6.1+ must be because that was the highest number available in choosing server runtime environment in Eclipse when choosing targeted runtime. Should I have chosen differently here?  Maybe not choose any target runtime and then point to the actual server somehow?

              Thanks for your time.

               

              <?xml version="1.0" encoding="UTF-8"?>

              <persistence version="2.1"

                xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

                <persistence-unit name="HandlingsPlanEJB">

                <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>

                <properties>

                <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />

                <!-- Properties for Hibernate -->

                <property name="hibernate.hbm2ddl.auto" value="create-drop" />

                <property name="hibernate.show_sql" value="false" />

                </properties>

                </persistence-unit>

              </persistence>

              • 4. Re: My issue with EAP 6.4 - possible java_home or version issue
                jaysensharma

                Hi,

                 

                    As your JPA error indicates that  [ Connection cannot be null when 'hibernate.dialect' not set ]  So can you try adding the Hibernate dialect in your persistence.xml file as following to see if it works:

                <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />


                 

                <?xml version="1.0" encoding="UTF-8"?>
                <persistence version="2.1"
                  xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
                  <persistence-unit name="HandlingsPlanEJB">
                  <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
                  <properties>
                      <!-- Properties for Hibernate -->
                      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />   <!-- Dialect -->
                      <property name="hibernate.hbm2ddl.auto" value="create-drop" />
                      <property name="hibernate.show_sql" value="false" />
                  </properties>
                  </persistence-unit>
                </persistence>
                

                 

                Reference: Basic JPA2.0 Demo with Hibernate as persistence provider on JBoss AS7 « JBoss

                • 5. Re: My issue with EAP 6.4 - possible java_home or version issue
                  citb

                  Hi Jay Kumar

                   

                  Thank you for your response. I have made it work as stated, but I will look into your suggestion.

                   

                  Thank you so much for your time - I really appreciate it.

                   

                  Sincerely

                  Bjarne