java - Error while invoking mbean in JBoss AS7 -
i trying invoke mbean jboss application using below code:
mbeanserver mbeanserver = managementfactory.getplatformmbeanserver(); objectname namingname = objectname.getinstance("naming"+namingport+":type=rmiregistry"); if (mbeanserver.isregistered( namingname)) mbeanserver.unregistermbean( namingname); mbeanserver.creatembean( "mx4j.tools.naming.namingservice", namingname, null, new object[] { new integer( namingport) }, new string[] { "int" }); mbeanserver.invoke( namingname, "start", null, null); //namingport = ((integer)mbeanserver.getattribute(namingname, "port")).intvalue(); string jndipath = "/jmxconnector"; int port = 9999; // management-native port string urlstring = system.getproperty("jmx.service.url","service:jmx:remoting-jmx://127.0.0.1:" + port); jmxserviceurl serviceurl = new jmxserviceurl(urlstring); //jmxserviceurl url = new jmxserviceurl("service:jmx:rmi://localhost/jndi/rmi://localhost:2099" + jndipath); jmxserviceurl url = new jmxserviceurl(urlstring); // create , start rmiconnectorserver jmxconnectorserver connectorserver = jmxconnectorserverfactory.newjmxconnectorserver( url, null, mbeanserver); connectorserver.start();
while executing code, getting below error in jboss console:
caused by: java.lang.linkageerror: loader constraint violation: loader (instance of org/jboss/modules/moduleclassloader) initiated loading diff erent type name "javax/management/mbeanserver" @ com.sample.app.mx4j.mx4jstandalonemanagement.preparembeanserver(mx4jstandalonemanagement.java:116) [sample-app.jar:] @ com.sample.app.basemanagement.getmbeanserver(unknown source) [sample-app.jar:] @ com.sample.app.basemanagement.unregistermbean(unknown source) [sample-app.jar:] @ com.sample.app.managedconnectionfactory.registermbean(unknown source) [sample-app.jar:] @ com.sample.app.managedconnectionfactory.<init>(unknown source) [sample-app.jar:] @ com.sample.app.xamanagedconnectionfactory.<init>(unknown source) [sample-app.jar:] @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) [rt.jar:1.7.0_80] @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:57) [rt.jar:1.7.0_80] @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) [rt.jar:1.7.0_80] @ java.lang.reflect.constructor.newinstance(constructor.java:526) [rt.jar:1.7.0_80] @ java.lang.class.newinstance(class.java:383) [rt.jar:1.7.0_80] @ org.jboss.as.connector.services.resourceadapters.deployment.abstractresourceadapterdeploymentservice$abstractas7radeployer.initandinject(abstractreso urceadapterdeploymentservice.java:495) ... 9 more
what reason of error?
Comments
Post a Comment