Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBException not getting thrown.  RSS feed

 
chaitanya kapileshwarkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Got a major problem in implementing the ejbstore method for a stateless BMP. I am using session beans and entity beans in my code. From the session bean using a framework class(reflection) I am calling a method on the entity bean (setXXX for which the transaction attribute is : requires new). This method sets the attribute of the entity bean. Now after calling the setXXX method, as a postinvoke ejbstore is called which is going to insert/delete/update the values in the database. However if any errors are encountered during the database operations I am throwing an EJBException. The exception is getting thrown from the ejbstore correctly however the postinvoke method (in the generated stubs) is not catching the remote exception. Is this because I am using Local Interfaces? What should be done in this case, what should be done to ensure that the postinvoke/container correctly converts the exception into remote exception, catches it and throws it back to the calling framework class which in turn throws the exception to the session bean. Here is how the code looks like:

session bean

private xxxmethod()
{
frameworkclass.executemethod(entitybeanreference, methodname(setXXX),parameters)
}

frameworkclass
executemethod()
{
try
{
get the interface type
and callthe method
}
catch(invocationtargetexception)
{
}

stubs
{
call the setXXX method
and as a postinvoke
postinvoke()
catch(remoteexception e)(The problem is here. the ejbexception thrown by ejbstore is not caught and instead it returns a successful response)
{
}

Please help...
 
Henrique Sousa
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I do not know for sure right now if ejbStore gets called in the same thread as the setXxx method (I *think* it is). If it does, then the EJBException you expect will be the cause of an InvocationTargetException while you do the reflection routine. Otherwise, if you are forcing the execution of ejbStore during postinvoke() it is very hard to tell what might be happening. Anyway, you should check the server log for the exception. If it was thrown by ejbStore, it will surely be there. Then read through to find out whether it came from an invocation in your code or not. Posting the exception would be good too, try to do it whenever you can when dealing with bugs.
Best regards
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!