Weber I suspect it is because your jndi.properties url variable is missing the port of the server on gauss, most likely 1099, as in
java.naming.provider.url=gauss:1099 Regards Eric -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Weber Simoes Oliveira Sent: Thursday, December 19, 2002 2:42 PM To: [EMAIL PROTECTED] Subject: [JBoss-user] Accessing EJB remotely Hi folks, as you will notice, i'm a newbie to JBoss. My doubt is about how to access an EJB remotely. The first thing i did was trying to access the EJB from a local client application. So far, so good. The client ran smoothly and i thought that was pretty much all there was to it. Nevertheless, every time i try to run the same client application remotely, it crashes because the lookup call on the InitialContext instance always returns null. As far as i can see, its a problem on the absolute path of the context i'm passing to the lookup method. The EJB is being deployed correctly and the client application finds and connects to the server, as shown in the following tcpdump output: // ********** tcpdump output ********* [weber@gauss deploy]$ sudo /usr/sbin/tcpdump port 1099 tcpdump: listening on eth0 15:47:24.116519 socrates.34548 > gauss.1099: S 323478976:323478976(0) win 5840 <mss 1460,sackOK,timestamp 49002257 0,nop,wscale 0> (DF) 15:47:24.116623 gauss.1099 > socrates.34548: S 941156804:941156804(0) ack 323478977 win 5792 <mss 1460,sackOK,timestamp 11251787 49002257,nop,wscale 0> (DF) 15:47:24.116967 socrates.34548 > gauss.1099: . ack 1 win 5840 <nop,nop,timestamp 49002257 11251787> (DF) 15:47:24.132574 gauss.1099 > socrates.34548: P 1:5(4) ack 1 win 5792 <nop,nop,timestamp 11251795 49002257> (DF) 15:47:24.132941 socrates.34548 > gauss.1099: . ack 5 win 5840 <nop,nop,timestamp 49002266 11251795> (DF) 15:47:24.135833 gauss.1099 > socrates.34548: P 5:84(79) ack 1 win 5792 <nop,nop,timestamp 11251796 49002266> (DF) 15:47:24.136257 socrates.34548 > gauss.1099: . ack 84 win 5840 <nop,nop,timestamp 49002267 11251796> (DF) 15:47:24.136296 gauss.1099 > socrates.34548: P 84:90(6) ack 1 win 5792 <nop,nop,timestamp 11251797 49002267> (DF) 15:47:24.136580 socrates.34548 > gauss.1099: . ack 90 win 5840 <nop,nop,timestamp 49002268 11251797> (DF) 15:47:24.138991 gauss.1099 > socrates.34548: P 90:107(17) ack 1 win 5792 <nop,nop,timestamp 11251798 49002268> (DF) 15:47:24.139106 gauss.1099 > socrates.34548: FP 107:350(243) ack 1 win 5792 <nop,nop,timestamp 11251798 49002268> (DF) 15:47:24.139495 socrates.34548 > gauss.1099: . ack 107 win 5840 <nop,nop,timestamp 49002269 11251798> (DF) 15:47:24.177555 socrates.34548 > gauss.1099: . ack 351 win 6432 <nop,nop,timestamp 49002289 11251798> (DF) 15:47:24.511130 socrates.34548 > gauss.1099: F 1:1(0) ack 351 win 6432 <nop,nop,timestamp 49002459 11251798> (DF) 15:47:24.511198 gauss.1099 > socrates.34548: . ack 2 win 5792 <nop,nop,timestamp 11251989 49002459> (DF) 15 packets received by filter 0 packets dropped by kernel // ********** end of output ********** As i'm trying to use the JBoss naming service from a remote machine i also included in my classpath the "client jar packs" which come along with the JBoss package and the path to the following jndi.properties file: // ********* jndi.properties ********* java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=gauss // ********* end of jndi.properties ********* where gauss is where the JBoss server is located. The following is the code i'm trying get to work: // ********** The Client Application ********** package test.client; import test.interfaces.Calculator; import test.interfaces.CalculatorHome; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; public class TestClient { public static void main(String[] args){ try { CalculatorHome calcHome = lookupCalculatorHome(); Calculator calculator = calcHome.create(); System.out.println("3 + 4 = " + calculator.add(3,4)); System.out.println("2 - 8 = " + calculator.subtract(2,8)); calculator.remove(); } catch( Exception e ) { e.printStackTrace(System.err); } } public static CalculatorHome lookupCalculatorHome() throws Exception{ InitialContext ic = new InitialContext(); Object calculatorReference = ic.lookup("ejb/test/Calculator"); return((CalculatorHome)PortableRemoteObject.narrow( calculatorReference,CalculatorHome.class ) ); } } // ********* The Stateless Session Bean ********** package test.session; import javax.ejb.SessionBean; import javax.ejb.SessionContext; /** * Encapsulates the retrival of DB data * * @author Weber * @version $Revision: 0.1 $ * * @ejb:bean name="test/Calculator" * display-name="Calculadora sofisticada" * type="Stateless" * jndi-name="ejb/test/Calculator" **/ public class CalculatorBean implements SessionBean { // SessionBean implementation public void ejbActivate() { } public void ejbPassivate() { } public void setSessionContext(SessionContext ctx) { } /** * Create the Session Bean * * @throws CreateException * * @ejb:create-method view-type="remote" **/ public void ejbCreate() { } public void ejbRemove() { } // Calculator methods /** * @param pSequenceName Name of the Sequence Generator * * @return Next sequence number * * @throws RemoteException * * @ejb:interface-method view-type="remote" * @ejb:transaction type="Required" **/ public long add(int x,int y) { return(x+y); } /** * @param pSequenceName Name of the Sequence Generator * * @return Next sequence number * * @throws RemoteException * * @ejb:interface-method view-type="remote" * @ejb:transaction type="Required" **/ public long subtract(int x,int y) { return(x-y); } } I'm stuck and i don't know what else to try. Any ideas??? Thanx in advance, Weber. ------------------------------------------------------- This SF.NET email is sponsored by: Geek Gift Procrastinating? Get the perfect geek gift now! Before the Holidays pass you by. T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This SF.NET email is sponsored by: Geek Gift Procrastinating? Get the perfect geek gift now! Before the Holidays pass you by. T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user