[jboss-user] [JNDI/Naming/Network] - JBOSS405 GA userTransaction look up fail

colinTongzw do-not-reply at jboss.com
Tue Jul 15 23:15:45 EDT 2008


HI, 

everybody,my appliaction is ejb2.0 ,container jboss405,migrate from weblogic92,but the transaction problem puzzle me for a long time


  | public static UserTransaction getUserTransaction() throws NamingException,Exception {
  | 	if (fooTransaction != null)
  | 		return fooTransaction;
  |  
  | 	UserTransaction tran = null;
  | 	try {
  | 		Context ic = getInitialContext();
  | 		if (ic != null) {
  | 			tran = (UserTransaction) ic.lookup("UserTransaction");
  | 		                // tran = (UserTransaction) ic.lookup("java:/UserTransaction");
  | 		}
  | 		if (tran == null) {
  |  
  | 			throw new Exception("UserTransaction is null!");
  |  
  | 		}
  | 	} catch (NamingException ex) {
  | 		System.out.println("catch NamingException when trying to lookup UserTransaction name\n"+ ex.toString());
  | 			throw ex;
  | 	} finally {
  | 	}
  | 	return tran;
  | }
  | 
  | [code
  | in the oracle-ds.xml:
  | 
  |   | 
  |   | <jndi-name>jdbc/mydatasource</jndi-name>
  |   | <use-java-context>false</use-java-context>
  |   | 
  |   | 
  |   |   | 
  |   |   | but when i invoke ejb on my client,a exception happen:
  |   |   | 
  |   |   |   | 2008-07-16 10:40:29,718 INFO  [STDOUT] catch NamingException when trying to lookup UserTransaction name
  |   |   |   | javax.naming.NameNotFoundException: javax.transaction.UserTransaction not bound
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [com.start.hrgl.company.XzccfkBPO.class] userID = hrgl sessionID = 6C712864844DB11CF0CDC410AB15BE00 functionID = G00.01.00.01 code = 100201000  message = 100201000|
  |   |   |   | com.start.hrgl.company.XzccfkBPOµÄ×Ü¿Ø·½·¨mainPerform()·¢Éú´íÎó!|javax.transaction.UserTransaction not bound|  dateTime = 2008-07-16 10:40:29
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] javax.naming.NameNotFoundException: javax.transaction.UserTransaction not bound
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.transport.Transport$1.run(Transport.java:153)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at java.security.AccessController.doPrivileged(Native Method)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:595)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at javax.naming.InitialContext.lookup(InitialContext.java:351)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at com.lbs.sieaf.util.DBUtil.getUserTransaction(DBUtil.java:310)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at com.start.hrgl.company.XzccfkBPO.mainPerform(XzccfkBPO.java:52)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at com.start.hrgl.company.XzccfkFacadeBean.xzccfk(XzccfkFacadeBean.java:41)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
  |   |   |   | 2008-07-16 10:40:29,718 ERROR [STDERR] 	at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.ejb.Container.invoke(Container.java:954)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
  |   |   |   | 2008-07-16 10:40:29,734 ERROR [STDERR] 	at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
  |   |   |   | 
  |   |   |   | 
  |   |   |   |   | 
  |   |   |   |   | and another problem ,how does everybody solve the datasource 'java.lang.ClassCastException: javax.naming.reference' when I do this:
  |   |   |   |   | 
  |   |   |   |   |   | ds = (javax.sql.DataSource) ic.lookup("jdbc/mydatasource");
  |   |   |   |   |   | 
  |   |   |   |   |   |   | 
  |   |   |   |   |   |   | 
  |   |   |   |   |   |   | to avoid the effect of tomcat ,I make some changes as below:
  |   |   |   |   |   |   | at $JBOSS_HOME/server/default/deploy/jbossweb- tomcat55.sar/META-INF/jboss-service.xml
  |   |   |   |   |   |   | changes the UseJBossWebLoader's attribute to true
  |   |   |   |   |   |   | 
  |   |   |   |   |   |   |   | <attribute name="UseJBossWebLoader">true</attribute>
  |   |   |   |   |   |   |   | 
  |   |   |   |   |   |   |   |   | 
  |   |   |   |   |   |   |   |   | 
  |   |   |   |   |   |   |   |   | but it doesn't work, I don't konw how to do it
  |   |   |   |   |   |   |   |   | could anyone please look in.....
  |   |   |   |   |   |   |   |   | thanks a lot
  |   |   |   |   |   |   |   |   | 
  |   |   |   |   |   |   |   |   | colintodd 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4164638#4164638

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164638




More information about the jboss-user mailing list