Wednesday, January 19, 2011

[SOLVED] P6DriverNotFoundError: Error registering factory

ERROR

Caused by: com.p6spy.engine.spy.P6DriverNotFoundError:
Error registering factory [com.p6spy.engine.logging.P6LogFactory]
Caused By: java.lang.ClassCastException: com.p6spy.engine.logging.P6LogFactory
cannot be cast to com.p6spy.engine.spy.P6Factory
at com.p6spy.engine.spy.P6SpyDriverCore.initMethod(P6SpyDriverCore.java:289)
at com.p6spy.engine.spy.P6SpyDriver.initMethod(P6SpyDriver.java:78)
at com.p6spy.engine.spy.P6SpyDriver.(P6SpyDriver.java:74)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory
(BasicDataSource.java:1415)



SOLUTION

This problem is caused when I have multiple copies of p6spy.jar (one in my WAR file and the other one in Tomcat Lib folder). There should be only one copy of the jar per class loader. By removing p6spy.jar from either the war file or tomcat lib, problem is gone.

3 comments :