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 Certification (SCBCD/OCPJBCD) and the fly likes Session bean , Local and Remote interface with answer. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Session bean , Local and Remote interface with answer." Watch "Session bean , Local and Remote interface with answer." New topic
Author

Session bean , Local and Remote interface with answer.

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
As we know that a session bean can avoid implementing the busniess interface by applying say Local or Remote
annotation to the class itself as follows



Question and Answer:
Well this time am answering myself.

1) Does this mean that the bean can get away by not implementing all the methods of the interfaces?

Yes its got away, the bean did not implement method2(). The compiler did not complain, since the bean
never implmented TestRemote interface.

2) What happens if the client invokes the buisness interfaces in the above case, which are not implemented by the session bean?

TestBean is deployed, despite not implmenting the method2().
Now when client invokes method2() the following exception is thrown @ the client side
[java] Exception in thread "main" java.lang.RuntimeException: Could not resolve beanClass method from proxy call
[java] at $Proxy0.method2(Unknown Source)
[java] at com.ejb3inaction.actionbazaar.test.client.TestClient.main(TestClient.java:2


SCJP, SCWCD, SCBCD
Mellon Sun
Ranch Hand

Joined: Feb 20, 2003
Posts: 126
It's a little bit freak.


SCJP,SCWCD1.3,SCWCD1.4,SCJD,SCBCD5,SCEA5
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Deepak,

The implemenatation are are using appears to be buggy. The deployer should have caught this problem.

Best regards,
Reza


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637

The implemenatation are are using appears to be buggy. The deployer should have caught this problem.


Hello Rahman,
Its simply a honor getting an opportunity to interact with you.
I could not understand your answer. Are you trying to say that there is a bug in the code or a bug with the Jboss application server.
I am using jboss-4.2.3.GA as my application server.
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Deepak,

Thanks for the kind words. The priviledge is mine, I am just another developer like you - perhaps with slighly different circumstances...

The application server is buggy, but your code is also not spec compliant. If you want, you could open a JIRA issue for JBoss AS.

Best regards,
Reza
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session bean , Local and Remote interface with answer.