[jboss-user] [Beginners Corner] - obtaining MBeanServerConnection - classloading issues

akostadinov do-not-reply at jboss.com
Fri Sep 26 07:04:30 EDT 2008


Not sure I'm writing to the right place but anyways,

I want to obtain a MBeanServerConnection in an ant task to a remote jboss server.

My code is like:
ctx=new InitialContext(properties);
  | Object connection = ctx.lookup("jmx/rmi/RMIAdaptor");
  | 

When I run it putting jbossall-client.jar in classpath on jvm startup, then everything works fine. When I don't but instead tell apache-ant's "taskdef" task to include it in the new task's classpath (which IMO is the normal way to do it) then upon connection an exception is thrown:
anonymous wrote : javax.naming.NoInitialContextException: Cannot
  |  instantiate class: org.jboss.naming.NamingContextFactory [Root exception is jav
  | a.lang.ClassNotFoundException: org.jboss.naming.NamingContextFactory]

Now can I do something to make it work? I'm not referencing org.jboss.naming.NamingContextFactory in my code so it is used under the hood for whatever reasons. It is not the only such class. Can the thing trying to load that class, be instructed to regard the classloader created by apache-ant?

No secret, ant tasks are server:start/stop/config and my code is in jboss-server-manager.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179035#4179035

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4179035



More information about the jboss-user mailing list