5 Replies Latest reply on Nov 11, 2002 1:41 PM by Michael Schoning

    problem with EAR files sharing their classes

    Michael Schoning Newbie

      I am trying to port a number of applications running on Websphere to Jboss, but I have run into a class loader problem.

      I have “utility / business classes” that are common in between my projects. But they are populated from different backend resources i.e. different instances of SAP and databases…

      In Websphere each application creates an instance of a property class called common properties ( this class is often extended by each app though). The common property class contains information on what data source to use, what Sap instance to log into and so on.

      The common property is implemented as a singleton so when a webapp instantiates it, it will read a property file, but any new instantiation will return the same object. This way my common classes get the property for the actual webapp that is using them.

      In JBoss however once one webapp has instantiated its common property class. That instance is available for all webapps, so when another webapp tries to insatiate its common property it will get a copy of the first instance of the common property class. So now all applications tries to access the same backend resources.

      I have in each ear files META-INF directory added a jboss-app.xml, where I try to give each app a unique repository as I thought this would make them not find classes from other earfiles. The content of the jboss-app.cml is :

      The common object classes are included in each WAR file, normally I only have one WAR per EAR.

      Is there anything else I can do to make the ear files not load classes from each other?