Я пытаюсь добавить sslContext в activemq. xml. Но я получаю исключение. Что-то не так с этим кодом?
Я даже пробовал строчные sslcontext. Может ли кто-нибудь сказать мне, в чем именно заключается ошибка и как ее решить?
<sslContext>
<sslContext
keyStore="/etc/activemq/keystore.jks"
keyStorePassword="password"
trustStore="/etc/activemq/truststore.jks"
trustStorePassword="password" />
</sslContext>
Вот полное сообщение об ошибке при запуске activemq.
2020-06-18 09:17:49,831 | INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@256216b3: startup date [Thu Jun 18 09:17:49 UTC 2020]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2020-06-18 09:17:50,512 | WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Cannot create inner bean '(inner bean)#5cee5251' of type [org.apache.activemq.spring.SpringSslContext] while setting bean property 'sslContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5cee5251' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.security.UnrecoverableKeyException: Cannot recover key | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2020-06-18 09:17:50,514 | ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Cannot create inner bean '(inner bean)#5cee5251' of type [org.apache.activemq.spring.SpringSslContext] while setting bean property 'sslContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5cee5251' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.security.UnrecoverableKeyException: Cannot recover key | org.apache.activemq.xbean.XBeanBrokerFactory | main
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Cannot create inner bean '(inner bean)#5cee5251' of type [org.apache.activemq.spring.SpringSslContext] while setting bean property 'sslContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5cee5251' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.security.UnrecoverableKeyException: Cannot recover key
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1534)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1281)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)[spring3-beans.jar:4.3.22.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)[spring3-context.jar:4.3.22.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)[spring3-context.jar:4.3.22.RELEASE]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)[xbean-spring.jar:]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)[xbean-spring.jar:]
at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)[activemq-spring.jar:5.15.8]
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring.jar:5.15.8]
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring.jar:5.15.8]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker.jar:5.15.8]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker.jar:5.15.8]
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console.jar:5.15.8]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console.jar:5.15.8]
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)[activemq-console.jar:5.15.8]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console.jar:5.15.8]
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console.jar:5.15.8]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_252]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_252]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_252]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_252]
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq-run.jar:5.15.8]
at org.apache.activemq.console.Main.main(Main.java:115)[activemq-run.jar:5.15.8]
Вот activemq. xml содержимое файла.
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker xmlns="http://activemq.apache.org/schema/core"
useJmx="false"
brokerName="localhost"
dataDirectory="${activemq.base}/data">
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="mcollective" password="password" groups="mcollective,everyone"/>
<authenticationUser username="admin" password="password" groups="mcollective,admins,everyone"/>
</users>
</simpleAuthenticationPlugin>
</plugins>
<persistenceAdapter>
<kahaDB directory="${activemq.base}/data/kahadb"/>
</persistenceAdapter>
<sslContext>
<sslContext
keyStore="/etc/activemq/keystore.jks"
keyStorePassword="password"
trustStore="/etc/activemq/truststore.jks"
trustStorePassword="password" />
</sslContext>
<transportConnectors>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
<transportConnector name="stomp+nio+ssl" uri="stomp+ssl://0.0.0.0:61614?needClientAuth=true&transport.enabledProtocols=TLSv1,TLSv1.1,TLSv1.2"/>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>
</broker>
</beans>