[jboss-user] [Beginners Corner] - Call an ejb from Servlet in different application
bpet36
do-not-reply at jboss.com
Fri Dec 7 12:35:19 EST 2007
Has anyone been able to successfully call an ejb from a servlet that is deployed in a separate ear file, where both are deployed via JBoss.
I have ServletA that is deployed in app1.ear and EJB1 that is deployed in app2.ear.
I attempt to lookup the ejb from ServletA, but it fails and the following exception is caught
SEVERE: object is not an instance of declaring class
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java
:258)
at $Proxy262.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at mil.navy.admacs.DiscoveryManager.discover(DiscoveryManager.java:107)
web.xml for servlet which resides in app2.ear
<ejb-ref>
<ejb-ref-name>ejb/User/EJB1</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
com.ssi.ejb.EJB1Home
mil com.ssi.ejb.EJB1
</ejb-ref>
jboss-web.xml for servlet which resides in app2.ear
<ejb-ref>
<ejb-ref-name>ejb/User/EJB1</ejb-ref-name>
<jndi-name>ejb/User/EJB1</jndi-name>
</ejb-ref>
ejb-jar.xml file for EJB resides in app1.ear:
UserBeanSession
<display-name>UserBeanSession</display-name>
<ejb-name>UserBean</ejb-name>
com.ssi.ejb.EJB1Home
com.ssi.ejb.EJB1
<ejb-class>com.ssi.ejb.EJB1Session</ejb-class>
<session-type>Stateless</session-type>
Any ideas, thanks in advance!
Bob
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111298#4111298
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111298
More information about the jboss-user
mailing list