0

I am facing an issue when I am trying to set both jmx and rmi port to the same value. I added below two lines in my tomcat setenv.sh file but it was not having any effect because I saw rmiregistry was still running on default port 1099

CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=40000"
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.rmi.port=40000"

Then I removed the second line and from the java code I tried to set the connector port by adding below line

BrokerService.getManagementContext()
                    .setConnectorPort(40000);

After doing that change I dont see anything running on port 1099. But I see below error message

<> <> <> <> <> <org.apache.activemq.broker.jmx.ManagementContext> - <Failed to start JMX connector Cannot bind to URL [rmi://localhost:40000/jmxrmi]: javax.naming.NoPermissionException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.AccessException: Cannot modify this registry]. Will restart management to re-create JMX connector, trying to remedy this issue.>

Could you please give any idea why I am getting this error and what is the solution ? Please help

Thank you

Rahman
  • 3,755
  • 3
  • 26
  • 43
  • You can't bind to or unbind from a Registry that isn't running in the localhost. This is clearly stated in the documentation. – user207421 Mar 08 '22 at 23:18
  • @user207421 But I am running it in localhost. Could you tell me what needs to be done if i want to run both jmx and rmiregistry n the same port ? If you write a sample code that will be helpful – Rahman Mar 09 '22 at 17:53

0 Answers0