From: Scott M S. <sco...@at...> - 2002-11-27 16:40:52
|
The error occurs when the classes that are involved in the package private or protected relationship are loaded by different class loaders. Since class loading is done lazily this could be due to non-deterministic loading on first use in a multi-threaded environment. Another way to force the shared classes to be loaded under the same class loader would be to have a service that loads the classes in question on startup. xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx ----- Original Message ----- From: "anna schricker" <ann...@vi...> To: <jbo...@li...> Sent: Wednesday, November 27, 2002 12:39 AM Subject: AW: [JBoss-user] IllegalAccessError with package private methods in the same jar Thank you. I doubt that putting the classes in the server/xxx/lib directory is a feasible solution for us. I still don't understand why the error does occur sometimes and other times (after another deployment and/or restart of JBoss) not. When exactly will a class get loaded? Maybe there is a way to change the design of the testing framework in order to prevent this from happening... -----Ursprüngliche Nachricht----- Von: Scott M Stark [mailto:sco...@at...] Gesendet: Dienstag, 26. November 2002 20:32 An: jbo...@li... Betreff: Re: [JBoss-user] IllegalAccessError with package private methods in the same jar Most likely this is an instance of the following bug: [ 644289 ] ClassLoader issue with protected access and manifest refs http://sourceforge.net/tracker/index.php?func=detail&aid=644289&group_id=22866&atid=376685 You have to move the common jar that contains the classes using package protected access to the server/xxx/lib directory to ensure that only a single class loader it associated with it. xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx ----- Original Message ----- From: "anna schricker" <ann...@vi...> To: <jbo...@li...> Sent: Tuesday, November 26, 2002 12:52 AM Subject: [JBoss-user] IllegalAccessError with package private methods in the same jar Hi, I have the following problem: I have a servlet that calls a class derived from JUnit Testcase which again calls class A and class B in the same package. The testclass, class A and class B are packaged in the same jar, the servlet is in a war-file and jar and war are together in an ear-file. When class A calls a package private method in class B I often get an IllegalAccessError but not always. Sometimes when I build and deploy the classes again it is ok. I found that when the error occurs class A and class B are loaded by different classloaders. Both classes are not referenced from any classes in the war-file. From what I read in the newsgroups this can occur when classes reside in different jars which is not the case. My questions: 1. Why is this happening? I found the error only when accessing the classes via serlvet and Testcase-class. 2. Is there a way to prevent this? Can I tell JBoss to load all classes inside a jar with the same classloader? I am using JBoss 3.0.2 with jetty. Thanks for any help, Anna anna schricker virtual identity ag grünwälder str. 10-14 79098 freiburg ann...@vi... tel.: +761-20758-404 ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ JBoss-user mailing list JBo...@li... https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ JBoss-user mailing list JBo...@li... https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ JBoss-user mailing list JBo...@li... https://lists.sourceforge.net/lists/listinfo/jboss-user |