geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marquis <marqu...@etu.unige.ch>
Subject Re: simple Entity create() fails
Date Fri, 15 Jul 2005 19:00:02 GMT
> Can you try adding a container transaction block setting REQUIRED
> for all the methods of that entity

I added
<assembly-descriptor>
	<container-transaction>
		<method>
			<ejb-name>Employee</ejb-name>
			<method-name>*</method-name>
		</method>
		<trans-attribute>Required</trans-attribute>
	</container-transaction>
</assembly-descriptor>

but the same error happens.


> or else put a UserTransaction around the code that calls it in the  
> servlet?

I changed my servlet code :
[...]
	javax.transaction.UserTransaction utx = null;
      try {
          utx = (javax.transaction.UserTransaction)
          jndiContext.lookup("java:comp/UserTransaction");
      } catch (Exception e) {
          out.println("<li>Cannot lookup java:comp/UserTransaction: "
          + e + "</li>");
      }

		try {
	         Object ref3  = jndiContext.lookup("java:comp/env/ejb/Employee");
	        eh= (EmployeeHome) PortableRemoteObject.narrow(ref3,  
EmployeeHome.class);
	      } catch(Exception e) {
	         throw new ServletException("Failed to lookup employee", e);
	      }

		Employee employee = null;
		try {
          utx.begin();
			employee = eh.create("jack", "atak", "ja@a.com");
          utx.commit();
		} catch (Exception e) { throw new ServletException("create() failed",  
e); }
[...]

this gives a different stack trace (whatever the containter transaction  
attribute above) :



20:53:40,187 WARN  [SystemExceptionInterceptor] Employee
javax.transaction.TransactionRolledbackException
         at  
org.openejb.transaction.ContainerPolicy$TxMandatory.invoke(ContainerPolicy.java:287)
         at  
org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
         at  
org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
         at  
org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:234)
         at  
org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:129)
         at  
org.openejb.proxy.EntityEJBHome$$EnhancerByCGLIB$$6c319536.create(<generated>)
         at  
org.jboss.docs.interest.InterestServlet.doPost(InterestServlet.java:146)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
         at  
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
         at  
org.apache.geronimo.jetty.JettyServletHolder.handle(JettyServletHolder.java:92)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:832)
         at  
org.mortbay.jetty.servlet.JSR154Filter.doFilter(JSR154Filter.java:171)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
         at  
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
         at  
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:623)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
         at org.mortbay.http.HttpServer.service(HttpServer.java:954)
         at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
         at  
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
         at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
         at  
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
         at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
javax.servlet.ServletException: create() failed
         at  
org.jboss.docs.interest.InterestServlet.doPost(InterestServlet.java:148)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
         at  
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
         at  
org.apache.geronimo.jetty.JettyServletHolder.handle(JettyServletHolder.java:92)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:832)
         at  
org.mortbay.jetty.servlet.JSR154Filter.doFilter(JSR154Filter.java:171)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)
         at  
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
         at  
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
         at  
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:623)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
         at org.mortbay.http.HttpServer.service(HttpServer.java:954)
         at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
         at  
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
         at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
         at  
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
         at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
20:53:40,199 WARN  [HttpConnection] POST /interest/InterestServlet HTTP/1.1
java.lang.RuntimeException: WRONG EXCEPTION! returned from servlet call  
with wrong tx context
         at  
org.apache.geronimo.jetty.interceptor.TransactionContextBeforeAfter.after(TransactionContextBeforeAfter.java:73)
         at  
org.apache.geronimo.jetty.interceptor.ComponentContextBeforeAfter.after(ComponentContextBeforeAfter.java:50)
         at  
org.apache.geronimo.jetty.interceptor.ThreadClassloaderBeforeAfter.after(ThreadClassloaderBeforeAfter.java:52)
         at  
org.apache.geronimo.jetty.interceptor.WebApplicationContextBeforeAfter.after(WebApplicationContextBeforeAfter.java:51)
         at  
org.apache.geronimo.jetty.interceptor.RequestWrappingBeforeAfter.after(RequestWrappingBeforeAfter.java:53)
         at  
org.apache.geronimo.jetty.JettyWebAppContext.leaveContextScope(JettyWebAppContext.java:273)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1577)
         at  
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:623)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
         at org.mortbay.http.HttpServer.service(HttpServer.java:954)
         at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
         at  
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
         at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
         at  
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
         at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


Sam



Mime
View raw message