• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TxnRolledbackException instead of RemoteException

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
____________________________________________________________
TransactionRolledbackException instead of RemoteException?
___________________________________________________________

Hi,
Mi client program is having following code snippet:

Object home = (DepartmentHome) ctx.lookup("DepartmentBean");
dHome = (DepartmentHome) PortableRemoteObject.narrow(home, DepartmentHome.class);

//Create a department with code=1000 and name=HR.

dept = (Department)dHome.create("1000","HR");
.............
............

dept.remove();
dHome.remove("1000");
*****************************
and DD i have

<container-transaction>
<method>
<ejb-name>DepartmentBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>

*************
@ line "dHome.remove("1000");" i'm getting following exception:
********
javax.transaction.TransactionRolledbackException: EJB Exception: : javax.ejb.NoSuchEntityException:
[EJB:010142]Instance of EJB 'DepartmentBean' with primary key '1000' does not exist.
*********
My client hasn't started txn.(if the client has started txn i shd get TransactionRolledbackException). As per EJB2.0 spec(p376 and p375) i shd get RemoteException(Not the RemoveExcpetion).Even with trans-attribute as "RequiresNew" im getting javax.transaction.TransactionRolledbackException


cn anione explain me Y this hapens?

thanx
binoj
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct. It is surprising why you get TransactionRolledbackException in this case. btw what app server are you using?
[ February 22, 2005: Message edited by: Keerthi P ]
 
Binoj Viswanathan
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
im using weblogic8.1...

I dont see ani reazon to throw TransactionRolledbackException bak to the client as the tranx is started by the Container itself...The container can rollbak the tranx....


in place of folowin code snippet
*****************************

........
dept.remove();
dHome.remove("1000");
*****************************

i tried ths...
(1)
*****************************

........
dHome.remove("1000");// or dept.remove();
dept =dHome.findByName("HR");
*****************************

i got follwoing exc..n

*****************************
javax.ejb.ObjectNotFoundException: Bean not found in 'findByName'.
*****************************

(2)
*****************************

........
dHome.remove("1000");// or dept.remove();
dept.getCode() ;
*****************************

i got follwoing exc..n

*****************************
java.rmi.NoSuchObjectException: EJB Exception: : javax.ejb.NoSuchEntityException: [EJB:010140]Bean with primary key: '1000' not found.
*****************************


i think both r perfectli correct behaviours(as per ejb spec) of the container.

binoj
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I got the transactionrollBack Exception when using localHome.remove() method in the seesion bean.

Help me if u have any solution.

Thanks
Siva
 
Binoj Viswanathan
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I got the transactionrollBack Exception when using localHome.remove() method in the seesion bean.

Help me if u have any solution.



pls give us in detail...like,BMT or CMT, hu(container or client) initiated txn etc


binoj
 
Sivakumar Nachimuthu
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is CMP. Client Initiated tranaction thru session Bean.
 
Binoj Viswanathan
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
when u call localHome.remove() method in the seesion bean remote obj, the container will call ejbRemove()[if its SFSB] on the bean instance.If an exception happens during the removal of the bean instance it will throw RemoteException to the client. if the bean instance is running in client txn, in order to give the client more info, container will throw TxnRolledbackException. This is only applicable to container callbacks corresponding to the methods in home intf.

bin
 
reply
    Bookmark Topic Watch Topic
  • New Topic