Hey

I think I found the problem. Actually, this is a "biggie". 

In short:
You are indeed able to connect to the server, because you got the naming
server stub. However, when you try to call it the exception comes. And
the problem is that the naming server stub has "localhost" as the host.

Try this:
In /conf/jboss.properties, uncomment the line with
java.rmi.server.useLocalHostName and see if it works any better.

Let me know how it works out. I will look into this more.

/Rickard

[EMAIL PROTECTED] wrote:
> 
> Here is the code i used:
> final Properties prop = new Properties();
> prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
> 
> prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
> prop.put(Context.PROVIDER_URL,"63.74.222.154");
> 
>  try
> {
>            System.out.println("Getting Initial Context.");
>             final Context _context = new InitialContext(prop);
>             System.out.println("Initial Context: " +
> _context.toString());
>             System.out.println("");
>             System.out.println("Initial Context Retrieved.");
>             HelloWorldHome hwh =
> (HelloWorldHome)_context.lookup("HelloWorldBean");
>             System.out.println("Got the Home Interface..");
>             HelloWorld hw = hwh.create();
>             System.out.println("Got the Remote Interface...");
>             hw.hello();
>             System.out.println("Called the B Method...");
>             hw.remove();
> }
> 
> Here is the exception:
> 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: 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(RMIDirectSocketFactory.java:25)
> 
>         at
> 
>sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.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:167)
>         at
> org.jnp.interfaces.NamingContext.lookup(NamingContext.java:152)
>         at javax.naming.InitialContext.lookup(InitialContext.java:350)
> 
>         at com.vse.client.MAIN.main(MAIN.java:32)
> 
> I know this is got to be a small oversight on my part....
> 
> John
> 
>  Pedro Mota <[EMAIL PROTECTED]>
>  Sent by:                                    To:        jBoss
>  <[EMAIL PROTECTED]>  <[EMAIL PROTECTED]>
>                                              cc:
>  05/31/00 09:34 AM                           Subject:        Re:
>  Please respond to "jBoss"           [jBoss-User] Security Manager
> 
> [EMAIL PROTECTED] wrote:
> >
> > These are the properties passed into initial context.
> >
> > I get an initial context but when my code looks up the home
> interface
> > I get the exception below.
> >
> > final Properties prop = new Properties();
> >
> prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
> > prop.put(Context.PROVIDER_URL,"63.74.222.154");
> 
> Hi John:
> 
> Try this, it worked in my clients
> 
> prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
> prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
> prop.put(Context.PROVIDER_URL,"63.74.222.154");
> 
> Pedro Mota
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]

-- 
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to