K Erlandsson
K Erlandsson

Reputation: 13696

Error: Exception thrown by the agent : java.lang.NullPointerException when starting Java application

I am starting a Java application with the following command line arguments:

java -Dcom.sun.management.jmxremote.port=12312 \
     -Dcom.sun.management.jmxremote.rmi.port=12313 \
     -Dcom.sun.management.jmxremote.authenticate=false \
     Main

My program exits immediately and I get the following error:

Error: Exception thrown by the agent : java.lang.NullPointerException

I am using Java 8 update 45 on Windows 7:

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Upvotes: 10

Views: 5891

Answers (2)

K Erlandsson
K Erlandsson

Reputation: 13696

This error occurs if com.sun.management.jmxremote.rmi.port is set to a port that is already in use. Try setting the property to a free port or killing the process that is currently using the port in question.

There is a reported bug here in Open JDK to improve this error message. It is fixed in Java 8 update 60 and Java 7 update 80.

Upvotes: 18

user1793528
user1793528

Reputation: 1

I was facing same issue. After killing older process using same JMX port, issue got resolved and tomcat started properly.

Upvotes: 0

Related Questions