1 Reply Latest reply on Jun 14, 2012 7:44 AM by Eva K

    cannot deploy jpa with mysql connector

    Eva K Newbie

      I am trying to test a jpa project using the guidelines of Dan Allen, Bartosz Masjak and Alexis Hassler in this http://arquillian.org/guides/testing_java_persistence/

      which works fine for the h2 database but for my mysql database it throws a missing dependency (the mysql jar connector).

      The project is a maven project and have included the mysql-connector-java in the pom file.

      My code in test_persistence.xml is

       

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

      <persistence version="2.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_2_0.xsd">

          <persistence-unit name="primary">

            <!-- If you are running in a production environment, add a managed

               data source, the example data source is just for proofs of concept! -->

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

            <class>be.intoit.saas.EnterpriseRegistrationDemo.model.Member</class>

            <class>be.intoit.saas.EnterpriseRegistrationDemo.model.Company</class>

      ....

            <properties>

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

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

            </properties>

         </persistence-unit>

      </persistence>

       

      The code in jbossas-ds.xml

       

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

      <datasources xmlns="http://www.jboss.org/ironjacamar/schema"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="

              http://www.jboss.org/ironjacamar/schema

              http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

          <datasource enabled="true"

              jndi-name="java:jboss/datasources/EVisitor"

              pool-name="EVisitor">

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

              <driver>mysql-connector-java-5.1.19-bin.jar</driver>

              <security>

                              <user-name>root</user-name>

                              <password>admin</password>

                          </security>

          </datasource>

      </datasources>

       

      the code in the GamePersistenceTest.java

       

      package org.arquillian.example;

       

      import org.jboss.arquillian.container.test.api.Deployment;

      import org.jboss.arquillian.junit.Arquillian;

      import org.jboss.shrinkwrap.api.Archive;

      import org.jboss.shrinkwrap.api.ShrinkWrap;

      import org.jboss.shrinkwrap.api.asset.EmptyAsset;

      import org.jboss.shrinkwrap.api.spec.JavaArchive;

      import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;

      import org.jboss.shrinkwrap.api.spec.WebArchive;

      import org.junit.After;

      import org.junit.Assert;

      import org.junit.Before;

      import org.junit.Test;

      import org.junit.runner.RunWith;

        

      /**

      * @author <a href="http://community.jboss.org/people/dan.j.allen">Dan Allen</a>

      */

      @RunWith(Arquillian.class)

      public class GamePersistenceTest {

                @EJB

          private GameServiceLocal gameservice;

          @Deployment

          public static Archive<?> createDeployment() {

              JavaArchive jar = ShrinkWrap.create(JavaArchive.class)

                  .addPackage(Game.class.getPackage())

                  .addAsManifestResource("persistence.xml", "persistence.xml")

                  .addAsManifestResource("jbossas-ds.xml")

                  .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

                      return jar;

          }

      ..................................

       

      and the result is :

       

      -------------------------------------------------------

      T E S T S

      -------------------------------------------------------

      Forking command line: cmd.exe /X /C ""C:\Program Files (x86)\Java\jdk1.6.0_31\jre\bin\java" -jar C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\surefire\surefirebooter7575384950071485042.jar C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\surefire\surefire2237174227148892039tmp C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\surefire\surefire_06980914343627967506tmp"

      Running org.arquillian.example.CompanyServiceTest

      log4j:WARN No appenders could be found for logger (org.jboss.logging).

      log4j:WARN Please initialize the log4j system properly.

      log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

      Jun 14, 2012 12:14:02 PM org.jboss.as.arquillian.container.managed.ManagedDeployableContainer startInternal

      INFO: Starting container with: ["C:\Program Files (x86)\Java\jdk1.6.0_31\bin\java", -Xmx512m, -XX:MaxPermSize=128m, -Xverify:none, -XX:+UseFastAccessorMethods, -ea, -Djboss.home.dir=target\jboss-as-7.1.1.Final, -Dorg.jboss.boot.log.file=target\jboss-as-7.1.1.Final/standalone/log/boot.log, -Dlogging.configuration=file:target\jboss-as-7.1.1.Final/standalone/configuration/logging.properties, -Djboss.modules.dir=C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\modules, -Djboss.bundles.dir=C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\bundles, -jar, C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\jboss-modules.jar, -mp, target\jboss-as-7.1.1.Final\modules, -jaxpmodule, javax.xml.jaxp-provider, org.jboss.as.standalone, -server-config, standalone.xml]

      12:14:02,880 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

      12:14:03,010 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

      12:14:03,045 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

      12:14:03,662 INFO  [org.xnio] XNIO Version 3.0.3.GA

      12:14:03,665 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)

      12:14:03,669 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA

      12:14:03,674 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA

      12:14:03,692 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers

      12:14:03,695 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem

      12:14:03,716 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.

      12:14:03,725 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem

      12:14:03,734 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem

      12:14:03,737 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)

      12:14:03,741 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem

      12:14:03,745 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension

      12:14:03,775 INFO  [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.7.Final

      12:14:03,845 INFO  [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service

      12:14:03,858 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-6) JBAS015400: Bound mail session [java:jboss/mail/Default]

      12:14:04,014 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

      12:14:04,057 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-1) JBoss Web Services - Stack CXF Server 4.0.2.GA

      12:14:04,088 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-4) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080

      12:14:04,351 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) JBAS015012: Started FileSystemDeploymentService for directory C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\standalone\deployments

      12:14:04,352 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:4447

      12:14:04,352 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /127.0.0.1:9999

      12:14:04,367 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

      12:14:04,637 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990

      12:14:04,639 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 1960ms - Started 133 of 208 services (74 services are passive or on-demand)

      12:14:10,022 INFO  [org.jboss.as.repository] (management-handler-thread - 2) JBAS014900: Content added at location C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\standalone\data\content\c9\9d679b10d7e15776231e8741cca0fa4e53fa5c\content

      12:14:10,047 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "arquillian-service"

      12:14:10,378 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.as.jmx:main") which may be changed or removed in future versions without notice.

      12:14:10,380 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.as.server:main") which may be changed or removed in future versions without notice.

      12:14:10,383 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.as.osgi:main") which may be changed or removed in future versions without notice.

      12:14:10,385 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.jandex:main") which may be changed or removed in future versions without notice.

      12:14:10,386 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.osgi.framework:main") which may be changed or removed in future versions without notice.

      12:14:10,601 INFO  [org.jboss.as.server] (management-handler-thread - 2) JBAS018559: Deployed "arquillian-service"

      12:14:10,946 INFO  [org.jboss.as.repository] (management-handler-thread - 3) JBAS014900: Content added at location C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\standalone\data\content\d9\8c0fa08cf00189108d50cf95ad837af3a0ecff\content

      12:14:10,957 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "ff997489-4343-42b2-af5b-7b969053c865.jar"

      12:14:11,009 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for primary

      12:14:11,043 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment ff997489-4343-42b2-af5b-7b969053c865.jar

      12:14:11,049 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CompanyService in deployment unit deployment "ff997489-4343-42b2-af5b-7b969053c865.jar" are as follows:

       

       

                java:global/ff997489-4343-42b2-af5b-7b969053c865/CompanyService!org.arquillian.example.CompanyServiceLocalBusiness

                java:app/ff997489-4343-42b2-af5b-7b969053c865/CompanyService!org.arquillian.example.CompanyServiceLocalBusiness

                java:module/CompanyService!org.arquillian.example.CompanyServiceLocalBusiness

                java:global/ff997489-4343-42b2-af5b-7b969053c865/CompanyService

                java:app/ff997489-4343-42b2-af5b-7b969053c865/CompanyService

                java:module/CompanyService

       

       

      12:14:11,055 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CompanyFacade in deployment unit deployment "ff997489-4343-42b2-af5b-7b969053c865.jar" are as follows:

       

       

                java:global/ff997489-4343-42b2-af5b-7b969053c865/CompanyFacade!org.arquillian.example.CompanyFacade

                java:app/ff997489-4343-42b2-af5b-7b969053c865/CompanyFacade!org.arquillian.example.CompanyFacade

                java:module/CompanyFacade!org.arquillian.example.CompanyFacade

                java:global/ff997489-4343-42b2-af5b-7b969053c865/CompanyFacade

                java:app/ff997489-4343-42b2-af5b-7b969053c865/CompanyFacade

                java:module/CompanyFacade

       

       

      12:14:11,130 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016005: Starting Services for CDI deployment: ff997489-4343-42b2-af5b-7b969053c865.jar

      12:14:11,165 INFO  [org.jboss.weld.Version] (MSC service thread 1-2) WELD-000900 1.1.5 (AS71)

      12:14:11,179 INFO  [org.jboss.as.arquillian] (MSC service thread 1-1) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."ff997489-4343-42b2-af5b-7b969053c865.jar",unit=ff997489-4343-42b2-af5b-7b969053c865.jar,tests=[org.arquillian.example.CompanyServiceTest]]

      12:14:11,392 INFO  [org.jboss.as.server] (management-handler-thread - 3) JBAS015870: Deploy of deployment "ff997489-4343-42b2-af5b-7b969053c865.jar" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/EVisitorjboss.jdbc-driver.mysql-connector-java-5_1_19-bin_jarMissing[jboss.data-source.jboss/datasources/EVisitorjboss.jdbc-driver.mysql-connector-java-5_1_19-bin_jar]"]}

      12:14:11,422 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010409: Unbound data source [jboss/datasources/EVisitor]

      12:14:11,430 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment ff997489-4343-42b2-af5b-7b969053c865.jar in 36ms

      12:14:11,432 INFO  [org.jboss.as.controller] (management-handler-thread - 3) JBAS014774: Service status report

      JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.jdbc-driver.mysql-connector-java-5_1_19-bin_jar (missing) dependents: [service jboss.data-source.jboss/datasources/EVisitor]

       

       

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.416 sec <<< FAILURE!

      12:14:11,469 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment arquillian-service in 4ms

      12:14:11,579 INFO  [org.jboss.as.repository] (management-handler-thread - 1) JBAS014901: Content removed from location C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\jboss-as-7.1.1.Final\standalone\data\content\c9\9d679b10d7e15776231e8741cca0fa4e53fa5c\content

      12:14:11,584 INFO  [org.jboss.as.server] (management-handler-thread - 1) JBAS018558: Undeployed "arquillian-service"

      12:14:11,586 INFO  [org.jboss.as.controller] (management-handler-thread - 1) JBAS014774: Service status report

      JBAS014776:    Newly corrected services:

            service jboss.jdbc-driver.mysql-connector-java-5_1_19-bin_jar (new available)

       

       

       

       

      Results :

       

       

      Tests in error:

        org.arquillian.example.CompanyServiceTest: Could not deploy to container: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/EVisitorjboss.jdbc-driver.mysql-connector-java-5_1_19-bin_jarMissing[jboss.data-source.jboss/datasources/EVisitorjboss.jdbc-driver.mysql-connector-java-5_1_19-bin_jar]"]}

       

       

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

       

       

      [INFO] ------------------------------------------------------------------------

      [INFO] BUILD FAILURE

      [INFO] ------------------------------------------------------------------------

      [INFO] Total time: 13.797s

      [INFO] Finished at: Thu Jun 14 12:14:11 CEST 2012

      [INFO] Final Memory: 13M/32M

      [INFO] ------------------------------------------------------------------------

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project arquillian.persistence.mysql: There are test failures.

      [ERROR]

      [ERROR] Please refer to C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\surefire-reports for the individual test results.

      [ERROR] -> [Help 1]

      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project arquillian.persistence.mysql: There are test failures.

       

       

      Please refer to C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\surefire-reports for the individual test results.

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

                at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)

                at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)

                at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)

                at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)

                at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)

                at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

                at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)

                at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)

                at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)

                at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)

                at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)

                at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

      Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

       

       

      Please refer to C:\svnprojects\CloudProject\svn\arquillian.persistence.mysql\target\surefire-reports for the individual test results.

                at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:83)

                at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:673)

                at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:647)

                at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:137)

                at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:98)

                at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

                ... 19 more

      [ERROR]

      [ERROR]

      [ERROR] For more information about the errors and possible solutions, please read the following articles:

      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException