• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running a rmi sample

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys
iam facing a problem while working on a rmi sample
when i start my server i getting this exception


javax.naming.CommunicationException: Could not obtain connection to any of these
urls: rmi://127.1.1.14:1099 and discovery failed with error: javax.naming.Commu
nicationException: Receive timed out [Root exception is java.net.SocketTimeoutEx
ception: Receive timed out] [Root exception is javax.naming.CommunicationExcepti
on: Failed to connect to server rmi:1099 [Root exception is javax.naming.Service
UnavailableException: Failed to connect to server rmi:1099 [Root exception is ja
va.net.UnknownHostException: rmi]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
at org.jnp.interfaces.NamingContext.bind(NamingContext.java:538)
at org.jnp.interfaces.NamingContext.bind(NamingContext.java:531)
at javax.naming.InitialContext.bind(InitialContext.java:400)
at mathserver.main(mathserver.java:34)
Caused by: javax.naming.CommunicationException: Failed to connect to server rmi:
1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to conn
ect to server rmi:1099 [Root exception is java.net.UnknownHostException: rmi]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server
rmi:1099 [Root exception is java.net.UnknownHostException: rmi]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
... 5 more
Caused by: java.net.UnknownHostException: rmi
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1200)

at java.net.InetAddress.getAllByName0(InetAddress.java:1153)
at java.net.InetAddress.getAllByName(InetAddress.java:1083)
at java.net.InetAddress.getAllByName(InetAddress.java:1019)
at java.net.InetAddress.getByName(InetAddress.java:969)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory
.java:76)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
... 5 more


also please conform me that to run JNDI service i have to run any webserver like weblogic,jboss,
looking for your replies
[ April 03, 2008: Message edited by: Amirtharaj Chinnaraj ]
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you quote the source of the sample.(QuoteYourSources)
Are you specifically trying this for JNDI based Rmi registry?
If not, you can try first with a rmi registry only. More info here
From the error it looks like either the host is not reachable or there is no jndi registry running on it.
I have not tried with JNDI based RMI registry, but this link seems to be having some info.
[ April 03, 2008: Message edited by: Nitesh Kant ]
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Nitesh Kant
i have attached my codes here








//mathserverimpl

import java.rmi.*;
import javax.rmi.PortableRemoteObject;
import java.rmi.server.UnicastRemoteObject;

public class mathserverimpl extends UnicastRemoteObject implements mathserverinf

{


public mathserverimpl() throws Exception
{
}

public long add(int x,int y)
{
return x+y;
}




}



looking for your replies

iam using jboss 4.0.4 as jndi server
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the link i have specified in my previous reply, it seems the initial context factory to be used is com.sun.jndi.rmi.registry.RegistryContextFactory

However, i am not sure how this changes in case of jboss. You may have to search in the documentation of jboss.
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot Nitesh Kant

when i use com.sun.jndi.rmi.registry.RegistryContextFactory my sample

working properly

but i want to use the JNDI service provided by jboss

by using the JNDI driver org.jnp.interfaces.NamingContextFactory if this is not a proper driver please give me proper driver

looking for your replies
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea about jboss. You may be better off asking in JBoss forum
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot Nitesh Kant
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i not able to move this post to jboss can any of moderaters do this for me

i will thankful very much
[ April 03, 2008: Message edited by: Amirtharaj Chinnaraj ]
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

when i change the protocol in the jndi url to jnp://localhost:1099 my server is my mathserver is running properly
but when i invoke the mathclient iam getting the following error



looking for your replies
[ April 04, 2008: Message edited by: Amirtharaj Chinnaraj ]
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic