This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ejbRemove() and ejbCreate() are never invoked. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ejbRemove() and ejbCreate() are never invoked. " Watch "ejbRemove() and ejbCreate() are never invoked. " New topic
Author

ejbRemove() and ejbCreate() are never invoked.

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
The ejbRemove notification signals that the instance is in the process of being removed by the container.
In the ejbRemove method, the instance releases the resources that it is holding.

To test the above statement from EJB specification, I had defined a ejbRemove(), This was never invoked after i killed the JBOSSS
session.

This specification requires that the ejbRemove and the ejbCreate methods of a message-driven
bean be treated as the PreDestroy and PostConstruct lifecycle callback methods, respectively.
If the message-driven bean implements the MessageDrivenBean interface, the PreDestroy
annotation can only be applied to the ejbRemove method. Similar requirements apply to use of
deployment descriptor metadata as an alternative to the use of annotations.

I had the following code


ejbRemove() and ejbCreate() are never invoked.


SCJP, SCWCD, SCBCD
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Please take time to respond to this question.
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Experts/Ranchers, Please take time and reply.
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
Hi Deepak,

First please understand that most of the members in here are self contributors like you. So I dont think it is good force them to reply, but normally they respond quickly.

About your problem,

1. Why you have implemented both SessionBean and MessageListener. SessionBeans and MDBs 2 different things.

2. What did you do to create new instance of this MDB (or SB)? Did you send a message? If not it willnot create an instance.

3. Try by adding annotated listener like @PostConstruct. If that one also not being invockeed issue is in somewhere else

Hope this would help to trace the issue

Regards
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
First please understand that most of the members in here are self contributors like you. So I dont think it is good force them to reply, but normally they respond quickly.


I hope you have noticed the use of "Please"

Why you have implemented both SessionBean and MessageListener. SessionBeans and MDBs 2 different things. : I understand both are different things , I just implemented them. I think the whole point is the type of annotation used on the top of the class and since the example its @MessageDriven, the methods of SessionBean will simply be ignored and am alright with that.
My concern is ejbRemove() was never invoked???

What did you do to create new instance of this MDB (or SB)? Did you send a message? If not it willnot create an instance
YEs i had sent a message to the destination for which the above MDB is a listener.

Since i want to test ejbRemove and ejbCreate methods, If i had the annotation , i know they will work. I want to test the statement in the specification which i have mentioned in my question.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ejbRemove() and ejbCreate() are never invoked.
 
Similar Threads
jms not bound? what is that?
Who creates destination Queueor Topic
setMessageDrivenContext() doubt
JMS not bound? What is this?
JBoss 5.1 ejbCreate method not called on mdb