1 Reply Latest reply on Nov 23, 2005 12:18 AM by jaikiran

    JBoss 4.0.3-SP1 - Where should i place common files for "jar

    vijpan

      Hi,

      I have an ear which has an ejb module and a war. I am not making use of Hibernate MBean. I am initializing the Hibernate through a Struts plugin with a help of utility class as HibernateUtil. This HibernateUtil is present in the "war" as the struts plugin needs it. All the DAO's which are running behing an ejb need to get hold of HibernateUtil. The problem arises if i package this class in both jar and war, this class is again reloaded in jar and hence the whole initialization of Hibernate takes place. If i take out the class from the "jar" then we have class not found error. My query is how we can have some classes which once loaded in an ear should not be loaded again either by war or jar, like if they got loaded in war and then same should get used by jar and also vice versa?

      Any hint will be highly appreciated.
      Thanks

        • 1. Re: JBoss 4.0.3-SP1 - Where should i place common files for
          jaikiran

          My suggestion would be, Dont place the HibernatUtil classes in the war. Create a jar for the HibernateUtil classes(if you already have a jar created, then you can place these classes in that jar). Place this jar in the ear. So your ear struture would look like:

          MyApp.ear
          |___________ MyApp.war
          |
          |___________ MyApp.jar(contains the HibernateUtil classes and may be some other classes used in the application)

          Then in the application.xml file (present in the META-INF directory) make an entry as follows:

          <module>
           <java>MyApp.jar</java>
           </module>