当前位置: 技术问答>java相关
请教一个错误,关于jndi的
来源: 互联网 发布时间:2015-10-22
本文导语: 程序 java.util.Properties p = new java.util.Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); p.put(Context.PROVIDER_URL,"t3://172.16.58.178:7001"); System.out.println("DDd"); ...
程序
java.util.Properties p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://172.16.58.178:7001");
System.out.println("DDd");
Context ctx = new InitialContext(p);
错误
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassNotFoundException: we
blogic.jndi.WLInitialContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.jav
a:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
49)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195)
请问
weblogic.jndi.WLInitialContextFactory是什么意思,我本地的jdk的类库必须要有这个类吗?
java.util.Properties p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://172.16.58.178:7001");
System.out.println("DDd");
Context ctx = new InitialContext(p);
错误
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory. Root exception is java.lang.ClassNotFoundException: we
blogic.jndi.WLInitialContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.jav
a:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
49)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195)
请问
weblogic.jndi.WLInitialContextFactory是什么意思,我本地的jdk的类库必须要有这个类吗?
|
你如果没安装weblogic,又想用weblogic的jndi服务,就装一个weblogic,并启动它。
如果你装了weblogic,将weblogic.jar加入你的classpath
如果你装了weblogic,将weblogic.jar加入你的classpath