4 Replies Latest reply on Jan 13, 2015 4:21 AM by samwun9988

    Deployment failed with jboss.jdbc-driver.com_mysql

    samwun9988

      Hi, I created a ear / ejb project for jboss 7.2.final. The ejb need to connect to mysql.

      However it failed during deployment, with the following errors:

       

      00:40:26,376 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "ForestSurf-ear-1.0.ear" was rolled back with the following failure message:

      {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {

          "Services that were unable to start:" => [

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.ArticlePointFormFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.AustGeo2Facade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.AustGeoFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.CascadeProductImagesFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.CategoryImagesFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.CategorySubcategoriesFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.CustAddressFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.ProductArticleFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.ProductCategoryAssociateFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.ProductFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.ProductImagesFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.UserFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".component.UserInterestedProductFacade.START",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".deploymentCompleteService",

              "jboss.deployment.subunit.\"ForestSurf-ear-1.0.ear\".\"ForestSurf-ejb-1.0.jar\".jndiDependencyService",

              "jboss.deployment.unit.\"ForestSurf-ear-1.0.ear\".deploymentCompleteService",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".ArticlePointFormFacade.env.\"ForestSurf.entity.facade.ArticlePointFormFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".AustGeo2Facade.env.\"ForestSurf.entity.facade.AustGeo2Facade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".AustGeoFacade.env.\"ForestSurf.entity.facade.AustGeoFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".CascadeProductImagesFacade.env.\"ForestSurf.entity.facade.CascadeProductImagesFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".CascadeProductImagesFacade.env.\"ForestSurf.entity.facade.CascadeProductImagesFacade\".emf",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".CategoryImagesFacade.env.\"ForestSurf.entity.facade.CategoryImagesFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".CategorySubcategoriesFacade.env.\"ForestSurf.entity.facade.CategorySubcategoriesFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".CustAddressFacade.env.\"ForestSurf.entity.facade.CustAddressFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".ProductArticleFacade.env.\"ForestSurf.entity.facade.ProductArticleFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".ProductArticleFacade.env.\"ForestSurf.entity.facade.ProductArticleFacade\".emf",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".ProductCategoryAssociateFacade.env.\"ForestSurf.entity.facade.ProductCategoryAssociateFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".ProductFacade.env.\"ForestSurf.entity.facade.ProductFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".ProductImagesFacade.env.\"ForestSurf.entity.facade.ProductImagesFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".UserFacade.env.\"ForestSurf.entity.facade.UserFacade\".em",

              "jboss.naming.context.java.comp.\"ForestSurf-ear-1.0\".\"ForestSurf-ejb-1.0\".UserInterestedProductFacade.env.\"ForestSurf.entity.facade.UserInterestedProductFacade\".em",

              "jboss.persistenceunit.\"ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU\""

          ],

          "Services that may be the cause:" => ["jboss.jdbc-driver.com_mysql"]

      }}


      I followed the instruction as described in the following webpage:

      Developer Guide - JBoss AS 7.2 - Project Documentation Editor



      Here is the mysql folders/files structure in jboss:


      $ pwd

      /usr/local/users/jbossserv/jboss72Final/modules/com/mysql/main

      $ ls -l

      total 1652

      -rw-r--r--  1 jbossserv  jbossserv     265 Jan 13 00:18 module.xml

      -rw-r--r--  1 jbossserv  jbossserv  817285 Jan 13 00:18 mysql-connector-java-5.1.15.jar

      -rw-r--r--  1 jbossserv  jbossserv  827942 Jan 13 00:18 mysql-connector-java-5.1.21-bin.jar

      -rw-r--r--  1 jbossserv  jbossserv     461 Jan 13 00:18 mysql-connector-java-5.1.21-bin.jar.index


      $ cat module.xml

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

       

      <module xmlns="urn:jboss:module:1.1" name="com.mysql">

        <resources>

          <resource-root path="mysql-connector-java-5.1.21-bin.jar"/>

        </resources>

        <dependencies>

          <module name="javax.api"/>

        </dependencies>

      </module>

       

      The above files are just simply copied from my preiovus jboss7.1.1final folders.

       

      s
        • 1. Re: Deployment failed with jboss.jdbc-driver.com_mysql
          valsaraj007

          Did you try to install the JDBC driver as a deployment?

          Ref: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.2/html-single/Migration_Guide/inde…

           

          Please post data source configuration and detailed log.

          • 2. Re: Deployment failed with jboss.jdbc-driver.com_mysql
            samwun9988

            Here is the confinguration in standard-full.xml file:

             

            <datasources>

                            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">

                                <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>

                                <driver>h2</driver>

                                <security>

                                    <user-name>sa</user-name>

                                    <password>pass</password>

                                </security>

                            </datasource>

                            <datasource jndi-name="java:jboss/datasources/Houseware" pool-name="Houseware" enabled="true" use-java-context="true">

                                <connection-url>jdbc:mysql://localhost:3306/houseware</connection-url>

                                <driver>com.mysql</driver>

                                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                <pool>

                                    <min-pool-size>10</min-pool-size>

                                    <max-pool-size>100</max-pool-size>

                                    <prefill>true</prefill>

                                </pool>

                                <security>

                                    <user-name>myid</user-name>

                                    <password>pass</password>

                                </security>

                            </datasource>

                            <datasource jndi-name="java:jboss/datasources/ForestSurf" pool-name="ForestSurf" enabled="true" use-java-context="true">

                                <connection-url>jdbc:mysql://localhost:3306/forestsurf</connection-url>

                                <driver>com.mysql</driver>

                                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                <pool>

                                    <min-pool-size>10</min-pool-size>

                                    <max-pool-size>100</max-pool-size>

                                    <prefill>true</prefill>

                                </pool>

                                <security>

                                    <user-name>myid1</user-name>

                                    <password>pass</password>

                                </security>

                            </datasource>

                            <datasource jndi-name="java:jboss/datasources/Morfeusflex" pool-name="Morfeusflex" enabled="true" use-java-context="true">

                                <connection-url>jdbc:mysql://localhost:3306/morfeusflex</connection-url>

                                <driver>com.mysql</driver>

                                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                <pool>

                                    <min-pool-size>10</min-pool-size>

                                    <max-pool-size>100</max-pool-size>

                                    <prefill>true</prefill>

                                </pool>

                                <security>

                                    <user-name>myid2</user-name>

                                    <password>pass</password>

                                </security>

                            </datasource>

                            <datasource jndi-name="java:jboss/datasources/HibernateSearchTest" pool-name="HibernateSearchTest" enabled="true" use-java-context="true">

                                <connection-url>jdbc:mysql://localhost:3306/hibernatedb</connection-url>

                                <driver>com.mysql</driver>

                                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                <pool>

                                    <min-pool-size>10</min-pool-size>

                                    <max-pool-size>100</max-pool-size>

                                    <prefill>true</prefill>

                                </pool>

                                <security>

                                    <user-name>myid3</user-name>

                                    <password>pass</password>

                                </security>

                            </datasource>

                            <drivers>

                                <driver name="h2" module="com.h2database.h2">

                                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                                </driver>

                            </drivers>

                        </datasources>

            • 3. Re: Deployment failed with jboss.jdbc-driver.com_mysql
              valsaraj007

                 <drivers>

                 <driver name="mysql" module="com.mysql"/>

              </drivers>

               

              <datasource jndi-name="java:jboss/datasources/HibernateSearchTest" pool-name="HibernateSearchTest" enabled="true" use-java-context="true">

                                  <connection-url>jdbc:mysql://localhost:3306/hibernatedb</connection-url>

                                 <driver>mysql</driver>

                                  <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                  <pool>

                                      <min-pool-size>10</min-pool-size>

                                      <max-pool-size>100</max-pool-size>

                                      <prefill>true</prefill>

                                  </pool>

                                  <security>

                                      <user-name>myid3</user-name>

                                      <password>pass</password>

                                  </security>

                              </datasource>

               

              Ref: http://www.mastertheboss.com/jboss-server/jboss-datasource/how-to-configure-a-datasource-with-jboss-7

               

              Can you add this driver module to drivers list and refer from the datasource by driver name? I have configured in similar manner and it's working fine.

              • 4. Re: Deployment failed with jboss.jdbc-driver.com_mysql
                samwun9988

                OK, it passed that error, and come to application error:

                 

                20:14:58,618 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 60) MSC00001: Failed to start service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."ForestSurf-ear-1.0.ear/ForestSurf-ejb-1.0.jar#ForestSurfPU": javax.persistence.PersistenceException: [PersistenceUnit: ForestSurfPU] Unable to build EntityManagerFactory

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

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]

                        at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

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

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

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

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

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

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

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

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

                        ... 4 more

                Caused by: org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory]

                        at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:491)

                        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:289)

                        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2275)

                        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2271)

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

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

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

                        ... 9 more

                Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory]

                        at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)

                        at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:474)

                        ... 15 more

                Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory

                        at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)

                        at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [rt.jar:1.6.0_07]

                        at java.lang.ClassLoader.loadClass(ClassLoader.java:251) [rt.jar:1.6.0_07]

                        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [rt.jar:1.6.0_07]

                        at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_07]

                        at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_07]

                        at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)

                        ... 16 more

                 

                 

                Here is my persistence.xml file:

                 

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

                <persistence version="1.0" 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">

                  <persistence-unit name="ForestSurfPU" transaction-type="JTA">

                    <provider>org.hibernate.ejb.HibernatePersistence</provider>

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

                    <class>ForestSurf.entity.Product</class>

                    <class>ForestSurf.entity.ProductCategoryAssociate</class>

                    <class>ForestSurf.entity.ProductArticle</class>

                    <class>ForestSurf.entity.ProductImages</class>

                    <class>ForestSurf.entity.AustGeo2</class>

                    <class>ForestSurf.entity.UserInterestedProducts</class>

                    <exclude-unlisted-classes>false</exclude-unlisted-classes>

                    <properties>

                      <property name="hibernate.hbm2ddl.auto" value="update"/>

                      <!--<property name="hibernate.show_sql" value="true"/>-->

                      <property name="hibernate.format_sql" value="true"/>

                      <property name="hibernate.max_fetch_depth" value="4"/>

                      <property name="hibernate.default_batch_fetch_size" value="365"/>

                      <property name="hibernate.search.default.directory_provider" value="filesystem"/>

                      <property name="hibernate.search.default.indexBase" value="./lucene/indexes"/>

                      <property name="hibernate.search.default.batch.merge_factor" value="10"/>

                      <property name="hibernate.search.default.batch.max_buffered_docs" value="10"/>

                      <property name="hibernate.search.lucene_version" value="LUCENE_36"/>

                      <!-- cache entities -->

                        <property name="hibernate.cache.use_second_level_cache" value="true"/>

                        <property name="hibernate.cache.use_query_cache" value="true"/>

                        <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/>

                        <property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/>

                        <property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/>

                        <property name="hibernate.cache.region.jbc2.cfg.query" value="local-query"/>

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

                        <!-- End of cache entities -->

                      <!--<mapping class="com.srccodes.example.hibernate.Contact"/>-->                      

                    </properties>

                  </persistence-unit>

                </persistence>