0 Replies Latest reply on Jan 19, 2006 10:31 AM by Mustafa Tan

    Transaction Required Exception on Mandatory Transactional Re

    Mustafa Tan Newbie

      Hi,

      When i try transactional method invocation from remote client JBoss 3.2.5 throws javax.transaction.TransactionRequiredException. Client connects RMI over JRMP and calls a stateless session bean. It seems server doesn't accept "Mandatory" transactions because "RequiresNew" works. Any comments ?

      Client code, exception and deployment descriptor of EJB below:

      Client Code:

      ListenerRemote remote = null;
      try {
       Properties env = new Properties();
       // For JBoss: jnp://server:1099
       env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       env.put(Context.PROVIDER_URL, "jnp://10.10.100.19:11099");
       env.put("java.naming.factory.url.pkgs", "org.jboss.naming.client:org.jnp.interfaces");
      
      
       // Find the remote bean
       InitialContext context = new InitialContext(env);
       Object object = context.lookup("ListenerRemoteBean");
       ListenerRemoteHome home = (ListenerRemoteHome)PortableRemoteObject.narrow(object, ListenerRemoteHome.class);
       remote = home.create();
      
      } catch (Exception e) {
       e.printStackTrace();
      }
      


      Exception:

      Caused by: javax.transaction.TransactionRequiredException: Transaction Required
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:384)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:120)
      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:331)
      at org.jboss.ejb.Container.invoke(Container.java:723)
      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.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
      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)

      Deployment Descriptor:

      <ejb-jar>
      <display-name>ListenerRemoteBean</display-name>
      <enterprise-beans>

      <display-name>ListenerRemoteBean</display-name>
      <ejb-name>ListenerRemoteBean</ejb-name>
      tr.com.cs.aurora.auroracore.listener.ejb.remote.ListenerRemoteHome
      tr.com.cs.aurora.auroracore.listener.ejb.remote.ListenerRemote
      <ejb-class>tr.com.cs.aurora.auroracore.listener.ejb.remote.ListenerRemoteBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>

      </enterprise-beans>
      ....

      <ejb-name>ListenerRemoteBean</ejb-name>
      <method-name>create</method-name>
      <method-params />

      ...
      <container-transaction>

      <ejb-name>ListenerRemoteBean</ejb-name>
      <method-name>execute</method-name>
      <method-params>
      <method-param>char[]</method-param>
      </method-params>

      <trans-attribute>Mandatory</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar> tr.com.cs.aurora.auroracore.listener.ejb.remote.ListenerRemote
      <ejb-class>tr.com.cs.aurora.auroracore.listener.ejb.remote.ListenerRemoteBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>

      </enterprise-beans>


      <container-transaction>

      <ejb-name>ListenerRemoteBean</ejb-name>
      <method-name>execute</method-name>
      <method-params>
      <method-param>char[]</method-param>
      </method-params>

      <trans-attribute>Mandatory</trans-attribute>
      </container-transaction>