Sorry to ask so many questions in one here.  I'm not sure if this is the same
problem or not.  I've got jBoss running and the bean deployed. I have a program
that does this:

        System.out.println("Starting");
        Context jndiContext = null;
        Hashtable env = new Hashtable();

        String searchfor="ADMIN";
        try {
   searchfor=args[0];
     } catch (Exception e) {}

        System.out.println("1 Setting env");
        env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
        env.put(Context.PROVIDER_URL, "206.233.214.192:1099");

        System.out.println("2 Loading InitialContext");
        jndiContext = new InitialContext(env);

        System.out.println("Got initial context\n");

        System.out.println("3 Account EJB Test\n");

        AccountHome accountHome =
(AccountHome)PortableRemoteObject.narrow(jndiContext.lookup("accountEJB"),
AccountHome.class);

        System.out.println("4 Made AccountHome\n");

        Account a1 = accountHome.findByPrimaryKey(searchfor);

When I run it (local to JBoss) from Linux it does this:
Starting
1 Setting env
2 Loading InitialContext
Got initial context

3 Account EJB Test

javax.naming.CommunicationException [Root exception is
java.lang.ClassNotFoundException:
org.jboss.ejb.plugins.jrmp13.interfaces.HomeProxy (no security manager: RMI class
loader disabled)]
javax.naming.CommunicationException.  Root exception is
java.lang.ClassNotFoundException:
org.jboss.ejb.plugins.jrmp13.interfaces.HomeProxy (no security manager: RMI class
loader disabled)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:318)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:88)
        at
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:145)
        at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2262)

        at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)

        at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1411)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:284)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:265)
        at javax.naming.InitialContext.lookup(InitialContext.java:350)
        at RemoteTest.main(RemoteTest.java:42)

There was a question similar to this a while back.  But what code am I supposed to
use?  Am I supposed to cast jndiContext.lookup()?

==========================================================
When I run the same program (remote) from Windows, it does this:
Starting
1 Setting env
2 Loading InitialContext
Got initial context

3 Account EJB Test

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]
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
java.net.ConnectException: Connection refused: no further information
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
        at java.net.Socket.<init>(Socket.java:269)
        at java.net.Socket.<init>(Socket.java:98)
        at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:29)

        at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:124)

        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:497)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:194)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:87)
        at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java, Compiled
Code)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:265)
        at javax.naming.InitialContext.lookup(InitialContext.java:357)
        at RemoteTest.main(RemoteTest.java, Compiled Code)

This is the connection refused error.  But it seems to get this error every time
(if jBoss is running remote on Linux) yet it has never done it if jBoss is running
on the same Windows machine.

What am I doing wrong?  And why does it say "connection refused to localhost?"
since I'm not trying to connect to localhost.


Regards and many thanks,


Rich Katz

Rickard �berg wrote:

> Hi!
>
> Robert Taylor wrote:
> > I think I get the picture now.
> > Test app lives in one VM, JBoss lives in another VM.
> > Test app creates RMI object (allocates memory address etc...) and binds to
> > JNDI.
> > Test app exits. Memory address to RMI object has no meaning.
> > Test app starts again, finds the RMI stub in JNDI but crashes because stub
> > does not reference old RMI object address space.
>
> Exactly.
>
> > I'm not quite clear on what exactly an MBean is except that it refers to JMX
> > some how.
>
> You guessed right.
>
> > I'm guessing that it can be used as a sort of start up class that can be
> > called when JBoss starts up. This way the RMI object would live in the JBoss
> > VM and a call to it would access a valid object reference.
>
> Yup, that is the idea. You can copy an existing MBean in jBoss and go
> from there. You can, for example, copy the org.jboss.util.Info(MBean)
> classes and modify so that it creates your RMI object instead. Then add
> it to jboss.conf (see how Info is added for example) and off you go :-)
>
> /Rickard
>
> --
> Rickard �berg
>
> 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]



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

Reply via email to