After some more searching, I found a posting that referred to:
I was able to complete the instructions at the bottom of that page that fixed my previous problem, but now I am getting:
From my remote client. I run the same client on the same machine the server is running and it works fine. Should I be casting to RMIAdaptorImpl_Stub instead of RMIAdaptor? Are there any implications to doing this?
Thanx in advance.
So here's what I've done:
I have JBoss 3.0.8 running on RedHat 7.3 with JDK 1.4.2_10. I have a client that connects to JBoss with the following code:
Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(Context.PROVIDER_URL, "jnp://yeager:1099"); System.out.println("In remote call"); InitialContext ic = new InitialContext(props); System.out.println("ic: " + ic); Object obj = ic.lookup("jmx/rmi/RMIAdaptor"); System.out.println("obj: " + obj.getClass().getName()); org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub server = ( org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub) obj; System.out.println("server: " + server); ObjectName objName = new ObjectName("jboss.j2ee:jndiName=" + name + ",service=EJB"); System.out.println("objName: " + objName); server.invoke(...);
When the client runs on the same box as the JBoss server, everything works fine. When I move the client to a Windows XP box running JDK 1.4.2_10, I get the following output that ends in a ClassCastException:
In remote call
As you can see, the object coming back from the InitialContext is an RMIAdaptorImpl_Stub and that's what I cast it to, but I still get the ClassCastException.
What's going on here?
Thanx in advance.
Try using a more recent jboss version, 4.0.3SP1, 3.2.8SP1 are the latest.