5 Replies Latest reply on Aug 4, 2008 2:44 PM by Wolfgang Knauf

    JSR 88 Sample

    S D Newbie

      Hello,

      I'm using JBoss 4.0.5. Am a newbie. I need to write a client that deploys and undeployes (WAR, EAR) archives to/from JBoss using JSR88.

      I need to know how I can create a deployment plan for
      javax.enterprise.deploy.spi.DeploymentManager.distribute() call. It won't take null (as some application servers do). Is there a way I can generate a deployment plan using JBoss tools or where can I get a deployment plan from? Currently, I have no idea what JBoss is expecting and the JBoss JSR88 Javadoc isn't very helpful.

      I've done this successfully before for WebLogic and OC4J.

      Thanks,
      Siddharth

        • 1. Re: JSR 88 Sample
          S D Newbie

          So I downloaded JBoss source and stepped through the deployer code, since there isn't much documentation to look at.

          Figures that you need to have a deployment-plan.xml file packed in a jar file and passed to the distribute method.

          I got a bit further but not much. Now, the issue I'm running into is that JBoss is throwing a file not found exception when clearly that file exists on the filesystem (it is a file that the JBoss deployer dynamically creates).

          Exception in thread "main" java.lang.RuntimeException: Operation Distribute failed on target org.jboss.deployment.spi.JMXTarget@1050e1f
          javax.management.MBeanException
          at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:180)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:163)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:266)
          at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
          at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
          at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
          at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
          at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
          at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
          at sun.rmi.transport.Transport$1.run(Transport.java:153)
          at java.security.AccessController.doPrivileged(Native Method)
          at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
          at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
          at java.lang.Thread.run(Thread.java:595)
          Caused by: java.io.FileNotFoundException: E:\Temp\WTemp\sdesai\HelloSGD
          at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:94)
          at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:103)
          at org.jboss.deployment.services.DeploymentManagerService.deploy(DeploymentManagerService.java:213)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
          ... 40 more

          at JBossManage.waitForTask(JBossManage.java:129)
          at JBossManage.main(JBossManage.java:57)

          On a hunch, I tried putting this file on the remote machine's filesystem and everything worked OK.

          So I'm wondering whether this is a bug or I need to add an environment variable/toggle a switch saying that i'm on a machine different from the one running the jboss server and connecting to it remotely.

          Can someone please help? I'm stuck :-(

          Thanks.

          • 2. Re: JSR 88 Sample
            Dimitris Andreadis Master

            jsr-88 isn't really interesting and there are even thought if it being dropped from the EE spec. Why not dealing directly with the MainDeployer API? It's simpler.

            • 3. Re: JSR 88 Sample
              S D Newbie

              Are you talking about org.jboss.deployers.spi.deployment.MainDeployer? This appears to be a JBoss 5 API. I'm on 4.0.5 (upgrading the version is not in my hands...)

              But really, if JBoss says they support JSR88, then it should be a proper implementation. The impression I get from the code is that it is except I can't get it to work thanks to complete lack of documentation or samples.

              • 4. Re: JSR 88 Sample
                Gunnar Hilling Newbie

                Hi,

                I think Dimitris referred to the org.jboss.deployment.MainDeployer which is in JBoss 4.x. It's running on every JBoss 4.x server.

                (Basic) usage: Feed the URL (file or remote) of the archive to be deployed to the deploy()-Method via jmx.

                Cheers,

                -Gunnar

                • 5. Re: JSR 88 Sample
                  Wolfgang Knauf Master

                  I had also the problem of not finding any samples for the client side of JSR88 deployment, so I digged through some JBoss testcase and added my findings to the JBoss wiki:

                  http://wiki.jboss.org/wiki/JSR88Client

                  Hope someone finds this useful

                  Wolfgang