Forum LAMS for Tech-Heads - General Forum: Running multiple JBoss instances giving DataIntegrityViolationException


 
You may request notification for Running multiple JBoss instances giving DataIntegrityViolationException.
Search: 

1: Running multiple JBoss instances giving DataIntegrityViolationException
11/16/09 11:04 AM
[ Reply | Forward ]
Greetings,

We are running LAMS 2.3.1 on RH EL5 with a MySQL 5.1.31. We are trying to setup 3 instances running on separate servers (no session replication) with a single DB using Apache mod_proxy and mod_proxy_ajp to handle the load balancing across the instances. Everything seems to be working well with one major exception. When a user submits a response, a DataIntegrityViolationException error is thrown. The full stack is:

2009-11-16 09:50:31,361 [TP-Processor12:] FATAL org.lamsfoundation.lams.web.util.CustomStrutsExceptionHandler - org.springframework.dao.DataIntegrityViolationException: Hibernate transaction synchronization: Could not execute JDBC batch update; SQL [insert into tl_laqa11_usr_resp (answer, hidden, attempt_time, visible, time_zone, qa_que_content_id, que_usr_id, response_id) values (?, ?, ?, ?, ?, ?, ?, ?)]; Duplicate entry '13290' for key 'PRIMARY'; nested exception is java.sql.BatchUpdateException: Duplicate entry '13290' for key 'PRIMARY'
java.sql.BatchUpdateException: Duplicate entry '13290' for key 'PRIMARY'

If we disable 2 of the 3 servers, this error goes away. I'm not very familiar with Hibernate but it seems like the the primary key being generated by Hibernate rather than MySQL on insert.

I came across this bug http://bugs.lamsfoundation.org/browse/LDEV-1973 which seems related but has nothing to do with multiple instances of LAMS running simultaneously against the same DB.

Thanks in advance for any suggestions,
Bill

Posted by William Holloway

2: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 1 11/16/09 11:51 PM
[ Reply | Forward ]
Hi,

You're right about hibernate generating the key rather than MySQL - I have no idea why this was done as its the only table in Q&A that does so! I'll change this to MySQL-generated ids so that it's in line with the other tables. This might fix your problem - it should be part of LAMS 2.3.3.

Also - did you enable cache replication in your jboss instances? e.g. step 7 on this page, http://wiki.lamsfoundation.org/display/lams/Clustering. That could be another reason for the problem, if the jboss cache used by hibernate were not shared between your jboss instances.

Let me know what you think - if you want I can build a new copy of the Q&A tool jar based on LAMS 2.3.1 with the id generation fix I mentioned earlier, to see if that resolves the problem.

Posted by Jun-Dir Liew

3: Re: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 2 11/18/09 08:51 AM
[ Reply | Forward ]
Hi,

Thank you for the reply and for the information.

I attempted to setup the clustering as documented in the link you provided but discovered an issue with launching the authoring environment from Sakai (2.5.x), our LMS. Basically the authentication was failing but for that piece only. The Learners were able to launch a module and authenticate fine. Because of that, I thought (perhaps erroneously) that running multiple "un-clustered" instances might simplify things while still providing for some redundancy, albeit with a re-login.

I'd be very grateful if you would build the Q&A tool jar with the fix so we could test this out.

Many thanks,
Bill

Posted by William Holloway

4: Re: Re: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 3 11/18/09 06:38 PM
[ Reply | Forward ]
Sounds like a separate issue, the Author not working from Sakai. But I'll attaching the jar to this post... remember to make appropriate backups (e.g. original jar, database)! This jar is a modified version of the one in LAMS 2.3.1.

Posted by Jun-Dir Liew

Attachments:
5: Re: Re: Re: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 4 11/18/09 06:43 PM
[ Reply | Forward ]
Oops - wrong file! Do not use, will update with correct one soon...

Posted by Jun-Dir Liew

6: Re: Re: Re: Re: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 5 11/18/09 06:51 PM
[ Reply | Forward ]
Correct file.

Posted by Jun-Dir Liew

7: Re: Re: Re: Re: Re: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 6 11/18/09 06:53 PM
[ Reply | Forward ]
Got a server error uploading file. Will email you direct.

Posted by Jun-Dir Liew

8: Re: Re: Re: Re: Re: Re: Re: Running multiple JBoss instances giving DataIntegrityViolationException
In response to 7 11/19/09 08:11 AM
[ Reply | Forward ]
Email received. Will let you know how it goes.

Many thanks for your help.
Bill

Posted by William Holloway

Reply to first post on this page
Back to LAMS for Tech-Heads - General Forum