invoke ejb ,JTA in tomcat server will get the error.

abayi 04-04-19

i use the tomcat server and a ejb server envirmoment.
some logic code is like these:

class ship
UserTransaction ut=null;
public void begin()
ut=new UserTransaction

public void add(String nn) throws Exception
invoke some ejb
save some data into database
public void commit()
public void rollback()

and this class will be save and invoke in tomcat jsp file.

a complete transaction is like these
step 1 )file1.jsp to start the transaction
2 )file2.jsp to add the data or detail ,like buy
information, product ....
3)file3.jsp to commit transaction or rollback transaction

tomcat ship in session
client1 --- connect-- Thread1 --- ship.begin() file1.jsp
cleint2---------------- Thread2 --- ship.begin() file1.jsp
client1 ---------------Thread3 ----- ship.add("aa") file2.jsp
client2--------------- thread2------ship.add("aa") file2.jsp
client2-----------------Thread2-----ship.commit() file3.jsp

i had did the test ,and confirm the client cant confirm get the some thread in tomcat server.

if like the client2 will not get any error and can execute sucessful.
but the tomcat Thread pool cant control by jboss .
so how does it solve this problem??
thanks you very much.
because i try to implement a software like ejb server ,and self yo provider the distrubtion transaction function. and i got this problem, hope you can help me to solve it.thank you

2004-04-19 21:29

The crux of your problem is to provide a transaction control which span several threads.(each invocation of *.jsp means a new thread.) Although such transaction is allowed by means of stateful-session-bean, the usage is strongly discouraged for the reason of its error-prone. U'd better refactor your code and finish the transaction in single thread.

2004-04-19 21:38

by the way, could u tell the problem in chinese? it's quite tough to dig out your problem! :)

2004-04-20 09:25

Sorry,cos in my company not the chinese system can type the chinese.

so that mean we cant use the transaction in many threads ,or can invoke it in single thread? is it like that?

and how the stateful-session bean working in the JTA.
can give some code or examples.
thanks you very much.

2004-04-20 12:21

My Advice: NEVER make the transaction span several threads!

6Go 1 2 3 4 ... 6 下一页