2011-10-03 74 views
0

在一個GlassFish服務器我有一個JDBC連接池設置爲我的PostgreSQL數據庫。我也爲我這個連接池JNDI - Glassfish的JDBC,錯誤引用當數據源

GlassFish服務器上創建一個JDBC資源。如果我創造我部署和這個GlassFish服務器我得到的jdbc資源的以下消息上運行的Web應用程序。 (IDE就是Eclipse)

[#|2011-10-03T13:33:09.745+0200|WARNING|glassfish3.1.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=132;_ThreadName=Thread-2;|This web app [GlassfishTest] has no expand »resource environment reference by the name of [jdbc/MEM_Reporting]|#] 

在我的web.xml中的資源配置如下:

<resource-env-ref> 
<resource-env-ref-name>jdbc/MEM_Reporting</resource-env-ref-name> 
<jndi-name>reporting</jndi-name> 
</resource-env-ref> 

我一直在尋找了一段時間,但現在找不到任何解決辦法,希望你們中的任何guyz可以幫忙。

+0

已映射在'陽光web.xml'參考呢?另外,您用於JDBC資源的名稱是什麼? – beny23

+0

是否嘗試在創建資源後重新啓動服務器?在我看來,配置數據是正確的,但資源不存在... – Alex

+0

我剛剛注意到,我映射在我的sun-web.xml中,而不是web.xml中。該項目沒有一個web.xml。 – ophychius

回答

2

你不應該一直使用資源引用來代替的resource-env-REF?

更新:

你如何引用它?你有沒有嘗試引用它的 「java:comp/env的/ JDBC/MEM_Reporting」

也是在web.xml中的resource-ref看起來應該IKE

<resource-ref> 
    <res-ref-name>jdbc/MEM_Reporting</res-ref-name> 
    <res-type>javax.sql.DataSource</res-type> 
    <res-auth>Container</res-auth> 
</resource-ref> 
sun-web.xml中

<resource-ref> 
    <res-ref-name>jdbc/MEM_Reporting</res-ref-name> 
    <jndi-name>jdbc/MEM_Reporting</jndi-name> 
</resource-ref> 

而且,看看 Sun documentation for Reference Elements

+0

我只是改變者行: <資源引用> \t JDBC/MEM_Reporting \t JDBC/MEM_Reporting \t 但我得到了同樣的錯誤 – ophychius

+0

在我的sun-web.xml中的resource-ref必須包含RES-REF-名稱,JNDI名稱和默認資源校長。不是您更新中列出的字段。我也嘗試過這些,但它沒有改變任何東西。 – ophychius

+0

最後更新做到了這一點:)愚蠢的項目沒有web.xml,只是一個sun-web.xml。謝謝。 – ophychius

0

我添加<jndi-name>標籤GlassFish中-web.xml文件中,而不是在sun-web.xml中,並且警告dissapear後。