在red hat eap 7.3上找不到命名的jms队列

gdx19jrr  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(375)

编写一个简单的jms客户端:

09:00:59.771 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
09:00:59.774 [main] INFO org.wildfly.naming - WildFly Naming version 1.0.13.Final
09:00:59.905 [main] INFO org.wildfly.security - ELY00001: WildFly Elytron version 1.1.0.Final
09:00:59.963 [main] INFO org.xnio - XNIO version 3.5.1.Final
09:00:59.974 [main] INFO org.xnio.nio - XNIO NIO Implementation Version 3.5.1.Final
09:01:00.524 [XNIO-1 I/O-1] DEBUG org.xnio.nio - Started channel thread 'XNIO-1 I/O-1', selector sun.nio.ch.WindowsSelectorImpl@497899f6
09:01:00.525 [XNIO-1 Accept] DEBUG org.xnio.nio - Started channel thread 'XNIO-1 Accept', selector sun.nio.ch.WindowsSelectorImpl@25c2b866
09:01:00.532 [main] INFO org.jboss.remoting - JBoss Remoting version 5.0.0.Final
09:01:01.549 [main] DEBUG org.apache.commons.beanutils.converters.BooleanConverter - Setting default value: false
...
09:01:02.015 [main] DEBUG org.apache.commons.beanutils.converters.StringConverter - Converting 'Integer' value '65536' to type 'String'
Got ConnectionFactory
Attempting to acquire destination "jms/queue/ExternalSignalQueue"
javax.naming.NameNotFoundException: jms/queue/ExternalSignalQueue -- service jboss.naming.context.java.jboss.exported.jms.queue.ExternalSignalQueue
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
    at org.wildfly.naming.client.remote.RemoteServerTransport.handleLookup(RemoteServerTransport.java:200)
    at org.wildfly.naming.client.remote.RemoteServerTransport$1.handleMessage(RemoteServerTransport.java:120)
    at org.jboss.remoting3.remote.RemoteConnectionChannel.lambda$handleMessageData$3(RemoteConnectionChannel.java:430)
    at org.jboss.remoting3.EndpointImpl$TrackingExecutor.lambda$execute$0(EndpointImpl.java:991)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at java.lang.Thread.run(Thread.java:748)

使用相应的java代码

String destinationString = "java:jms/queue/ExternalSignalQueue"; 
ConnectionFactory connectionFactory = (ConnectionFactory) namingContext.lookup(connectionFactoryString);
System.out.println("Got ConnectionFactory");
System.out.println("Attempting to acquire destination \"" + destinationString + "\"");
Destination destination = (Destination) namingContext.lookup(destinationString);

对于以下目标(每个管理控制台):

ExternalSignalQueue   
Queue Address:     jms.queue.ExternalSignalQueue
JNDI Names:        java:/jms/queue/ExternalSignalQueue,java:jboss/exported/jms/queue/ExternalSignalQueue

什么是队列名称,因为它应该在java中指定(为什么)?我也试过使用java:jboss/exported/jms/queue/externalsignalqueue 和queue/externalsignalqueue作为队列名称-具有相同的错误,但不同的队列“名称”似乎被选中。
这是子系统的xml:

<subsystem xmlns="urn:jboss:domain:messaging-activemq:8.0">
            <server name="default">
                <statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
                <security-setting name="#">
                    <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
                    <role name="admin" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
                </security-setting>
                <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
                <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
                <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
                    <param name="batch-delay" value="50"/>
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0">
                    <param name="buffer-pooling" value="false"/>
                </in-vm-connector>
                <http-acceptor name="http-acceptor" http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput" http-listener="default">
                    <param name="batch-delay" value="50"/>
                    <param name="direct-deliver" value="false"/>
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0">
                    <param name="buffer-pooling" value="false"/>
                </in-vm-acceptor>
                <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <jms-queue name="ExternalSignalQueue" entries="java:/jms/queue/ExternalSignalQueue,java:jboss/exported/jms/queue/ExternalSignalQueue"/>  
                <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
                <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
                <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
            </server>
        </subsystem>
bzzcjhmw

bzzcjhmw1#

我认为你应该用 jms/queue/ExternalSignalQueue 而不是 java:jms/queue/ExternalSignalQueue . 这是因为 jms/queue/ExternalSignalQueue 之后出现的是什么 java:jboss/exported/ 在jndi绑定中(这是提供给远程jndi客户机的)。

相关问题