0

メッセージを送信しようとすると、次の例外が発生します。URLは正しいようで、以前は同様の構成を使用しました。この問題の原因となる可能性のある手がかりがありません...

Caused by: javax.naming.NamingException: invalid URL: protocol != smqp, URL==smqp://activemq:3001/timeout=10000
    at com.swiftmq.jndi.v400.URLParser.parseURL(Unknown Source)
    at com.swiftmq.jndi.InitialContextFactoryImpl.getInitialContext(Unknown Source)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)
    at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)
    at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)
    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
    at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
    at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:127)
    ... 50 more

構成

<!-- JMS Connection Factory -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.provider.url">smqp://activemq:3001/timeout=10000</prop>
            <prop key="java.naming.factory.initial">com.swiftmq.jndi.InitialContextFactoryImpl</prop>
        </props>
    </property>
</bean>

<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="QueueConnectionFactory" />
    <property name="lookupOnStartup" value="false" />
    <property name="cache" value="false" />
    <property name="proxyInterface" value="javax.jms.QueueConnectionFactory" />
</bean>

<bean id="sendConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory" destroy-method="destroy">
    <property name="targetConnectionFactory" ref="jmsConnectionFactory" />
    <property name="reconnectOnException" value="true" />
    <property name="sessionCacheSize" value="100"/>
</bean>

<!-- Template used only for sending messages -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="sendConnectionFactory" />
    <property name="defaultDestinationName" value="request@z4smq_4001" />
</bean>

使用法

MessageCreator messageCreator = new MessageCreatorImpl(payload);
jmsTemplate.send(messageCreator); // setter injection
4

1 に答える 1

0

「smqp://」の前に空白やその他の見えない文字がありますか?その場合、同じ例外が発生します。それ以外の場合は機能します。

適切な対象者に到達するには、SwiftMQのユーザーフォーラムに質問を投稿する必要があります。

于 2012-07-30T06:35:05.780 に答える