Hello,
I am relatively new to both EJBs and jBoss, so please bear with me if my explanation is a bit jumbled. :)
I recently downloaded the jboss2.0_pr4.1_BETA version. I tried deployment of a couple of test beans, all of which worked fine. I then made a relatively simple stateless session bean that would do some SNMP polling for me. This deployed fine. I then wrote a simple client and ran it on the same machine that jBoss was running on. Everything worked great.
I then decided to try to move the client to a remote machine. I used the examples in the "Getting Started" web pages as a base. I created a properties file (named "scheduler.properties"). Here are its contents:
> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
> java.naming.provider.url=134.141.56.142:1099
"134.141.56.142" is the IP address of my machine that has jBoss running on it.
The first few lines of my client file are code like this:
> Properties props = new Properties();
> Properties sysProps = System.getProperties();
>
> try
> {
> props.load (new FileInputStream("scheduler.properties"));
> sysProps.putAll(props);
> } catch (Exception e) {
> System.err.println ("Can't read 'scheduler.proprties'");
> System.exit (-1);
> }
>
> System.setProperties(sysProps);
>
> try
> {
> InitialContext jndiContext = new InitialContext(System.getProperties());
> System.out.println("Got context");
> Object ref = jndiContext.lookup("Scheduler");
> System.out.println("Got reference");
> ... <do other stuff>
When I run my client from a remote machine, I get the following output:
D:\LoggingProposal\Gpe>java -classpath %CLASSPATH%;\jboss\client\ejb.jar;\jboss\
client\jboss-client.jar;\jboss\client\jnp-client.jar;. com.aprisma.gpe.SnmpClien
t2 input_data.txt
Got context
javax.naming.CommunicationException. Root exception is java.rmi.ConnectExceptio
n: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: no further information
java.net.ConnectException: Connection refused: no further information
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:312)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
at java.net.Socket.<init>(Socket.java:273)
at java.net.Socket.<init>(Socket.java:100)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
SocketFactory.java:25)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
SocketFactory.java:120)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190
)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:280)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:265)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.aprisma.gpe.SnmpClient2.main(SnmpClient2.java:40)
javax.naming.CommunicationException [Root exception is java.rmi.ConnectException
: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: no further information]
So I can see by the "Got context" message that the jndiContext was successfully created. However, when I used it to lookup my "scheduler" bean, it failed. Any ideas what the problem might be?
Thanks,
Craig Dube
