Tomcat資料來源的問題

jackyhuang發表於2006-03-31
錯誤:ERROR com.xlands.ilove.dao.CohabitationJdbcDAO - javax.naming.NameNotFoundException: Name iloveDB is not bound in this Context

[JdonFramework] the method 'findModelByKey' of your handler or 'getMethod' of service happened error: java.lang.NullPointerException
ERROR com.jdon.strutsutil.util.EditeViewPageUtil - [JdonFramework]please check your service 、 model or form, error is: java.lang.Exception: java.lang.NullPointerException

這個資料來源其實我是已經配好,
因為使用一下程式碼測試成功了:
test.jsp
Context initCtx=new InitialContext();
DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/iloveDB");
Connection conn=ds.getConnection();

不知道jdon裡查詢資料來源的方式是怎樣,那我應該還要作怎麼樣的工作。
注: 我在server.xml配的資料來源,在web工程裡的web.xml有引用:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/iloveDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>”

相關文章