Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Fun with classloaders and start.jar

start.jar itself does no work around the WebAppContext's classloaders.
That's for the various XML files you are using to manage.

The WebAppContext has a ClassLoader layer of its own.
This layer is likely preventing you from accessing the webapp specific classes from the server classloader.

If you want to play around with the access rules, you'll want to check out the WebAppContext class and the relationship of System Classes to Server Classes. 
Accessing classes in that direction Server -> WebApp seems odd to me.

Check the __dftSystemClasses and __dftServerClasses fields (and comments) at
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java?h=master#n92

Good Luck

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Developer advice, services and support
from the Jetty & CometD experts.



On Wed, Jun 20, 2012 at 3:18 PM, ccleve <ccleve.tech@xxxxxxxxx> wrote:
I recently switched our app from our own startup code to using start.jar. Now we're getting an error in our webapp:

java.lang.IllegalAccessException: com.mycompany.MySuperClass can not access a member of class com.mycompany.MySubClass with modifiers "protected"

MySuperClass is an odd beast. It exists in a jar in the main /lib directory. It contains a method that uses reflection to examine protected members of subclasses. MySubClass exists in the webapp.

MySuperClass and MySubClass are both in the same package, but in different jars.

I do not get this error when I use our own Jetty startup code, only with start.jar. My guess is that start.jar sets up classloaders in a way that prevents access, but that's just a guess.

Anyone know how to fix this?

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top