On Thu, 19 Sep 2002 22:03, Daniel S. Haischt wrote: > i am currently developing an avalon-phoenix block > for OpenEJB.
Fantastic! > i am having some problems with the avalon classloader. > > OpenEJB uses a custom java.net.URLStreamHandler that > manages resources of the form 'resource:/'. that handler > is contained within the openejb.jar file and gets > registered by setting the 'java.protocol.handler.pkgs' > system property. > > this happens before initializing any OpenEJB specific > component. > > allthough i am still having problems, loading files > from the SAR file using the 'resource:/' identifier. > it seems that the protocol handler wont be found, > allthough it is definitly within the block's SAR file. Yep. The problem is that each .sar file has it's own ClassLoader and this different from the System classloader (which is where the URLStreamHandler is loaded from). > i would appreciate it, if you could explain the > classloader system of avalon-phoenix a little > bit further. The ClassLoader arrangement is actually undergoing some change before the next release. However I will try to explain how it currently works. We currently have the system classloader that contains all the files in $PHOENIX_HOME/bin/phoenix-client.jar and $PHOENIX_HOME/lib/*.jar The Container classloader has system classloader as parent and loads all classes from $PHOENIX_HOME/bin/lib/*.jar Each Application/.sar file also has it's own classloader with system classloader as parent. In the future we plan to migrate to something like what is described at http://jakarta.apache.org/ant/myrmidon/classloader.html (Except replace Antlib with .sar file). We also plan to allow users to build their own ClassLoader hierarchy (which is more complex but may be useful for you). For an explanation of that have a look at http://jakarta.apache.org/avalon/excalibur/loader/ There are two options for you to fix your problem. You could extract the resource URL handler into another jar and place the jar in $PHOENIX_HOME/lib. However I would instead recomend that you change the OpenEJB code (if you have access to it) so that new URL( "resource:/x.txt" ); is replaced with getClassLoader().getResource( "/x.txt" ); This will be a lot more portable to different environments, should be backward compatible and should also work from within phoenix. -- Cheers, Peter Donald Sufficiently advanced science is indistinguishable from magic" -- Arthur C. Clarke -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
