用于 GlassFish2.x Cargo 部署的设置资源

发布于 2024-09-30 03:41:45 字数 537 浏览 7 评论 0原文

我正在尝试使用 Maven2 和 Cargo 对 GlassFish 2.x 项目进行集成测试。我终于让 Cargo 尝试部署我的 EAR,但由于未配置数据源,它无法启动。该应用程序还依赖于一些 JMS 队列和一个连接工厂 - 如何添加这些?

Cargo Glassfish 2.x 插件 表示不支持现有配置,所以我不能这样做。

使用 maven-glassfish-plugin 是一种选择,但我们也运行 OC4J,因此 Cargo 解决方案将是首选。

编辑:资源包括:1 个 JDBC 连接池、1 个 JDBC 资源、4 个 JMS 队列、2 个 JMS 连接工厂和一个自定义安全领域(梨树可选)。该领域需要在 login.conf 中添加一个条目,例如:

myRealm {
    uk.co.mycom.MyGlassFishLoginModule required;
};

I'm trying to get integration testing working for a GlassFish 2.x project, using Maven2 and Cargo. I finally have Cargo attempting to deploy my EAR but it fails to start because the data source is not configured. The app also depends on a few JMS queues and a connection factory - how do I add these?

The Cargo Glassfish 2.x plugin says existing configurations are not supported, so I can't do that.

Using the maven-glassfish-plugin is an option, but we also run OC4J so a Cargo solution would be preferred.

edit: The resources are: 1 JDBC connection pool, 1 JDBC resource, 4 JMS queues, 2 JMS connection factories and a custom security realm (pear tree optional). The realm needs an entry in the login.conf like:

myRealm {
    uk.co.mycom.MyGlassFishLoginModule required;
};

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

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

发布评论

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

评论(1

风吹雪碎 2024-10-07 03:41:45

不确定(我从未使用过这个),但是 IIRC,您应该能够将数据源配置放在 sun-resources.xml 文件中并将其打包在 < EAR 中的 code>META-INF/sun-resources.xml 和 GlassFish 应该在部署时创建资源。

下面是一个 sun-resources.xml 示例:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" "sun-resources_1_3.dtd">
<resources>
 <jdbc-connection-pool name="SPECjPool" steady-pool-size="100" 
   max-pool-size="150" max-wait-time-in-millis="60000" 
   pool-resize-quantity="2" idle-timeout-in-seconds="300" 
   is-isolation-level-guaranteed="true" 
   is-connection-validation-required="false" 
   connection-validation-method="auto-commit" 
   fail-all-connections="false" 
   datasource-classname="oracle.jdbc.pool.OracleDataSource">
  <property name="URL" 
    value="jdbc:oracle:thin:@iasperfsol12:1521:specdb"/>
  <property name="User" value="spec"/>
  <property name="Password" value="spec"/>
  <property name="MaxStatements" value="200"/>
  <property name="ImplicitCachingEnabled" value="true"/>
 </jdbc-connection-pool>
 <jdbc-resource enabled="true" pool-name="SPECjPool" 
   jndi-name="jdbc/SPECjDB"/> 
</resources>

尝试一下。

资源


谢谢,成功了。数据源似乎已正常输入,并且应用程序已部署。但是,从您链接的文档中,我看不到如何添加我需要的其他内容(在我的问题中编辑了有关这些内容的更多详细信息)。该解决方案还意味着我必须(使用配置文件?)为 IT 构建不同的 EAR,这是不完美的。

我不知何故错过了您想要创建除数据源之外的其他资源,并且我看到多个线程报告建议的方法不适用于任何资源(如 JMS 资源)的 GlassFish v2。我的不好。

因此,鉴于当前状态,您的选择是(IMO):

  • 为 Cargo 做出贡献,为 GlassFish v2 提供“现有”配置实现,
  • 按照您的建议使用 maven-glassfish-plugin

我没有任何更好的建议。

I'm not sure (I never used this) but IIRC, you should be able to put your datasource configuration in a sun-resources.xml file and package it under META-INF/sun-resources.xml in your EAR and GlassFish is supposed to create the resources at deploy time.

Here is an example sun-resources.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" "sun-resources_1_3.dtd">
<resources>
 <jdbc-connection-pool name="SPECjPool" steady-pool-size="100" 
   max-pool-size="150" max-wait-time-in-millis="60000" 
   pool-resize-quantity="2" idle-timeout-in-seconds="300" 
   is-isolation-level-guaranteed="true" 
   is-connection-validation-required="false" 
   connection-validation-method="auto-commit" 
   fail-all-connections="false" 
   datasource-classname="oracle.jdbc.pool.OracleDataSource">
  <property name="URL" 
    value="jdbc:oracle:thin:@iasperfsol12:1521:specdb"/>
  <property name="User" value="spec"/>
  <property name="Password" value="spec"/>
  <property name="MaxStatements" value="200"/>
  <property name="ImplicitCachingEnabled" value="true"/>
 </jdbc-connection-pool>
 <jdbc-resource enabled="true" pool-name="SPECjPool" 
   jndi-name="jdbc/SPECjDB"/> 
</resources>

Give it a try.

Resources


Thanks, that worked. The datasource seems to have gone in okay and the app has deployed. However from the doc you linked, I can't see how to add the other things I need (edited more detail into my question about these). This solution also means that I will have to (use profiles to?) build my EAR differently for IT, which is imperfect.

I somehow missed that you wanted to create other resources than Datasources and I've seen several threads reporting that the suggested approach won't work with GlassFish v2 for any resources (like JMS resources). My bad.

So, given the current state, your options are (IMO):

  • contribute to Cargo to provide an "existing" configuration implementation for GlassFish v2
  • use the maven-glassfish-plugin as you suggested

I don't have any better suggestions.

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