Can't connect to Tigase with JMX from JBOSS 7.x

為{幸葍}努か 提交于 2019-12-08 06:44:49

问题


I have a problem with connecting to Tigase with JMX from JBOSS 7.x.
For connection i use next code:

import java.util.Hashtable;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

JMXServiceURL u = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + HOST_NAME + ":" + PORT +  "/jmxrmi");
    Hashtable<String, Object> env = new Hashtable<String, Object>();
    String[] credentials = new String[] {"login","pass"};
    env.put(JMXConnector.CREDENTIALS, credentials);
    JMXConnector jmxConnector = JMXConnectorFactory.connect(u, env);

in tigase init.properties i've added

--monitoring=jmx:9050,http:9080,snmp:9060

in tigase start script for java options i've added

-Dcom.sun.management.jmxremote 
-Djava.rmi.server.hostname=< tigase host name >

And the interesting, that it's all works from simple java application, but doesn't work from jboss

i use java openJDK7 and JBOSS AS 7.0.2, and when i try to create connection, i get next error on JMXConnectorFactory.connect(u, env):

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: rmi://localhost:9050/jmxrmi -- service jboss.naming.context.java.rmi:."localhost:9050".jmxrmi
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:357)
    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)
    at com.mypackage.tigase.JMXTigaseConnector.checkConnection(JMXTigaseConnector.java:61)
    at com.mypackage.db_interlayer.StatusLayer.getListTaskStatus(StatusLayer.java:133)
    at com.mypackage.servlets.DashBoardServlets.doGet(DashBoardServlets.java:136)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at com.mypackage.servlets.LoginFilter.doFilter(LoginFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
    at java.lang.Thread.run(Thread.java:722)
 Caused by: javax.naming.NameNotFoundException: rmi://localhost:9050/jmxrmi -- service jboss.naming.context.java.rmi:."localhost:9050".jmxrmi
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
    at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1924)
    at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1891)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:274)
    ... 22 more

so, i don't understand why it's happening. Anyone else encountered with this problem? How to solve it?

Regards, Marina.

来源:https://stackoverflow.com/questions/20612245/cant-connect-to-tigase-with-jmx-from-jboss-7-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!