我有一个场景,我需要为不同的客户端使用不同的名称(如TestA,TestB等)部署相同的战争。每个war文件都连接到不同的数据库。所以我用不同的名称复制相同的战争,具有相应的数据库连接属性。
TestA的连接属性
hibernate.connection.driver_class = com.mysql.jdbc.Driver
hibernate.connection.url = jdbc:mysql://localhost:3306/TESTADB
hibernate.connection.username = testa
hibernate.connection.password = testa
hibernate.dialect = org.hibernate.dialect.MySQLDialect
TestB的连接属性
hibernate.connection.driver_class = com.mysql.jdbc.Driver
hibernate.connection.url = jdbc:mysql://localhost:3306/TESTBDB
hibernate.connection.username = testb
hibernate.connection.password = testb
hibernate.dialect = org.hibernate.dialect.MySQLDialect
但只有TestA正在运行,其他战争没有运行。
我已经在JBOSS的F:/jboss-5.0.0./server/default
文件夹中部署了所有战争。
我使用
浏览应用程序http://localhost:8080/TestA
http://localhost:8080/TestB
答案 0 :(得分:0)
在每次战争中,尝试配置jboss-web.xml
<jboss-web>
<context-root>/TestA</context-root>
</jboss-web>
和
<jboss-web>
<context-root>/TestB</context-root>
</jboss-web>
这应该有效....