如何在 Widfly 域上从 Web 客户端连接到同一域中的 jndi 应用程序
我有一个 Wildfly 域,我需要从 .war 部署的客户端项目连接到也部署的 Ear 内部 ejb 模服务。
该域有两个服务器组,一个是 8080 端口的 appWeb 项目,第二个是 10080 端口的 servMod,所以。
我从本地网络连接到远程查找 jndi 设置。
private static final String JNDI = "ejb:ServicesProj/ServicesP/Locator!com.mycompany.services.LocatorRemote";
Hashtable<String,String> jndiProperties = new Hashtable<>();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "userconjndi");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "userCon.dev1");
jndiProperties.put(Context.PROVIDER_URL,"http-remoting://devwflypilot.devcomp.dom:10080");
Context ctx = new InitialContext(jndiProperties);
Object remoto = ctx.lookup(JNDI);
当我在 webapp 服务器组中部署 .war 文件以与相同的设置进行通信时,详细信息就出现了。
我不确定在这种情况下我在提供程序 url 中使用“http-remoting”是否正确,以及 JNDI 前缀“ejb:”是否正确,以在同一域服务器组中连接到其他端口
I'm having a wildfly domain and I need connect from .war deployed client project to ear inner ejb modulo service deployed too.
This domain have two server groups, one is appWeb projects in 8080 port and second servMod in 10080 port, so.
I have connection from local network with remote lookup to jndi setting.
private static final String JNDI = "ejb:ServicesProj/ServicesP/Locator!com.mycompany.services.LocatorRemote";
Hashtable<String,String> jndiProperties = new Hashtable<>();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "userconjndi");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "userCon.dev1");
jndiProperties.put(Context.PROVIDER_URL,"http-remoting://devwflypilot.devcomp.dom:10080");
Context ctx = new InitialContext(jndiProperties);
Object remoto = ctx.lookup(JNDI);
Detail's came when I deployed the .war file in webapp server group to comunicate with the same setting.
I don't sure if in this case is correct that I used "http-remoting" in the provider url and if JNDI prefix "ejb:", to connect in same domain server groups to other port
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在给出回应,因为也许其他人也遇到过同样的情况。
实际上问题不在于 jndi 配置,我可以注释连接 jndi 中涉及的所有代码,错误仍然存在,这对我来说是很好的提示。
项目环境具有struts2和tiles的依赖关系,问题出在tiles定义中,该项目有几个tiles.xml文件,其中之一使用了错误的版本,我在所有文件中设置相同的版本并运行。
磁贴不会在服务器上的日志记录信息级别的控制台中写入,我通过将日志服务器设置置于调试级别来提示磁贴错误。
我希望你能解决这个问题。
I'm giving a response, because maybe someone else pass by same situation.
Actually the problem isn't in jndi configuration, I could comment all code envolved in the connection jndi and error continues, well good hints to me.
The project enviroment has dependencies of struts2 and tiles, the problem was in tiles definition, the project has several tiles.xml files one of then used wron version, I'm setting same version in all files and run.
tiles don't write in console in info level of logging on the server, well I had hint of tiles error by log server setting put in debug level.
I hope that you will solved the issue.