"org.jnp.interfaces.NamingContextFactory"Not Found

Properties props = new Properties();        
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1097");
     try {
     InitialContext context = new InitialContext(props);

 提示異常:

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] 

解決辦法:

導入jbossall-client.jar即可

你可能感兴趣的:(java)