使用故障转移协议时,使用 genericra 集成 activemq 和 glassfish 时出现问题
我正在尝试使用 glassfish 2.1 提供的 genericra 资源适配器在 glassfish 中使用 activemq。我发现了一些包含有用信息的页面,包括 http://activemq.apache.org/sjsas -with-genericjmsra.html。
我实际上已经取得了成功,并且能够让 MDB 使用 activemq 作为其 JMS 提供程序,但是当我尝试进行一些更复杂的配置时,我遇到了问题。我想设置主从配置,这需要我的客户端使用故障转移的brokerURL:(tcp://broker1:61616,tcp://broker2:61616)。为此,我在调用 asadmin create-resource-adapter-config
时设置了以下属性(我必须转义“=”和“:”):
ConnectionFactoryProperties=brokerURL\=failover\:(tcp\://127.0.0.1\:61616,tcp\://127.0.0.1\:61617)
但是,我现在收到 StringIndexOutOfBoundsException当我的应用程序启动时。我怀疑两个 URL 之间的逗号是罪魁祸首,因为这工作正常:
brokerURL\=failover\:(tcp\://127.0.0.1\:61616)
只是想知道以前是否有人处理过这个问题。还想知道是否有比使用通用资源适配器更好的方法来与 glassfish 集成。
编辑:我忘记在第二个 tcp 之后转义冒号,但不幸的是这并没有解决我所看到的问题。
I'm attempting to use activemq in glassfish using the genericra resource adapter provided with glassfish 2.1. I have found a few pages with helpful information including http://activemq.apache.org/sjsas-with-genericjmsra.html.
I have actually had success and been able to get MDBs to use activemq as their JMS provider, but I'm running into an issue as I'm trying to do some more complicated configuration. I want to set up a master-slave configuration, which would require my clients to use a brokerURL of failover:(tcp://broker1:61616,tcp://broker2:61616). In order to do this, I set the following property when calling asadmin create-resource-adapter-config
(I have to escape '=' and ':'):
ConnectionFactoryProperties=brokerURL\=failover\:(tcp\://127.0.0.1\:61616,tcp\://127.0.0.1\:61617)
However, I am now getting a StringIndexOutOfBoundsException when my application starts up. I suspect the comma in between the two URLs is the culprit, since this works fine:
brokerURL\=failover\:(tcp\://127.0.0.1\:61616)
Just wondering if anyone has dealt with this issue before. Also wondering if there is a better way to integrate with glassfish than using the generic resource adapter.
EDIT: I forgot to escape the colon after the second tcp, but unfortunately that didn't fix the issue I'm seeing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终转而使用 lib/optional 目录中的 activemq 提供的资源适配器。
如果有人感兴趣,以下是我让它工作的步骤
然后创建资源:
要连接 mdb,我必须将其添加到 sun-ejb-jar.xml 中
要将其连接到 spring JMSTemplate :
I ended up switching to use the resource adapter provided by activemq that comes in the lib/optional directory.
In case anyone is interested, here are the steps I followed to get it working
Then to create resources:
To get an mdb hooked up, I had to add this in the sun-ejb-jar.xml
To hook this up to a spring JMSTemplate:
这是 genericjmsra 中的一个已知缺陷,请参阅:http://java.net/jira/browse/GENERICJMSRA -50
在评论中建议在 ObjectBuilder.java 中进行修复。
This is a known defect in genericjmsra, see: http://java.net/jira/browse/GENERICJMSRA-50
In the comments a fix in ObjectBuilder.java is suggested.
我看起来你没有逃脱第二个 uri 中的冒号。
I looks like you're not escaping the colon in the second uri.