Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query regarding @EJB in servlet

 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
java:global/echoejb/EchoEJB/remoteEcho!ejb.EchoBeanRemoteInterface

5) If EJB implementation jar is placed in the same web application, look-up is successful.
 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Issue resolved!

I had not annotated the interface with Local or Remote. Look-up is successful now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic