• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javax naming CommunicationException

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am managing and monitoring web based chat application in local intranet by using JMX. Part of my code is as follows :

...
mbeanServer.registerMBean(regMBean, regName);
serviceURL = new JMXServiceURL("rmi", "localhost", 0,"/jndi/jmx");
connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(
serviceURL, null, mbeanServer);
ObjectName serverName = new ObjectName(":service="+ JMXConnectorServer.class.getName() + ",protocol="
+ serviceURL.getProtocol());
mbeanServer.registerMBean(connectorServer, serverName);

=>errconnectorServer.start();
System.out.println("server started");
setStarted(true); ....

I am getting following stacktrace.

[STDOUT] java.io.IOException: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
14:43:13,095 INFO [STDOUT] at mx4j.remote.resolver.rmi.Resolver.bindServer(Resolver.java:199)
14:43:13,095 INFO [STDOUT] at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:152)
14:43:13,095 INFO [STDOUT] at com.csam.webchat.misc.WebChatMBeanAgent.startServer(WebChatMBeanAgent.java:50)
14:43:13,095 INFO [STDOUT] at org.apache.jsp.login_jsp._jspService(login_jsp.java:78)
....

Can anybody help me out??

Thank You..

Jahnvi
 
Jahnvi Vyas
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hei, I got the answer.

For that we have to populate jndi.properties file and it is to be placed in src or classes folder. Additional change is in ServiceURL string we have to give /jndi/rmi. Snapshot of the changes are as follows..

=> jndi.properties

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jnp.interfaces
java.naming.provider.url=localhost

=> MBeanAgent class

private JMXServiceURL serviceURL;
...
serviceURL = new JMXServiceURL("rmi", "localhost", 0,"/jndi/rmi");
....

I am posting this solution because it may be helpful to anybody who is going through such problem, as I went through many forums and ma..ny people had same kind of problem but nobody has answer.

So, best of luck to who so ever is reading this post.

Thank you..

Jahnvi.
 
reply
    Bookmark Topic Watch Topic
  • New Topic