Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails(spring amqp)-通过XML配置使用SSL连接RabbitMQ_Xml_Ssl_Grails_Config_Spring Amqp - Fatal编程技术网

Grails(spring amqp)-通过XML配置使用SSL连接RabbitMQ

Grails(spring amqp)-通过XML配置使用SSL连接RabbitMQ,xml,ssl,grails,config,spring-amqp,Xml,Ssl,Grails,Config,Spring Amqp,我一直在尝试修改一个旧项目(基于Grails2.5.6)的配置,以便在与RabbitMQ实例集成时使用ssl连接。我有版本1.4.6中的spring amqp。我的旧版配置文件是在xml文件中编写的,如下所示: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="ht

我一直在尝试修改一个旧项目(基于Grails2.5.6)的配置,以便在与RabbitMQ实例集成时使用ssl连接。我有版本1.4.6中的spring amqp。我的旧版配置文件是在xml文件中编写的,如下所示:

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:rabbit="http://www.springframework.org/schema/rabbit"
    xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.4.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<rabbit:connection-factory
        id="connectionFactory"
        username="guest2"
        password="guest"
        virtual-host="dev"
        host="localhost"
        port="5672"
/>
<bean id="rabbitListener" class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory"/>
    <property name="queues" ref="rabbitQueue" />
    <property name="defaultRequeueRejected" value="false"/>
    <property name="messageListener" ref="listenerService" />
    <property name="errorHandler" ref="errorHandlerService" />
    <property name="autoStartup" value="false" />
    <property name="concurrentConsumers" value="1" />
</bean>
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:rabbit="http://www.springframework.org/schema/rabbit"
    xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.4.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<rabbit:connection-factory
        id="connectionFactory"
        connection-factory="clientConnectionFactory"
        username="guest2"
        password="guest"
        virtual-host="dev"
        host="localhost"
        port="5671"
/>

<bean id="clientConnectionFactory"
      class="org.springframework.xd.dirt.integration.rabbit.RabbitConnectionFactoryBean">
    <property name="useSSL" value="true" />
    <property name="sslPropertiesLocation" value="file://./rabbitSSL.properties"/>
</bean>


我一直在努力解决这个问题。我不知道如何解释这个错误以及如何解决它。是否有人遇到过类似的问题,或者可能知道此配置可能有什么问题

回复太晚了,但我发现了问题所在。一直都是我的错。调试后,我发现
sslPropertiesLocation
设置不正确。在
file://./rabbit..
使其转到错误的ftp位置。设置正确的文件位置后,如:
file:grails-app/conf/rabbit/file
连接已建立。调试建议使我意识到我的错误。非常感谢。

为什么在这里使用Spring XD中的类?spring rabbit jar中有一个
RabbitConnectionFactoryBean
。打开调试日志查看它的帮助-更好的是,升级到至少1.7.5,在那里我们在连接时添加了一些诊断。我已经尝试使用org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean,但我得到了完全相同的错误。当我升级到1.7.5.RELEASE时,我得到了不同的错误:原因:org.springframework.beans.factory.BeanCreationException:创建名为“org.springframework.cache.config.internalCacheAdvisor”的bean时出错:bean初始化失败;嵌套的异常是java.lang.NoSuchMethodError:org.springframework.beans.factory.config.ConfigurableBeanFactory.getSingletonMutex()Ljava/lang/Object;1.7.5需要更新版本的spring framework jars(4.3.13)。我一直在使用依赖项,并添加了
spring核心:4.3.13
。在那之后,我仍然会犯同样的错误。我使用的是
grails2.5.6
(由于其他插件的依赖性,我不能再高了),它是基于
spring4.1.9
构建的。在我看来,我认为我得到了不同版本的双重jar,我怀疑应用了错误的版本。我不知道这样工作是否可行。看来使用
grails2.5.6
我只能做到
springrabbit:1.4.6
,因为更高版本需要比
4.1.9
更高的spring版本(我一直坚持使用)。我启用了调试日志记录,但我又回到了原点。以下是一些相关日志,其中包含错误信息:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rabbitListener' defined in URL [file:/target/classes/rabbitmq/resources-listeners.xml]: Cannot resolve reference to bean 'connectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory': Cannot create inner bean '(inner bean)#50b63731' of type [org.springframework.xd.dirt.integration.rabbit.RabbitConnectionFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#50b63731': Invocation of init method failed; nested exception is java.net.UnknownHostException: .
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#50b63731': Invocation of init method failed; nested exception is java.net.UnknownHostException: .