Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Remote JNDI/EJB Problems

Reply
Thread Tools

Remote JNDI/EJB Problems

 
 
Chris
Guest
Posts: n/a
 
      06-18-2004
How's everyone doing today.. Good.

well my problem is driving me crazy, so I hope someone can help me
figure out why this is doing what it's doing.. i'm probably just doing
something "stupid"

I'm trying to call a remote stateless session bean from a different
physical box.

what i have working: i have a ear file w/ the war + ejb.jar all
enclosed and that is working beautifully. now i'm trying to
distribute out the processes. have a "client" either tomcat or a java
application sitting on one box, and the ejb container w/ my session
facades on the other box.

my environment: jboss 3.2.2-tomcat 4.1.24 bundle, linux redhat.

I've been monkeying around with the configuration and have gotten two
different errors.

1st error: java application (see source below) on box one trying to
connect to box 2 jndi but saying connection refused to 127.0.0.1. I
have also even removed (commented out) the localhost references to
/etc/hosts.

this is trying to do a simple listBindings.

java source:

import javax.naming.*;
import java.util.*;
import javax.rmi.PortableRemoteObject;

public class TestClient3 {

public static void main(String[] args){
try{

String sInitialContextFactory =
"org.jnp.interfaces.NamingContextFactory";
String sProviderUrl = "jnp://192.168.0.100:1099";
String sFactoryUrl = "java.naming.factory.url.pkgs";
// also tried sInterface org.jboss.namingrg.jnp.interface
String sInterface = "org.jboss.naming.clientrg.jnp.interfaces";

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, sInitialContextFactory);
env.put(Context.PROVIDER_URL, sProviderUrl);
env.put(sFactoryUrl, sInterface);


InitialContext initialContext = new InitialContext(env);
System.out.println(initialContext.getEnvironment() .toString());
NamingEnumeration enum = initialContext.listBindings("");
System.out.println(enum.toString());

while (enum.hasMoreElements()) {
System.out.println(enum.next().toString());
}
}catch(Exception e){ e.printStackTrace(System.err);
}
}
}

// my box ip i'm running this from is 192.168.0.194 and here's the
output results:

{java.naming.provider.url=192.168.0.100:1099,
java.naming.factory.initial=org.jnp.interfaces.Nam ingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming.clie ntrg.jnp.interfaces}
javax.naming.CommunicationException [Root exception is
java.rmi.ConnectException: Connection refused to host: 127.0.0.1;
nested exception is:
java.net.ConnectException: Connection refused]
at org.jnp.interfaces.NamingContext.listBindings(Nami ngContext.java:796)
at org.jnp.interfaces.NamingContext.listBindings(Nami ngContext.java:735)
at javax.naming.InitialContext.listBindings(InitialCo ntext.java:396)
at xxx.xxx.xxx.xxx.client.TestClient3.main(TestClient 3.java:4
Caused by: java.rmi.ConnectException: Connection refused to host:
127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection( TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCP Channel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:1 01)
at org.jnp.server.NamingServer_Stub.listBindings(Unkn own Source)
at org.jnp.interfaces.NamingContext.listBindings(Nami ngContext.java:747)
... 3 more


Any Ideas?


Problem two. I got the jndi connecting properly but when i try to a
lookup w/ the same string name i'm using through jndi on the bundled
process it's coming up w/

javax.naming.CommunicationException [Root exception is
java.rmi.NoSuchObjectException: no such object in table]
at org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:647)
at org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:507)
at javax.naming.InitialContext.lookup(InitialContext. java:347)
at xxx.xxx.xxx.client.TestClient2.main(TestClient2.ja va:4
Caused by: java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.StreamRemoteCall.exceptionReceiv edFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(Str eamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:1 33)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:52
... 3 more


source:
public static void main(String args[]){

try{

String sInitialContextFactory =
"org.jnp.interfaces.NamingContextFactory";
String sProviderUrl = "jnp://zodiac:1099";
// zodiac is 192.168.0.100
String sFactoryUrl = "java.naming.factory.url.pkgs";
String sInterface = "org.jboss.namingrg.jnp.interfaces";


Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, sInitialContextFactory);
env.put(Context.PROVIDER_URL, sProviderUrl);
env.put(sFactoryUrl, sInterface);


InitialContext ctx = new InitialContext(env);

Object jndi = ctx.lookup("zodiac_facade/BusinessService");
Object portable = PortableRemoteObject.narrow(jndi,
getEJBClassRef(nServiceId));

}catch(Exception e){ e.printStackTrace(System.err);
}
}



and the jndi lookup string works inside the web container on the same
box... I even got it working through the client application on the
same box.... apparently the problem is just when it's on a remote box.
there is no firewall i've turned off /etc/init.d/iptables.sh stop

i'm baffled,

someone please give me some pointers.

Chris
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
re: remote assistance and remote desktop eddy Computer Support 1 09-20-2005 03:44 AM
Ghost Console version 8 Remote Client install will not install to remote pc Ed Computer Support 3 03-18-2005 05:18 PM
Remote Assistance fails to connect, remote remote host name could not be resolved Peter Sale Wireless Networking 1 12-11-2004 09:09 PM
Difference between Remote Desktop and Remote Desktop for Admin Dave Marden MCSE 16 01-24-2004 12:47 PM
FS: Minolta Maxxum remote shutter release cord and remote flash cord Webkatz Digital Photography 1 07-17-2003 07:20 PM



Advertisments