You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by bu...@apache.org on 2006/01/25 05:48:26 UTC

DO NOT REPLY [Bug 38377] New: - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377

           Summary: BCEL cannot be used as java.system.class.loader
           Product: BCEL
           Version: 5.1
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: bcel-dev@jakarta.apache.org
        ReportedBy: neumann@lostwebsite.net


The property java.system.class.loader is supposed to allow JVM users to change 
the default class loader to another class. 
 
org.apache.bcel.util.ClassLoader cannot be used with this property.  Setting 
-Djava.system.class.loader=org.apache.bcel.util.ClassLoader provokes this at 
load time. 
 
Error occurred during initialization of VM 
java.lang.Error: java.lang.IllegalStateException: recursive invocation 
 
java version "1.5.0_06" 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) 
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) 
 
this bug also applies to SVN-HEAD.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377


neumann@lostwebsite.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|Other                       |SGI




------- Additional Comments From neumann@lostwebsite.net  2006-01-25 05:49 -------
This link might provide additionnal informations: 
 
http://www.mail-archive.com/bcel-dev%40jakarta.apache.org/msg00451.html 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377





------- Additional Comments From neumann@lostwebsite.net  2006-01-25 15:05 -------
Now that I think of it, my idea of the source of the problem is probably wrong 
so disregard the explanation after the patch. 
 
The patch, though, still solves the problem. 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377





------- Additional Comments From mail@dcoy.org  2006-09-28 11:23 -------
Created an attachment (id=18930)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18930&action=view)
Patch for ClassLoader constructor

I created a subclass of org..ClassLoader (lets call is SLoader) and tried to
use it as the system class loader, but it gave me the same error as described
in the initial comment.

The class looks like this:

public class SLoader extends ClassLoader{
 [...]
    public SLoader(java.lang.ClassLoader deferTo) {
	super(deferTo, new String[]{ "java.",
				     "javax.",
				     "com.sun.",
				     "sun."}
	);
    }
 [...]
}

The JVM calls the above constructor when the class is passed with the
-Djava.system.class.loader VM argument. This constructor then calls the
constructor of the org..ClassLoader

public class ClassLoader extends java.lang.ClassLoader {
 [...]
    public ClassLoader(java.lang.ClassLoader deferTo, String[]
ignored_packages) {
	this(ignored_packages);
	this.repository = new ClassLoaderRepository(deferTo);
    }
 [...]
}

As you can see, there is no explicit call the any constructor of the
java..ClassLoader class. This causes its default constructor to be invoked,
which tries to resolv the parent class loader by calling
java..ClassLoader.getSystemClassLoader() which causes the loop in the class
loader hierarchy.

The appended patch fixes this by explicitly invoking the

    java.lang.ClassLoader.ClassLoader(ClassLoader parent)

constructor which does not use the getSystemClassLoader() method.


A question about the bug reporting process: Should I REOPEN the bug and then
set it RESOLVED/FIXED again?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377





------- Additional Comments From neumann@lostwebsite.net  2006-01-25 14:54 -------
To reproduce: 
 
public class EmptyMain 
{ 
   public static void main(String[] args) 
     { 
     } 
} 
 
neumann@Silvester:/tmp$ javac EmptyMain.java 
neumann@Silvester:/tmp$ java 
-Djava.system.class.loader=org.apache.bcel.util.ClassLoader 
-cp /home/neumann/Libs/bcel-5.1/bcel-5.1.jar:. EmptyMain 
Error occurred during initialization of VM 
java.lang.Error: java.lang.IllegalStateException: recursive invocation 
neumann@Silvester:/tmp$ java -version 
java version "1.5.0_06" 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) 
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) 
 
A tentative patch will soon follow. 
 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377





------- Additional Comments From neumann@lostwebsite.net  2006-01-25 14:59 -------
Created an attachment (id=17501)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17501&action=view)
Tentative patch.

This is a tentative patch.  It may not well be the solution to the problem, but
it does remove the IllegalStateException error.

I think the problem is that, once initSystemClassLoader is called (it's in
java.lang.ClassLoader), no class should depend load java.lang.ClassLoader or
you get a indirectly recursive call of initSystemClassLoader.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377


tcurdt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From tcurdt@apache.org  2006-03-02 03:11 -------
tentative this looks ok ...I am not 100% but since it solves the problem I've just committed it

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38377] - BCEL cannot be used as java.system.class.loader

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38377





------- Additional Comments From dbrosius@apache.org  2006-01-25 07:50 -------
hmmm. I attempted to do as you suggest, but can't seem to shake the 
java.lang.Error: java.lang.IllegalStateException: recursive invocation 

error.

could getParent() be returning org.apache.bcel.util.ClassLoader, in this case?

Unfortunately the error occurs before debugging begins.

Any ideas?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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