When running neo4j-admin
the below exception is thrown:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 3637; nested exception is:
java.net.BindException: Address already in use (Bind failed)
jdk.internal.agent.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 3637; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:491)
at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
Caused by: java.rmi.server.ExportException: Port already in use: 3637; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:243)
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412)
at java.rmi/sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at java.rmi/sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:234)
at java.rmi/sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:220)
at java.rmi/sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:180)
at jdk.management.agent/sun.management.jmxremote.SingleEntryRegistry.<init>(SingleEntryRegistry.java:49)
at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:836)
at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:479)
... 2 more
Caused by: java.net.BindException: Address already in use (Bind failed)
at java.base/java.net.PlainSocketImpl.socketBind(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:452)
at java.base/java.net.ServerSocket.bind(ServerSocket.java:395)
at java.base/java.net.ServerSocket.<init>(ServerSocket.java:257)
at java.base/java.net.ServerSocket.<init>(ServerSocket.java:149)
at java.rmi/sun.rmi.transport.tcp.TCPDirectSocketFactory.createServerSocket(TCPDirectSocketFactory.java:45)
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:670)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:324)
... 11 more
Cause
The issue occurs because neo4j-admin
launches a separate JVM. When neo4j-admin
is executed on the same system as a running Neo4j database instance, the neo4j-admin
JVM shares the same neo4j.conf
file by default. This includes port and address configurations for JMX which can cause a conflict with the running Neo4j process.
Solution
Here are two examples of how to address this situation by disabling JMX on neo4j-admin
:
- Set
JAVA_OPTS
- Disable JMX or change the port using the
JAVA_OPTS
environment variable before executing theneo4j-admin
command. For example,JAVA_OPTS=’-Dlog4j2.disable.jmx=true’; bin/neo4j-admin ...
- Disable JMX or change the port using the
- Create a separate configuration file
- Make a new directory for a separate configuration file to be used for
neo4j-admin
. For example,<neo4j home>/conf-admin/
. - Copy your current
neo4j.conf
into the new directory. - In the copied
neo4.conf
file, set thedbms.jvm.additional=-Dlog4j2.disable.jmx
totrue
. Or, if you wish to logneo4j-admin
events with JMX, assign a different (unused) port todbms.jvm.additional=-Dcom.sun.management.jmxremote.port
(With Neo4j 5.x, the configuration setting is renamed to "server.jvm.additional") - After these file edits, assign the directory path to the
NEO4J_CONF
environment variable when running theneo4j-admin
command.
- Make a new directory for a separate configuration file to be used for
Comments
0 comments
Please sign in to leave a comment.