当前位置: 首页 > 知识库问答 >
问题:

使用Spring4.x解决连接问题

阎善
2023-03-14

我们试图通过Spring4.x创建Solace JMS连接,但在运行main类时面临以下问题。

还可以找到附加的spring-context文件,用于Solace服务器配置

谢谢这是我的Spring配置

http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd“xmlns:jms=”http://www.springframework.org/schema/jms“xmlns:xsi=”http://www.w3.org/2001/xmlschema-instance“xmlns=”http://www.springframework.org/schema/beans“>

<bean autowire="default" lazy-init="default"
    class="org.springframework.jndi.JndiTemplate" id="solaceJndiTemplate">

    <property name="environment">

        <map>
            <entry value="smf://192.168.56.101:24" key="java.naming.provider.url" />
            <entry value="com.solacesystems.jndi.SolJNDIInitialContextFactory"
                key="java.naming.factory.initial" />
            <entry value="spring_user@Solace_Spring_VPN" key="java.naming.security.principal" />
            <entry value="spring_password" key="java.naming.security.credentials" />
        </map>
    </property>
</bean>

<bean autowire="default" lazy-init="default"
    class="org.springframework.jndi.JndiObjectFactoryBean" id="solaceConnectionFactory">
    <property name="jndiTemplate" ref="solaceJndiTemplate" />
    <property name="jndiName" value="JNDI/CF/ncs" />
</bean>

<bean class="org.springframework.jms.connection.CachingConnectionFactory"
    id="solaceCachedConnectionFactory">
    <property name="targetConnectionFactory" ref="solaceConnectionFactory" />
    <property name="sessionCacheSize" value="10" />
</bean>

<bean class="org.springframework.jndi.JndiObjectFactoryBean" id="destination">
    <property name="jndiTemplate" ref="solaceJndiTemplate" />
    <property name="jndiName" value="JNDI/Q/requests" />
</bean>

<bean class="org.springframework.jms.core.JmsTemplate" id="jmsTemplate">
    <property name="connectionFactory" ref="solaceCachedConnectionFactory" />
    <property name="defaultDestination" ref="destination" />
    <property name="deliveryPersistent" value="true" />
    <property name="explicitQosEnabled" value="true" />
</bean>
-
<bean class="com.solacesystems.integration.spring.MessageProducer"
    id="messageProducer">
    <property name="jmsTemplate" ref="jmsTemplate" />
</bean>
<bean class="com.solacesystems.integration.spring.MessageConsumer"
    id="messageConsumer">
</bean>
-
<bean
    class="org.springframework.jms.listener.DefaultMessageListenerContainer"
    id="jmsContainer">
    <property name="connectionFactory" ref="solaceCachedConnectionFactory" />
    <property name="destination" ref="destination" />
    <property name="messageListener" ref="messageConsumer" />
</bean>

共有1个答案

戴鸿羽
2023-03-14

该错误表示到192.168.56.101:24的网络连接失败。

请确保192.168.56.101:24是您的Solace路由器的正确IP地址和消息端口,并且您和Solace message Broker之间没有防火墙。请注意,默认端口是55555,而不是24。

您可以通过在Solace message Broker上执行以下CLI命令来验证所使用的IP地址和端口。

在Solace Pubsub+硬件设备上,show ip vrf msg-backing将为您提供硬件设备的ip地址。

在Solace Pubsub+软件消息传递代理上,show ip vrf management将为您提供它的ip地址。

 类似资料:
  • 本文向大家介绍用Python解决x的n次方问题,包括了用Python解决x的n次方问题的使用技巧和注意事项,需要的朋友参考一下 我考虑到了x的所有n次的情况,下面的代码有可能是不完美的,但是肯定是对的。 以上这篇用Python解决x的n次方问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持呐喊教程。

  • 本文向大家介绍MySQL 可以用localhost 连接,但不能用IP连接的问题解决方法,包括了MySQL 可以用localhost 连接,但不能用IP连接的问题解决方法的使用技巧和注意事项,需要的朋友参考一下 MySQL localhost 连接,但不能用IP连接问题解决方案 主要涉及到MySQL 可以用localhost 连接,但不能用IP连接的问题 方面的内容,对于MySQL 可以用loca

  • 本文向大家介绍eclipse连接不到genymotion问题的解决方案,包括了eclipse连接不到genymotion问题的解决方案的使用技巧和注意事项,需要的朋友参考一下 (1)很多朋友在使用genymotion开发安卓应用程序的时候,会遇见完全正确的安装但是在运行的时候仍然找不到,genymotion上的设备,在打开的devices上找不到如下图所示: (2)解决的方法如下: 1、关闭ecl

  • 我希望在我的Spring 4应用程序中使用Hikari连接池。数据库是Google CloudSQLPostgres数据库。 我在pom中有以下依赖项。xml: 在我的申请Context.xml,我有: 但是我得到了以下例外: 出了什么问题?

  • 本文向大家介绍Python连接mssql数据库编码问题解决方法,包括了Python连接mssql数据库编码问题解决方法的使用技巧和注意事项,需要的朋友参考一下 python一直对中文支持的不好,最近老遇到编码问题,而且几乎没有通用的方案来解决这个问题,但是对常见的方法都试过之后,发现还是可以解决的,下面总结了常用的支持中文的编码问题(这些方法中可能其中一个就能解决问题,也可能是多个组合)。 (1)

  • 本文向大家介绍PHP连接sql server 2005环境配置及问题解决,包括了PHP连接sql server 2005环境配置及问题解决的使用技巧和注意事项,需要的朋友参考一下 一、Windows下PHP连接SQLServer 2005 设定:安装的Windows操作系统(Win7 或XP均可,其他系统暂未测试),在C盘下;PHP的相关文件位于c:/PHP下面,其配置文件php.ini位于C:\