Java VisualVM JMX connection in IBM Websphere - java

I am trying to monitor IBM Websphere using JVisualVM but i cannot connect.
Error Says "Cannot connect to using service:jmx:rmi:///jndi/rmi:///jmxrmi"
This is the first time were using IBM JDK in WAS. this is working smoothly on our old Solaris Server.
Specs and configuration.
IBM Websphere 8.0.0.5
Red Hat Linux
Java version = 1.6.0, Java Compiler = j9jit26, Java VM name = IBM J9
VM
JVM Args:
-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=19823 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Xgcpolicy:gencon -verbose:gc -Djava.rmi.server.hostname=
VISUALVM Error.
[com.sun.tools.visualvm.jmx.impl.JmxModelImpl]: connect(service:jmx:rmi:///jndi/rmi://<MYHOST>:19823/jmxrmi)
java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
Caused: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:728)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.DataOutputStream.flush(DataOutputStream.java:123)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:229)
Caused: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:304)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:118)
Caused: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:122)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1929)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1896)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287)
Caused: java.io.IOException: Failed to retrieve RMIServer stub
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369)
at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.tryConnect(JmxModelImpl.java:512)
[catch] at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.connect(JmxModelImpl.java:449)
at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.connect(JmxModelImpl.java:203)
at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.<init>(JmxModelImpl.java:192)
at com.sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.java:40)
at com.sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.java:21)
at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:91)
at com.sun.tools.visualvm.tools.jmx.JmxModelFactory.getJmxModelFor(JmxModelFactory.java:49)
at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.addJmxApplication(JmxApplicationProvider.java:261)
at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.createJmxApplication(JmxApplicationProvider.java:170)
at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationImpl(JmxApplicationsSupport.java:273)
at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationInteractive(JmxApplicationsSupport.java:250)
at com.sun.tools.visualvm.jmx.impl.AddJMXConnectionAction$1.run(AddJMXConnectionAction.java:60)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1393)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2005)
Checkings ive done.
expose the JMX port in the server. i can see that it is listening.
and i can even connect into in using telnet <19823> in my
laptop.
Im not seeing any error log in websphere side.

Got this issue resolved by trying to disable iptables in the linux.
then somehow, operations/support approved to open some default ephemeral ports for RMI to use.
Final JVM args is the below.
-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=PORT -Dcom.sun.management.jmxremote.rmi.port=PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=HOST
Thank you!

Related

OperatingSystemMXBean is not a valid MXBean interface error when deploying on WebSphere Application Server

When deploying and executing my aplication in WebSphere Application server the following error message is presented.
[6/1/21 17:44:24:958 CDT] 0000004e webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:141)
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:130)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.transform.cartridge.volpayreferencedatautil.VolPayReferenceDataUtilFunctions.addTimeLog(VolPayReferenceDataUtilFunctions.java:204)
at com.transform.flow.logaudit.LogAudit.Custom3Activity(LogAudit.java:100)
at com.transform.flow.logaudit.LogAudit.executeInternal(LogAudit.java:152)
at com.transform.flow.logaudit.LogAudit.run0(LogAudit.java:115)
at com.tplus.transform.runtime.AbstractMessageFlow.run(AbstractMessageFlow.java:157)
at com.tplus.transform.runtime.volante.MessageFlowVolante$1.run(MessageFlowVolante.java:75)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start0(DeclarativeTransactionalExecutor.java:137)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start(DeclarativeTransactionalExecutor.java:113)
at com.tplus.transform.runtime.volante.MessageFlowVolante.run(MessageFlowVolante.java:73)
at com.tplus.transform.runtime.proxy.MessageFlowProxy.run(MessageFlowProxy.java:32)
at com.transform.flow.logaudit_sys_debug_instr.LogAudit_Sys_Debug_Instr.Invoke1Activity(LogAudit_Sys_Debug_Instr.java:41)
at com.transform.flow.logaudit_sys_debug_instr.LogAudit_Sys_Debug_Instr.executeInternal(LogAudit_Sys_Debug_Instr.java:82)
at com.transform.flow.logaudit_sys_debug_instr.LogAudit_Sys_Debug_Instr.run0(LogAudit_Sys_Debug_Instr.java:53)
at com.tplus.transform.runtime.AbstractMessageFlow.run(AbstractMessageFlow.java:157)
at com.tplus.transform.runtime.volante.MessageFlowVolante$1.run(MessageFlowVolante.java:75)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start0(DeclarativeTransactionalExecutor.java:137)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start(DeclarativeTransactionalExecutor.java:113)
at com.tplus.transform.runtime.volante.MessageFlowVolante.run(MessageFlowVolante.java:73)
at com.tplus.transform.runtime.proxy.MessageFlowProxy.run(MessageFlowProxy.java:32)
at com.transform.flow.volantepaymentenginestartofprocess.VolantePaymentEngineStartOfProcess.Invoke4Activity(VolantePaymentEngineStartOfProcess.java:77)
at com.transform.flow.volantepaymentenginestartofprocess.VolantePaymentEngineStartOfProcess.executeInternal(VolantePaymentEngineStartOfProcess.java:325)
at com.transform.flow.volantepaymentenginestartofprocess.VolantePaymentEngineStartOfProcess.run0(VolantePaymentEngineStartOfProcess.java:300)
at com.tplus.transform.runtime.AbstractMessageFlow.run(AbstractMessageFlow.java:157)
at com.tplus.transform.runtime.volante.MessageFlowVolante$1.run(MessageFlowVolante.java:75)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start0(DeclarativeTransactionalExecutor.java:137)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start(DeclarativeTransactionalExecutor.java:113)
at com.tplus.transform.runtime.volante.MessageFlowVolante.run(MessageFlowVolante.java:73)
at com.tplus.transform.runtime.proxy.MessageFlowProxy.run(MessageFlowProxy.java:32)
at com.volantetech.volante.services.StartOfProcess.process(StartOfProcess.java:45)
at com.volantetech.volante.services.ApplicationStartupListener.contextInitialized(ApplicationStartupListener.java:218)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1837)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:443)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1249)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1591)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:708)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:1162)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:801)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2325)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5536)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5662)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2330)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:436)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:379)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:127)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:985)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:524)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)
Caused by: java.lang.IllegalArgumentException: com.sun.management.OperatingSystemMXBean is not a valid MXBean interface.
at java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:469)
at com.volantetech.volante.services.performance.log.LogTime.<init>(LogTime.java:23)
at com.volantetech.volante.services.performance.log.LogTime.<clinit>(LogTime.java:20)
... 57 more
The server is a RHEL with WebSphere 9.0.5.5 and java openjdk version "1.8.0_292"
The application is developed so it takes a message from a message queue and processes them. The message queue being used is IBM MQ 9.1.1.0. The application is taking the messages but not processing them correctly. The error is presenting on startup and also on execution.
Any guidance would be much valued.
It looks like the AppServer is using OpenJ9 while your application is being compiled with openjdk 1.8. Perhaps you are getting mismatch in the WAS ManagementFactory. Try "ps -fea" and check the jvm being used.
It was resolved by installing and configuring java JRE version 1.8 at Websphere execution level.

jvisualvm: Software caused connection abort: socket write error

When I want to profile a java programm started from eclipse with jvisualvm 1.3.8 I get the error message within eclipse console:
Software caused connection abort: socket write error.
This also happens when I start the program without eclipse (java -jar ...) from command line console. I tested jvisualvm from JDK 1.8.0_20 and downloaded the newest version 1.3.8. Here is the stacktrace:
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 15)
Profiler Agent: Established connection with the tool
Profiler Agent: Local accelerated session
Profiler Agent: Connection with agent closed
Profiler Agent Error: Exception when trying to send response or command to client:
java.net.SocketException: Software caused connection abort: socket write error
*** Profiler engine warning: class load hook invoked at inappropriate time for java.lang.Throwable$PrintStreamOrWriter, loader = null
*** This class will not be instrumented unless you re-run the instrumentation command
*** Please report this problem to feedback#profiler.netbeans.org
=============================== Stack trace =====================
*** Profiler engine warning: class load hook invoked at inappropriate time for java.lang.Throwable$WrappedPrintStream, loader = null
*** This class will not be instrumented unless you re-run the instrumentation command
*** Please report this problem to feedback#profiler.netbeans.org
=============================== Stack trace =====================
*** Profiler engine warning: class load hook invoked at inappropriate time for java.util.IdentityHashMap$KeySet, loader = null
*** This class will not be instrumented unless you re-run the instrumentation command
*** Please report this problem to feedback#profiler.netbeans.org
=============================== Stack trace =====================
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.util.IdentityHashMap.keySet(IdentityHashMap.java:976)
at java.util.Collections$SetFromMap.<init>(Collections.java:5512)
at java.util.Collections.newSetFromMap(Collections.java:5496)
at java.lang.Throwable.printStackTrace(Throwable.java:650)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at org.netbeans.lib.profiler.server.ProfilerServer.handleIOExceptionOnSend(ProfilerServer.java:1698)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:706)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
=============================== End stack trace =================
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at org.netbeans.lib.profiler.server.ProfilerServer.handleIOExceptionOnSend(ProfilerServer.java:1698)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:706)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
=============================== End stack trace =================
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at org.netbeans.lib.profiler.server.ProfilerServer.handleIOExceptionOnSend(ProfilerServer.java:1698)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:706)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
=============================== End stack trace =================
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeBytes(ObjectOutputStream.java:1985)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2168)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2007)
at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:869)
at org.netbeans.lib.profiler.wireprotocol.RootClassLoadedCommand.writeObject(RootClassLoadedCommand.java:159)
at org.netbeans.lib.profiler.wireprotocol.WireIO.sendComplexCommand(WireIO.java:301)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:703)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
Profiler Agent Error: Exception when handling command from client:
java.net.SocketException: Software caused connection abort: recv failed
Profiler Agent: Connection with agent closed
After this the port 5140 is opened by my application to be profiled. I googled a lot and could not find any help with this. I also wrote another simple program and the error occured as well.
What can I do?
I've encountered this a few times. What OS platform are you running this on? Windows? or *nix?
On Windows, you'll almost certainly need to run your Eclipse and/or the jvisualvm using Admin privs...I typically set up a command prompt, Run As ... Administrator.
On Linux, you'll need to be running Eclipse and/or jvisualvm as either root or with an account that has privs that match or exceed the account running the pid you are trying to monitor.
This is definitely a firewall issue. Most likely you will not have rights to disable your firewall if an OS is not asking you (Windows). In my case I had eventually ran the application on another box where I had rights to allow JVisualVM to connect to my application.

Why am I getting the error "connection refused" with JMX

I am unable to connect to JMX object. Here is how I create a JMX object:
public static void main(String... args) {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try {
ObjectName name = new ObjectName("org.javasimon.jmx.example:type=Simon");
if (mbs.isRegistered(name)) {
mbs.unregisterMBean(name);
}
SimonManagerMXBean simonManagerMXBean = new SimonManagerMXBeanImpl(SimonManager.manager());
mbs.registerMBean(simonManagerMXBean, name);
System.out.println("SimonManagerMXBean registerd under name: "+name);
} catch (JMException e) {
System.out.println("SimonManagerMXBean registration failed!\n"+e);
}
while (true) {
// waiting for connections
}
}
This is a code for connecting to the remote JMX object:
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://127.0.0.1:9999/jndi/rmi://127.0.0.1:1099/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
SimonManagerMXBean simonManagerMXBean = JMX.newMXBeanProxy(mbsc, new ObjectName("org.javasimon.jmx.example:type=Simon"), SimonManagerMXBean.class);
return simonManagerMXBean;
Unfortunatelly I receive the following error:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at my.code.RemoteSimonManagerFactoryImpl.createSimonManager(RemoteSimonManagerFactoryImpl.java:24)
at my.code.Demo.main(DemoAggregation.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:255)
... 9 more
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
... 14 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 19 more
If I try to connect to my JMX server (as to local process) using "jconsole" utility, I first get "ConnectionFailedSSL1" error, but when I click "Insecure" button in the error form, I connect successfully.
Both server and client are on the same computer.
I am using Windows 7 x64. Windows firewall is disabled.
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
Most likely you are not running your server with the right JVM parameters. Jconsole uses a different mechanism to find and to connect to local processes. Your client code is trying to use TCP/IP to connect to your server. To turn this on you'll need to add something like the following to your Java command line on your server:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
See: How to activate JMX on my JVM for access with jconsole?
As an aside, you might want to consider using my SimpleJMX library which does all this code for you. It includes a JMX client code as well.
I've manage run Tomcat with JMX (Tomcat 8, Windows) by:
add
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
run with admin permissions
I received the same error. In my case I was using a #PostConstruct annotation and that method was attempting to use the RMI connection before Spring had a chance to configure the connection.
It didn't end up being anything wrong with the configuration of the connection, just that I accidentally tried to use it before it was ready. Hope this might help someone.
check your tomcat's bin folder for catalina.sh file. open it up and find java server parameters. add thoose followings to $JAVA_OPTS on any line you want.
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
you are done!

WebService call with ClientAuth: recv failed on Tomcat, working on stand-alone app

I've turned on the SSL client authentication for the web services deployed on ServiceMix server. I have imported both client and server certificate. I've tested it with stand-alone application and everything was working fine. But when I try to call this web service from application deployed on the Tomcat, I get exception:
Caused by: java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:312)
at sun.security.ssl.InputRecord.read(InputRecord.java:350)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:893)
at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1689)
at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:122)
at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:972)
at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1083)
at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1002)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:282)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:523)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1087)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1916)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1871)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1934)
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 107 more
I've got recv failed message from stand-alone java app, when I failed to specify keyStore with client private key. The stack trace, however, was other:
Exception in thread "main" com.sun.xml.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.
java.net.SocketException: Software caused connection abort: recv failed
java.net.SocketException: Software caused connection abort: recv failed
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:172)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:144)
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:263)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:226)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:174)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)
at javax.xml.ws.Service.<init>(Service.java:56)
I've failed to read WSDL in that case. But on Tomcat, WSDL is read, but the error is thrown when CXF try to send the message.
What could cause that error on Tomcat? Is it the certificate problem? The Java variables pointing to both trustStore and keyStore are THE SAME in both cases:
javax.net.ssl.keyStoreType=jks
javax.net.ssl.trustStoreType=jks
javax.net.ssl.keyStore=c:/cert/gen.keystore
javax.net.ssl.trustStore=c:/cert/client.keystore
javax.net.ssl.keyStorePassword=changeit
javax.net.ssl.trustStorePassword=changeit
Java:
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)
Tomcat: 6.0.26
Even I used to get the same error. But when I do one of the following it doesn't occur
Restart the server.
Regenerate the certs.
Try to set all of these variables from the server side, meaning in Tomcat's server.xml file:
javax.net.ssl.keyStoreType=jks
javax.net.ssl.trustStoreType=jks
javax.net.ssl.keyStore=c:/cert/gen.keystore
javax.net.ssl.trustStore=c:/cert/client.keystore
javax.net.ssl.keyStorePassword=changeit
javax.net.ssl.trustStorePassword=changeit

CruiseControl cannot get web interface to work

On a fresh installation of CruiseControl, every single time I start CruiseControl, I get the following two exceptions thrown:
ontrollerAgent- Exception starting httpAdaptor
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
ontrollerAgent- Exception starting connectorServer
java.io.IOException: Cannot bind to URL [jrmp]: javax.naming.NameAlreadyBoundException: jrmp [Root exception is java.rmi.AlreadyBoundException: jrmp]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(Unknown Source)
Before and after these nothing seems to (obviously) go wrong. And as a result, I cannot view the web dashboard of CruiseControl. Any ideas on what is going wrong here?
Full stack traces:
[cc]Feb-25 16:33:49 ontrollerAgent- Starting HttpAdaptor with CC-Stylesheets
[cc]Feb-25 16:33:49 ontrollerAgent- starting httpAdaptor
[cc]Feb-25 16:33:49 ontrollerAgent- Exception starting httpAdaptor
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at mx4j.tools.adaptor.PlainAdaptorServerSocketFactory.createServerSocket (PlainAdaptorServerSocketFactory.java:24)
at mx4j.tools.adaptor.http.HttpAdaptor.createServerSocket(HttpAdaptor.java:672)
at mx4j.tools.adaptor.http.HttpAdaptor.start(HttpAdaptor.java:478)
at net.sourceforge.cruisecontrol.jmx.CruiseControlControllerAgent.start(CruiseControlControllerAgent.java:172)
[truncated]
[cc]Feb-25 16:33:49 ontrollerAgent- starting rmiRegistry
[cc]Feb-25 16:33:49 ontrollerAgent- Port 1099 is already in use, so no new rmiRe
gistry is started
[cc]Feb-25 16:33:49 ontrollerAgent- starting connectorServer
[cc]Feb-25 16:33:50 ontrollerAgent- Exception starting connectorServer
java.io.IOException: Cannot bind to URL [jrmp]: javax.naming.NameAlreadyBoundException: jrmp [Root exception is java.rmi.AlreadyBoundException: jrmp]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(Unknown Source)
at javax.management.remote.rmi.RMIConnectorServer.start(Unknown Source)
at net.sourceforge.cruisecontrol.jmx.CruiseControlControllerAgent.start(CruiseControlControllerAgent.java:190)
at net.sourceforge.cruisecontrol.Main.startJmxAgent(Main.java:137)
at net.sourceforge.cruisecontrol.Main.start(Main.java:115)
at net.sourceforge.cruisecontrol.launch.Launcher.run(Launcher.java:259)
at net.sourceforge.cruisecontrol.launch.Launcher.main(Launcher.java:117)
Caused by: javax.naming.NameAlreadyBoundException: jrmp [Root exception is java.
rmi.AlreadyBoundException: jrmp]
at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
at javax.naming.InitialContext.bind(Unknown Source)
at javax.management.remote.rmi.RMIConnectorServer.bind(Unknown Source)
... 6 more
Caused by: java.rmi.AlreadyBoundException: jrmp
at sun.rmi.registry.RegistryImpl.bind(Unknown Source)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
[truncated]
2010-02-25 16:33:50.710::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2010-02-25 16:33:50.850::INFO: jetty-6.1.11
2010-02-25 16:33:51.161:/dashboard:INFO: Initializing Spring root WebApplicationContext
Do you have any Java program still running at the time of CC starting?
As illustrated in this thread:
I've noticed when I restart cruisecontrol I need to kill any remaining java programs or a port class error will occur.
The solution is to:
Stop cruisecontrol
Kill any remaining cvs and java programs.
Wait 30 seconds.
Start cruisecontrol.
The OP bguiz adds in the comments his own recipe:
Stop CruiseControl
Kill any remaining cvs and java programs.
Restart computer,
sc delete CruiseControl,
wrapper -i wrapper.conf.
Start CruiseControl
It looks like you just have another application server running on your machine that uses the same ports as your cruise control server.
Do you deploy Cruise Control on a new server? What server is it?
Try to stop all the servers on your machine and try to launch cruise control again.
If you are using the windows service wrapper to launch CruiseControl, the RMI port is set to 1099 by default. You can alter this port by editing the wrapper.conf file in your CruiseControl installation directory. You might want to run 'netstat' at a command prompt to list all the ports your system is currently using. Then pick one that doesn't conflict with any other server or process.
Killing all other processes isn't always an option.

Categories

Resources