Openshift数据源无法正常工作

时间:2012-12-19 16:13:47

标签: hibernate spring-security jboss7.x openshift

我在openshif中有一个项目,我正在尝试使用mysql数据源配置模块。但它不起作用。

这是代码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>

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

这是代码

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>

applicationContext.xml

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

的配置
standalone.xml

我用ssh访问了我的项目。检查文件teste.war.failed。我想象这个文件:

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

我在路径{"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"}}}} 中配置了一个mysql模块:

jbossas-7/jbossas-7/modules/com/mysql/jdbc/main/

这是配置module.xml mysql-connector-java-5.1.18-bin.jar

module.xml

请帮忙!

1 个答案:

答案 0 :(得分:1)

建议不要更改文件设置standalone.xml。我遇到了问题,因为我正在改变它的内容。 我按照提示解决了这个问题:OpenShift ; - )