在 OpenEJB 嵌入模式下使用 JNDI 属性文件

发布于 2024-12-29 10:17:31 字数 349 浏览 4 评论 0原文

尽管 jndi 属性文件保留在类路径中,但它不会加载,并且在 ANT 中的 JVM 参数中配置 JNDI 属性时,它工作正常。

<jvmarg value="-Djava.naming.factory.initial=org.openejb.client.LocalInitialContextFactory"/>   

如何通过属性配置 JNDI,以便即使

在 EJB 中使用 Context=new InititalContext() 时,也需要加载在属性中配置的 JNDI 属性。

谢谢,

Velmurugan R

Eventhough the jndi properties file is kept in the classpath its not loaded and JNDI properties when configured in JVM arguments in ANT its working fine.

<jvmarg value="-Djava.naming.factory.initial=org.openejb.client.LocalInitialContextFactory"/>   

How to configure the JNDI thorugh properties so that even when

Context=new InititalContext() is used in the EJB's the JNDI properties that are configured in properties needs to be loaded.

Thanks,

Velmurugan R

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东走西顾 2025-01-05 10:17:31

务必确保 jndi.properties 文件位于类路径的根目录中,而不是位于 META-INF/ 目录或任何其他位置。我所说的 root 是指与 META-INF/ 所在位置平行的某个目录。例如:

  • foo.jar/jndi.properties
  • foo.jar/META-INF/MANIFEST.MF

该文件由 JVM 本身处理,因此如果它不起作用,很可能与它不在类路径上有关正确。

Definitely make sure the jndi.properties file is at the root of the classpath and not in a META-INF/ directory or any other location. By root, I mean some directory that is parallel to a where a META-INF/ would be. For example:

  • foo.jar/jndi.properties
  • foo.jar/META-INF/MANIFEST.MF

That file is processed by the JVM itself, so if it doesn't work, odds are it is related to it not being on the classpath correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文