使用故障转移协议时,使用 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.
我最终转而使用 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: