tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mel Martinez <melaqu...@yahoo.com>
Subject Bug?[Tomcat 3.2.1] Or am I missing something...
Date Wed, 07 Feb 2001 22:32:42 GMT
Hi,

I'm not sure what I'm missing here, but I'm running
into a strange bit of behavior in Tomcat 3.2.1.

I've got a jsp that uses classes in a jar file that is
placed in the WEB-INF/lib folder like so:

webapps/demo/simple.jsp
webapps/demo/WEB-INF/lib/mylib.jar

Early on one of the classes inside mylib.jar gets
handed a reference to the ServletConfig object (as
returned from
javax.servlet.Servlet.getServletConfig()).  At some
point further on (through a sequence too complex to
relate here just yet) this class invokes the
'getServletName()' method on the ServletConfig object
using reflection (i.e. Method.invoke()).

This results in an IllegalAccessException.  Details
are like so:

com.g1440.naf.util.NFRuntimeException:
com.g1440.naf.reflect.SimpleDecorator: illegal access
attempt on :
 object = 
   org.apache.tomcat.facade.ServletConfigImpl@5e83f9 :

 object class = 
    org.apache.tomcat.facade.ServletConfigImpl : 
 method = getServletContext : 
 modifiers = public abstract : 
 object class loader = 
       sun.misc.Launcher$AppClassLoader@404536 : 
 handler class loader = AdaptiveClassLoader(  )

 Nested Exception = java.lang.IllegalAccessException

In the above diagnostics, 'handler' refers to the
class that is simply calling (the equivalent of)

ServletConfig cfg = getServletConfig();
...
Method.invoke(cfg,"getServletName",null);

The 'ServletConfig.getServletName()' method is
declared public in the API.  Can anyone suggest to me
why the above might be happening?  I note that the
implementation class:
org.apache.tomcat.facade.ServletConfigImpl is declared
package-level, (why?) but I wouldn't think this should
affect my access to a public method.  There seems to
be some mumblings about access protection in the
facade package but I'm not yet familiar with what is
going on there yet.

Any help is appreciated.  As usual, I'm sure this is
something boneheaded that I am doing wrong...

Mel


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

Mime
View raw message