什么是“javax.naming.NoInitialContextException”意思? [英] What does "javax.naming.NoInitialContextException" mean?

查看:1098
本文介绍了什么是“javax.naming.NoInitialContextException”意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所暗示的那样,javax.naming.NoInitialContextException在非技术术语中意味着什么?有什么一般性建议可以解决它?

As the title suggests, what does "javax.naming.NoInitialContextException" mean in non technical terms? And what are some general suggestions to fix it?

编辑(从控制台):

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at cepars.app.ConnectionHelper.getConnection(ConnectionHelper.java:25)
    at cepars.app.ConnectionHelper.getConnection(ConnectionHelper.java:10)
    at cepars.review.ReviewDAO.getJobList(ReviewDAO.java:30)
    at cepars.review.Test.main(Test.java:43)
java.lang.NullPointerException
    at cepars.review.ReviewDAO.getJobList(ReviewDAO.java:31)
    at cepars.review.Test.main(Test.java:43)
cepars.app.DAOException
    at cepars.review.ReviewDAO.getJobList(ReviewDAO.java:39)
    at cepars.review.Test.main(Test.java:43)


推荐答案

它基本上意味着应用程序想要执行一些命名操作(例如JNDI或LDAP查找),它没有足够的信息可用于创建与目录服务器的连接。作为异常状态的文档,

It basically means that the application wants to perform some "naming operations" (e.g. JNDI or LDAP lookups), and it didn't have sufficient information available to be able to create a connection to the directory server. As the docs for the exception state,


当没有
初始上下文实现可以创建
时抛出此异常。如何选择初始
上下文实现的策略是在
InitialContext类的文档中描述的

This exception is thrown when no initial context implementation can be created. The policy of how an initial context implementation is selected is described in the documentation of the InitialContext class.

如果你尽职地看看 InitialContext <的javadocs / a>,他们很好地描述了初始上下文是如何构建的,以及你提供地址/凭证等的选择。

And if you dutifully have a look at the javadocs for InitialContext, they describe quite well how the initial context is constructed, and what your options are for supplying the address/credentials/etc.

如果你去了创建上下文并卡在其他地方,请回复解释你到目前为止所做的以及你在哪里搁浅。

If you have a go at creating the context and get stuck somewhere else, please post back explaining what you've done so far and where you're running aground.

这篇关于什么是“javax.naming.NoInitialContextException”意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆