3 Replies Latest reply on Jul 29, 2005 10:57 AM by denisius

    Deployment from standalone application.

    denisius

      Is it possible to deploy .ear to the running JBoss 4.0.2 server from other JVM (from standalone application)?

        • 1. Re: Deployment from standalone application.
          denisius

          I've found solution:

          public void doDeploy() {
          try {
          getServer().invoke(
           new ObjectName("jboss.deployment:flavor=URL,type=DeploymentScanner"),
           "addURL",
           new Object[] { "file:/E:/Work/ear/my_ear_name.ear" },
           new String[] { "java.lang.String" });
          } catch(Exception e) {}
          }
          //--------------
           private MBeanServerConnection getServer() {
           if (mBeanServer == null) {
           try {
           Properties props = new Properties();
           props.put("java.naming.factory.initial",
           "org.jnp.interfaces.NamingContextFactory");
           props.put("ava.naming.factory.url.pkgs",
           "org.jboss.naming:org.jnp.interfaces");
           props.put("java.naming.provider.url", "localhost:1199"); //jnp://
          
           InitialContext ctx = new InitialContext(props);
           mBeanServer = (MBeanServerConnection) ctx
           .lookup("jmx/invoker/RMIAdaptor");
           } catch (Exception e) {
           e.printStackTrace();
           mBeanServer = null;
           }
           }
           return mBeanServer;
           }
          


          • 2. Re: Deployment from standalone application.

            Or you could copy the file over if you have the server's deploy directory mapped to your machine via Samba or NFS or something...

            Or use FTP or HTML to upload the file, using the commons net library from apache...

            I do this sort of thing with Ant all the time (using a deploy target in an Ant script) which just uses the Ant copy target to copy over to a mapped drive.

            • 3. Re: Deployment from standalone application.
              denisius

              In my code after jboss restarting i need to run my_deployer again to make my ear file visible for server.
              Is it posssible to upload .ear file to jboss folder (not using ant)?