1 Reply Latest reply on Oct 29, 2003 7:42 PM by jonlee

    How to organize my deployment .jar files?

    arabin

      I'd like to know how I need to organize my classes and .jar files.
      I have a startup class A.class, that is used in user-service.xml for automatic startup. That means that I need to put my .jar file containing A.class into jboss-home\server\default\lib directory. Do I ALSO need to put it into jboss-home\server\default\deploy directory? Or just in one place - jboss-home\server\default\lib?
      This class uses class B.class. Where should the .jar file, containing B.class, be located?
      Should it be located in jboss-home\server\default\lib or in jboss-home\server\default\deploy? Or in both?

      Basically, .jar files with what exactly classes should be located in jboss-home\server\default\lib and .jar files with what exactly classes should be located in jboss-home\server\default\deploy?

      Another question. I could have just one combined .jar file with all classes, located in both directories. Can I split it somehow? Am I allowed to have several .jar files under jboss-home\server\default\deploy? Under jboss-home\server\default\lib?
      Can I split it to several .jar files? Where exactly do I put them? In both places?
      For instance, I split it to two .jar files. Do I need to put both into both places?

      Can I put several classes into several different .jar files? Like if I put A.class into both B.jar and C.jar into jboss-home\server\default\deploy, will I have any problems? Like trying to redeploy certain things twice? Like EJBs or Message Driven Beans?

      Can you give me any explanations on those questions? I am definitely doing something wrong. At this point the only way I succeed is to put everything into ONE .jar file, and put it into both directories. I can live with it, but that is not what I want.

      I do not want to duplicated files unnecessarily into two directories, and I do not want conflicts between different files, between EJBs and MDBs. But I want all my EJBs and MDBs to be deployed correctly. At the same time I want to put as small amount of files as possible into jboss-home\server\default\lib directory (moving the rest to jboss-home\server\default\deploy), and I also want to split my .jar file in jboss-home\server\default\deploy directory into several .jar files, related to different packages.

      Please give my some kind of guidelines to do that. Thanks

        • 1. Re: How to organize my deployment .jar files?
          jonlee

          It is possible that you want to actually package a SAR with whatever MBean configurations you have in there under META-INF/jboss-service.xml instead. You could then place your helper libraries in the SAR. Have a look at the SARs for standard JBoss componets such as Tomcat to get an idea of the packaging and the Tomcat MBean. You can split things as necessary into separate JARs within the SAR. Again look at the way Tomcat is bundled into the SAR deployment.

          There are certain physical constraints you might encounter that prevents you from placing all your JARs in the SAR. For example, STRUTS is known to have some problems undeploying under certain conditions so you may out of necessity need to place such libraries in server/default/lib or whatever is appropriate for your run-time instance. This will allow undeployment of services or dynamic redeployment.

          Helper libraries (ones that do not play any direct component role - e.g. not an EJB) should not be placed in the deploy directory. The deploy directory is really for J2EE components. You may be lucky in the current JBoss implementation that these JARs are loaded, however, it is not specifically guaranteed that this will occur in the future.

          Hope that gives you a starting point.