gpt4 book ai didi

java.lang.ClassNotFoundException : org. jboss.naming.remote.client.InitialContextFactory

转载 作者:行者123 更新时间:2023-12-01 12:46:06 25 4
gpt4 key购买 nike

我正在将 jboss-4.0.4.GA 移动到 wildfly-8.1.0.Final。部署 EAR 时出现以下错误:

2014-07-10 17:09:44,900 ERROR [stderr] (default task-1) javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "deployment.wildfly.ear.wildfly-war.war:main" from Service Module Loader [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory from [Module "deployment.wildfly.ear.wildfly-war.war:main" from Service Module Loader]]

我的代码:

Properties appProp = new Properties();
appProp.put(Context.INITIAL_CONTEXT_FACTORY, CGProperties.initial_context_factory);
appProp.put(Context.PROVIDER_URL, CGProperties.provider_url);
appProp.put("java.naming.rmi.security.manager", "yes");
appProp.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
appProp.put("jboss.naming.client.ejb.context","true");
context = new InitialContext(appProp);
//context = new InitialContext();

if(serverName.equalsIgnoreCase("JBOSS")) {
ds = (javax.sql.DataSource) context.lookup(CGProperties.dsName);
reportDS=(javax.sql.DataSource) context.lookup(CGProperties.reportdsName);
}

请帮我解决这个错误。

最佳答案

需要添加 jboss-client.jar 或包含相应的 WildFly 模块。

已回答here standalone-full.xml 中的以下配置可以解决问题:

    <subsystem xmlns="urn:jboss:domain:ee:4.0"><!-- ee:2.0  in WildFly 8 -->
<global-modules>
<module name="org.jboss.remote-naming"/>
</global-modules>
...

它允许在另一个 WildFly 服务器上查找远程连接。

关于java.lang.ClassNotFoundException : org. jboss.naming.remote.client.InitialContextFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24691830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com