2011-04-05 64 views
0

在運行Eclipse赫利俄斯SR2,Windows 7的和Tomcat 6.0.32我們有重複的JNDI連接池Eclipse的Tomcat的創建3個重複的JNDI連接池

  • 的一個很奇怪的情況下,從Eclipse的
  • 運行Tomcat一個開發人員工作站
  • 的server.xml

>

<Context docBase="path to web app" path="/ds-web" reloadable="true"> 
    <Resource 
     name="jdbc/ds" 
     username="ds" 
     password="pass" 
     type="javax.sql.DataSource" 
     url="jdbc:postgresql://localhost:5432/ds" 
     auth="Container" 
     driverClassName="org.postgresql.Driver" 
     factory="org.apache.commons.dbcp.BasicDataSourceFactory" 
     logAbandoned="true" 
     maxActive="30" 
     maxIdle="10" 
     maxWait="1000" 
     removeAbandoned="true" 
     removeAbandonedTimeout="60" 
     validationQuery="SELECT 1" 
     testOnBorrow="true" 
     testOnReturn="true"/> 

</Context> 
  • 當啓動服務器,我們看到下面的3次連續在控制檯上

AbandonedObjectPool is used 
([email protected]) 
    LogAbandoned: true 
    RemoveAbandoned: true 
    RemoveAbandonedTimeout: 60 
  • 應用則無法找到JNDI資源
  • 如果我們在server.xml刪除<Resource>,然後控制檯顯示沒有連接池被創建在所有
  • 在另一家開發商機使用相同的硬件和操作系統,我們沒有這個問題

任何想法? 感謝

馬克

回答

0

我們在機器上重新安裝了postgresql,問題得到了解決。

我們認爲原始postgresql配置中的東西已經混亂,tomcat無法以某種方式連接到BD。我猜tomcat只是「嘗試3次」,因此是三重輸出。

另一個未解之謎......

0

我的建議,從複製的server.xml整個<Context>,並創建Web應用程序META-INF文件夾內的一個空白context.xml並粘貼<Context>server.xml那裏複製。

重新啓動您的應用程序,看看它是否有效。

0

移動

<Resource 
    name="jdbc/ds" 
    username="ds" 
    password="pass" 
    type="javax.sql.DataSource" 
    url="jdbc:postgresql://localhost:5432/ds" 
    auth="Container" 
    driverClassName="org.postgresql.Driver" 
    factory="org.apache.commons.dbcp.BasicDataSourceFactory" 
    logAbandoned="true" 
    maxActive="30" 
    maxIdle="10" 
    maxWait="1000" 
    removeAbandoned="true" 
    removeAbandonedTimeout="60" 
    validationQuery="SELECT 1" 
    testOnBorrow="true" 
    testOnReturn="true"/> 

到即server.xml中

<GlobalNamingResources> 

在你的conf/context.xml中你會文件中的元素

而是指定

<ContextLink name="jdbc/ds" global="jdbc/ds"/> 

這樣,這三個上下文將共享同一個池。