NoClassDefFoundError: Could not initialize class net.sf.log4jdbc.DriverSpy

4,013 views
Skip to first unread message

Vince Roan

unread,
May 9, 2012, 11:23:47 AM5/9/12
to log4jdbc
Hi,

A little background, firstly I'm a tester not a Java dev, so whilst I
can understand some Java issues I'm not always able to find a
solution, hence my post!

What I'm trying to accomplish is to just log all SQL statements, I
have setup my configuration files accordingly & have modified jboss's
run.sh to include the classpath for log4jdbc4-1.2.jar, we are using
JDBC Version 4.

All seems to be well, but when I look in the logs, I see:

server.log

ERROR [ConnectionManager ][][ConnectionManagerPollThread ]
#=4bac3fc7=# 'PersistenceManager' could not establish connection.

And in the error.log:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class
net.sf.log4jdbc.DriverSpy

Now (I believe) this means that all though the class is found it
cannot be loaded. So how can I solve this?

FYI, I tried version 3, ,log4jdbc3-1.2.jar, just to be sure & this
leads to another set of exceptions:

There was an unexpected error while trying to create a new
PersistenceManager instance.

BTW the apps use toplink, but cannot find any info regarding support
for this.
My original driver-class: oracle.jdbc.driver.OracleDriver
My original url: jdbc:oracle:thin

Thanks.

Arthur Blake

unread,
May 9, 2012, 1:39:09 PM5/9/12
to log4...@googlegroups.com
Hard to tell from the information you gave me... could it be a classloader issue with jboss maybe?


--
You received this message because you are subscribed to the Google Groups "log4jdbc" group.
To post to this group, send email to log4...@googlegroups.com.
To unsubscribe from this group, send email to log4jdbc+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/log4jdbc?hl=en.


Vince Roan

unread,
May 10, 2012, 3:12:01 AM5/10/12
to log4jdbc
Thanks for your reply, that sounds likely. What further information
would help? Thanks.

Arthur Blake

unread,
May 10, 2012, 8:53:59 AM5/10/12
to log4...@googlegroups.com
Really, I'm just guessing, the problem could be something else.
I've never used jboss, but I presume that it is an app server which typically has a special classloader so that each app is isolated from each other.
Maybe reading the jboss documentation (focusing on the database configuration sections) or asking on a jboss forum could get some answers?
If you could for example, get jboss to talk to some completely other database type successfully, that might be a good start.
Maybe there is a special place you need to add jars for the database, rather than just on the classpath in the .sh file?

On Thu, May 10, 2012 at 3:12 AM, Vince Roan <vinc...@googlemail.com> wrote:
Thanks for your reply, that sounds likely. What further information
would help? Thanks.

Vince Roan

unread,
May 15, 2012, 5:28:58 AM5/15/12
to log4jdbc
After some more investigation, it seems the issue is with Toplink,
does log4jdbc support Oracle Toplink?

Arthur Blake

unread,
May 15, 2012, 7:53:24 AM5/15/12
to log4...@googlegroups.com
I've never used Toplink.  If it uses plain JDBC under the covers then it should work.  Odds are they are doing some Oracle specific stuff in Toplink which could cause problems-- but I don't know.

On Tue, May 15, 2012 at 5:28 AM, Vince Roan <vinc...@googlemail.com> wrote:
After some more investigation, it seems the issue is with Toplink,
does log4jdbc support Oracle Toplink?

Vince Roan

unread,
May 15, 2012, 9:59:33 AM5/15/12
to log4jdbc
Thanks (again) for getting back to me .. I've upped the logging & see:

Reason: java.lang.RuntimeException: Error starting
SpringStartupService:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'uee' defined in URL [file:/usr/local/
xxxxxx_jboss/conf/context-uber.xml]: Instantiation of bean failed;
nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[org.springframework.context.support.FileSystemXmlApplicationContext]:
Constructor threw exception; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'externalSubscriptionRepo' defined in URL
[file:/usr/local/xxxxxx_jboss/conf/uee-conf/context-subscription.xml]:
Cannot resolve reference to bean 'persistenceManager' while setting
constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'persistenceManager' defined in URL [file:/usr/
local/xxxxxx_jboss/conf/context-UEE.xml]: Instantiation of bean
failed; nested exception is
org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public static synchronized
com.xxxxxx.server.persistence.PersistenceManager
com.xxxxxx.server.persistence.PersistenceManager.getInstance(com.xxxxxx.util.config.xxxxxxSystem
$SystemProxy) throws
com.xxxxxx.server.persistence.PersistenceException] threw exception;
nested exception is
com.xxxxxx.server.persistence.PersistenceException: [ Host
'aaaaaaa.bbbbbbb'] An error occurred whilst trying to get the instance
of the Persistence Manager.

Looking into these files [file:/usr/local/xxxxxx_jboss/conf/context-
uber.xml]

<!-- User Experience Engine context -->
<bean id="uee"
class="org.springframework.context.support.FileSystemXmlApplicationContext">
<constructor-arg value="file:/usr/local/xxxxxx_jboss/
conf/context-UEE.xml"/>
</bean>

Is what it is complaining about & then [file:/usr/local/xxxxxx_jboss/
conf/uee-conf/context-subscription.xml]

<bean id="externalSubscriptionRepo"
class="com.shazam.repository.toplink.TopLinkExternalSubscriptionRepository">
<constructor-arg><ref bean="persistenceManager"/></
constructor-arg>
</bean>

But, I've no clue as to what all this does, or should do! I originally
followed this: http://groups.google.com/group/log4jdbc/browse_thread/thread/1734ffa0f01cc0ef
for jBoss setup .. but I'm at a loss of what to do to get it to
work .. so any further pointers appreciated. Thanks.

Arthur Blake

unread,
May 15, 2012, 10:03:24 AM5/15/12
to log4...@googlegroups.com
I suggest you ask on a toplink and or jboss mailing list or forum.

Reply all
Reply to author
Forward
0 new messages