1 Reply Latest reply on Jan 20, 2013 2:09 PM by avis71

    JNDI  error

    gjx_xiang

      Properties prop = new Properties();

                  prop.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");

                  prop.put(Context.SECURITY_PRINCIPAL, System.getProperty("username","user1"));

                  prop.put(Context.SECURITY_CREDENTIALS, System.getProperty("password","12345"));

                  prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                                    final Context ctx = new InitialContext(prop);

                                    Object ref = ctx.lookup("java:/eis/unionpayConnectionFactory");

       

                                    unionpayConnectionFactory acf=(unionpayConnectionFactory)ref;

                                    unionpayConnection ac=acf.getConnection();

       

      when the code was runned,  there will be such a mistake:

      javax.naming.NameNotFoundException: eis/unionpayConnectionFactory -- service jboss.naming.context.java.jboss.exported.eis.unionpayConnectionFactory

                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(ThreadPoolExecutor.java:1110)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

                at java.lang.Thread.run(Thread.java:722)

        • 1. Re: JNDI  error
          avis71

          Verify the connection factory was bind to jboss JNDI - you can see in the server log.

          You can try to search without the java: namespace.