Donate Share

One-JAR(TM)

Tracker: Patches

5 Patch for External UrlClassLoader - ID: 2833948
Last Update: Comment added ( nobody )

We have a situation where jars loaded via the external option
(one-jar.class.path) have dependencies on classes contained within the
one-jar itself. For us, this happens when we have things like vendor
implementation JDBC or JMS jars that have to live outside of the one-jar.
This patch allows for the correct resolution of these dependencies while
avoiding infinite loops...


Nobody/Anonymous ( nobody ) - 2009-08-07 22:05

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2009-08-07 22:11
Sender: nobody

The reason the patch diff is so large is that we indented the code inside
the try .. finally block.

Our problem:
1. A class is loaded by the externalClassLoader that requires a class
available via JarClasspathLoader

Solution:
* Construct the externalClassLoader so that it's parent is the
JarClasspathLoader

Causes:
* A stack overflow because the JarClasspathLoader will first consult the
externalClassLoader to locate the class.

Solution:
* Track the class name being currently loaded in a ThreadLocal and throw a
ClassNotFound exception when we detect a loop.

Preferred solution:
* Design the JarClasspathLoader around the usage of parent
ClasspathLoaders.


Log in to comment.

Attached File ( 1 )

Filename Description Download
external-loop.patch Download

Change ( 1 )

Field Old Value Date By
File Added 338359: external-loop.patch 2009-08-07 22:05 nobody