简体   繁体   English

GlassFish 3.1.1修改资源名称,然后抱怨找不到资源

[英]GlassFish 3.1.1 mangles resource name then complains it can't find it

According to this article and a number of other documents, JDBC resources are deployed globally (available server-wide) unless prefixed with java:app/ . 根据本文和许多其他文档,除非以java:app/为前缀,否则JDBC资源是全局部署的(在服务器范围内可用)。 When I change jdbc/myDataSource to java:app/jdbc/myDataSource and myConnectionPool to java:app/myConnectionPool , deployment fails with this exception: 当我将jdbc/myDataSource更改为java:app/jdbc/myDataSource并将myConnectionPool更改为java:app/myConnectionPool ,部署因以下异常而失败:

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. 如果没有java:app/前缀,它可以正常工作,但是随后将资源部署到服务器范围内。

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

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. 阅读本节后 ,我意识到我不必在glassfish-resources.xml定义glassfish-resources.xml加上java:app/ scope前缀。 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. 如果在档案文件中提供资源定义(即,.ear或其他档案文件中的glassfish-resources.xml ),则假定它们是范围内的资源。

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 . 然后继续说,如果应用程序是EAR且路径是META-INF/glassfish-resources.xml或(在我的情况下)它是WAR且路径是WEB-INF/glassfish-resources.xml则资源是应用程序范围的WEB-INF/glassfish-resources.xml

This may explain why GlassFish was mangling the name. 这可以解释为什么GlassFish修改了该名称。 There was most likely a name collision because I added the prefix. 因为我添加了前缀,所以很可能发生名称冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM