[
http://jira.jboss.com/jira/browse/JBIDE-1291?page=comments#action_12397969 ]
Juergen Zimmermann commented on JBIDE-1291:
-------------------------------------------
The Java solution for undeploy (same procedure for deploy and redeploy):
package de.hska.util;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Hashtable;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class Undeploy {
private static String DEPLOY_PATH = System.getenv("JBOSS_HOME") +
File.separatorChar +
"server" + File.separatorChar +
"default" + File.separatorChar +
"deploy" + File.separatorChar;
private static String EAR = "myapp.ear";
public static void main(String[] args) throws URISyntaxException, NamingException,
InstanceNotFoundException, MalformedObjectNameException, MBeanException,
ReflectionException, NullPointerException, IOException {
String ear = DEPLOY_PATH + EAR;
File earFile = new File(ear);
URI uri = earFile.toURI();
URL url = uri.toURL();
Hashtable<String, String> env = new Hashtable<String, String>();
env.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.factory.url.pkgs", "org.jboss.naming");
env.put("java.naming.provider.url", "localhost");
InitialContext ctx = new InitialContext(env);
MBeanServerConnection server = (MBeanServerConnection)
ctx.lookup("jmx/invoker/RMIAdaptor");
// JMX operations: "redeploy", "deploy", "undeploy"
server.invoke(new ObjectName("jboss.system:service=MainDeployer"),
"undeploy", new Object[] { url }, new String[] { "java.net.URL" });
}
}
Utilize JMX DeploymentScanner to ensure proper deployment
---------------------------------------------------------
Key: JBIDE-1291
URL:
http://jira.jboss.com/jira/browse/JBIDE-1291
Project: Tools (JBoss Tools)
Issue Type: Feature Request
Components: JBossAS
Affects Versions: 2.0.0.CR1
Reporter: Max Andersen
Assigned To: Rob Stryker
Priority: Critical
Fix For: 2.1
Jmx DeploymentScanner has suspendDeployment() and resumeDeployment() which could be
usefull to call before/after deployment.
See:
http://docs.jboss.org/jbossas/javadoc/4.0.4/system/org/jboss/deployment/s...
addURL() could be used to have our own eclipse workspace local deployment which won't
pollute existing configurations.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira