例外:需要在环境或系统属性中指定类名称:java.naming.factory.initial [英] Exception: Need to specify class name in environment or system property: java.naming.factory.initial

查看:1214
本文介绍了例外:需要在环境或系统属性中指定类名称:java.naming.factory.initial的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行与JMS相关的应用程序时,遇到以下异常错误.

When i run a JMS related application, i am encountering the following exception error.

javax.naming.NoInitialContextException:需要在环境或系统属性中或作为applet参数或在应用程序资源文件中指定类名称:java.naming.factory.initial

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

我们正在使用Sun Application Server 9.1

We are using Sun Application Server 9.1

知道我们缺少什么吗?

我已经尝试添加以下内容,但结果仍然相同

I already tried adding the following but result still the same

    Properties env = new Properties();
    env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");

    Context ctx = new InitialContext(env);

推荐答案

一个非常常见的错误可能是您尚未添加jboss-client.jar! 或如果使用weblogic,则为备用jar.

A very common error can be that you have not added the jboss-client.jar! or alternate jar if using weblogic.

这篇关于例外:需要在环境或系统属性中指定类名称:java.naming.factory.initial的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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