尝试使用BoneCP配置Tomcat Global JNDI ConnectionPool时出错

时间:2013-09-22 19:45:39

标签: tomcat jndi jtds bonecp

我在C:\ Tomcat5.5 \ common \ lib

中有以下文件

的activation.jar
bonecp-0.7.1.RELEASE.jar
公地el.jar
ECJ-3.7.2.jar
番石榴15.0.jar
碧玉compiler.jar
碧玉runtime.jar
JSP-api.jar文件
JTDS-1.3.1.jar
log4j的-1.2.17.jar

了mail.jar 命名-工厂dbcp.jar
命名-factory.jar
命名-resources.jar
servlet的api.jar文件
SLF4J-API-1.7.5.jar

我在server.xml中有以下内容

<Resource 
auth="Container"
driverClassName="net.sourceforge.jtds.jdbc.Driver"  
type="com.jolbox.bonecp.BoneCPDataSource"
idleMaxAge="240"
idleConnectionTestPeriod="60"
partitionCount="3"
acquireIncrement="1"
maxConnectionsPerPartition="10"
minConnectionsPerPartition="3"
statementsCacheSize="50"
releaseHelperThreads="4"

name="jdbc/MyDatasource"
jdbcUrl="jdbc:jtds:sqlserver://localhost:1433;databaseName=ROWAN-UK;integratedSecurity=true;"
username="rowanadmin" 
password="aeibP4wwZgr"
factory="org.apache.naming.factory.BeanFactory"/> 

以及C:\ Tomcat5.5 \ conf \ context.xml中的以下内容:

<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <ResourceLink global="jdbc/MyDatasource" name="jdbc/MyDatasource" type="com.jolbox.bonecp.BoneCPDataSource"/>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

</Context>

我在Tomcat5-stdout.log中获得以下内容:

  

2013-09-22 21:28:52 Commons Daemon procrun stdout初始化SLF4J:   无法加载类“org.slf4j.impl.StaticLoggerBinder”。 SLF4J:   默认为无操作(NOP)记录器实现SLF4J:请参阅   http://www.slf4j.org/codes.html#StaticLoggerBinder进一步说明   细节。 java.lang.reflect.InvocationTargetException at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)at   sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)at   java.lang.reflect.Method.invoke(未知来源)at   org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)at at   org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)引起   by:java.lang.IllegalAccessError:试图访问方法   com.google.common.collect.MapMaker.makeComputingMap(LCOM /谷歌/普通/碱/功能;)Ljava / util的/并行/ ConcurrentMap;   来自com.jolbox.bonecp.BoneCPDataSource类   com.jolbox.bonecp.BoneCPDataSource。(BoneCPDataSource.java:64)     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native   方法)at   sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown   来自java.lang.reflect.Constructor.newInstance(未知来源)     在java.lang.Class.newInstance0(未知来源)at   java.lang.Class.newInstance(未知来源)at   org.apache.naming.factory.BeanFactory.getObjectInstance(BeanFactory.java:143)     在   org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)     在javax.naming.spi.NamingManager.getObjectInstance(未知来源)     在org.apache.naming.NamingContext.lookup(NamingContext.java:793)at   org.apache.naming.NamingContext.lookup(NamingContext.java:140)at   org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)     在   org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)     在   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)     在   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:144)     在   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)     在   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)     在   org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)     在   org.apache.catalina.core.StandardServer.start(StandardServer.java:693)     在org.apache.catalina.startup.Catalina.start(Catalina.java:552)...   6更多

1 个答案:

答案 0 :(得分:2)

请参阅https://stackoverflow.com/a/15656405/2408961

这适用于Play框架,但解决方案应该相同。 升级到bonecp-0.8.0.RELEASE。 (番石榴15似乎不适用于bonecp-0.7.1.RELEASE)