JBoss Community

JNDI error

created by TOM smith in JNDI and Naming - View the full discussion

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)

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community