You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ju...@Bertelsmann.de on 2003/06/26 14:42:46 UTC
unable to get transaction in JBoss
Hello,
I'm using JBoss 3.0.6 and I have a web application running that uses OJB
rc3. I'm trying to insert an object but I'm not able to get the current
transaction:
Transaction tx = odmg.currentTransaction(); /* here I get the crash */
tx.lock(object, Transaction.WRITE);
tx.commit();
The ODMG implemantation is instantiated as follows (I didn't wanted to use
ODMGFactory because needed JBoss specific Jar-Files):
ODMGJ2EEFactory factory = null;
try
{
factory = (ODMGJ2EEFactory) context.lookup("java:/ojb/defaultODMG");
}
catch (NamingException e)
{
logger.error(THIS_CLASS + "ctx.lookup(java:/ojb/defaultODMG) failed", e);
throw new OJBRuntimeException("Could not lookup ODMG factory instance",
e);
}
this.odmg = factory.getInstance();
What am I doing wrong?
Julia.
P.S.: The Stack Trace:
org.odmg.TransactionNotInProgressException: No external transaction found
at org.apache.ojb.odmg.JTATxManager.registerTx(Unknown Source)
at org.apache.ojb.odmg.TransactionImpl.begin(Unknown Source)
at org.apache.ojb.odmg.OJBJ2EE_2.beginInternTransaction(Unknown
Source)
at org.apache.ojb.odmg.OJBJ2EE_2.currentTransaction(Unknown Source)
at
de.arvatosystems.monitoring.integration.dao.server.ServerOjbDAO.insert(Serve
rOjbDAO.java:285)
at
de.arvatosystems.monitoring.business.delegate.ServerDelegate.insert(ServerDe
legate.java:191)
at
de.arvatosystems.monitoring.presentation.action.server.CollectModule.execute
(CollectModule.java:255)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:465)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandl
er.java:280)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1717)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext
.java:549)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1667)
at org.mortbay.http.HttpServer.service(HttpServer.java:862)
at org.jboss.jetty.Jetty.service(Jetty.java:497)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:759)
at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:776)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
Re: unable to get transaction in JBoss
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,
in your configuration OJB needs a JTA transaction
to synchronize with this a internal tx.
Try to use UserTransaction
UserTransaction utx = lookup..
utx.begin()
> Transaction tx = odmg.currentTransaction(); /* here I get the crash */
> tx.lock(object, Transaction.WRITE);
utx.commit();
or enable container managed transaction demarcation.
regards,
Armin
----- Original Message -----
From: <Ju...@Bertelsmann.de>
To: <oj...@db.apache.org>
Sent: Thursday, June 26, 2003 2:42 PM
Subject: unable to get transaction in JBoss
> Hello,
>
> I'm using JBoss 3.0.6 and I have a web application running that uses
OJB
> rc3. I'm trying to insert an object but I'm not able to get the
current
> transaction:
>
> Transaction tx = odmg.currentTransaction(); /* here I get the crash */
> tx.lock(object, Transaction.WRITE);
> tx.commit();
>
> The ODMG implemantation is instantiated as follows (I didn't wanted to
use
> ODMGFactory because needed JBoss specific Jar-Files):
>
> ODMGJ2EEFactory factory = null;
> try
> {
> factory = (ODMGJ2EEFactory) context.lookup("java:/ojb/defaultODMG");
> }
> catch (NamingException e)
> {
> logger.error(THIS_CLASS + "ctx.lookup(java:/ojb/defaultODMG)
failed", e);
> throw new OJBRuntimeException("Could not lookup ODMG factory
instance",
> e);
> }
> this.odmg = factory.getInstance();
>
> What am I doing wrong?
>
> Julia.
>
>
> P.S.: The Stack Trace:
>
> org.odmg.TransactionNotInProgressException: No external transaction
found
> at org.apache.ojb.odmg.JTATxManager.registerTx(Unknown Source)
> at org.apache.ojb.odmg.TransactionImpl.begin(Unknown Source)
> at
org.apache.ojb.odmg.OJBJ2EE_2.beginInternTransaction(Unknown
> Source)
> at org.apache.ojb.odmg.OJBJ2EE_2.currentTransaction(Unknown
Source)
> at
>
de.arvatosystems.monitoring.integration.dao.server.ServerOjbDAO.insert(S
erve
> rOjbDAO.java:285)
> at
>
de.arvatosystems.monitoring.business.delegate.ServerDelegate.insert(Serv
erDe
> legate.java:191)
> at
>
de.arvatosystems.monitoring.presentation.action.server.CollectModule.exe
cute
> (CollectModule.java:255)
> at
>
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
oces
> sor.java:465)
> at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
> at
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
> at
>
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
andl
> er.java:280)
> at
>
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1717)
> at
>
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
text
> .java:549)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1667)
> at org.mortbay.http.HttpServer.service(HttpServer.java:862)
> at org.jboss.jetty.Jetty.service(Jetty.java:497)
> at
org.mortbay.http.HttpConnection.service(HttpConnection.java:759)
> at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:923)
> at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:776)
> at
>
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202
)
> at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
> at
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>