所以当我尝试从jconsole连接到jmx时,我得到了这个异常:
@H_301_2@Caused by: java.rmi.ConnectException: Connection refused to host: 78.84.17.116; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
...
我试图在jconsole中连接到这样的url:service:jmx:rmi:/// jndi / rmi://78.84.17.116:43030 / test
我的jmx弹簧配置:
@H_301_2@<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:mbean-server /> <bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter"> <property name="server" ref="jmxServer" /> <property name="assembler"> <bean class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler"> <property name="attributeSource"> <bean class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" /> </property> </bean> </property> <property name="beans"> <map> <entry key="SpringBeans:name=hibernateStatisticsMBean" value-ref="hibernateStatisticsMBean" /> </map> </property> </bean> <bean id="jmxServer" class="org.springframework.jmx.support.MBeanServerfactorybean" p:locateExistingServerIfPossible="false" /> <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerfactorybean" depends-on="rmiRegistry" p:objectName="connector:name=rmi" p:serviceUrl="service:jmx:rmi://78.84.17.116/jndi/rmi://localhost:43030/test" /> <bean name="hibernateStatisticsMBean" class="org.hibernate.jmx.StatisticsService"> <property name="statisticsEnabled" value="true" /> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="rmiRegistry" class="org.springframework.remoting.rmi.RmiRegistryfactorybean"> <property name="port" value="43030" /> </bean> </beans>我认为jconsole不想连接到这个jmx服务器的错误是什么? jmx url最后测试的是什么意思?我只是在教程中看到它,所以我在我的网址中写了相同的内容.
编辑1:
当我在服务器上运行netstat -ntlp时,我得到了这个:
tcp6 0 0 ::: 10099 ::: * LISTEN 10754 / java
10754是正确的java应用程序.那是对的吗?在10099上运行telnet .. *.*我收到一条消息,它也连接到它.所以我猜这不是服务器端的防火墙?
编辑2:
好吧,我现在正在尝试(并且在服务器上也抛出异常)在我的本地环境(在Eclipse中)运行应用程序,我猜测它不是服务器问题,因为所有相同的事情都发生了.
这个问题可能在配置中吗?有人可以验证我的配置是否正确?
编辑3:
每当我启动应用程序时,我都会得到这个.我猜这就是问题所在.它发生在服务器和我的机器上..