9 Replies Latest reply on Jul 9, 2008 2:29 PM by Roshan

    How do I deploy shared jars in jboss 5?

    Roshan Newbie

      In 4.2.2 I created a folder under the deploy folder called shared libs.
      This folder contains all my shared jars that are used by different apps.
      It also contains a few service jars like

      1) persistence jar
      2) A jar contains Message Driven beans
      3) A Sar file which contains a JMX bean

      4.2.2 finds everything in there and deploys them nicely.
      These jars and other service objects are available from my web applications.
      I tried the same thing in 5.0 CR1. Nothing happens.
      I read about vfs but I couldn't figure out a way of making this work.

      It would be great if somebody could help me with this.
      Getting this to work is essential for me to be able to upgrade.

      Besides jdk6 doesn't work well with 4.2.2. I had issues deploying web services. The libraries in jboss clash with the jdk.

        • 1. Re: How do I deploy shared jars in jboss 5?
          Ales Justin Master

          What do you mean nothing happens?
          Did you check the debug log?

          There should be some info if things got picked up.
          e.g.

          2008-07-07 09:28:19,609 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] (HDScanner) Add deployment: vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/hello1.war
          2008-07-07 09:28:19,609 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] (HDScanner) Scheduling deployment: vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/hello1.war parent=null
          2008-07-07 09:28:19,609 DEBUG [org.jboss.deployers.plugins.deployers.DeployersImpl] (HDScanner) Deploying vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/hello1.war
          ...
          

          VFS should not be an issue here.

          Although we changed the classloading layer, things should not behave differently, since current usage is a mock of the old one.

          Provide more info, in order to get some exact help. ;-)

          • 2. Re: How do I deploy shared jars in jboss 5?
            Roshan Newbie

            Basically what I mean is the jars in the sub directory under deploy don't get picked up.
            The persistence entities don't get deployed.
            The JMX Bean doesn't ge deployed
            The
            They are not available to the web applications.

            I read this in the docs at
            http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/beta500/html/ch04s02.html



            JARDeployer : this bean is a structural deployment aspect which handles the legacy nested deployment behavior of adding non-deployable jars to the current deployment classpath.


            I kinda assumed that because of this not being enabled by default nested folders under deploy don't get loaded.
            Also it seems to indicate that standard jar files that do not contain any deployable artifact will not be added into the classpath even if they are put directly into the deploy folder



            • 3. Re: How do I deploy shared jars in jboss 5?
              Ales Justin Master

               

              "roshan_ail" wrote:

              The JMX Bean doesn't ge deployed

              Trying to mock you shared_lib/jmx deployment:

              2008-07-08 11:16:11,078 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] (main) Add deployment: vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar
              2008-07-08 11:16:11,078 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] (main) Scheduling deployment: vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar parent=null
              ...
              2008-07-08 11:16:11,093 DEBUG [org.jboss.deployers.plugins.deployers.DeployersImpl] (main) Deploying vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar
              ...
              2008-07-08 11:16:14,093 DEBUG [org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer] (main) Dynamic class root for vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar is vfsmemory://ae1fr-twdmps-fieaergb-1-fieaf6a5-t
              ...
              2008-07-08 11:16:14,390 DEBUG [org.jboss.classloader.spi.base.BaseClassLoader] (main) Created BaseClassLoader@15887db{vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar} with policy VFSClassLoaderPolicy@13f67a9{name=vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar domain=null roots=[MemoryContextHandler@28230754[path=classes context=vfsmemory://ae1fr-twdmps-fieaergb-1-fieaf6a5-t real=vfsmemory://ae1fr-twdmps-fieaergb-1-fieaf6a5-t/classes], DelegatingHandler@14616845[path=shared_libs/invoker-adaptor-test.sar context=file:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/ real=vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar]] delegates=null exported=[org.jboss.test.jmx.interceptors, META-INF, org.jboss.test.jmx.invoker] <IMPORT-ALL>NON_EMPTY}
              ...
              2008-07-08 11:16:41,187 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] (main) Added component jboss.test:service=InvokerTest to vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar
              2008-07-08 11:16:41,187 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] (main) Added component jboss.test:service=InvokerTest,type=XMBean to vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar
              2008-07-08 11:16:41,187 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] (main) Added component jboss.test:secured=true,service=InvokerTest to vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar
              ...
              2008-07-08 11:16:51,875 DEBUG [org.jboss.deployers.plugins.deployers.DeployersImpl] (main) Fully Deployed vfszip:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.CR2/server/default/deploy/shared_libs/invoker-adaptor-test.sar
              


              And the mbean is seen in JMX console:
               jboss.test
              
               * secured=true,service=InvokerTest
               * service=InvokerTest
               * service=InvokerTest,type=XMBean
              


              For jar to be _real_ jar - being picked up - it needs to have META-INF directory. See JARStructure deployer.

              • 4. Re: How do I deploy shared jars in jboss 5?
                Roshan Newbie

                Here is how I have my project setup.
                These are all maven 2 projects so dependency management is done automatically.

                I have a few projects that get compiled into jars which contains common functions.
                e.g. common.jar (Utility methods)

                I have a web app which depends on common, spring and a few other libs.

                My .m2/settings.xml file has a jboss.home variable defined.

                my webapp's pom file is set to create a lean war basically I don't want to include any of the dependent libs into the web-inf/lib folder.
                When I run mvn package on the webapp it copies all the dependencies
                into the JBOSS_HOME/deploy/common-libs folder.

                This setup works fine in 4.2.2.
                After getting 5.0 CR1, I changed the jboss.home variable in my settings.xml and jusr reran the maven scripts.

                I start up jboss and I get these errrors.


                
                4:43:30,927 INFO [TomcatDeployment] deploy, ctxPath=/semwebapp, vfsUrl=semwebapp.war
                4:43:30,960 WARN [TomcatInjectionContainer] could not find servlet class
                 org.springframework.web.servlet.DispatcherServlet
                 in classpath when processing annotations.
                4:43:30,977 WARN [TomcatInjectionContainer] could not find servlet class
                 org.directwebremoting.servlet.DwrServlet
                 in classpath when processing annotations.
                4:43:31,034 WARN [TomcatInjectionContainer] could not find servlet class
                 org.springframework.web.servlet.DispatcherServlet
                 in classpath when processing annotations.
                4:43:31,050 WARN [TomcatInjectionContainer] could not find servlet class
                 org.directwebremoting.servlet.DwrServlet
                 in classpath when processing annotations.
                4:43:31,086 INFO [[/semwebapp]] Marking servlet springDispatcher as unavailable
                4:43:31,093 ERROR [[/semwebapp]] Servlet /semwebapp threw load() exception
                ava.lang.ClassNotFoundException:
                 org.springframework.web.servlet.DispatcherServlet
                
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                 at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:162)
                 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
                 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
                 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4074)
                 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4384)
                 at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:346)
                 at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:139)
                 at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:431)


                There are a few other errors as well with mbeans
                I get this for the mbean
                ueue/DLQ DLQUser=null DLQMaxResent=5)
                4:41:30,151 ERROR [JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@1c64057(ra=org.jboss.resource.adapter.jms.JmsR
                sourceAdapter@5e79f428 destination=queue/TabularReportGenerator isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null
                maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queu
                /DLQ DLQUser=null DLQMaxResent=5)
                avax.naming.NameNotFoundException: TabularReportGenerator not bound
                 at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
                 at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
                 at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
                 at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                 at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
                 at javax.naming.InitialContext.lookup(InitialContext.java:392)
                 at org.jboss.util.naming.Util.lookup(Util.java:222)
                 at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:441)
                 at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:340)
                 at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:280)
                 at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:696)
                 at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
                 at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
                 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                



                • 5. Re: How do I deploy shared jars in jboss 5?
                  Ales Justin Master

                  Split your question into different forums.

                  The first error should go to Tomcat or Web forum.
                  - the workaround there would be to put Spring lib into (JBoss_Home)/server/(config)/lib

                  The second one to JCA, JMS or Messaging (in that particular order).

                  • 6. Re: How do I deploy shared jars in jboss 5?
                    Carlo de Wolf Master

                     

                    "alesj" wrote:
                    For jar to be _real_ jar - being picked up - it needs to have META-INF directory. See JARStructure deployer.

                    http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html
                    A JAR file is essentially a zip file that contains an optional META-INF directory.

                    Do your jars contain a META-INF directory?


                    • 7. Re: How do I deploy shared jars in jboss 5?
                      jaikiran pai Master

                       

                      It also contains a few service jars like

                      2) A jar contains Message Driven beans


                      javax.naming.NameNotFoundException: TabularReportGenerator not bound
                      at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
                      at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
                      at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
                      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                      at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
                      at javax.naming.InitialContext.lookup(InitialContext.java:392)
                      at org.jboss.util.naming.Util.lookup(Util.java:222)
                      at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:44
                      1)
                      at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:340)
                      at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:280)
                      at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java
                      :696)
                      at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
                      at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)


                      This might be related to http://jira.jboss.com/jira/browse/EJBTHREE-1199

                      • 8. Re: How do I deploy shared jars in jboss 5?
                        Ales Justin Master

                         

                        "wolfc" wrote:
                        "alesj" wrote:
                        For jar to be _real_ jar - being picked up - it needs to have META-INF directory. See JARStructure deployer.

                        http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html
                        A JAR file is essentially a zip file that contains an optional META-INF directory.

                        Do your jars contain a META-INF directory?

                        If it's exploded directory, known jar, or archive (by JarUtils::isArchive), then there is no need for META-INF:
                        - http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java

                        • 9. Re: How do I deploy shared jars in jboss 5?
                          Roshan Newbie

                          Maven takes care of creating the META-INF when it builds the jars.
                          So all the jars have META-INF in them.

                          As per your suggestion I posted the questions on the 2 forums

                          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=138718


                          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=138865