【发布时间】:2016-12-30 20:52:13
【问题描述】:
我在 Tomcat 上有一个应用程序。它使用 mysql 进行持久化。我在context.xml中定义mysql连接相关数据如下:
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<Resource
auth="Container"
description="User database that can be updated and saved"
name="jdbc/VTREProto"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
removeAbandoned="true"
username="vtreapp"
password="vtre!@#$%"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/developermodule"
/>
</Context>
我在我的 java 代码中访问它:
InitialContext initCTX = new InitialContext();
// Lookup the DataSource, which will be backed by a pool
// that the application server provides.
pool = (DataSource)initCTX.lookup("java:comp/env/jdbc/VTREProto");
我想迁移到 JBoss EAP 7.0.0。我如何以及在哪里指定 JBoss EAP 7.0.0 中的上述资源而不破坏我的 java 代码。
感谢和问候
【问题讨论】: