try {
Context context;
Hashtable <String, String> jndi = new Hashtable <String, String>();
jndi.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
jndi.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
jndi.put(Context.PROVIDER_URL, "172.60.0.126:1099");
context = new InitialContext(jndi);
MBeanServerConnection server = (MBeanServerConnection) context.lookup("jmx/invoker/RMIAdaptor");
server.invoke(new ObjectName("jboss.messaging:service=ServerPeer"),
"deployQueue",
new Object[] {queueName, "queue/" + queueName},
new String[] {"java.lang.String", "java.lang.String"});
} catch (Exception e) {
e.printStackTrace();
}
}