Sant
Sant

Reputation: 386

The Openshift datasource is not working

I have a project in openshif and I'm trying to configure the module with mysql datasource. but it's not working.

this is the code hibernate.cfg:

<hibernate-configuration>
    <session-factory>
        <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
        <property name="connection.datasource">datasources/MysqlDS</property>
        <property name="current_session_context_class">thread</property>
        <property name="show_sql">false</property>
        <property name="hibernate.hbm2ddl.auto">update</property>
        <mapping class="com.wavetech_st.usuario.Usuario" />
    </session-factory>
</hibernate-configuration>

this is code applicationContext-security.xml:

 <authentication-manager>
    <authentication-provider>
        <password-encoder hash="sha" />
        <jdbc-user-service data-source-ref="homeDataSource"
                           authorities-by-username-query="SELECT u.emailUsuario, p.permissao FROM Usuario u, permissaoUsuario p WHERE u.codigoUsuario = p.usuario AND u.emailUsuario = ?"
                           users-by-username-query="SELECT emailUsuario, senhaUsuario, ativoUsuario FROM Usuario WHERE emailUsuario = ?"/>
    </authentication-provider>
 </authentication-manager>

and this is the code applicationContext.xml:

<bean id="homeDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>datasources/MysqlDS</value>
    </property>
</bean>

It's the configuration of standalone.xml:

<datasource jta="false" jndi-name="java:jboss/datasources/MysqlDS" enabled="true" use-java-context="true" pool-name="MysqlDS" use-ccm="false">
  <connection-url>jdbc:mysql://127.5.211.129:3306/testehome</connection-url>
  <driver>mysql</driver>
  <security>
    <user-name>user</user-name>
    <password>mypassword</password>
  </security>
  <validation>
    <validate-on-match>false</validate-on-match>
    <background-validation>false</background-validation>
  </validation>
  <statement>
    <share-prepared-statements>false</share-prepared-statements>
  </statement>
</datasource>
<driver name="mysql" module="com.mysql.jdbc">
  <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>

I accessed my project with ssh. check the file teste.war.failed. I visualized this file:

{"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default
-host./testehome" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./testehome: JBAS018040: Failed to start context"}}}}

I have a mysql module configured in the path jbossas-7/jbossas-7/modules/com/mysql/jdbc/main/:

module.xml  mysql-connector-java-5.1.18-bin.jar

this is the configuration module.xml:

<module xmlns="urn:jboss:module:1.0" name="com.mysql.jdbc">
    <resources>
        <resource-root path="mysql-connector-java-5.1.18-bin.jar"/>
    <!-- Insert resources here -->
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

Please, help!

Upvotes: 2

Views: 2687

Answers (1)

Sant
Sant

Reputation: 386

It is not recommended to change file settings standalone.xml. I was having problems because I was altering its contents. I solved the problem by following the hint: OpenShift ;-)

Upvotes: 1

Related Questions