I have a session bean that has methods in it that create lists from a CMP
entity bean. The methods work fine there is just one client, but with two
clients calling the methods simultaneously I get the following exception:
EntitySynchroImpl.considerRequest() registerSynchronization(this) :
javax.transa
ction.RollbackException
Get the following RemoteException thrown by an enterprise Bean's method
(rethrow
)
java.rmi.RemoteException: java.rmi.ServerException: RemoteException occurred
in
server thread; nested exception is:
java.rmi.RemoteException: Container cannot register synchronization
Obje
ct; nested exception is:
javax.transaction.RollbackException
at
damanPay.pay.CreateStubImpl.getAllStandardProperties(CreateStubImpl.j
ava, Compiled Code)
at
damanPay.pay.JOnASCreateStubImplCreateStub.getAllStandardProperties(J
OnASCreateStubImplCreateStub.java:87)
at
damanPay.pay.JOnASCreateStubImplCreateStub_Skel.dispatch(JOnASCreateS
tubImplCreateStub_Skel.java:88)
at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java, Co
mpiled Code)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java,
Compi
led Code)
at sun.rmi.transport.Transport$1.run(Transport.java, Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java, Compiled
Code
)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
22)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:634)
at java.lang.Thread.run(Thread.java:479)
Current.commit() : javax.transaction.RollbackException
I am using InstantDB and Jonas 1.5 on Windows NT. Both the entity bean
(StandardItem) and the Session bean (CreateStub) have their transaction
levels set to TX_REQUIRED. This is ths session bean code for the offending
method:
public HashMap getAllStandardProperties() throws RemoteException{
HashMap map = new HashMap();
try{
StandardItemHome suHome=
(StandardItemHome)initCtx.lookup("StandardItemHome");
Enumeration enum = suHome.findAll();
while(enum.hasMoreElements()){
StandardItem si = (StandardItem)enum.nextElement();
StandardProperties props= si.getProperties(null);
map.put(props,new Integer(props.oid));
}
}catch(FinderException fe){
return map;
}catch (Exception e){
throw new RemoteException(e.toString());}
return map;
}
I'm not sure if its the database or Jonas causing the problem. The
getProperties method in StandardItem simply returns a class representing the
persistent attributes of the entity bean (as opposed to having get/sets for
each attribute).
Regards,
Robert Hargreaves.