Thanks Nick for the fast reply. Thing is synchronization is a over kill for my webapp as there will be many users on the system at a given time.
Yes, I'm using connection pooling and I get only one connection when the transaction begins, and too many hits to the database also is not good. It will slow down the system. Any other thoughts other than synchronization? Aditya. -----Original Message----- From: Nick Stuart [mailto:[EMAIL PROTECTED] Sent: Friday, May 28, 2004 11:12 AM To: [EMAIL PROTECTED] Subject: Re: [castor-user] Transaction not in progress It sounds like you have a synchronization issue. Have you tried making the said method synchronized or maybe even just the offending transaction? I often take the practice of making all my write actions to the database synchronized. Might be a bit over-kill but it seems to work for me at least. This is kind of odd because you are getting a new database each time, and the first think that comes to mind is if you are using connection pooling or do just have one connection to the database? (not sure if it would matter). -Nick -------Original Message----- --From: Aditya Akella [mailto:[EMAIL PROTECTED] --Sent: Friday, May 28, 2004 2:02 PM --To: [EMAIL PROTECTED] --Subject: [castor-user] Transaction not in progress -- -- --Hi All, -- --I'm getting error for the following code snippet -- -- --......//some code --PatientForm ptForm = (PatientForm)form; --......//some code --myDb = jdo.getDatabase(); --myDb.begin(); -- -- PatientBizDelegate.processFillUpLists(ptForm,myDb);//this --method has will fill up 8 Lists and set them to the form obj. --Data is filled up from cache(all these lists will be using castor). -- forward = --PatientBizDelegate.processAddUpdateOfPatient(ptJdo,ptForm,forw --ard,logOutput, --myDb); --myDb.commit(); --myDb.close(); -- -- --here is the method for processFillUpLists -- --public static final PatientForm --processFillUpVectors(PatientForm patientForm, Database myDb) --throws PersistenceException { -- List ptypeList = PatientLiteDB.getPatientType(myDb); -- List relcationList= PatientLiteDB.getPatientRelationCode(myDb); -- List pssList= PatientLiteDB.getSignatureSource(myDb); -- List psaList= PatientLiteDB.getSourceOfAdmissionList(myDb); -- List mpList= ProviderDB.getMainProviderJdoList(myDb); -- .......... //here rest of the code follows -- return patientForm; --} -- --here is the code snippet for one of the above methods, and --the rest will be of the same pattern. -- --public static final List getPatientRelationCode(Database --myDb) throws PersistenceException { -- List prcList = new ArrayList(); -- OQLQuery productOql = myDb.getOQLQuery("SELECT obj FROM --com.PCPgo.prm.web.util.PatientReleaseCode obj"); -- QueryResults results = productOql.execute(Database.ReadOnly); -- while (results.hasMore()) -- { -- prcList.add(results.next()); -- } -- results.close(); -- productOql.close(); -- return prcList; --} -- --NOTE: All the above code works fine when a single user using --the system. If I've more than 2 users I'm getting the --following error more often. This also happens when we are --testing with more than 3 virtual users. -- -- --java.lang.IllegalStateException: Transaction not in progress ---- must open a transaction in order to perform this operation -- at --org.exolab.castor.persist.TransactionContext.prepare(Transacti --onContext.java --:1434) -- at --org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl. --java:528) -- at --com.PCPgo.prm.web.patient.PatientLiteAction.execute(PatientLit --eAction.java:2 --41) -- at --org.apache.struts.action.RequestProcessor.processActionPerform --(RequestProces --sor.java:465) -- at --org.apache.struts.action.RequestProcessor.process(RequestProce --ssor.java:274) -- at --org.apache.struts.action.ActionServlet.process(ActionServlet.j --ava:1422) -- at --org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505) -- at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) -- at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) -- at --org.apache.catalina.core.ApplicationFilterChain.internalDoFilt --er(Application --FilterChain.java:247) -- at --org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli --cationFilterCh --ain.java:193) -- at --org.apache.catalina.core.StandardWrapperValve.invoke(StandardW --rapperValve.ja --va:260) -- at --org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invok --eNext(StandardPipeline.java:643) -- at --org.apache.catalina.core.StandardPipeline.invoke(StandardPipel --ine.java:480) -- at --org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) -- at --org.apache.catalina.core.StandardContextValve.invoke(StandardC --ontextValve.ja --va:191) -- at --org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invok --eNext(StandardPipeline.java:643) -- at --org.apache.catalina.core.StandardPipeline.invoke(StandardPipel --ine.java:480) -- at --org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) -- at --org.apache.catalina.core.StandardContext.invoke(StandardContex --t.java:2396) -- at --org.apache.catalina.core.StandardHostValve.invoke(StandardHost --Valve.java:180 --) -- at --org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invok --eNext(StandardPipeline.java:643) -- at --org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDi --spatcherValve. --java:170) -- at --org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invok --eNext(StandardPipeline.java:641) -- at --org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport --Valve.java:172 --) -- at --org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invok --eNext(StandardPipeline.java:641) -- at --org.apache.catalina.core.StandardPipeline.invoke(StandardPipel --ine.java:480) -- at --org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) -- at --org.apache.catalina.core.StandardEngineValve.invoke(StandardEn --gineValve.java --:174) -- at --org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invok --eNext(StandardPipeline.java:643) -- at --org.apache.catalina.core.StandardPipeline.invoke(StandardPipel --ine.java:480) -- at --org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) -- at --org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter. --java:223) -- at --org.apache.coyote.http11.Http11Processor.process(Http11Process --or.java:405) -- at --org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle r.processConne --ction(Http11Protocol.java:380) -- at --org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi --nt.java:508) -- at --org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( ThreadPool.jav --a:533) -- at java.lang.Thread.run(Thread.java:534) -- --Thanks, --Aditya -- -- -- ------------------------------------------------------------- --If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: -- unsubscribe castor-user -- -- ----- --Incoming mail is certified Virus Free. --Checked by AVG anti-virus system (http://www.grisoft.com). --Version: 6.0.691 / Virus Database: 452 - Release Date: 5/26/2004 -- -- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.691 / Virus Database: 452 - Release Date: 5/26/2004 ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user
