- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试使用 iiop 协议(protocol)从容器外部查找在 Websphere 应用程序服务器 7.0 上定义的资源,如下所示:
(RMI 客户端)Test.jar 的 Java 代码:
public static void main(String[] args){
Hashtable<Object, Object> properties = new Hashtable<Object, Object>();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put(Context.PROVIDER_URL, "iiop://localhost:2809");
InitialContext intCt;
try {
InitialContext initCtx = new InitialContext(properties);
Object obj = intCt.lookup(JNDI_NAME);
}catch (NamingException namingE) {
System.out.println("Naming Exception occurred :");
namingE.printStackTrace();
}
}
调用Test.jar的命令文件:
set appClassPath=C:\WebSphere\AppServer7.0\deploytool\itp\plugins\com.ibm.websphere.v7_7.0.1.v20090422_1423\wasJars\naming.jar;C:\WebSphere\AppServer7.0\deploytool\itp\plugins\com.ibm.websphere.v7_7.0.1.v20090422_1423\wasJars\namingclient.jar;C:\WebSphere\AppServer7.0\properties;C:\Batch\CommandFiles\JobServer\Test.jarC:\WebSphere\AppServer7.0\java\jre\bin\java -jar -cp "%appClassPath%" C:\Batch\CommandFiles\JobServer\Test.jar %Parameters%
注意:请注意,我在本地机器上运行客户端,引导主机是:localhost,端口是 2809。
在从命令文件运行 Test.jar 代码时,出现以下错误:
javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable {java.naming.provider.url=iiop://localhost:2809, java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory} [Root exception is java.lang.NullPointerException] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:243) at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357) at javax.naming.InitialContext.internalInit(InitialContext.java:295) at javax.naming.InitialContext.(InitialContext.java:212) at com.uuic.ets.rmi.server.client.Client.main(Client.java:130)Caused by: java.lang.NullPointerException at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:235) ... 5 more
我不知道为什么这段代码无法实例化 InitialContext(Hashmap env)
。同样的代码在 Websphere 应用程序服务器 5.1 版中运行,但在 Websphere 应用程序服务器 7.0 版中出现问题。
最佳答案
不支持将 WAS_HOME/deploytool 中的 JAR 用于类路径。尝试使用已记录的 EJB thinclient使用 WAS_HOME/runtimes/com.ibm.ws.ejb.thinclient_7.0.0.jar。
关于java - 如何从容器外部访问Websphere 7.0中定义的JNDI命名空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9739965/
我是 JNDI 的新手,我阅读了 oracle 的在线资料: http://docs.oracle.com/javase/jndi/tutorial/getStarted/overview/index
什么是JNDI? 它的基本用途是什么? 什么时候使用? 最佳答案 What is JNDI ? 它代表Java Naming and Directory Interface . What is its
我有完整的应用服务器背景,并考虑在 Jetty 等轻量级嵌入式服务器上运行应用。 我一直使用 JNDI 来查找连接池以查找数据库连接之类的东西,但我想知道这是否是轻量级案例的最佳方法。似乎如果我使用
您如何使用 JDBCRealm处理servlet 中的用户身份验证和授权?我能找到的唯一示例是在 web.xml 中创建数据源(例如 Authentication against database u
命名和目录 (JNDI) - 使用 JNDI 的陷阱是什么 最佳答案 这个问题有点含糊,但这里有几点需要考虑并且与 JNDI 相关。 JNDI 的好处是对象创建与对象查找分离 在 JDNI 中直接查找
在 Wildfly 9 中显示注册的 JNDI 名称的正确方法是什么? 对于旧版本,可以使用 /subsystem=naming:jndi-view ,但它似乎不再起作用。在域模式下运行时。 感谢帮助
我有两个 JBoss 服务器,JbossA 和 JbossB。每个都有自己的 JNDI。现在我在 JbossA 上有一个名为 jms/Client 的 JMS,在 JbossB 上有一个名为 jms/
这是我的“hibernate.cfg.xml”,我正在尝试连接到我的本地主机(postgres),但我不确定我是否输入了参数值(例如连接 url 或其他) : org.hiber
是否可以通过 JNDI 访问 Wildfly 属性(在 standalone.xml 中定义)? 喜欢: ... 并在java中阅读它: @Resource(lo
第126章OSGI Enterprise Release 5 specification提到兼容性: "Support the traditional JNDI programming model u
import org.apache.catalina.Context; import org.apache.catalina.deploy.ContextResource; import org.ap
在我们的项目中,我们使用 websphere liberty 服务器和 IBM MQ 作为消息服务器。我们在云中移动。我们想用 AWS SQS 替换 IBM MQ。在 server.xml 中,我们有
似乎每个人都说您应该使用 Tomcat 的 JNDI 上下文来管理您的 JDBC 连接和驱动程序等等。在阅读了文档之后,我理解了平局。但是,如果您使用它,您的应用程序必须从现在开始一直使用 Tomca
我正在 JBoss7.1.1 应用程序服务器上部署我的 MDB (EJB3.1)。当我使用@Resource进行数据源注入(inject)时,我使用全局JNDI引用名称(ENC +本地JNDI引用名称
使用 JBoss eap 6.4.12 出现错误: Error looking up ${email.jndi.lookup.binding} in JNDI 在我的 java 类中映射此 JNDI
使用com.sun.jndi.fscontext.RefFSContextFactory基于文件的 JNDI 上下文工厂,它似乎只允许在您指定的位置有 1 个绑定(bind)文件。例如 Hashtab
这是我的persistence.xml: org.hibernate.ejb.HibernatePersistence jdbc/abcDS 这是来自 src/test
我已经为我的模块之一运行了强化扫描,我已经收到了 动态代码评估:JNDI 引用注入(inject)漏洞问题 显示在下一行 lookup(dataSource) 数据源是动态的。我应该怎么做才能防止这种
我有 EJB 3.1 中的 EJB,我试图将其部署在 JBoss EAP 6 中,但是当我启动服务器时。它在 JNDI 名称中附加版本号,如下所示。 18:27:57,068 INFO [org.j
我有一个测试,它成功地使用嵌入式 glassfish 来测试 JCA 的部署。 但是,与已经在使用端口 3700 的 GlassFish 2.1 的运行版本存在冲突。 如何将嵌入的 GlassFish
我是一名优秀的程序员,十分优秀!