如何获取新的 JNDI 名称(尤其是 ConnectionFactory)
我升级到 JBoss 7.0.1,我们使用以下 JNDI 查找来获取与 HornetQ 消息队列的连接。
InitialContext jndiContext = new InitialContext();
QueueConnectionFactory qf = (QueueConnectionFactory) jndiContext.lookup( "ConnectionFactory" );
当与 JBoss 7 一起使用时,这会导致 NameNotFoundException
。我还尝试了以下方法:
- java:jms/ConnectionFactory
- java:env/ConnectionFactory
.. 以及其他一些方法。但我认为猜测不会让我走得太远。如何获取未记录在控制台中的新 JNDI 名称(例如我的 EJB bean)?
亲切的问候, 塞巴斯蒂安
I upgraded to JBoss 7.0.1 and we are using the following JNDI lookup to get a connection to a HornetQ message queue.
InitialContext jndiContext = new InitialContext();
QueueConnectionFactory qf = (QueueConnectionFactory) jndiContext.lookup( "ConnectionFactory" );
This results in a NameNotFoundException
when used with JBoss 7. I have also tried the following:
- java:jms/ConnectionFactory
- java:env/ConnectionFactory
.. and some others. But I think guessing won't get me far. How do I get the new JNDI names that are not logged in the console (like my EJB beans)?
Kind regards,
Sebastian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
没有测试它,但会尝试一下,因为
更正和编辑:查看了我的安装,正确的是:
也在domain.xml 中定义。
Try
Did not test it, but would give that a try, since https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7 says:
Correction and edit: Had a look at my installation and correct is:
as it is defined in domain.xml also.
解决了:
整个 HornetQ 部分在 JBoss 7 中默认被停用。必须将相应部分从
standalone-preview.xml
复制到standalone.xml
并将所有内容从META-INF/hornetq-jms.xml
到 JBoss 配置。现在我已经像这样配置了 ConnectionFactory:
我可以通过执行此 JNDI 查找来使用它:
这是由
Solved it:
The whole HornetQ part was deactivated by default in JBoss 7. Had to copy the corresponding part from the
standalone-preview.xml
tostandalone.xml
and move everything fromMETA-INF/hornetq-jms.xml
to the JBoss config.Now I have the ConnectionFactory configured like this:
and I can use it by doing this JNDI lookup:
This is caused by a bug in the JMS configuration of JBoss 7. Seems to be fixed in 7.0.1, used that version, didn't notice any fix - however, the above configuration works.