I get a NullPointerException every now and then in my Embedded Jetty application:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jetty.jmx.ObjectMBean.getAttribute(ObjectMBean.java:349)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1445)
...
Caused by: java.lang.NullPointerException
at org.eclipse.jetty.server.handler.ContextHandler.isShutdown(ContextHandler.java:682)
... 28 more
I have set up JMX like this:
Server server = new Server();
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
MBeanContainer mbContainer = new MBeanContainer(mBeanServer);
server.addBean(mbContainer);
This happens randomly (not always) at server startup and only if I have my Prometheous JMX Exporter running on the same machine, most likely connecting to the JMX server at a phase when Jetty is not quite ready to handle the connection.
Any ideas how to fix this?
The JMX exporter should be gracefully handling the error, so you shouldn't have to worry on the JMX side.
Looking at the jetty code, that's just a synchronised accessor so I don't see how you can get an NPE out of it. Presumably the object is null, so this is likely worth filing a bug against jetty.
Related
I am working with Elastic Search 5.5.0 on Spring boot 1.5.8.RELEASE using the Java Transport Client library.
The Elastic Search was deployed with docker in a container. It works well. The queries from my java application works well too.
The problem is that the Elasticsearch Health check failed almost every time when Spring boot started from my local machine as the following exception says. I didn't call any health check explicitly in my application.
How can I remove the health check every time on start up or are there any way of passing the health check?
Thanks.
20180201 09:04:12.499 [restartedMain] INFO c.k.a.Application - Log info On
20180201 09:04:12.499 [restartedMain] WARN c.k.a.Application - Log warn On
20180201 09:04:12.499 [restartedMain] ERROR c.k.a.Application - Log error On
20180201 09:04:15.628 [RMI TCP Connection(9)-10.10.20.187] WARN o.s.b.a.h.ElasticsearchHealthIndicator - Health check failed
org.elasticsearch.ElasticsearchTimeoutException: java.util.concurrent.TimeoutException: Timeout waiting for task.
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:71)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:58)
at org.springframework.boot.actuate.health.ElasticsearchHealthIndicator.doHealthCheck(ElasticsearchHealthIndicator.java:52)
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:35)
at org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean.getData(DataEndpointMBean.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1252)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1246)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1085)
at org.springframework.jmx.export.SpringModelMBean.invoke(SpringModelMBean.java:90)
at javax.management.modelmbean.RequiredModelMBean.getAttribute(RequiredModelMBean.java:1562)
at org.springframework.jmx.export.SpringModelMBean.getAttribute(SpringModelMBean.java:109)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1445)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:639)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.TimeoutException: Timeout waiting for task.
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:232)
at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:67)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:69)
... 47 common frames omitted
You can disable the Elasticsearch health check by adding the following line to your application.xml file
management.health.elasticsearch.enabled: false
When I went deep into the same issue happening in my sprint boot app too, I found that elasticsearch health check use org.elasticsearch.client.RestClient but I was using org.elasticsearch.client.RestHighLevelClient and had created Bean for the same.
In case you want to keep the recurring elasticsearch's healthcheck,
Create a Bean for RestClient using the right host and port.
Or add following entry in app config yml/xml to remove healthcheck itself:
management.health.elasticsearch.enabled: false
disable the health indicator auto configuration
#SpringBootApplication(exclude = {
ElasticSearchRestHealthIndicatorAutoConfiguration.class
})
public class YourApplication
Disable elastic search health check. Mention this property in your yml/xml file
management.health.elasticsearch.enabled=false
Monitoring Spring boot application(TestMonitoring) using JMX exporter and Prometheus. Prometheus and spring boot application Pods are up and running in kubernetes cluster.
Now the pain is to get JMX exporter running and the application should expose metrics via JMX.
In TestMonitoring application , the application.properties file has the following setting:
endpoints.jmx.enabled=true
spring.jmx.enabled=true
Now how to install the JMX exporter as an agent:
i have download the jar and executed:
java -javaagent:./jmx_prometheus_javaagent-0.9.jar=1234:config.yml
In the config.yml -> the following hostPort:xx.x.x.x:30001 (target port of myspring boot application which is available as a service)
The following exception is thrown:
Sep 22, 2017 4:12:31 PM
io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector collect
SEVERE: JMX scrape failed: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [R oot exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:370)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:268)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxScraper.doScrape(JmxScraper.java:106)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.collect(JmxCollector.java:401)
at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry.collectorNames(CollectorRegistry.java:99)
at io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry.register(CollectorRegistry.java:50)
at io.prometheus.jmx.shaded.io.prometheus.client.Collector.register(Collector.java:128)
at io.prometheus.jmx.shaded.io.prometheus.client.Collector.register(Collector.java:121)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:142)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:204)
at javax.naming.InitialContext.lookup(InitialContext.java:415)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1928)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1895)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287)
What could be the reason of the such exception,Just not able to figure it? any suggestions will be very helpful
Try https://github.com/fabric8io/agent-bond
It works fine.
Use it like this:
-javaagent:/opt/agent-bond/agent-bond.jar=/etc/config/agent-bond.properties
I wrote a program using Processing(which uses jogl and gluegen), and am using PApplet to run it in a java application in NetBeans.
I am unable to run my program (by running the jar) outside the IDE - neither on my local windows 64-bit machine using command line, nor on a external linux server (which is where I would like to run the program) using X11 forwarding
I previously was able to run the program via command line on my windows machine, but ran into trouble after testing on the linux server. I think there may have been some issues with paths or something after I downloaded the linux versions of the same jars
This is the error I receive from the linux machine:
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z
at jogamp.common.jvm.JVMUtil.initialize(Native Method)
at jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:58)
at com.jogamp.common.os.Platform$1.run(Platform.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
at processing.opengl.PJOGL.initSurface(PJOGL.java:250)
at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:6310)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1653)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Thread.java:724)
this is the error I get from trying to run the jar on my machine using command line:
java.lang.NoSuchMethodError: com.jogamp.common.nio.Buffers.slice2Float(Ljava/nio
/Buffer;[FII)Ljava/nio/FloatBuffer;
at jogamp.opengl.ProjectFloat.<init>(ProjectFloat.java:181)
at jogamp.opengl.ProjectFloat.<init>(ProjectFloat.java:167)
at jogamp.opengl.ProjectFloat.<init>(ProjectFloat.java:163)
at javax.media.opengl.glu.GLU.<init>(GLU.java:164)
at processing.opengl.PJOGL.<init>(PJOGL.java:218)
at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744
)
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:518)
at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at processing.core.PApplet.makeGraphics(PApplet.java:1919)
at processing.core.PApplet.size(PApplet.java:1771)
at processing.core.PApplet.size(PApplet.java:1742)
at noblis.farag.MySketch.setup(MySketch.java:132)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Animation Thread" java.lang.RuntimeException: com.jogamp.co
mmon.nio.Buffers.slice2Float(Ljava/nio/Buffer;[FII)Ljava/nio/FloatBuffer;
at processing.core.PApplet.makeGraphics(PApplet.java:1944)
at processing.core.PApplet.size(PApplet.java:1771)
at processing.core.PApplet.size(PApplet.java:1742)
at noblis.farag.MySketch.setup(MySketch.java:132)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Unknown Source)
Any idea about why I can run it in the IDE but not outside? or any way to package it so that it can run outside the IDE?
thanks
we have axis2 (1.5.1)web service deployed on weblogic 11g running on jrockit 1.6._024/linux boxes.
we get <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1342771457231> <BEA-101020> <[ServletContext#470808509[app:npv-websvc module:/ path: spec-version:null]] Servlet failed with Exception
java.lang.NullPointerException
at org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source)
at org.apache.xerces.dom.ParentNode.item(Unknown Source)
at com.ibm.wsdl.util.xml.DOM2Writer.print(Unknown Source)
at com.ibm.wsdl.util.xml.DOM2Writer.print(Unknown Source)
at com.ibm.wsdl.util.xml.DOM2Writer.print(Unknown Source)
at com.ibm.wsdl.util.xml.DOM2Writer.print(Unknown Source)
Axis2 JIRA had a recommended bug fix (URL below) but this is happening more frequently after we upgraded weblogic 9 to weblogic 11g. any patch recommended by oracle ?
The above null pointer does a stack overflow and the whole weblogic instance comes down.
https://issues.apache.org/jira/browse/AXIS2-4517
Appreciate experts help here !
I am trying to run JBoss Profiler(jboss-profiler-2.0.0.Beta5) on my JBoss AS5.0 for a web application made on RF3.3
I followed all the steps mentioned in the JBoss profiler user guide:-
Copy jboss-profiler.jar to jbossas/bin
• Copy jboss-profiler.properties to jbossas/bin
• Edit jboss-profiler.properties in jbossas/bin to include the classes to be profiled
• Copy jboss-profiler-plugins.jar to jbossas/bin
• Edit run.conf (Unix) or run.bat (Windows) in jbossas/bin to include JBoss Profiler in JAVA_OPTS
• Copy jboss-profiler.sar to jbossas/server/<conf>/deploy
• Boot application server
Include the following in JAVA_OPTS
-javaagent:jboss-profiler.jar -Djboss-profiler.properties=jboss-profiler.properties
Post this I started my JBoss AS.The MBean is getting registered and I am able to see the MBean also..During startup I observe that Profiler is taking entry as IP(say 10.10.10.10) and port 5400 whereas I had specified 8080 in the jboss-profiler.props file.
Now when I navigate to 10.10.10.10:8080/jboss-profiler I get 404 page not found.
When I navigate to 10.10.10.10:5400/jboss-profiler I get exception as:-
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jboss.remoting.transport.socket.ServerThread.createServerSocketWrapper(ServerThread.java:907)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:489)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
Caused by: java.io.StreamCorruptedException: invalid stream header: 47455420
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:782)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.<init>(ObjectInputStreamWithClassLoader.java:97)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.createInput(JavaSerializationManager.java:54)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.getMarshallingStream(SerializableUnMarshaller.java:7
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.getMarshallingStream(SerializableUnMarshaller.java:5
at org.jboss.remoting.transport.socket.ClientSocketWrapper.createInputStream(ClientSocketWrapper.java:179)
at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:162)
at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:66)
at org.jboss.remoting.transport.socket.ServerSocketWrapper.<init>(ServerSocketWrapper.java:46)
... 7 more
When I tried running the command java -jar jboss-profiler-client.jar from commandprompt it says
org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://localhost:5400/]
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:579)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.remoting.Client.invoke(Client.java:536)
at org.jboss.profiler.client.cmd.Client.main(Client.java:281)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:192)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:827)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:569)
... 5 more
Can anyone PLEASE GUIDE ME HOW TO SETUP PROFILER....
The same doubt is also posted on JBoss forum.
https://community.jboss.org/message/743228#743228