geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neal Sanche <n...@nsdev.org>
Subject Transactions?
Date Fri, 17 Jun 2005 07:04:18 GMT
Hi All,

Okay, another rough spot found in my transition. I'm trying to create a 
new CMP bean instance from my web app. But it needs a transaction to do 
so. I suppose I could do the operation from within a Session bean method 
(I probably will anyway), but is there a way to obtain a new Transaction 
from within the web application's code? I was used to doing the following:

        UserTransaction tx = null;
        InitialContext ctx = null;
        try {
            ctx = new InitialContext();
            tx = (UserTransaction)ctx.lookup("UserTransaction");
            tx.begin();
            chain.doFilter(request, response);
        } catch (Throwable e) {
            throw new ServletException(e);
        } finally {
            try {
                if (tx != null)
                    tx.commit();
                if (ctx != null)
                    ctx.close();
            } catch (Throwable ex) {
                throw new ServletException(ex);
            }
        }

Now that just throws a name not found for UserTransaction. How do I do 
it with Geronimo?

Thanks in advance.

-Neal

Mime
View raw message