You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by bu...@apache.org on 2003/05/04 13:29:19 UTC

DO NOT REPLY [Bug 19628] New: - [Fortress] BCELCodeGenerator causes NPE in web app

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19628>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19628

[Fortress] BCELCodeGenerator causes NPE in web app

           Summary: [Fortress] BCELCodeGenerator causes NPE in web app
           Product: Avalon
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Excalibur
        AssignedTo: dev@avalon.apache.org
        ReportedBy: unico@hippo.nl


When using BCEL in a web app environment the following class hierarchy of 
components will cause a NPE in BCELCodeGenerator:

interface Role1 extends org.apache.avalon.framework.component.Component
{}

class Component1 implements Role1
{}

If, instead the hierarchy reads:

interface Role1
{}

class Component1 implements Role1, o.a.a.f.c.Component
{}

There is no problem.


Here is the stacktrace:

Caused by: java.lang.NullPointerException
	at 
org.apache.avalon.fortress.impl.factory.BCELCodeGenerator.extractMethods
(BCELCodeGenerator.java:592)
	at 
org.apache.avalon.fortress.impl.factory.BCELCodeGenerator.createImplementation
(BCELCodeGenerator.java:504)
	at 
org.apache.avalon.fortress.impl.factory.BCELWrapperGenerator.buildWrapper
(BCELWrapperGenerator.java:346)
	at 
org.apache.avalon.fortress.impl.factory.BCELWrapperGenerator.createWrapper
(BCELWrapperGenerator.java:256)
	at 
org.apache.avalon.fortress.impl.factory.WrapperObjectFactory.newInstance
(WrapperObjectFactory.java:94)
	at 
org.apache.avalon.fortress.impl.handler.AbstractComponentHandler.newComponent
(AbstractComponentHandler.java:278)
	at 
org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler.doPrepare
(ThreadSafeComponentHandler.java:72)
	at 
org.apache.avalon.fortress.impl.handler.AbstractComponentHandler.prepareHandler
(AbstractComponentHandler.java:179)
	at org.apache.avalon.fortress.impl.handler.AbstractComponentHandler.get
(AbstractComponentHandler.java:209)
	at org.apache.avalon.fortress.impl.handler.LEAwareComponentHandler.get
(LEAwareComponentHandler.java:128)
	at org.apache.avalon.fortress.impl.lookup.FortressServiceManager.lookup
(FortressServiceManager.java:129)
	... 31 more


This NPE is only a secondary symtom though. It is caused by the fact that 
org.apache.bcel.classfile.JavaClass cannot find the class o.a.a.f.c.Component 
in this case and returns null on JavaClass.getInterfaces() method. BCEL prints 
this exception to the console right before returning null:

java.lang.ClassNotFoundException: Exception while looking for class 
org.apache.avalon.framework.component.Component: java.io.IOException: Couldn't 
find: org.apache.avalon.framework.component.Component.class

Now I couldn't reproduce this error with a regular test case. It only appears 
to happen in a web application wich tells me it may be a classloader problem. 
On both web containers I tested: Tomcat and Jetty this exception occurs.

I will attach a small test webapp with which to reproduce this problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org