aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes NullpointerException when I removed an ejb session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NullpointerException when I removed an ejb session" Watch "NullpointerException when I removed an ejb session" New topic
Author

NullpointerException when I removed an ejb session

Steph Wutke
Greenhorn

Joined: Mar 21, 2005
Posts: 1

Hi, I m using WAS 5.1.3 and ejb 2.0, I don't have any trouble since 2 week ... and yesterday I 've got NullPointerException for each calling of remove method of each ejb session (I m using session facade patern) !!!

I don t know why !!

InitialContext iCtx;
Object obj;
try {
iCtx = new InitialContext();
obj = iCtx.lookup(PrometheeEjb.CONTEXT_LOCAL + BtrSequenceFacadeBean.NOM_JNDI);
BtrSequenceFacadeLocalHome btrSequenceFacadeHome = (BtrSequenceFacadeLocalHome) obj;
BtrSequenceFacadeLocal btrSequenceFacadeLocal = btrSequenceFacadeHome.create();
btrSequence = btrSequenceFacadeLocal.getNextBtrSequence(this.numRub, this.getSite());
// Here !!! btrSequenceFacadeLocal is not null, but his reference in memory dont exist ?
btrSequenceFacadeLocal.remove();
} catch (RemoveException exc) {
exc.printStackTrace();
} catch (CreateException exc) {
exc.printStackTrace();
} catch (NamingException exc) {
exc.printStackTrace();
throw new EJBException("EJBException");
}catch (Exception exc){}

Thanks for any reply ...
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Steph,

Couple of things:
  • Is this a SFSB or a SLSB? If your bean is a SLSB then you don�t need to call remove; the client reserves the bean during the current transaction and the server will return the bean in the pool, after the transaction ends. The instance won�t necessarily get removed from the pool. The container will remove it if necessary, in order to preserve resources and not as a direct response to client's remove() call (which is useless anyway).
  • You might need to check if your business method (getNextBtrSequence) fails. If that�s the case and it throws a RuntimeException then your container will: 1) log the error message and will 2) discard the bean. It might be why your remove fails...


  • Regards.


    I think, therefore I exist -- Rene Descartes
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: NullpointerException when I removed an ejb session