File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Query regarding @Local Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Query regarding @Local" Watch "Query regarding @Local" New topic
Author

Query regarding @Local

Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

I have an EJB which has following annotation.

@Remote(SomeInterface.class)

Now, even if I dont implement all the methods of this interface, compiler does not complain.

When I refer this EJB from a servlet and try to call this unimplemented method, it gives some exception as:
Invocation cannot proceed (end of interceptor chain has been hit)


My question is, why is this allowed at first place? Why doesnt compiler complain?


Regards,
Prajakta
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9924
    
158

Prajakta Acharya wrote:

When I refer this EJB from a servlet and try to call this unimplemented method, it gives some exception as:
Invocation cannot proceed (end of interceptor chain has been hit)

Please post the entire exception stacktrace and the relevant code from the Servlet. Also, which server are you using?

Prajakta Acharya wrote:
My question is, why is this allowed at first place? Why doesnt compiler complain?


The Java compiler knows nothing about EJBs other than the fact that @Remote is a annotation supported by the Java language. Unless there's a specific "implements" keyword, the compiler does no checks on the implemented methods in the class. It's the EJB container which uses the @Remote information to create the relevant proxies. That's the whole reason why you need a container/server to run the EJBs.

[My Blog] [JavaRanch Journal]
Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

Hi Jaikiran,

Thank you very much for your valuable inputs. I am using JBOSS 7.

Now i am facing another issue in my set-up.
@EJB is unable to inject an EJB implementing local interface.

The exception is:
java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
java.lang.IllegalArgumentException: Can not set ejb.EchoBeanLocalInterface field servlet.WebServlet.localEcho to ejb.EchoBeanLocalInterface$$$view17

WebServlet code:



Local Interface:


Bean class:


Packaging of the application:
EAR contents:
1) EJBClient.jar (EJB interfaces)
2) EJBApp.jar (EJB implementation)
3) Webapp.war




Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

Resolved.

There were two JARs having that interface class so something related to classpath issues.

Removed one and placed dependencies in MANIFEST.MF and the look up was successful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query regarding @Local
 
Similar Threads
Final check before submission
Integer... and int...
ejbCreate
Questions about creat methods
Remote and Home Interfaces