javax.naming.NoInitialContextException: Need to specify class name in environment or system property

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错误解决办法

在用JNDI连接数据库时用main函数测试时总报错,

后来看到论坛里的回复才知道原因

InitialContext 是要在应用服务器的上下文里才有的。

你在普通的应用程序里怎么行!

放到tomcat里面运行看看吧!

不能用main函数直接测试,只能放到tomcat或者servlet、jsp显示

javax.naming.NoInitialContextException: Need to specify class name in environment or system property,布布扣,bubuko.com

时间: 2025-01-03 03:32:52

javax.naming.NoInitialContextException: Need to specify class name in environment or system property的相关文章

javax.naming.NoInitialContextException错误的解决方案

今天,学习用了一下nutz框架,写了一个HelloWorld的小程序,在用jndi配置数据源时,写了一个测试类,并在main方法中调用了jndi获得数据库连接,但是报错了,错误信息如下: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resour

配置jndi服务,javax.naming.NamingException的四种情况

1.当jndi服务没有启动,或者jndi服务的属性没有设置正确,抛出如下异常: javax.naming.CommunicationException: Can't find SerialContextProvider... 2.如果InitialContext class既没有为jndi服务提供者指出默认属性也没有明确指明属性,抛出如下异常: javax.naming.NoInitialContextException:Need to specify class name in enenvir

javax.naming.NameNotFoundException:Name[ XXX] is not bound in this context.

在用局部数据源去连数据库的时候,在本地的项目中,都是可以的,可是一部署到服务器上,就报错了. 报的错误是:javax.naming.NameNotFoundException:Name[ XXX] is not bound in this context. 查了下解决方案:在项目的web.xml中加入下面的代码 <resource-ref> <description>DB Connection</description> <res-ref-name>zjut

javax.naming.NameNotFoundException: Name ZKING is not bound in this Context 的问题

runqianReportLogger : [ERROR] - Name ZKING is not bound in this Contextjavax.naming.NameNotFoundException: Name ZKING is not bound in this Context 这是一个数据源,在tomcat的目录下conf配置文件中,context.xml添加数据源:ZKING <Resource name="ZKING" type="javax.sql

javax.naming.NamingException

警告: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: com.alibaba.druid.pool.DruidDataSourceFactory] 1 <dependency> 2 <groupId>com.alibaba</gr

javax.naming.NameNotFoundException

[java] view plain copy 2015-08-27 09:53:16,463 [localhost-startStop-1] DEBUG [org.springframework.jndi.JndiTemplate] - Looking up JNDI object with name [java:comp/env/spring.liveBeansView.mbeanDomain] 2015-08-27 09:53:16,463 [localhost-startStop-1] D

spring mvc 500错误Allocate exception for servlet AppService javax.naming.NamingException: Cannot create resource instance

头几天已经测试的完毕了,换了个目录出现这个问题 严重: Allocate exception for servlet AppService javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:96) at javax.naming.spi.NamingManager.getO

springmv日志debug异常,javax.naming.NameNotFoundException

解决方案: 在web.xml配置如下代码即可: <context-param> <param-name>spring.profiles.active</param-name> <param-value>dev</param-value> </context-param> <context-param> <param-name>spring.profiles.default</param-name>

Hibernate 异常 : Error parsing JNDI name [xxx]

初学 Hibernate ,用官方给的日志模板配置好了日志,跑起小例子, 控制台中的日志里写了一些异常: 21:16:36,036 DEBUG EntityLoader:146 -  Static select for entity cn.sjll.hibernate435.model.UserModel  [OPTIMISTIC_FORCE_INCREMENT]: select usermodel0_.ID as ID1_0_0_,  usermodel0_.NAME as NAME2_0_0