ubuntu - java.lang.SecurityException: Expecting a sun.rmi.server.UnicastRef2 remote reference in stub -
i trying connect remote java process running on different machine using jconsole tool on ubuntu machine.
this how running java program in remote machine:
sudo java -dcom.sun.management.jmxremote.port=51082 -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -jar myfile.jar
i running jconsole command on machine this:
jconsole -debug -j-djava.util.logging.config.file=logging.properties
this logging.properties
file:
handlers = java.util.logging.consolehandler sun.rmi.level=finest .level = info java.util.logging.consolehandler.level = finest java.util.logging.consolehandler.formatter = \ java.util.logging.simpleformatter // use finer or finest javax.management.remote.level - finest // verbose... javax.management.level = finest javax.management.remote.level = finer
now on jconsle ui have given below properties:
when click on connect
button getting exception saying:
finer: [javax.management.remote.rmi.rmiconnector: jmxserviceurl=service:jmx:rmi:///jndi/rmi://my-remote-host:51082/jmxrmi] failed connect: java.lang.securityexception: expecting sun.rmi.server.unicastref2 remote reference in stub! java.lang.securityexception: expecting sun.rmi.server.unicastref2 remote reference in stub! complete stacktrace of exception per logs: jul 14, 2015 7:39:55 pm rmiconnector connect finer: [javax.management.remote.rmi.rmiconnector: jmxserviceurl=service:jmx:rmi:///jndi/rmi://my-remote-host:51082/jmxrmi] connecting... jul 14, 2015 7:39:55 pm rmiconnector connect finer: [javax.management.remote.rmi.rmiconnector: jmxserviceurl=service:jmx:rmi:///jndi/rmi://my-remote-host:51082/jmxrmi] finding stub... jul 14, 2015 7:39:55 pm sun.rmi.transport.tcp.tcpendpoint <clinit> fine: vmpanel.connect: localhostknown = true, localhost = 127.0.0.8 jul 14, 2015 7:39:55 pm sun.rmi.server.unicastref newcall fine: vmpanel.connect: connection jul 14, 2015 7:39:55 pm sun.rmi.transport.tcp.tcptransport <init> fine: vmpanel.connect: version = 2, ep = [127.0.0.8:0] jul 14, 2015 7:39:55 pm sun.rmi.transport.tcp.tcpendpoint getlocalendpoint fine: vmpanel.connect: created local endpoint socket factory null on port 0 jul 14, 2015 7:39:55 pm sun.rmi.transport.tcp.tcpchannel createconnection fine: vmpanel.connect: create connection jul 14, 2015 7:39:55 pm sun.rmi.transport.tcp.tcpendpoint newsocket finer: vmpanel.connect: opening socket [my-remote-host:51082] jul 14, 2015 7:39:55 pm sun.rmi.transport.proxy.rmimastersocketfactory createsocket fine: vmpanel.connect: host: my-remote-host, port: 51082 jul 14, 2015 7:39:58 pm sun.rmi.transport.tcp.tcpchannel createconnection finer: vmpanel.connect: server suggested 10.56.36.2:36585 jul 14, 2015 7:39:58 pm sun.rmi.transport.tcp.tcpchannel createconnection finer: vmpanel.connect: using 127.0.0.8:0 jul 14, 2015 7:39:58 pm sun.rmi.server.unicastref newcall finer: vmpanel.connect: create call context jul 14, 2015 7:39:58 pm sun.rmi.server.unicastref logclientcall finer: vmpanel.connect: outbound call: [endpoint:[my-remote-host:51082](remote),objid:[0:0:0, 0]] : sun.rmi.registry.registryimpl_stub[0:0:0, 0]: java.rmi.remote lookup(java.lang.string) jul 14, 2015 7:39:58 pm sun.rmi.transport.streamremotecall <init> finer: vmpanel.connect: write remote call header... jul 14, 2015 7:39:58 pm sun.rmi.transport.streamremotecall getoutputstream finer: vmpanel.connect: getting output stream jul 14, 2015 7:39:58 pm sun.rmi.server.unicastref invoke finer: vmpanel.connect: execute call jul 14, 2015 7:39:59 pm sun.rmi.transport.streamremotecall getinputstream finer: vmpanel.connect: getting input stream jul 14, 2015 7:39:59 pm sun.rmi.server.loaderhandler loadclass fine: vmpanel.connect: name = "javax.management.remote.rmi.rmiserverimpl_stub", codebase = "", defaultloader = sun.misc.launcher$appclassloader@530f243b jul 14, 2015 7:39:59 pm sun.rmi.server.loaderhandler loadclass finer: vmpanel.connect: class "javax.management.remote.rmi.rmiserverimpl_stub" found via defaultloader, defined null jul 14, 2015 7:39:59 pm sun.rmi.server.loaderhandler loadclass fine: vmpanel.connect: name = "java.rmi.server.remotestub", codebase = "", defaultloader = sun.misc.launcher$appclassloader@530f243b jul 14, 2015 7:39:59 pm sun.rmi.server.loaderhandler loadclass finer: vmpanel.connect: class "java.rmi.server.remotestub" found via defaultloader, defined null jul 14, 2015 7:39:59 pm sun.rmi.server.loaderhandler loadclass fine: vmpanel.connect: name = "java.rmi.server.remoteobject", codebase = "", defaultloader = sun.misc.launcher$appclassloader@530f243b jul 14, 2015 7:39:59 pm sun.rmi.server.loaderhandler loadclass finer: vmpanel.connect: class "java.rmi.server.remoteobject" found via defaultloader, defined null jul 14, 2015 7:39:59 pm sun.rmi.server.unicastref done fine: vmpanel.connect: free connection (reuse = true) jul 14, 2015 7:39:59 pm sun.rmi.transport.tcp.tcpchannel free fine: vmpanel.connect: reuse connection jul 14, 2015 7:39:59 pm sun.rmi.transport.tcp.tcpchannel free fine: vmpanel.connect: create reaper jul 14, 2015 7:39:59 pm sun.rmi.server.unicastref newcall fine: vmpanel.connect: connection jul 14, 2015 7:39:59 pm sun.rmi.transport.tcp.tcpchannel createconnection fine: vmpanel.connect: create connection jul 14, 2015 7:39:59 pm sun.rmi.transport.tcp.tcpendpoint newsocket finer: vmpanel.connect: opening socket [127.0.1.1:57675] jul 14, 2015 7:39:59 pm sun.rmi.transport.proxy.rmimastersocketfactory createsocket fine: vmpanel.connect: host: 127.0.1.1, port: 57675 jul 14, 2015 7:39:59 pm sun.rmi.server.unicastref newcall fine: rmi renewclean-[127.0.1.1:57675]: connection jul 14, 2015 7:39:59 pm sun.rmi.transport.tcp.tcpchannel createconnection fine: rmi renewclean-[127.0.1.1:57675]: create connection jul 14, 2015 7:39:59 pm sun.rmi.transport.tcp.tcpendpoint newsocket finer: rmi renewclean-[127.0.1.1:57675]: opening socket [127.0.1.1:57675] jul 14, 2015 7:39:59 pm sun.rmi.transport.weakref pin finer: vmpanel.connect: strongref = sun.rmi.transport.dgcimpl@63a1b509 jul 14, 2015 7:40:00 pm sun.rmi.transport.proxy.rmimastersocketfactory createsocket fine: rmi renewclean-[127.0.1.1:57675]: host: 127.0.1.1, port: 57675 jul 14, 2015 7:40:00 pm sun.rmi.transport.objecttable puttarget finer: vmpanel.connect: add object [0:0:0, 2] jul 14, 2015 7:40:00 pm sun.rmi.transport.connectioninputstream done finer: vmpanel.connect: send ack jul 14, 2015 7:40:00 pm sun.rmi.transport.tcp.tcpchannel newconnection fine: vmpanel.connect: reuse connection jul 14, 2015 7:40:00 pm sun.rmi.transport.tcp.tcpchannel free fine: vmpanel.connect: reuse connection jul 14, 2015 7:40:00 pm rmiconnector connect finer: [javax.management.remote.rmi.rmiconnector: jmxserviceurl=service:jmx:rmi:///jndi/rmi://my-remote-host:51082/jmxrmi] failed connect: java.lang.securityexception: expecting sun.rmi.server.unicastref2 remote reference in stub! java.lang.securityexception: expecting sun.rmi.server.unicastref2 remote reference in stub! @ javax.management.remote.rmi.rmiconnector.checkstub(rmiconnector.java:1871) @ javax.management.remote.rmi.rmiconnector.connect(rmiconnector.java:295) @ javax.management.remote.jmxconnectorfactory.connect(jmxconnectorfactory.java:268) @ sun.tools.jconsole.proxyclient.tryconnect(proxyclient.java:357) @ sun.tools.jconsole.proxyclient.connect(proxyclient.java:313) @ sun.tools.jconsole.vmpanel$2.run(vmpanel.java:292) jul 14, 2015 7:40:01 pm sun.rmi.server.unicastref newcall fine: rmi renewclean-[127.0.1.1:57675]: connection jul 14, 2015 7:40:01 pm sun.rmi.transport.tcp.tcpchannel createconnection
i not able figure out issue.
update:
i able connect remote host given port:
telnet my_remote_host 51082
as per this link, got response host without issues.
please use below settings . facing same issue resolved after having below settings
-dcom.sun.management.jmxremote -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -dcom.sun.management.jmxremote.port=9704 -djava.rmi.server.hostname=172.18.137.35 -dcom.sun.management.jmxremote.rmi.port=9704"
please note of djava.rmi.server.hostname , dcom.sun.management.jmxremote.rmi.port after settings ask insecure connection please accept yes can able connect (ill give error of "failed connect: java.lang.securityexception: expecting sun.rmi.server.unicastref2 remote reference in stub!"). hope
Comments
Post a Comment