[jboss-user] [Beginners Corner] - invoking an EJB over iiop

HibsMax do-not-reply at jboss.com
Fri Jun 1 12:47:23 EDT 2007


Hi, folks.

I've tried a couple of other forums with this issue but no traction, so here I am to tickle your brains. :)

I have a servlet that makes calls to an EJB on another server using iiop.  I've been trying for days but I still cannot get it to work.  My current issue is that when I access the servlet it gets an initial context and performs a lookup for the EJB which returns this:
12:23:00,104 ERROR [STDERR] java.lang.ClassCastException
12:23:00,104 ERROR [STDERR]     at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)

For my INITIAL_CONTEXT_FACTORY I am using:
org.jboss.iiop.naming.ORBInitialContextFactory

This is the same class as I am specifying in my server's jndi.properties.  

Here are the steps being taken by the servlet:
1. create a Properties object 
2. put the initial context factory class name i.e. org.jboss.iiop.naming.ORBInitialContextFactory
3. put URL of the server where the EJB lives i.e. iiop:/server:3528
4. create a new InitialContext using the above Properties object.
5. once I have the InitialContext, I perform a lookup using the EJB name i.e. "iiop://my.EJBHome"
6. I added a debug statement to the code and note that the Object returned by the lookup is : com.sun.jndi.cosnaming.CNCtx

My understanding is that the EJB JAR doesn't need any stubs, etc.  they are supposed to be created on at runtime.  So I must be doing something wrong but I dont' know what.  I also understand that JBoss iiop is supposed to be enabled when you use the all configuration which is what I am using.  I don't know of any additional configuration changes that need to be made, if any.  This type of work is new to me, I don't have experience with EJBs on any other application server platform to fall back on.  Can anyone suggest any know traps that a newbie might fall into?  My clientside WAR file does not contain the EJB classes, just the interfaces (I found that problem in another thread).  I can't find a lab or tutorial for this on JBoss 4.2 GA so I have no reference.  I can't find an answer on google and the books I have (O'Reilly and JBoss admin guide) don't discuss this topic.

peace, Anders

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050552#4050552

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050552



More information about the jboss-user mailing list