3 Replies Latest reply on Sep 16, 2001 2:00 PM by p_d_austin

    Use of a jar file ????

    prashu

      Hi all,
      Generally, we make a jar file & place it in jboss\deploy directory.
      Also, we keep all the remote, home interfaces & bean class files in
      the web-inf\classes directory. And then we invoke the servlet to
      access the bean methods.
      Can anyone tell me whats the use of making a jar file & placing
      it in a deploy directory ??? I mean whats the use of zipping all
      interface files & bean class files in a jar when we already kept it in
      web-inf\classes directory !!!!! Coz, the servlet reads info from the
      web-inf\classes directory & not from the jar file, then whats the use
      of making a jar ???
      If I don't create a jar file & place all the classes files including
      home,remote interfaces & bean classes in web-inf\classes directory,
      will my servlet get invoked correctly ???
      My another doubt is, if I place only jar file in jboss\deploy folder
      & don't keep any home, remote interface or bean class files (except
      the client servlet) in the web-inf\classes directory, will my client
      servlet run perfectly ???? In short, what I wanna ask is that r these
      remote, home & bean classes necessarily be placed in the
      web-inf\classes directory ??

      Thanks & Regards,
      Prashant

        • 1. Re: Use of a jar file ????

          The need of placing the ejb interfaces & possibly helper classes (value objects, etc.) into the web archive is that the web archive could be deployed in another vm or even on an other physical machine and the servlets need direct access to the mentioned classes, which is granted if they are in the war.IMO its better to put the mentioned ejb classes into a jar and put it into the wars /lib directory than mixing it with the servlet classes in the /WEB-INF. U dont need to and should not put any ejb classes but the mentioned (i.e. no bean impl clasees, package protected classes etc.) into the war. The use of placing a jar in the deploy dir is that that jboss deploys all ejbs in this jar and makes them available for clients (standalone, servlet or whatever) all classes needed by the ejbs in it need to be inside of it. Jboss nor any other ejb server will deploy ejbs from a web archive - the classes there are only as the ejb client view for the servlet.

          • 2. Re: Use of a jar file ????
            prashu

            Hi lothar,
            If I place only jar file in jboss\deploy folder
            & don't keep any home, remote interface or bean class files (except the client servlet) in the web-inf\classes directory, will my client
            servlet run perfectly ???? In short, what I wanna ask is that r these remote, home & bean classes necessarily be placed in the web-inf\classes directory ??
            I m not using a war file.

            Regards,
            Prashant

            • 3. Re: Use of a jar file ????
              p_d_austin

              You must put the Home and Remote interfaces in your WEB-INF/classes directory so that tomcat/jetty can find the definition of these classes. This is true for the static contexts not deployed as part of a war file. If you war files and the scoped deployer you don't need to put them there.

              You must generate the jar file and deploy it in the deploy directory with the Home, Remote and Bean classes + any utility classes. This is how JBoss creates a container to run your bean in.

              Paul