Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / April 2005

Tip: Looking for answers? Try searching our database.

[JBOSS] Can't connect Client to remote JBoss 3.2.2 server

Thread view: 
MichaelBrinkhues - 15 Jan 2004 13:51 GMT
Hello everybody

I am currently using the following setup:

Server:

JBoss 3.2.2 (default context) on a Windows XP-Pro box (1 Network card,
fixed adress, in DNS-Server) under Java 1.4.1_02 (Sun-JSDK), Database
is SQL-Server 2000 (Workstation variant)

Client:

Windows XP-Pro in the same network domain (192.168.2.x) with Java
1.4.1_02 (Sun-JSDK) with dynamic IP

The programm is a simple call to an EJB (Entity BMP-Bean) and works
fine if both the JBoss and the client run on the same box. If I start
the client on the second box I get

========= Begin error

Failed: findByPrimaryKey(4)
javax.naming.CommunicationException: Receive timed out.  Root
exception is java.
net.SocketTimeoutException: Receive timed out
       at java.net.PlainDatagramSocketImpl.receive(Native Method)
       at java.net.DatagramSocket.receive(DatagramSocket.java:671)
       at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:10
93)
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1192)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
       at javax.naming.InitialContext.lookup(InitialContext.java:347)
       at crocobl.test.EmployeeDataTestClient1.findByPrimaryKey(EmployeeDataTes
tClient1.java:128)
       at crocobl.test.EmployeeDataTestClient1.initialize(EmployeeDataTestClien
t1.java:69)
       at crocobl.test.EmployeeDataTestClient1.<init>(EmployeeDataTestClient1.j
ava:23)
       at crocobl.test.EmployeeDataTestClient1.main(EmployeeDataTestClient1.jav
a:282)
-- Return value from findByPrimaryKey(4): null.
-- Failed initializing bean access.null
java.lang.NullPointerException
       at crocobl.test.EmployeeDataTestClient1.initialize(EmployeeDataTestClien
t1.java:70)
       at crocobl.test.EmployeeDataTestClient1.<init>(EmployeeDataTestClient1.j
ava:23)
       at crocobl.test.EmployeeDataTestClient1.main(EmployeeDataTestClient1.jav
a:282)
CrocoBL

==== End error

The (relevant) part of the client code is

=== Begin client

  Properties prop = new Properties();
   prop.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
   prop.setProperty("java.naming.provider.url",
"kl-dev-199.dev.klag:1099");
   prop.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces" );
   prop.setProperty("jnp.socket.factory","org.jnp.interfaces.TimedSocketFactory");
   prop.setProperty("jnp.timeout","0");
   prop.setProperty("jnp.sotimeout","0");

/* (This didn't help either
   prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
   prop.put(Context.PROVIDER_URL,"jnp://kl-dev-199.dev.klag:1099");
   prop.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
*/
   long startTime = 0;
   if (logging) {
     log("Initializing bean access.");
     startTime = System.currentTimeMillis();
   }

   try {
     //get naming context
     Context context = new InitialContext(prop);

     //look up jndi name
     Object ref = context.lookup("EmployeeDataRemote");
     //look up jndi name and cast to Home interface
     employeeDataRemoteHome =
(EmployeeDataRemoteHome)PortableRemoteObject.narrow(ref,
EmployeeDataRemoteHome.class);
     if (logging) {
       long endTime = System.currentTimeMillis();
       log("Succeeded initializing bean access through Home
interface.");
       log("Execution time: " + (endTime - startTime) + " ms.");

       newElem4 = this.findByPrimaryKey("4");
       System.out.println(newElem4.getFirstname());

========== End Client part

Does anybody have a sugestion? I tried the hints from google (i.e.
give the server a fixed IP and a DNS-entry on an (external) DNS
server) but to no help.

Did I miss something (i.e. need another server-setup?)

      Thanks in advance,

                  Michael
Taki - 15 Jan 2004 16:10 GMT
> === Begin client
>
[quoted text clipped - 3 lines]
>     prop.setProperty("java.naming.provider.url",
> "kl-dev-199.dev.klag:1099");

try without the port number.  It sloved the same problem I had....

Also, it's better to use Context.INITIAL_CONTEXT_FACTORY,
Context.PROVIDER_URL, Context.URL_PKG_PREFIXES when you
set the properties of an InitialContext instance.

hope this helps

Taki
MichaelBrinkhues - 16 Jan 2004 13:06 GMT
> > === Begin client
> >
[quoted text clipped - 13 lines]
>
> Taki

Sadly no.

Tried that (Use it now) but that didn't change anything

Situation update:

- I switched to a fresh installation of JBoss-3.2.3 (didn't help)

Browsing through google I came to a description where a guy put the
parameters

-Djava.naming.provider.url=jnp://kl-dev-199:1099
-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

in the client start script and claimed that this worked while other
ways didn't. So I said to me "Ach Schei**s, was solls" and tried the
same (even so I set the same stuff in source.

Now the <deity>dam*** client runs like a charm!

Question: Error between keyboard and chair or in the common
documentation of the current production-level JBoss?

             Michael (I'a happy now)
Sarah - 19 Feb 2004 22:06 GMT
Hi Michael,
I was tring to run the example in JBoss workbook.I got the same error message:
run.client_61:
    [java] done with getInitialContext
    [java] javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
    [java]     at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1115)
    [java]     at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1192)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
    [java]     at javax.naming.InitialContext.lookup(InitialContext.java:347)
    [java]     at com.titan.clients.Client_61.main(Client_61.java:34)
    [java] Caused by: java.net.SocketTimeoutException: Receive timed out
    [java]     at java.net.PlainDatagramSocketImpl.receive(Native Method)
    [java]     at java.net.DatagramSocket.receive(DatagramSocket.java:711)
    [java]     at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1093)
    [java]     ... 5 more

I tried what you said, like:
public static Context getInitialContext() throws NamingException
{

java.util.Hashtable JNDIParm = new java.util.Hashtable();
JNDIParm.put(Context.PROVIDER_URL, "10.150.132.221");
JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
JNDIParm.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
javax.naming.InitialContext ctx = new InitialContext(JNDIParm);
//javax.naming.InitialContext ctx = new InitialContext();
return ctx;

}

+++++++++++++++++++
I got the new error message:
run.client_61:
    [java] done with getInitialContext
    [java] javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 10.150.132.221; nested exception is:
    [java]     java.net.ConnectException: Connection refused]
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
    [java]     at javax.naming.InitialContext.lookup(InitialContext.java:347)
    [java]     at com.titan.clients.Client_61.main(Client_61.java:34)
    [java] Caused by: java.rmi.ConnectException: Connection refused to host: 10.150.132.221; nested exception is:
    [java]     java.net.ConnectException: Connection refused
    [java]     at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
    [java]     at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    [java]     at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    [java]     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
    [java]     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
    [java]     ... 3 more
    [java] Caused by: java.net.ConnectException: Connection refused
    [java]     at java.net.PlainSocketImpl.socketConnect(Native Method)
    [java]     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    [java]     at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    [java]     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    [java]     at java.net.Socket.connect(Socket.java:452)
    [java]     at java.net.Socket.connect(Socket.java:402)
    [java]     at java.net.Socket.<init>(Socket.java:309)
    [java]     at java.net.Socket.<init>(Socket.java:124)
    [java]     at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    [java]     at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    [java]     at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
    [java]     ... 8 more
+++++++++++++++
I am running on Jboss3.2.3, RedHat9. The example is Jboss3.2.2.

Any suggestions?

Thanks in advance!

Sarah
Sarah - 19 Feb 2004 22:15 GMT
Hi Michael,
I was tring to run the example in JBoss workbook.I got the same error message:
run.client_61:
    [java] done with getInitialContext
    [java] javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
    [java]     at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1115)
    [java]     at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1192)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
    [java]     at javax.naming.InitialContext.lookup(InitialContext.java:347)
    [java]     at com.titan.clients.Client_61.main(Client_61.java:34)
    [java] Caused by: java.net.SocketTimeoutException: Receive timed out
    [java]     at java.net.PlainDatagramSocketImpl.receive(Native Method)
    [java]     at java.net.DatagramSocket.receive(DatagramSocket.java:711)
    [java]     at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1093)
    [java]     ... 5 more

I tried what you said, like:
public static Context getInitialContext() throws NamingException
{

java.util.Hashtable JNDIParm = new java.util.Hashtable();
JNDIParm.put(Context.PROVIDER_URL, "10.150.132.221");
JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
JNDIParm.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
javax.naming.InitialContext ctx = new InitialContext(JNDIParm);
//javax.naming.InitialContext ctx = new InitialContext();
return ctx;

}

+++++++++++++++++++
I got the new error message:
run.client_61:
    [java] done with getInitialContext
    [java] javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 10.150.132.221; nested exception is:
    [java]     java.net.ConnectException: Connection refused]
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
    [java]     at javax.naming.InitialContext.lookup(InitialContext.java:347)
    [java]     at com.titan.clients.Client_61.main(Client_61.java:34)
    [java] Caused by: java.rmi.ConnectException: Connection refused to host: 10.150.132.221; nested exception is:
    [java]     java.net.ConnectException: Connection refused
    [java]     at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
    [java]     at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    [java]     at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    [java]     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
    [java]     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
    [java]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
    [java]     ... 3 more
    [java] Caused by: java.net.ConnectException: Connection refused
    [java]     at java.net.PlainSocketImpl.socketConnect(Native Method)
    [java]     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    [java]     at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    [java]     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    [java]     at java.net.Socket.connect(Socket.java:452)
    [java]     at java.net.Socket.connect(Socket.java:402)
    [java]     at java.net.Socket.<init>(Socket.java:309)
    [java]     at java.net.Socket.<init>(Socket.java:124)
    [java]     at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    [java]     at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    [java]     at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
    [java]     ... 8 more
+++++++++++++++
I am running on Jboss3.2.3, RedHat9. The example is Jboss3.2.2.

Any suggestions?

Thanks in advance!

Sarah
Petros Petrou - 20 Feb 2004 21:14 GMT
You might want to try this code.
JNDI listens to port 1099.

Not sure if if thats what u r asking but I dont have much time
at the moment to read the posts carefully.

Hashtable props = new Hashtable();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL,"jnp://localhost:1099");
               
Context ctx = new InitialContext(props);

> Hi Michael,
> I was tring to run the example in JBoss workbook.I got the same error message:
[quoted text clipped - 67 lines]
>
> Sarah
themuppeteer - 04 Mar 2004 13:23 GMT
Hello sarah,

I had the same problem, you better check if you have your remotePortableObject.narrow(..) code when you look up your home interface.
Marek Lange - 04 Mar 2004 14:12 GMT
>> java.rmi.ConnectException: Connection refused to host: 10.150.132.221;

Try to set -Djava.rmi.server.hostname=10.150.132.221 in your JBoss
environment or update /etc/hosts accordingly.

-marek
binu - 22 Apr 2005 12:20 GMT
hi all
    THe problem is very urgent. TIME out error occure when try to access
remote home through narrow binding ...
binu - 22 Apr 2005 12:20 GMT
javax.naming.CommunicationException: Receive timed out [Root exception is
java.n
et.SocketTimeoutException: Receive timed out]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.