Hi Jason,

Strange!
I'm not a servlet expert,
but could it be a multi-thread
problem?

Armin

> protected PersistenceBroker getDefaultBroker() throws
PBFactoryException
> {
>   return PersistenceBrokerFactory.defaultPersistenceBroker();
> }
>
> Then I have methods in the subclass like this:
>
> public void createTable() {
Try
PersistenceBroker broker = this.getDefaultBroker();
instead of

>   broker = this.getDefaultBroker(); ??
>     try {
>       broker.beginTransaction();
>       broker.store(this);
>       broker.commitTransaction();
>       broker.removeFromCache(this);
>     }
>     catch (Exception e) {
>       broker.abortTransaction();
>       log.error("Exception in createTable(): ", e);
>     }
>     finally {
>       broker.close();
>     }
>   }
>
>
> This method fails (stack trace at the end).
>
> However THIS one succeeds.
>
> public void createTable() {
>   PersistenceBroker br =
> PersistenceBrokerFactory.defaultPersistenceBroker();
>     try {
>       br.beginTransaction();
>       br.store(this);
>       br.commitTransaction();
>       br.removeFromCache(this);
>     }
>     catch (Exception e) {
>       br.abortTransaction();
>       log.error("Exception in createTable(): ", e);
>     }
>     finally {
>       br.close();
>     }
>   }
>
> This behavior seems to only happen with store, because it works fine
> with remove like this:
>
> public void removeTable() {
>     try {
>       broker = super.getDefaultBroker();
>       broker.beginTransaction();
>       broker.delete(this);
>       broker.commitTransaction();
>     }
>     catch (Exception e) {
>       broker.abortTransaction();
>       log.error("Exception in removeTable(): ", e);
>     }
>     finally {
>       broker.close();
>     }
>   }
>
> Any idea why I get this exception?
>
> Thanks, Jason
>
> EXCEPTION:
> ----------------------------------------------
>
> 2002-10-31 15:04:05,429 [tcpConnection-8080-0] ERROR
> org.nacse.dbd.data.table.TableAction (TableAction.java:119) -
Exception
> in DispatchAction createTable:
> org.apache.ojb.broker.TransactionNotInProgressException
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.abortTransaction(Un
known Source)
> at org.nacse.dbd.data.table.Table.createTable(Table.java:173)
> at
> org.nacse.dbd.data.table.TableAction.createTable(TableAction.java:113)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.apache.struts.actions.DispatchAction.perform(DispatchAction.java:236
)
> at
>
org.apache.struts.action.ActionServlet.processActionPerform(ActionServle
t.java:1787)
> at
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
> at
>
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.ja
va:96)
> at com.caucho.server.http.Invocation.service(Invocation.java:312)
> at
>
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
> at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:221)
> at
>
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163
)
> at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
> at java.lang.Thread.run(Thread.java:536)
>
>
>
>
>
>
>
>
>
>
>
> On Thu, 2002-10-31 at 12:07, Armin Waibel wrote:
> > Could you post the stack trace
> > and the code snip where it happend?
> >
> > regards,
> > Armin
> >
> > ----- Original Message -----
> > From: "Jason McKerr" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, October 31, 2002 8:58 PM
> > Subject: Rollback was called in ConnectionManager...
> >
> >
> > > I just upgraded and I must be missing something that changed.
> > >
> > > When I go to store an object with a simple "broker.store(this);"
> > >
> > > I get this
> > >
> > > "[org.apache.ojb.broker.accesslayer.ConnectionManager] INFO:
Rollback
> > > was called, do rollback on current connection [Pool
> > > org.postgresql.jdbc2.Connection@162198b]"
> > >
> > > This, in turn, seems to cause the following
> > > TransactionNotInProgressException.
> > >
> > > I went from 0.9.4 to 0.9.7.
> > >
> > > Am I doing something wrong with my connections or something? Why
is it
> > > doing a rollback on the connection before it even gets to a
> > > commitTransaction() call?
> > >
> > > Any help much appreciated.
> > >
> > > Thanks,
> > >
> > > Jason
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:ojb-user-help@;jakarta.apache.org>
> > >
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
<mailto:ojb-user-help@;jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ojb-user-help@;jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>

Reply via email to