2 Replies Latest reply on Sep 5, 2011 12:57 PM by Stijn Cremers

    Cannot connect to mysql with jpa

    Stijn Cremers Novice

      I have an application which uses mysql as database. The problem is that the deployment of the war fails in AS 7.

       

      This is the error that i get:

       

      {code}

      12:30:50,285 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "mythings-openshift-3.0.0-SNAPSHOT.war" was rolled back with failure message Operation handler failed to complete

      12:30:50,316 INFO  [org.jboss.weld] (MSC service thread 1-7) Stopping weld service

      12:30:50,432 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) Stopped deployment mythings-openshift-3.0.0-SNAPSHOT.war in 147ms

      12:30:50,434 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "Operation handler failed to complete"}}

      {code}

       

      I've tried to deploy the mysql driver with a module and as a standalone jar.

       

      When i startup as 7, the jar gets deployed.

       

      This is my persistence.xml

       

       

      {code:xml}

      <?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">

       

       

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

            <!--

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

               -->

            <properties>

               <!-- Properties for Hibernate -->

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

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

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

       

            </properties>

         </persistence-unit>

       

      </persistence>

      {code}

       

       

      And my datasource definition is standalone.sh

       

      {code:xml}

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

                          <connection-url>

                              jdbc:mysql://localhost:3306/mythings

                          </connection-url>

                          <driver>

                              mysql-connector-java-5.1.5.jar

                          </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>

                              <use-strict-min>

                                  false

                              </use-strict-min>

                              <flush-strategy>

                                  FailingConnectionOnly

                              </flush-strategy>

                          </pool>

                          <security>

                              <user-name>

                                  *

                              </user-name>

                              <password>

                                  *

                              </password>

                          </security>

                          <statement>

                              <prepared-statement-cache-size>

                                  32

                              </prepared-statement-cache-size>

                          </statement>

                      </datasource>

      {code}

       

      What is wrong???

       

      Thanks!