GlassFish 3.1.1 损坏资源名称,然后抱怨找不到它

发布于 2024-12-25 03:48:17 字数 641 浏览 1 评论 0原文

根据这篇文章和一些其他文档,JDBC资源是全局部署的(可用服务器-wide) 除非以 java:app/ 为前缀。当我将 jdbc/myDataSource 更改为 java:app/jdbc/myDataSource 并将 myConnectionPool 更改为 java:app/myConnectionPool ,部署失败并出现以下异常:

com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:无效资源:{ ResourceInfo: (jndiName=java:app/jdbc/myDataSource__pm), (applicationName=com.example.web_example_war_1.0-SNAPSHOT) }

它在没有 java:app/ 前缀的情况下工作得很好,但是然后资源会在服务器范围内部署。

According to this article and a number of other documents, JDBC resources are deployed globally (available server-wide) unless prefixed with java:app/. When I change jdbc/myDataSource to java:app/jdbc/myDataSource and myConnectionPool to java:app/myConnectionPool, deployment fails with this exception:

com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : { ResourceInfo : (jndiName=java:app/jdbc/myDataSource__pm), (applicationName=com.example.web_example_war_1.0-SNAPSHOT) }

It works just fine without the java:app/ prefixes, but then the resources are deployed server-wide.

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

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

发布评论

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

评论(2

久随 2025-01-01 03:48:17

您是否正在部署捆绑在 EAR 文件中的 WAR 文件,因为根据链接,您的“java:app/”前缀用于 EAR 部署。

Are you deploying your WAR files bundled in an a EAR file, coz as per the link you have the 'java:app/' prefix is for EAR deployment.

向日葵 2025-01-01 03:48:17

阅读本节后,我意识到我没有使用 java:app/ 范围前缀为 glassfish-resources.xml 中定义的资源添加前缀。根据该文件:

如果资源定义在存档中提供(即 .ear 或其他存档中的 glassfish-resources.xml),则假定它们是范围资源。

然后它继续说,如果应用程序是 EAR 并且路径是 META-INF/glassfish-resources.xml 或(在我的例子中)它是 WAR 并且路径是WEB-INF/glassfish-resources.xml

这也许可以解释为什么 GlassFish 会修改这个名字。很可能发生名称冲突,因为我添加了前缀。

After reading this section, I realised that I don't have to prefix resources defined in glassfish-resources.xml with the java:app/ scope prefix. According to that document:

If the resource definition is provided within an archive (ie., glassfish-resources.xml within an .ear or other archives), they are assumed to be scoped resources.

And then it goes on to say the resources are application scoped if the application is an EAR and the path is META-INF/glassfish-resources.xml or (in my case) it is a WAR and the path is WEB-INF/glassfish-resources.xml.

This may explain why GlassFish was mangling the name. There was most likely a name collision because I added the prefix.

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