2011-01-18 9 views
0

休止状態で2つのデータソースを使用する際の問題?すべて 私は休止状態(二つの異なるsessionFactoriesと二つの異なるのTransactionManagers) を持つ2つの異なるデータソースを使用しようとしましたが、私はアプリケーションを持って挨拶

の起動に失敗しました。それが停止し

Creating new JDBC DriverManager Connection to [jdbc:mysql://some-ip-here/mydb] 

のステップで、ここです構成:

<?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:context="http://www.springframework.org/schema/context" 
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" 
    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-3.0.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 


    <context:component-scan base-package="com.myapp" /> 
    <context:annotation-config /> 
    <tx:annotation-driven transaction-manager="transactionManager" /> 


    <!-- ================PostgreSQL/Hibernate================ --> 

    <bean id="sessionFactory" 
     class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 

     <property name="dataSource" ref="dataSource" /> 
     <property name="annotatedClasses"> 
      <list> 
       <value>com.myapp.domain.myDomain1</value> 
      </list> 

     </property> 

     <property name="hibernateProperties"> 
      <value> 
       hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 
      </value> 
     </property> 


    </bean> 


    <bean id="dataSource" 
     class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 

     <property name="driverClassName" value="org.postgresql.Driver" /> 

     <property name="url"> 
     <value>${db.url}</value> 
     </property> 

     <property name="username" > 
     <value>${db.username}</value> 
     </property> 

     <property name="password"> 
     <value>${db.password}</value> 
     </property> 

    </bean> 

    <bean id="transactionManager" 
     class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
     <property name="sessionFactory" ref="sessionFactory" /> 
    </bean> 

    <!-- ================MySQL/Hibernate================ --> 

    <bean id="mysqlSessionFactory" 
     class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 

     <property name="dataSource" ref="mysqlDataSource" /> 
     <property name="annotatedClasses"> 
      <list> 
      <value>com.myapp.domain.myDomain2</value>  
      </list> 
     </property> 

     <property name="hibernateProperties"> 
      <value> 
       hibernate.dialect=org.hibernate.dialect.MySQLDialect 
      </value> 
     </property> 
    </bean> 


    <bean id="mysqlDataSource" 
     class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 

     <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 

     <property name="url"> 
     <value>${db.mysql.url}</value> 
     </property> 

     <property name="username" > 
     <value>${db.mysql.username}</value> 
     </property> 

     <property name="password"> 
     <value>${db.mysql.password}</value> 
     </property> 

    </bean> 

    <bean id="mysqltransactionManager" 
     class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
     <property name="sessionFactory" ref="mysqlSessionFactory" /> 
    </bean> 

     <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />  

     <!-- ================End of MySQL/Hibernate================ --> 


</beans> 
+0

[複数のデータソースの共通の解決策は何ですか?](http://stackoverflow.com/questions/4723045/what-is-the-common-solution-for-multiple-datasources) –

+0

設定の問題、別のトピック –

+0

設定に何か問題があるかどうか教えてください。 –

答えて

0

問題は、リモートサーバーのファイアウォールで修正されました。

関連する問題