[jboss-user] [Beginners Corner] - correctly packaging ear, war, har and ejb3 in jboss

cinzia do-not-reply at jboss.com
Thu Jan 11 12:00:21 EST 2007


Hi,

I know that some of this should go to a java forum, but I'd be grateful for any help on jboss-related issues. 

Can we state, from my understanding of JBoss class loading model (http://docs.jboss.com/jbossas/guides/j2eeguide/r2/en/html_single/#d0e1053), that:

1) duplication of classes across apllications in not allowed.
2) where multiple versions of the same jar are required by different applications, deployment-based scoping can be achieved by creating a loader repository with <loader-repository> in jboss-app.xml.

If this is correct, then I structure an ear in the following way:
     

  | application.ear
  |   lib/common-1.jar
  |   module-domain.har
  |   module-business.ejb3
  |   module-web.war
  |   META-INF
  |     MANIFEST.MF
  |     application.xml    -->list modules war and ejb3 
  |     jboss-app.xml    --> list module har 
  | 
  | module-domain.har
  |   META-INF
  |     MANIFEST.MF
  |     hibernate-service.xml
  |   com    --> structured classes dirs 
  | 
  | module-business.ejb3
  |   META-INF
  |     MANIFEST.MF    --> Class-Path: ./lib/common-1.jar 
  |   com   --> structured classes dirs 
  | 
  | module-web.war
  |   WEB-INF
  |     lib
  |     classes
  |     web.xml
  |     jboss-web.xml
  |   META-INF
  |     MANIFEST.MF    --> Class-Path: ./lib/common-1.jar
  | 

Things I'm not sure:

1) ejb3 archive uses classes in the har archive, are they visible once deployed? ejb and har use different class loaders but report to the same loader repository, so this should be a yes, right?

2) what do/don't include in the ear lib folder:a) don't: jars already in jboss default/lib directory, but should they be added to the MANIFEST Class-Path?
  |       b) don't: jars that might be used by future apps, instead place them in default/dir
  |       c) do: jars needed by the particular app.
  |       d) do: jars of a different version of those in default/lib, in this case add <loader-repository> to jboss-app.xml to achieve isolation.
  | 
  | 3) if I added to the above ear: lib/dom4j-1.6.1.jar, and added it to the MANIFEST Class-Path of one of the modules, then 
  |   | a) because default/dir has already a different version dom4j.jar I should add to jboss-app.xml: <jboss-app>
  |   |   |  <loader-repository>myappname.com:loader=application.ear</loader-repository>
  |   |   | </jboss-app>, correct?
  |   | 
  |   | b) does this mean that only dom4j classes will be looked in the HeirarchicalLoaderRepository3? And that only dom4j will be isolated? Or will this apply to all jars in application.ear/lib?
  | 
  | thanks for any help
  | cinzia

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000540#4000540

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000540



More information about the jboss-user mailing list