-
1. Re: Transaction locking problem
roadrunner Jan 12, 2002 6:34 AM (in response to robert)Just an idea:
Try to use Requires instead of RequiresNew.
bye
Sven -
2. Re: Transaction locking problem
davidjencks Jan 12, 2002 9:47 AM (in response to robert)I don't really see how this could be happening... but are there more concurrent calls to your bean than connections to hypersonic? There are some scenarios with local transactions (ie non xa drivers) where you can run out of connections with requiresNew calls.
If it does not appear to be a dumb mistake, is there any chance you could turn this into a testcase for the testsuite? -
3. Re: Transaction locking problem
robert Jan 22, 2002 7:19 PM (in response to robert)roadrunner: I've tried both varients for the transactions and no difference :-(
davidjencks: It boggles me too. I thought it might be the database causing trouble, cause it will happen after a restart of JBoss. The very first call to the bean will cause a TransactionRollbackException saying that it is trying to remove the bean lock and it has a tx set. Yet I made no previous call to it. Somehow this 'state' is being maintained even after the server is restarted. The only way to 'fix' it is to stop the server, manually delete the row in the database, restart the server and recreate the bean. Not good.
Also, I installed MySQL and that didn't do anything either; thinking it was hsql somehow. Unless it is the XADataSource driver. (using the JBoss one)
I thought about the connections/calls problem too. But _sometimes_ it works... I've also noticed that a transaction will get rolled back if I let the server sit, i.e. no calls of any kind going to it.
I'll try to isolate exactly when it is happening if I can so it can be tested. I'm also going to try to front it with a session bean (I have a reason for not, but not enough of one that I can't use a SLSB fronting the entity bean) and set the transaction at that level. Not sure if it will help, but who knows.
Any other thoughts?
Thanks! -
4. Re: Transaction locking problem
sachin Jan 22, 2002 10:45 PM (in response to robert)Hi Robert,
Well, i too have a similar kind of problem though not exactly the same. I am unable to delete a record from db through jsp page.
I am getting exception while i try to shutdown the server using ctrl+c. The exception is of the same kind which mentions NullPointer and then something about tx.
I am using jsp-sessionbean-entity bean.
It seems to be a transaction locking problem.
However in my case the first time i try to delete a record after server boot, it is successful. But subsequent calls freeze the server.
Did post a topic 'record deletion' but have not found replies on that.
Will write the solution if i find one.
Sachin -
5. Re: Transaction locking problem
seven Jan 25, 2002 10:10 AM (in response to robert)Does Hypersonic support commit/rollback standards (I've never used it)? What about MySql (as far as I know the plain Mysql is commit/rollback unaware and u need MySql-Max breed to use commit/rollback). Anyway this is just an ideea. U should send us somehow the actual code in order to be able to better judge this one. And as knew JBoss implements pessimistic lock policy for the EJBs, so there should be no attempt from one transaction to intersect with others.
-
6. Re: Transaction locking problem: UPDATE
robert Jan 25, 2002 12:48 PM (in response to robert)Ok, I have news on this issue. Quick background... I think I didn't mention it (my fault!), but my bean was looking up a datasource when it was loaded and storing it in a class variable. The reason for this was that some of the business methods used the datasource for JDBC operations.
Now, that was the whole problem. For whatever reason, keeping this DS was not good. The container, or the DS manager or whatever didn't like it and it conflicted with the transactions. What I did to correct it is to not store the DS in a class variable, but look it up each time I needed it, i.e. in each method invocation. Maybe not quite as fast, but it solved the problem.
I don't think I would really call this a bug per se, but a gotcha, as I don't know the particulars of how the transaction manager interacts with the datasource manager(?), but, there it is.
Thanks for the help and feedback though! -
7. Re: Transaction locking problem: UPDATE
sachin Jan 29, 2002 12:15 AM (in response to robert)Hi All,
Well even i have solved the problem of record deletion.
What i did was that i got a new connection for each of the SQL queries i fired and then closed at the method end( i use bmp).
That solved my problem. My transaction attributes were set to Required in Session bean and Mandatory in the Entity bean with SB calling EB.
I had my application working on sun's j2ee server but when i ported it to jboss i had to make the above changes.
With this i believe i have to set the GCInterval to lesser time so as to garbage collect the connection objects.
Do give me inputs on this so that my code is efficient at least in this area.
Thanks,
Sachin