• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

J2EE Visibility, Class Loaders and other fun stuff

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, hows it going? I am working on a lovely little framework that provides functionality around lots of disparate areas, such as connecting to LDAP, a Data Access Layer, EJB lookups, logging, exception handling, integration with Struts etc etc. Anyway, it is deployed as a single JAR, with lots of 'singletons' (actually classes with static functionality), most of which are configured by one or more XML files.
My problem is this: For any given Enterprise Application (EAR), my framework is to be used at both the EJB level, and by numerous web applications, but each module requires its own completely different set of XML configuration files. Because of J2EE visibility class loader ordering, the only way I could achieve this on WebSphere was to do as follows:
- deploy the framework JAR at the EJB level
- deploy it again in the WEB-INF/lib directory of each web app that uses it
- Set the system property of the Application Server com.ibm.ws.classloader.warDelegationMode to false, which instructs the web app class loader to try itself first, rather than instantly delegate to its parent (the EJB/Dependency class loader)

I think that sets a new record for being both crap, and amazingly, simultaneously sh*t.
My questions are as follows:
1. Is there any way to deploy my framework JAR just once at the EJB/dependency level, and still get each web application class loader to load the framework classes in their own class loader space
2. How do other frameworks get around this problem? For instance, if I deployed the log4j JAR at the EJB/Dependency level with a copy of log4j.properties for EJB's to use, could I still put other configurations of log4j.properties in individual web applications (without also putting the log4j JAR in each application) and expect those web applications to work off their own property file rather than the EJB/dependency one? And if so, how did log4j do it?
2 and a half. The Jakarta Struts framework would be another good example. An Enterprise Application may have several web applications, each with its own XML configuration. If the struts JAR was deployed just once at the EJB/Dependency level, presumably there would be only one copy of the ActionServlet class loaded (and hence one copy of XML, since ActionServlet stores the configuration) between all web applications. So does the Struts JAR need to be deployed in every single web application? If not, how do they get around this problem?
2 and eight ninths. How could I go about getting individual EJB deployments within a single enterprise application, to also work off their own unique version of the framework (and hence their own copy of the XML configurations)
Thanks in advance, *250,000 dollars to anyone who proffers good advice, Alan
* - offer of cash will not be honouredcom.ibm.ws.classloader.warDelegationModefalse
 
reply
    Bookmark Topic Watch Topic
  • New Topic