Could not initialize class net.sf.log4jdbc.sql.jdbcapi.DriverSpy【已解决】

博客内容涉及到Java应用程序在启动时遇到NoClassDefFoundError,具体为无法初始化net.sf.log4jdbc.sql.jdbcapi.DriverSpy类。问题可能源于系统缺失log4jdbc库或者配置文件log4jdbc.log4j2.properties不正确。解决方案包括检查src目录下是否存在该配置文件,并确保文件内已正确配置所需驱动。
摘要由CSDN通过智能技术生成

Exception in thread “Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@39117085” java.lang.NoClassDefFoundError: Could not initialize class net.sf.log4jdbc.sql.jdbcapi.DriverSpy
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded(DriverManagerDataSource.java:100)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:132)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access 800 ( B a s i c R e s o u r c e P o o l . j a v a : 32 ) a t c o m . m c h a n g e . v 2. r e s o u r c e p o o l . B a s i c R e s o u r c e P o o l 800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool 800(BasicResourcePool.java:32)atcom.mchange.v2.resourcepool.BasicResourcePoolAcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)

系统缺少或者log4j文件名字出错

确认src目录下有文件log4jdbc.log4j2.properties,

且文件中配置了

log4jdbc.drivers=com.thunisoft.ArteryBase.Driver,com.sybase.jdbc3.jdbc.SybDriver

log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值