Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Exception inthread"main"java.lang.NoClassDefFoundError

Hi

I am suspecting that there might be a bug in AspectJ LTW and static
initializers. I am getting something very similar in a multi-classloader
(WebSphere 6.1) environment:

Caused by: java.lang.ExceptionInInitializerError
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:205)
	at java.lang.Class.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1301)
	at java.beans.Beans.instantiate(Beans.java:219)
	at java.beans.Beans.instantiate(Beans.java:63)
	at
com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run(ServletWrapper.java
:1305)
	at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.
java:118)
	at
com.ibm.ws.webcontainer.servlet.ServletWrapper.loadServlet(ServletWrappe
r.java:1300)
	... 22 more
Caused by: org.apache.commons.logging.LogConfigurationException:
java.lang.reflect.InvocationTargetException
	at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
l.java:532)
	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:272)
	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:246)
	at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
	at
org.apache.struts.action.ActionServlet.<clinit>(ActionServlet.java:228)
	at java.lang.J9VMInternals.initializeImpl(Native Method)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:187)
	... 29 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:67)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:45)
	at
java.lang.reflect.Constructor.newInstance(Constructor.java:521)
	at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
l.java:525)
	... 35 more
Caused by: java.lang.NoClassDefFoundError: org.apache.log4j.Priority
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:63)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:124)
	at
org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:63)

And from -debug
....
[7/1/08 7:42:59:070 CEST] 00000017 SystemErr     R
[CompoundClassLoader@6b286b28] debug generating class
'org.apache.commons.logging.impl.Log4JLogger$AjcClosure23'
[7/1/08 7:42:59:070 CEST] 00000017 SystemErr     R
[ExtClassLoader@2bc02bc0] debug weaving 'org.apache.log4j.Priority'
[7/1/08 7:42:59:070 CEST] 00000017 SystemErr     R
[ExtClassLoader@2bc02bc0] debug weaving 'org.apache.log4j.Level'
...

Priority is in the classpath as you can see, because it is loaded and
weaved

Hermod 

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Tuesday, July 01, 2008 4:37 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Exception
inthread"main"java.lang.NoClassDefFoundError

No special setup.  The dump output should go into an folder called
"_ajdump" (the .class files before weaving will go into a subdir of that
called _before).  "_ajdump" is created relative to the current directory
in which the application runs.  A warning message should come out if
there is a problem dumping, if you don't see that then the files should
be somewhere...
Sorry if I'm a bit vague, I'm a bit rusty on LTW at the moment ;)

Andy.


2008/6/30 Buck, Robert <rbuck@xxxxxxxxxxxx>:
> Hi,
>
> <dump is not working for me at all. I am using 1.6.0.
>
> Is there some special setup necessary to get dump to work?
>
> Bob
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx 
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> Sent: Monday, June 30, 2008 5:53 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Exception in 
> thread"main"java.lang.NoClassDefFoundError
>
> Hi,
>
> I've never seen a case of that before - and I've seen some pretty 
> wierd stuff :)
>
>> Exception in thread "main" java.lang.NoClassDefFoundError
>>        at $AllProbeAspect.aspectOf(Unknown Source)
>
> You could turn on weaveinfo messages and see if anywhere unexpected is

> getting woven by your aspects, I think that is <weaver 
> options="-showWeaveInfo"
>
> Or it would be interesting to turn on dump diagnostics for the weaver
> pre- and post- weave and then see how that method had been affected 
> during the weave and is it bad code.  (It seems like the code is OK 
> because there is no verifyerror.)
>
> To turn on that debugging, add this option to weaver options:
>
>  <dump within="com.verisign.common.properties..*"
> beforeandafter="true"/>
>
> navigating from the PropertyManager.getInstance() method using a 
> decompiler or javap on the woven code and seeing where it leads.
>
> My suspicion right now is that something is being woven that you 
> weren't expecting and it is having a nasty side effect.
>
> If you want me to take a look at the bytecode, I'm happy to - use my 
> regular gmail ID if you don't want to share it with the list.
>
> cheers,
> Andy.
>
>
> 2008/6/30 Buck, Robert <rbuck@xxxxxxxxxxxx>:
>> Hi Andy,
>>
>> Okay, so I reverted back to double-dots. The doc was not very clear, 
>> which is why I tried single-dots. But still, I get the same error:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError
>>        at $AllProbeAspect.aspectOf(Unknown Source)
>>        at
>> com.verisign.common.properties.PropertyManager.getInstance(PropertyMa
>> n
>> ag
>> er.java:81)
>>        at com.verisign.jtaps.test.Test.calc(Test.java:19)
>>        at com.verisign.jtaps.test.Test.main(Test.java:29)
>>
>> Notice that there is no class name specified; when I trap all 
>> exceptions in the debugger, what I see is a null error message, and 
>> the causation member self-references the lexically enclosing 
>> exception
>
>> instance, as if somewhere someone did something evil like:
>>
>>  NoClassDefFoundError error = new NoClassDefFoundError(); 
>> error.initCause(error);  throw error;
>>
>> The information I Google'd did not turn up any hints that worked.
>>
>> What sort of approach might I use to dianose and resolve this issue?
>>
>> Thanks in advance,
>>
>> Bob
>>
>> -----Original Message-----
>> From: aspectj-users-bounces@xxxxxxxxxxx 
>> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
>> Sent: Monday, June 30, 2008 5:14 PM
>> To: aspectj-users@xxxxxxxxxxx
>> Subject: Re: [aspectj-users] Exception in thread 
>> "main"java.lang.NoClassDefFoundError
>>
>> In AspectJ syntax, the expression
>>
>> pkg.*
>>
>> means any type in package 'pkg'.  If your type is in pkg.subpkg then 
>> it will not match that expression.  Two dots are needed to include 
>> types in the package or any sub-package.
>>
>> pkg..*
>>
>> Going by the aop.xml in your previous email, you are using
>> org.apache.log4j.*  and that doesn't match 
>> org.apache.log4j.spi.RootLogger, so it is not excluded from the 
>> weaving process.
>>
>> The doc is here:
>> http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuratio
>> n
>> .h
>> tml
>> but i'll say that if you aren't familiar with the double dot 
>> notation,
>
>> it isn't explicitly indicated there as what you need to use, and the 
>> example on that page is a bit unclear.  we could do with improving 
>> that doc.
>>
>> cheers,
>> Andy.
>>
>> 2008/6/30 Buck, Robert <rbuck@xxxxxxxxxxxx>:
>>> Hello,
>>>
>>> I have been grappling with an issue for a couple weeks now. No 
>>> information in the documentation, on the web via google, seems to 
>>> point me in the right direction. I looked through the aspectj 
>>> database, and nothing there to help either.
>>>
>>> I put together a simple hello world application to diagnose an issue

>>> I
>>
>>> see when using aspectj in a larger scale application. Here is my
>> question...
>>>
>>> Why, when I specifically tell aspectj not to weave log4j, does it 
>>> try
>> to?
>>> (assuming the stack trace below hints this, because the standalone 
>>> application works properly).
>>>
>>> Or, is there a bug in the aspectj agent that would cause this?
>>>
>>> Or, is there a bug in aspectj with respect to static initializer
>> blocks?
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError  at
>>> org.apache.log4j.spi.RootLogger.<init>(RootLogger.java:46)
>>>  at org.apache.log4j.LogManager.<clinit>(LogManager.java:80)
>>>  at org.apache.log4j.Logger.getLogger(Logger.java:118)
>>>  at
>>> com.verisign.common.properties.PropertyManager.<clinit>(PropertyMana
>>> g
>>> e
>>> r.java:47)  at com.verisign.jtaps.test.Test.calc(Test.java:19)
>>>  at com.verisign.jtaps.test.Test.main(Test.java:29)
>>> Thanks
>>>
>>> Bob
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *



Back to the top