Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Naslai Shobha

+ Follow
since Aug 18, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Naslai Shobha

One important thing to note here is the order in which the webserver loads them and secondly what the application demands.

Suppose the logic which you are planning to write in that init() method is something that only one servlet needs, then its better to go for servlet init method.

Whereas if the logic is required by other servlets then it should be in the Servlet Context:

According to the Servlet Spec the following is the order teh server should follow:
Instantiate an instance of each event listener identified by a <listener> element
in the deployment descriptor.
� For instantiated listener instances that implement ServletContextListener,
call the contextInitialized() method.
� Instantiate an instance of each filter identified by a <filter> element in the deployment
descriptor and call each filter instance�s init() method.
� Instantiate an instance of each servlet identified by a <servlet> element that
includes a <load-on-startup> element in the order defined by the load-onstartup
element values, and call each servlet instance�s init() method.

Shobha Naslai
14 years ago
Hi All,

Passed SCBCD with 90 %. Thank you all the support.

Shobha Naslai
15 years ago

I have taken a voucher from a Prometric testing center. The exam was scheduled for Oct 1 but due to some reasons I was not able to take the exam.
Is there anyway by which I can reschedule the exam.

I spoke to the Prometric center division located at my place, they say its not possible.
But just wanted to know if there is any kind of a option to reschedule a scheduled exam after the schedule date is complete.

I am sorry for posting this here. Though not related to SCBCD, I was preparing for this exam.
Hence I posted this here.

Thank you
Shobha Naslai
you are right !!!
The reason behind this is that it makes your bean code more open: if you would throw a RemoteException you can't expose the method in a local home/component interface.

If instead you throw a EJBException you can, if the interface is remote the container will wrap your EJBException in a RemoteException.

Hi Paulus,
When we say home methods, these methods are defined in the interface extending from EJBHome or EJBLocalHome.
How can we have an option of exposing the home methods in local home or remote home?
Pls explain.
Hi Edi,

ejbActivate() is a container call back method.

Since this is called by the Container the security context of the client will not be available.
Hi Ranganathan,

For the stateless session ejbs, when the client calls create() only the remote stub gets created and is returned to the client.

The remote stub gets associated with the SLSB in the pool, when a business method is invoked.

Hence when the create() is actually not creating the bean, its the same case with remove() also. Only the remote stub is invalid after a remove method. The bean instance still lies in the pool.

Hope this helps.

Shobha Naslai
For an entity bean, the container instantiates the Entitybean class and calls setEntityConext(entityContext) on it.

I would like to know what is the use of EntityContext variable for the entity bean instance when it is in pooled state.
Where actually the bean is using the entityContext in pooled state.

The same applies for a Session Bean also.
I understand that the entity bean with the help of EntityContext can know about its Home, environment.
It will depend upon the database locking mechanism configured. The folowing link gives some information on this.
Originally posted by Keerthi P:
1. If the transaction is rolled back in any of the above three method, to which state bean will be moved? Is bean is moved to pooled state or method ready state.

in the ejbCreate()/ejbPostCreate()/ejbRemove() methods in the case of an entity bean the instance will move from ready state to pooled state, If a transaction is rollback.

the following is an excerpt from the spec

the container will transition the instance to the pooled state. There are three possible
transitions from the ready to the pooled state: through the ejbPassivate() method,
through the ejbRemove() method, and because of a transaction rollback for ejbCreate(),
ejbPostCreate(), or ejbRemove()

2. In an entity bean, if the client gets the RuntimeException,
(1) can he continue with that EJBObject?
-- The bean instance will be killed. If the client still has reference to EJBObject and invokes methods on it, it receives java.rmi.NoSuchObjectException.

(2) Will the container creates new instance of the bean for the client?

-- Depends. If an instance is available in the pool, it can take one from there. Otherwise, a new instance will be created
To Handle the exceptions thrown by the business method, in a bean-managed transaction demarcation.

If its a system exception: The container would mark it for rollback, which means even if the client continues to use the transaction, It would be fruitless.

According to Spec: Table 16 says
Mark for rollback a
transaction that has been
started, but not yet completed,
by the instance.