aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes Query regarding @EJB in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Query regarding @EJB in servlet " Watch "Query regarding @EJB in servlet " New topic

Query regarding @EJB in servlet

Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

My application structure is as follows:
1) I have a JAR file containing EJB interfaces. Lets call it EJBClient.jar.
It is placed in WEB-INF/lib directory of a web application.

2) I have another JAR of actual EJBs implementing above interfaces. This JAR is pacakged as an EAR and deployed on JBoss.
EAR name is echoejb.ear

3) JBoss prints JNDI names of registered EJBs on console.

4) Now, in servlet, I am using @EJB(lookup="lookup-string"), but I am getting following exception:
Can not set ejb.EchoBeanRemoteInterface field org.cts.servlet.WebServlet.remoteEcho1 to ejb.EchoBeanRemoteInterface$$$view6

What does this mean?

I tried looking up using InitialContext but same result
For look-up, I am using global namespace.

5) If EJB implementation jar is placed in the same web application, look-up is successful.

Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

Issue resolved!

I had not annotated the interface with Local or Remote. Look-up is successful now.
I agree. Here's the link:
subject: Query regarding @EJB in servlet