-
1. Re: ClassLoader configuration for multiple ESB archives
kconner Jan 28, 2009 5:53 AM (in response to joshua.dev)If it is just the classes contained within one of the esbs then you should take those out and place them with the "new" code.
Anything contained in a scoped class loader will not be visible outside of the scope. It is possible to handle these types of issues in other ways though, depending on what your real requirements are.
Can you tell us more about what you are trying to achieve? -
2. Re: ClassLoader configuration for multiple ESB archives
joshua.dev Jan 28, 2009 7:21 AM (in response to joshua.dev)Thanks for your answer Kevin. I actually drew the same conclusion reading some more documentation as you wrote:
Anything contained in a scoped class loader will not be visible outside of the scope
and therefore went ahead to change the architecture of my applications.
I was trying to achieve the following - having one of the scope-deployed ESB applications use a custom library for object conversion. The converter code is in a separately deployed JAR archive and was unable to convert one object to another, because it had no access to the classes from the ESB. I solved the issue by passing a ClassLoader instance from the calling code inside the ESB application to the converter object and using it there in Class.forName().
I was wondering however what are the possible ways to read a file (let's say a Java properties file) packaged inside an ESB archive. To reach it using standard "new File()" I would have to know the exact location of uncompressed .esb contents in application server's "deploy" folder. And to reach it using Class.getResource() I would have to use scope deployment (which may be undesirable) or otherwise I will get the same file for different ESB applications. -
3. Re: ClassLoader configuration for multiple ESB archives
kconner Jan 29, 2009 5:12 AM (in response to joshua.dev)Sounds like you need to use the thread context classloader. If this code is being executed on behalf of the ESB (through one of the services) then it will specify the classloader of the .esb deployment.
You can also use this to load files from that deployment, using the resource methods.