For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > April 2005 > [JBOSS] Can't connect Client to remote JBoss 3.2.2 server









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2004-03-19, 8:44 pm

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)PortableRemoteOb
ject.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

2004-03-19, 8:44 pm


> === 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");


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

2004-03-19, 8:44 pm

"Taki" <takahiro@interchange.ubc.ca> wrote in message news:<bu6dp2$fr0$1@nntp.itservices.ubc.ca>...
>
> 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


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

2004-03-19, 8:45 pm

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

2004-03-19, 8:45 pm

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

2004-03-19, 8:45 pm

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);






Sarah wrote:
> 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
>
>
>

themuppeteer

2004-03-19, 8:45 pm

X-Complaints-To: abuse@supernews.com
Lines: 4
Path: kermit!newsfeed-east.nntpserver.com!nntpserver.com!newshosting.com!nx02.iad01.newshosting.com!newshub.sdsu.edu!tethys.csu.net!nntp.csufresno.edu!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
Xref: kermit comp.lang.java.beans:14814

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

2004-03-19, 8:45 pm

Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.t-online.com 1078409573 00 13276 F8efG-y1iKtH2cf 040304 14:12:53
X-Complaints-To: usenet-abuse@t-online.de
X-ID: EGc86+ZTZeNpc8hgx2LSpBXmsGuxQf+pdESq3r2m
kMUoBGtxmzu-oF
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us, en
In-Reply-To: <1077311489.418382@leri.aber.ac.uk>
Path: kermit!newsfeed-east.nntpserver.com!nntpserver.com!news3.optonline.net!in.100proofnews.com!in.100proofnews.com!tiscali!newsfeed1.ip.tiscali.net!feed.news.tiscali.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!no
t-for-mail
Xref: kermit comp.lang.java.beans:14815
[color=darkred]
> Sarah wrote:

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

-marek
binu

2005-04-22, 8:56 am

X-Complaints-To: abuse@supernews.com
Lines: 4
Xref: number1.nntp.dca.giganews.com comp.lang.java.beans:22981

javax.naming.CommunicationException: Receive timed out [Root exception is
java.n
et.SocketTimeoutException: Receive timed out]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com