eclipse-archived / concierge

Eclipse Concierge™ project
https://www.eclipse.org/concierge/
Eclipse Public License 1.0
33 stars 22 forks source link

Running Concierge on CEE-J throws a NPE in this.getClass().getClassLoader().loadCLass() #39

Closed JochenHiller closed 7 years ago

JochenHiller commented 7 years ago

An user running Concierge on Skelmir CEE-J reports:

In this.getClass().getClassLoader().loadClass("org.w3c.dom.Document") CEE-J returns null on this.getClass().getClassLoader() which results in a NPE when loading class

See code at https://github.com/eclipse/concierge/blob/59ba0eb4d2c7a347bb3f084ae3524b4595585346/framework/org.eclipse.concierge/src/org/eclipse/concierge/Concierge.java#L699

I checked the Java spec on that: https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getClassLoader--

public ClassLoader getClassLoader() Returns the class loader for the class. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader.

So according to spec, this seems to be valid if the JVM returns null on getClassLoader(), in case the current class has been loaded by the bootstrap class loader.

At Wolfgang: what is your proposal to do that in CEE-J ? Purpose is to get on Java 8 the compact profile where the JVM is running on.