2011-09-13 29 views
0

我在同一個linode(vps提供商)數據中心設置了2個VPS。通過內部靜態IP可見。使用tomcat進行hibernate + spring + mysql的遠程事務?

VPS.1.- Apache代理,使用mod_jk與VPS.2的tomcat連接。

我想讓VPS.2的tomcats spring應用程序在VPS.1中使用mysql數據庫。

我試圖改變META-INF/context.xml中以品脫該數據庫:

<?xml version="1.0" encoding="UTF-8"?> 
<Context path="/" override="true" reloadable="false" swallowOutput="false"> 

    <Resource name="jdbc/catWDB" auth="Container" type="javax.sql.DataSource" 
       driverClassName="com.mysql.jdbc.Driver" 
       factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" 

url="jdbc:mysql://VPS.1_IP:3306/database_name?zeroDateTimeBehavior=convertToNull&amp;autoReconnect=true" 
       username="user_name" 
       password="pass_name" 
       validationQuery="select 1" 
       maxActive="20" 
       maxIdle="10" 
       maxWait="-1"/> 
</Context> 

我如何過得到了錯誤:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

會有人請扔一些光這黑暗問題?謝謝!

回答

相關問題