• Post Reply Bookmark Topic Watch Topic
  • New Topic

Few Questions

Naidu Sanapala
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1 Which statement about locating or using a session bean's home interface is true?

A) Acquire an InitialContext is required only for remote clients.
B) The Initial Context must be narrowed before it can be used.
C) After it is acquired by a client, a home interface can be used multiple times.
D) The client can aquired a handle for the bean's local home interface.
Q2 Which three are goals for security management in the ejb architecture?(choose 3)

A) allow for portabillity of EJB applications across servers that user different security mechanisms.
B) provide a robust authentication mechanism for standardization.
C) allow the application assembler and deployer to supply the security policies at deployment time.
D) lessen the burden for the bean provider for securing the application.
E) provide a rich secuity API for the bean developer to use within the EJB.
Q3 Which is the true about the client's view of exception received from an ejb?

A) Receiving an application exception communicates to the client that the bean will no longer be accessible
B) The client of a CMT bean can determine if the transaction has been roll back by calling the getStatus() method of the java.transaction.UserTransaction interface
C) If the client receives an EJBException,the client must discontinue the transaction.
D) If the client receives the java.rmi.RemoteException exception, the client will not typically know whether the method has completed.

Q4 Which 2 are true when comparing two session object with different homes?

A) Using the isIdentical() method, stateless session beans will always return true
B) Using the isIdentical() method, stateless session beans will always return false
C) The isIdentical() method can be used for only local object reference.
D) Using the isIdentical() method, stateful session beans will always return true
E) Using the isIdentical() method, stateful session beans will always return false

My answer Q1: C Q2:BCD Q3:C Q4:BE

But I don't sure Q3 whether C Or D

If whoever think those answer not as same as me . Would you please explain reason for your answers
Tejas Gokhale
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answers of Q2. is ACD and not BCD and that of Q3.is D. Following are the excerpts from ejb2.0 specs:

Regarding Q2.:
We set the following goals for the security management in the EJB architecture:
� Lessen the burden of the application developer (i.e. the Bean Provider) for securing the application
by allowing greater coverage from more qualified EJB roles. The EJB Container provider
provides the implementation of the security infrastructure; the Deployer and System
Administrator define the security policies.
� Allow the security policies to be set by the Application Assembler or Deployer rather than
being hard-coded by the Bean Provider at development time.
� Allow the enterprise bean applications to be portable across multiple EJB Servers that use different
security mechanisms.

Regarding Q3.
If the client receives the java.rmi.RemoteException or the javax.ejb.EJBException
exception from a method invocation, the client, in general, does not know if the enterprise Bean�s
method has been completed or not.
If the client executes in the context of a transaction, the client�s transaction may, or may not, have been
marked for rollback by the communication subsystem or target bean�s Container.
For example, the transaction would be marked for rollback if the underlying transaction service or the
target Bean�s Container doubted the integrity of the data because the business method may have been
partially completed. Partial completion could happen, for example, when the target bean�s method
returned with a RuntimeException exception, or if the remote server crashed in the middle of executing
the business method.
The transaction may not necessarily be marked for rollback. This might occur, for example, when the
communication subsystem on the client-side has not been able to send the request to the server.
When a client executing in a transaction context receives a RemoteException or an EJBException
from an enterprise bean invocation, the client may use either of the following strategies to deal
with the exception:
� Discontinue the transaction. If the client is the transaction originator, it may simply rollback its
transaction. If the client is not the transaction originator, it can mark the transaction for rollback
or perform an action that will cause a rollback. For example, if the client is an enterprise
bean, the enterprise bean may throw a RuntimeException which will cause the Container
to rollback the transaction.
� Continue the transaction. The client may perform additional operations on the same or other
enterprise beans, and eventually attempt to commit the transaction. If the transaction was
marked for rollback at the time the RemoteException or EJBException was thrown to
the client, the commit will fail.
If the client chooses to continue the transaction, the client can first inquire about the transaction status to
avoid fruitless computation on a transaction that has been marked for rollback. A client that is an enterprise
bean with container-managed transaction demarcation can use the EJBContext.getRollbackOnly()
method to test if the transaction has been marked for rollback; a client that is an
enterprise bean with bean-managed transaction demarcation, and other client types, can use the User-
Transaction.getStatus() method to obtain the status of the transaction.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!