Hi, I've some queries re. multiple classloaders in Avalon... ..what I'm trying to do is this:
I have a main block which establishes a connection to a J2EE server (JNDI InitialContext). After login, based on user profile, a set of blocks get downloaded and deployed into this running instance. Till now, everything works fine. Now, one of these blocks (say, Block A) needs to lookup a session bean deployed in the application server using the InitialContext created by the main block. When it tries to lookup the Home interface of the EJB, it gets a ClassNotFoundException stating that the Home interface class is not found - even though the dependencies are coded correctly (the Home interface's .class file IS present in Block A's classpath). The only reason I could think of is that the classloaders are different for both of these blocks.. Block A's classloader is able to 'see' the Home interface, but the actual Class.forName() is being sent to the classloader that loaded the InitialContext (main block).. I tested this out by adding the home interface alone to the main block's classpath, then it works fine.. I understand that components will search their PARENT classloader for a class, but the situation here kindof needs a CHILD classloader to be searched. In a standard Java application, I'd have just added the Jar to the classpath and everyone will be able to see it... (having only a single classloader)... Is there any solution to this problem? Whatever options I could think of are listed below, any suggestions/any other solution will be definitely helpful: * Seperate the home interfaces into seperate Jars and load these into the main block's classpath.. ..I have tried it, this works fine, but this means that the ALL interface Jars will be downloaded irrespective of whether the user had access to a specific block.. For example, if there are two blocks in the application - Block A and Block B, and the user has access to Block A only, Block B's interfaces will still get loaded when it shouldn't. * Configure Merlin to use a 'shared' classloader between components... ..is this possible? If yes, what needs to be done? * Supply some kindof custom ClassLoader/ClassLoaderModel when deploying the block myself... ..is this possible? If yes, how do I do this (what I'm doing right now is m_containmentModel.addModel(url);)? Thanks, and Brgds, R. Saravanan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]