File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes an exception question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "an exception question." Watch "an exception question." New topic

an exception question.

Praveena Gupta

Joined: Jun 26, 2006
Posts: 12
On which line is the exception thown?
According my thinking, the excepption is thrown at line 16 getEJBHome() as this method returns remote Home,and when this method is called and the bean does not have a remote home "illigal State Exception " is thrown.

Please correct if i am wrong.

Given an interface:

public interface MyI {
public Set go(Set s);

Given an excerpt from a stateful session bean that implements this business interface:

9. @Stateful
10. @TransactionAttribute(TransactionAttributeType.REQUIRED)
11. public class MyStatefulBean implements MyI {
12. @Resource SessionContext ctx;
13. public Set go(Set s) {
14. ctx.getRollbackOnly();
15. ctx.getEJBOjbect();
16. ctx.getEJBHome();
17. throw new Exception("Will I, won't I?");
18. }
50. }

No deployment descriptor is used. Which statement is correct?

An exception is thrown on line 14.
An exception is thrown on line 15.
An exception is thrown on line 16.
An exception is thrown on line 17.
Meng Tan
Ranch Hand

Joined: Jan 20, 2001
Posts: 115

My thinking is line 15. The bean does not have a EJB 2.1 remote interface.

Meng Tan
I agree. Here's the link:
subject: an exception question.
It's not a secret anymore!