JMXConnectorServer.start() causes java.rmi.AccessException

Hi all,

I've already posted this message to the tomcat mailing list as well as to the jmx forum, but without any result.

I've a web service running inside tomcat which

creates the jmx stuff needed to manage resources:

LocateRegistry.createRegistry(port);

String localhost = InetAddress.getLocalHost().getCanonicalHostName();

MBeanServer mbs = MBeanServerFactory.createMBeanServer();

// it is the same with getPlatformMBean

JMXServiceURL url =new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + localhost +":"

+ port +"/qosp");

JMXConnectorServer cs =

JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);

cs.start();

The problem is that I get a java.rmi.AcessException -- see below -- when the cs.start() call is executed (on linux machines only -- it works fine on Windows)

The problem seems to be the following:

Caused by: java.rmi.ServerException: RemoteException occurred in

server thread; nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host

However my machine does not have that address, and actually I have no idea what it is.

Any clue?

Michele

Nov 6, 2006 11:55:01 AM org.apache.catalina.core.AprLifecycleListener

lifecycleEvent

INFO: The Apache Tomcat Native library which allows optimal

performance in production environments was not found on the

java.library.path: .:/Library/Java/Extensions:/System/Library/Java/

Extensions:/usr/lib/java

Nov 6, 2006 11:55:01 AM org.apache.coyote.http11.Http11BaseProtocol init

INFO: Initializing Coyote HTTP/1.1 on http-8080

Nov 6, 2006 11:55:01 AM org.apache.catalina.startup.Catalina load

INFO: Initialization processed in 666 ms

Nov 6, 2006 11:55:02 AM org.apache.catalina.core.StandardService start

INFO: Starting service Catalina

Nov 6, 2006 11:55:02 AM org.apache.catalina.core.StandardEngine start

INFO: Starting Servlet Engine: Apache Tomcat/5.5.15

Nov 6, 2006 11:55:02 AM org.apache.catalina.core.StandardHost start

INFO: XML validation disabled

Nov 6, 2006 11:55:02 AM org.apache.catalina.startup.HostConfig deployWAR

INFO: Deploying web application archive axis2.war

2006-11-06 11:55:03,668 INFO

org.apache.axis2.deployment.DeploymentEngine - Deploying module :

addressing-1.1

2006-11-06 11:55:03,682 INFO

org.apache.axis2.deployment.DeploymentEngine - Deploying module :

managerInterceptor

2006-11-06 11:55:03,690 INFO

org.apache.axis2.deployment.DeploymentEngine - Deploying module :

soapmonitor-1.1

2006-11-06 11:55:03,890 INFO ncl.qosp.controller.LifecycleSupport -

Qosp jmx is starting up...

org.apache.axis2.deployment.DeploymentException: Processing

Operations Modules Unable to start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Processing

Operations Modules Unable to start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

at

org.apache.axis2.deployment.repository.util.ArchiveReader.processService

Group(ArchiveReader.java:124)

at org.apache.axis2.deployment.DeploymentEngine.doDeploy

(DeploymentEngine.java:528)

at org.apache.axis2.deployment.repository.util.WSInfoList.update

(WSInfoList.java:196)

at org.apache.axis2.deployment.RepositoryListener.update

(RepositoryListener.java:227)

at org.apache.axis2.deployment.RepositoryListener.checkServices

(RepositoryListener.java:174)

at org.apache.axis2.deployment.DeploymentEngine.loadServices

(DeploymentEngine.java:88)

at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices

(WarBasedAxisConfigurator.java:252)

at

org.apache.axis2.context.ConfigurationContextFactory.createConfiguration

Context(ConfigurationContextFactory.java:72)

at org.apache.axis2.transport.http.AxisServlet.initConfigContext

(AxisServlet.java:373)

at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:

317)

at org.apache.catalina.core.StandardWrapper.loadServlet

(StandardWrapper.java:1105)

at org.apache.catalina.core.StandardWrapper.load

(StandardWrapper.java:932)

at org.apache.catalina.core.StandardContext.loadOnStartup

(StandardContext.java:3915)

at org.apache.catalina.core.StandardContext.start

(StandardContext.java:4176)

at org.apache.catalina.core.ContainerBase.addChildInternal

(ContainerBase.java:759)

at org.apache.catalina.core.ContainerBase.addChild

(ContainerBase.java:739)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:

524)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:

804)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:

693)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:

472)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)

at org.apache.catalina.startup.HostConfig.lifecycleEvent

(HostConfig.java:310)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent

(LifecycleSupport.java:119)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:

1020)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:

1012)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:

442)

at org.apache.catalina.core.StandardService.start

(StandardService.java:450)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:

700)

at org.apache.catalina.startup.Catalina.start(Catalina.java:551)

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:585)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Caused by: org.apache.axis2.deployment.DeploymentException:

Processing Operations Modules Unable to start the connector; nested

exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

at org.apache.axis2.deployment.ServiceBuilder.populateService

(ServiceBuilder.java:320)

at

org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGr

oup(ArchiveReader.java:76)

at

org.apache.axis2.deployment.repository.util.ArchiveReader.processService

Group(ArchiveReader.java:118)

... 35 more

Caused by: org.apache.axis2.deployment.DeploymentException: Unable to

start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

at

org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass

(ServiceBuilder.java:349)

at org.apache.axis2.deployment.ServiceBuilder.populateService

(ServiceBuilder.java:127)

... 37 more

Caused by: java.lang.RuntimeException: Unable to start the connector

at ncl.qosp.controller.LifecycleSupport.initRemoteJmx

(LifecycleSupport.java:192)

at ncl.qosp.controller.LifecycleSupport.startUp

(LifecycleSupport.java:132)

at

org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass

(ServiceBuilder.java:345)

... 38 more

Caused by: java.io.IOException: Cannot bind to URL [rmi://

sealbook.ncl.ac.uk:10099/qosp]: javax.naming.NoPermissionException

[Root exception is java.rmi.ServerException: RemoteException occurred

in server thread; nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host]

at javax.management.remote.rmi.RMIConnectorServer.newIOException

(RMIConnectorServer.java:814)

at javax.management.remote.rmi.RMIConnectorServer.start

(RMIConnectorServer.java:431)

at ncl.qosp.controller.LifecycleSupport.initRemoteJmx

(LifecycleSupport.java:190)

... 40 more

Caused by: javax.naming.NoPermissionException [Root exception is

java.rmi.ServerException: RemoteException occurred in server thread;

nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host]

at com.sun.jndi.rmi.registry.RegistryContext.bind

(RegistryContext.java:122)

at com.sun.jndi.toolkit.url.GenericURLContext.bind

(GenericURLContext.java:208)

at javax.naming.InitialContext.bind(InitialContext.java:359)

at javax.management.remote.rmi.RMIConnectorServer.bind

(RMIConnectorServer.java:635)

at javax.management.remote.rmi.RMIConnectorServer.start

(RMIConnectorServer.java:427)

... 41 more

Caused by: java.rmi.ServerException: RemoteException occurred in

server thread; nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host

at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:

385)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)

at sun.rmi.transport.Transport$1.run(Transport.java:153)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:149)

at sun.rmi.transport.tcp.TCPTransport.handleMessages

(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run

(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:613)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer

(StreamRemoteCall.java:247)

at sun.rmi.transport.StreamRemoteCall.executeCall

(StreamRemoteCall.java:223)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)

at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)

at com.sun.jndi.rmi.registry.RegistryContext.bind

(RegistryContext.java:116)

... 45 more

Caused by: java.rmi.AccessException: Registry.Registry.bind

disallowed; origin /128.240.229.70 is non-local host

at sun.rmi.registry.RegistryImpl.checkAccess(RegistryImpl.java:223)

at sun.rmi.registry.RegistryImpl.bind(RegistryImpl.java:119)

at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)

at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:

375)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)

at sun.rmi.transport.Transport$1.run(Transport.java:153)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:149)

at sun.rmi.transport.tcp.TCPTransport.handleMessages

(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run

(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:613)

2006-11-06 11:55:04,041 ERROR

org.apache.axis2.deployment.DeploymentEngine - Invalid service

RoutingService.aar due to Processing Operations Modules Unable to

start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Processing

Operations Modules Unable to start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

org.apache.axis2.deployment.DeploymentException: Processing

Operations Modules Unable to start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Processing

Operations Modules Unable to start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

at

org.apache.axis2.deployment.repository.util.ArchiveReader.processService

Group(ArchiveReader.java:124)

at org.apache.axis2.deployment.DeploymentEngine.doDeploy

(DeploymentEngine.java:528)

at org.apache.axis2.deployment.repository.util.WSInfoList.update

(WSInfoList.java:196)

at org.apache.axis2.deployment.RepositoryListener.update

(RepositoryListener.java:227)

at org.apache.axis2.deployment.RepositoryListener.checkServices

(RepositoryListener.java:174)

at org.apache.axis2.deployment.DeploymentEngine.loadServices

(DeploymentEngine.java:88)

at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices

(WarBasedAxisConfigurator.java:252)

at

org.apache.axis2.context.ConfigurationContextFactory.createConfiguration

Context(ConfigurationContextFactory.java:72)

at org.apache.axis2.transport.http.AxisServlet.initConfigContext

(AxisServlet.java:373)

at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:

317)

at org.apache.catalina.core.StandardWrapper.loadServlet

(StandardWrapper.java:1105)

at org.apache.catalina.core.StandardWrapper.load

(StandardWrapper.java:932)

at org.apache.catalina.core.StandardContext.loadOnStartup

(StandardContext.java:3915)

at org.apache.catalina.core.StandardContext.start

(StandardContext.java:4176)

at org.apache.catalina.core.ContainerBase.addChildInternal

(ContainerBase.java:759)

at org.apache.catalina.core.ContainerBase.addChild

(ContainerBase.java:739)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:

524)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:

804)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:

693)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:

472)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)

at org.apache.catalina.startup.HostConfig.lifecycleEvent

(HostConfig.java:310)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent

(LifecycleSupport.java:119)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:

1020)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:

1012)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:

442)

at org.apache.catalina.core.StandardService.start

(StandardService.java:450)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:

700)

at org.apache.catalina.startup.Catalina.start(Catalina.java:551)

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:585)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Caused by: org.apache.axis2.deployment.DeploymentException:

Processing Operations Modules Unable to start the connector; nested

exception is:

java.lang.RuntimeException: Unable to start the connector; nested

exception is:

org.apache.axis2.deployment.DeploymentException: Unable to start the

connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

at org.apache.axis2.deployment.ServiceBuilder.populateService

(ServiceBuilder.java:320)

at

org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGr

oup(ArchiveReader.java:76)

at

org.apache.axis2.deployment.repository.util.ArchiveReader.processService

Group(ArchiveReader.java:118)

... 35 more

Caused by: org.apache.axis2.deployment.DeploymentException: Unable to

start the connector; nested exception is:

java.lang.RuntimeException: Unable to start the connector

at

org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass

(ServiceBuilder.java:349)

at org.apache.axis2.deployment.ServiceBuilder.populateService

(ServiceBuilder.java:127)

... 37 more

Caused by: java.lang.RuntimeException: Unable to start the connector

at ncl.qosp.controller.LifecycleSupport.initRemoteJmx

(LifecycleSupport.java:192)

at ncl.qosp.controller.LifecycleSupport.startUp

(LifecycleSupport.java:132)

at

org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass

(ServiceBuilder.java:345)

... 38 more

Caused by: java.io.IOException: Cannot bind to URL [rmi://

sealbook.ncl.ac.uk:10099/qosp]: javax.naming.NoPermissionException

[Root exception is java.rmi.ServerException: RemoteException occurred

in server thread; nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host]

at javax.management.remote.rmi.RMIConnectorServer.newIOException

(RMIConnectorServer.java:814)

at javax.management.remote.rmi.RMIConnectorServer.start

(RMIConnectorServer.java:431)

at ncl.qosp.controller.LifecycleSupport.initRemoteJmx

(LifecycleSupport.java:190)

... 40 more

Caused by: javax.naming.NoPermissionException [Root exception is

java.rmi.ServerException: RemoteException occurred in server thread;

nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host]

at com.sun.jndi.rmi.registry.RegistryContext.bind

(RegistryContext.java:122)

at com.sun.jndi.toolkit.url.GenericURLContext.bind

(GenericURLContext.java:208)

at javax.naming.InitialContext.bind(InitialContext.java:359)

at javax.management.remote.rmi.RMIConnectorServer.bind

(RMIConnectorServer.java:635)

at javax.management.remote.rmi.RMIConnectorServer.start

(RMIConnectorServer.java:427)

... 41 more

Caused by: java.rmi.ServerException: RemoteException occurred in

server thread; nested exception is:

java.rmi.AccessException: Registry.Registry.bind disallowed; origin /

128.240.229.70 is non-local host

at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:

385)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)

at sun.rmi.transport.Transport$1.run(Transport.java:153)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:149)

at sun.rmi.transport.tcp.TCPTransport.handleMessages

(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run

(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:613)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer

(StreamRemoteCall.java:247)

at sun.rmi.transport.StreamRemoteCall.executeCall

(StreamRemoteCall.java:223)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)

at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)

at com.sun.jndi.rmi.registry.RegistryContext.bind

(RegistryContext.java:116)

... 45 more

Caused by: java.rmi.AccessException: Registry.Registry.bind

disallowed; origin /128.240.229.70 is non-local host

at sun.rmi.registry.RegistryImpl.checkAccess(RegistryImpl.java:223)

at sun.rmi.registry.RegistryImpl.bind(RegistryImpl.java:119)

at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)

at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:

375)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)

at sun.rmi.transport.Transport$1.run(Transport.java:153)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:149)

at sun.rmi.transport.tcp.TCPTransport.handleMessages

(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run

(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:613)

2006-11-06 11:55:04,180 INFO

org.apache.axis2.deployment.DeploymentEngine - Deploying Web service

version.aar

Nov 6, 2006 11:55:04 AM org.apache.coyote.http11.Http11BaseProtocol

start

INFO: Starting Coyote HTTP/1.1 on http-8080

Nov 6, 2006 11:55:04 AM org.apache.jk.common.ChannelSocket init

INFO: JK: ajp13 listening on /0.0.0.0:8009

Nov 6, 2006 11:55:04 AM org.apache.jk.server.JkMain start

INFO: Jk running ID=0 time=0/26 config=null

Nov 6, 2006 11:55:04 AM org.apache.catalina.storeconfig.StoreLoader load

INFO: Find registry server-registry.xml at classpath resource

Nov 6, 2006 11:55:04 AM org.apache.catalina.startup.Catalina start

INFO: Server startup in 2979 ms

[23438 byte] By [michele81a] at [2007-10-3 9:13:49]
# 1
Is it possible that InetAddress.getLocalHost().getCanonicalHostName() is returning a bogus name? Could you replace it with .getHostName()?
emcmanusa at 2007-7-15 4:26:15 > top of Java-index,Core,Monitoring & Management...
# 2

> Is it possible that

> InetAddress.getLocalHost().getCanonicalHostName() is

> returning a bogus name? Could you replace it with

> .getHostName()?

Yes, I did it, but nothing changed, so I tried to hardcode the 'localhost' when I create the JMXServiceURL instead of using the value returned by InetAddress.getLocalHost().get* and it worked.

Could it be because of network settings (I'm running behind a proxy)?

Thanks,

Michele

michele81a at 2007-7-15 4:26:15 > top of Java-index,Core,Monitoring & Management...
# 3
Hi again,some more details.> Could it be because of network settings (I'm running> behind a proxy)?> I've tried to set the system properties socksProxyHost and socksProxyPort but it doesn't work.
michele81a at 2007-7-15 4:26:15 > top of Java-index,Core,Monitoring & Management...
# 4

Eamonn, thanks for your hint.

It was because of the network settings.

By setting:

System.setProperty("socksProxyHost", "");

System.setProperty("socksProxyPort", "");

I sorted my problem out.

Michele

michele81a at 2007-7-15 4:26:15 > top of Java-index,Core,Monitoring & Management...