我正在使用wildfly10。 这是我的java代码。
private Hashtable mEnv = new Hashtable();
InitialContext e = new InitialContext(mEnv);
mEnv的值为流量。
mEnv = {
java.naming.provider.url=localhost:8080,
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.security.authentication=simple,
java.naming.security.principal=fc,
java.naming.security.credentials=1234
} 当我运行此命令时,我有这样的错误。
javax.naming.NamingException: WFLYNAM0027: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.cppro.war:main" from Service Module Loader [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory from [Module "deployment.cppro.war:main" from Service Module Loader]]
java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory from [Module "deployment.cppro.war:main" from Service Module Loader]
WFLYNAM0027: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.cppro.war:main" from Service Module Loader
null
null
请帮帮我。 感谢。
答案 0 :(得分:4)
JNP是JBoss AS5的旧命名协议。你必须为WildFly 10使用新的JNDI属性。看看https://docs.jboss.org/author/display/WFLY/JNDI+Reference(取决于你首先需要一个InitialContext的原因)