Uploaded image for project: 'EJB Client Library (AS7+)'
  1. EJB Client Library (AS7+)
  2. EJBCLIENT-41

I want to make UserTransaction available.

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 4.0.12.Final
    • 1.0.5.Final
    • None

      It fails though it connects from a single Java program with the JBossAS7.1.1 server by using Remote EJB Client, and it tries to acquire UserTransaction.
      However, it is attached from the beginning with the sample, and 'Jms/queue/test' can do lookup correctly.

      Result(It operates correctly. )
      -------------------------------

      5 29, 2012 1:21:40 午後 org.xnio.Xnio <clinit>
      INFO: XNIO Version 3.0.3.GA
      5 29, 2012 1:21:40 午後 org.xnio.nio.NioXnio <clinit>
      INFO: XNIO NIO Implementation Version 3.0.3.GA
      5 29, 2012 1:21:40 午後 org.jboss.remoting3.EndpointImpl <clinit>
      INFO: JBoss Remoting version 3.2.3.GA
      Got InitialContext ic: javax.naming.InitialContext@17430d3
      HornetQQueue[testQueue]

      Source
      ------
      import java.util.Properties;

      import javax.jms.Queue;
      import javax.naming.Context;
      import javax.naming.InitialContext;

      public class LookupTest {
      public static void main (String[] args) {

      //MakeContext

      final Properties jndiProperties = new Properties();

      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
      jndiProperties.put(Context.PROVIDER_URL,"remote://localhost:4447");
      jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
      jndiProperties.put(Context.SECURITY_PRINCIPAL, "apuser");
      jndiProperties.put(Context.SECURITY_CREDENTIALS, "apuserpass");

      try

      { final Context context = new InitialContext(jndiProperties); System.out.println("Got InitialContext ic: "+ context); Queue queue = (Queue) context.lookup("jms/queue/test"); System.out.println(queue.toString()); }

      catch (Exception e)

      { e.printStackTrace(); }

      }
      }


      Result(Operation failure)
      -------------------------

      5 29, 2012 1:25:52 午後 org.xnio.Xnio <clinit>
      INFO: XNIO Version 3.0.3.GA
      5 29, 2012 1:25:52 午後 org.xnio.nio.NioXnio <clinit>
      INFO: XNIO NIO Implementation Version 3.0.3.GA
      5 29, 2012 1:25:52 午後 org.jboss.remoting3.EndpointImpl <clinit>
      INFO: JBoss Remoting version 3.2.3.GA
      Got InitialContext ic: javax.naming.InitialContext@d12826
      javax.naming.NameNotFoundException: jboss/UserTransaction – service jboss.naming.context.java.jboss.exported.jboss.UserTransaction
      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
      at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)
      at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)


      Source
      ------

      import java.util.Properties;

      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.transaction.UserTransaction;

      public class LookupTest {
      public static void main (String[] args) {

      //MakeContext

      final Properties jndiProperties = new Properties();

      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
      jndiProperties.put(Context.PROVIDER_URL,"remote://localhost:4447");
      jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
      jndiProperties.put(Context.SECURITY_PRINCIPAL, "apuser");
      jndiProperties.put(Context.SECURITY_CREDENTIALS, "apuserpass");

      try { final Context context = new InitialContext(jndiProperties); System.out.println("Got InitialContext ic: "+ context); UserTransaction ut = (UserTransaction)context.lookup("java:jboss/UserTransaction"); System.out.println(ut.toString()); }catch (Exception e){ e.printStackTrace(); }

      }
      }

      Source JNDI = java:jboss/UserTransaction

      jboss.naming.context.java.jboss.exported.jboss.UserTransaction

      The cause of javax.naming.NameNotFoundException is not understood well.

      It is What 'jboss.naming.context.java.jboss.exported' ?

              jaikiran Jaikiran Pai (Inactive)
              kuribara_jira 栗原 政彦 (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: