Thanks for the feedback.
Looks like I need to do more reading about transactions in EJB. At the moment the thought of removing s.beingTransaction() from my code feels as safe as skating on thin ice ;-)
No thats not the fully stack trace. I thought I could save space and not include it all.
Here it is in full.
Code:
14:23:49,139 ERROR [JTATransaction] Could not find UserTransaction in JNDI
javax.naming.NameNotFoundException: UserTransaction not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:96)
at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:80)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1981)
at com.starjar.ejbtest.PurchaseOrderBean.newPurchaseOrder(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
at org.jboss.ejb.Container.invoke(Container.java:674)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
14:23:49,154 INFO [STDOUT] Failure creating new Purchase Order
Also.
When I lookup the UserTransaction as per your suggestiong, using.
Code:
try {
System.out.println( "Looking up java:/UserTransaction" );
System.out.println( "Got txn : " + new InitialContext().lookup( "java:/UserTransaction" ) );
} catch( Exception e ) {
System.out.println("ERROR: " + e);
e.printStackTrace();
}
It fails with a very similar exception.
Code:
14:23:48,858 INFO [STDOUT] Looking up java:/UserTransaction
14:23:48,858 INFO [STDOUT] ERROR: javax.naming.NameNotFoundException: UserTransaction not bound
14:23:48,858 ERROR [STDERR] javax.naming.NameNotFoundException: UserTransaction not bound
14:23:48,858 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
14:23:48,858 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
14:23:48,858 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
14:23:48,858 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
14:23:48,858 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
14:23:48,858 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
14:23:48,858 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
14:23:48,858 ERROR [STDERR] at com.starjar.ejbtest.PurchaseOrderBean.newPurchaseOrder(Unknown Source)
14:23:48,858 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:23:48,858 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:23:48,858 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:23:48,858 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionC
ontainer.java:629)
14:23:48,858 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnect
ionInterceptor.java:186)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInst
anceInterceptor.java:72)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
14:23:48,858 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderIntercep
tor.java:122)
14:23:48,873 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java
:322)
14:23:48,873 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:674)
14:23:48,873 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:23:48,873 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:23:48,873 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:23:48,873 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:23:48,873 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java
:284)
14:23:48,873 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
14:23:48,873 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
14:23:48,873 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:23:48,873 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:23:48,873 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:23:48,873 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:23:48,873 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
14:23:48,873 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:148)
14:23:48,873 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
14:23:48,873 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
14:23:48,873 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
14:23:48,873 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
14:23:48,873 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)
Thanks again for your help.
Peter Henderson.