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 Missed PreDestroy Calls 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 "Missed PreDestroy Calls" Watch "Missed PreDestroy Calls" New topic

Missed PreDestroy Calls

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637

01:23:26,500 INFO [EARDeployer] Started J2EE application: file:/E:/DJ/Certifications
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.setSessionContext()
01:23:33,390 INFO [STDOUT] Exit:HelloUserBean.setSessionContext()
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.init(***** N E W *****)
01:23:33,390 INFO [STDOUT] [PostConstruct]
01:23:33,390 INFO [STDOUT] Exit:HelloUserBean.init()
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.afterBegin()
01:23:33,390 INFO [STDOUT] Exit:HelloUserBean.afterBegin()
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.sayHello()
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.instanceMethod()()
01:23:33,390 INFO [STDOUT] Exit:HelloUserBean.instanceMethod()()
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.afterCompletion()
01:23:33,390 INFO [STDOUT] didCommit:false
01:23:33,390 INFO [STDOUT] Exit:HelloUserBean.afterCompletion()
01:23:33,390 INFO [STDOUT] Enter:HelloUserBean.destroy()
01:23:33,421 INFO [STDOUT] [PreDestroy]
01:23:33,421 INFO [STDOUT] Exit:HelloUserBean.destroy()

EJB 3.0 Core Specification:
4.4.3 Missed PreDestroy Calls
A system exception thrown from the instance's method to the container

HelloUserBean invokes instanceMethod() from one of the business interface methods, which throws a System exception, As expected the instance is destroyed but the PreDestroy call back is invoked violating specification.

Can someone explain what is happening here.

EJB Version : 3.0
Application Server: JBOSS 4.2.3.GA
J2SE: 1.5 or 5.0
OS: Windows XP

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032

Which is your method in the code marked for PreDestroy callback? Can you post the complete code please?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Here is the PreDestroy method

I had used jboss-4.2.3.GA as the application server.
Looks like this is yet another case of jboss-4.2.3.GA violating ejb 3.0 specification.
With so much less time remaining & my request post for selling the Sun Voucher being removed by moderators as "Spam", looks like i definetly started the preparation on a wrong note.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

my request post for selling the Sun Voucher being removed by moderators as "Spam"

Really ? Such requests usually end at the Blatant Advertising forum. It's there. Those removed were duplicates.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Missed PreDestroy Calls
It's not a secret anymore!