2 Replies Latest reply on Feb 5, 2013 5:43 AM by Luciane Araujo

    Spring 3 + JBoss AS7 + Hibernate 4 + MySQL on openshift

    Luciane Araujo Newbie

      Hi,

       

      I have and application with the components mentioned in the title. Everything seems to be working fine, until I try to persist something to the bank. Nothing happens. No exceptions or warnings and no entities being added to the database. I need at least to know where to look to find what is the problem. HELP!!!!

       

      My configurations files:

       

      persistance.xml

       

       

      <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="ekobinPersistenceUnit">

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

               data source, this example data source is just for development and testing! -->

            <!-- The datasource is deployed as WEB-INF/spring-quickstart-ds.xml, you

               can find it in the source at src/main/webapp/WEB-INF/spring-quickstart-ds.xml -->

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

            <properties>

               <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/ekobin/persistence" />

               <!-- Properties for Hibernate -->

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

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

            </properties>

         </persistence-unit>

      </persistence>

       

       

      infraestructure.xml

       

       

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

       

      <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"

          xsi:schemaLocation="http://www.springframework.org/schema/beans

                 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

                 http://www.springframework.org/schema/tx

                 http://www.springframework.org/schema/tx/spring-tx.xsd

                 http://www.springframework.org/schema/jee

                 http://www.springframework.org/schema/jee/spring-jee.xsd">

       

          <!-- JDNI name for EntityManagerFactory is defined in src/main/resources/META-INF/persistence.xml -->

          <jee:jndi-lookup jndi-name="java:jboss/ekobin/persistence" id="entityManagerFactory"

              expected-type="javax.persistence.EntityManagerFactory" />

      <!--

          <jee:jndi-lookup jndi-name="java:jboss/datasources/MysqlDS" id="dataSource"

              expected-type="javax.sql.DataSource" />

      -->

       

          <bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">

              <property name="entityManagerFactory" ref="entityManagerFactory" />

          </bean>

       

          <tx:jta-transaction-manager />

       

          <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">

              <property name="basenames">

                  <list>

                      <value>classpath:messages/pageText</value>

                      <value>classpath:messages/general</value>

                  </list>

              </property>

              <property name="defaultEncoding" value="UTF-8"></property>

              <property name="fallbackToSystemLocale" value="false" />

              <property name="cacheSeconds" value="3" />

              <property name="fileEncodings" value="UTF-8" />

          </bean>

       

          <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">

              <property name="defaultLocale" value="pt_BR"></property>

          </bean>

       

      </beans>

       

       

      applicationContext.xml:

       

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

       

      <beans xmlns="http://www.springframework.org/schema/beans"

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

          xmlns:aop="http://www.springframework.org/schema/aop"

          xmlns:context="http://www.springframework.org/schema/context"

          xmlns:jee="http://www.springframework.org/schema/jee"

          xmlns:p="http://www.springframework.org/schema/p"

          xmlns:security="http://www.springframework.org/schema/security"

          xmlns:tx="http://www.springframework.org/schema/tx"

          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

              http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd

              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

              http://www.springframework.org/schema/security

                 http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">   

       

          <context:component-scan base-package="br.com.ekoimpacto.ekobin.user" />

          <context:component-scan base-package="br.com.ekoimpacto.ekobin.device" />

          <context:component-scan base-package="br.com.ekoimpacto.ekobin.material" />

          <context:component-scan base-package="br.com.ekoimpacto.ekobin.general" />

       

          <tx:annotation-driven />

       

      </beans>

       

       

      standalone.xml datasource:

       

      <datasource jndi-name="java:jboss/datasources/MysqlDS" pool-name="MySqlDS">

                          <connection-url>jdbc:mysql://localhost:3306/ekobin</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>root</user-name>

                          </security>

                          <statement>

                              <prepared-statement-cache-size>32</prepared-statement-cache-size>

                              <share-prepared-statements>true</share-prepared-statements>

                          </statement>

                      </datasource>