ActiveMQ Broker creation failing no matching editors or conversion strategy found

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveMQ Broker creation failing no matching editors or conversion strategy found

nmalli.531@gmail.com
We are upgrading servicemix 4.4.1 to 5.6.0,ActiveMQ 5.5.1 to 5.12.2.

Existing bean creation xml is failing with

Cannot convert value of type [com.myproduct.transport.bean.JcsSslContext] to
required type [org.apache.activemq.broker.SslContext] for property
'sslContext': no matching editors or conversion strategy found

Bean definition in xml is like below

<bean id="mySslContext" class="com.myproduct.transport.bean.MYSslContext"
init-method="afterPropertiesSet">
    <property name="keyStore" value="file:MY/conf/ssl.keystore" />
    <property name="keyStorePasswordProperty"
value="com.myproduct.transport.sslcontext.keyStorePassword" />
    <property name="trustStore" value="file:MY/conf/ssl.keystore" />
    <property name="trustStorePasswordProperty"
value="com.myproduct.transport.sslcontext.trustStorePassword" />
</bean>






<broker id="MY-broker"
        brokerName="MY-broker"
        dataDirectory="${karaf.data}/activemq"
        xmlns="http://activemq.apache.org/schema/core"
        sslContext="#MYSslContext"
</broker>
MYSslContext class definition is as below

package com.myproduct.transport.bean;
import org.apache.activemq.spring.SpringSslContext;

public class MYSslContext extends SpringSslContext
  {
     /** The system property containing the key store password */
      private String keyStorePasswordProperty;

      /** The system property containing the trust store password */
    private String trustStorePasswordProperty;

    @Override
   public void afterPropertiesSet() throws Exception
    {
       // The values are set in etc/system.properties.
       // They should have been decoded during startup by
YOsgiBootstrapBean.

    String keyStorePassword = System.getProperty(keyStorePasswordProperty,
"");
    String trustStorePassword =
System.getProperty(trustStorePasswordProperty, "");

    setKeyStorePassword(keyStorePassword);
    setTrustStorePassword(trustStorePassword);
}

/**
 * Set the system property containing the key store password.
 *
 * @param keyStorePasswordProperty The system property containing the key
store password.
 */
public void setKeyStorePasswordProperty(String keyStorePasswordProperty)
{
    this.keyStorePasswordProperty = keyStorePasswordProperty;
}

/**
 * Set the system property containing the trust store password.
 *
 * @param trustStorePasswordProperty The system property containing the
trust store password.
 */
public void setTrustStorePasswordProperty(String trustStorePasswordProperty)
{
    this.trustStorePasswordProperty = trustStorePasswordProperty;
 }
}
Ideally there should not be any issue as MYSslContext extends
SpringSslContext and SpringSslContext extends SslContext

Any suggestions will be very helpful.



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ Broker creation failing no matching editors or conversion strategy found

Tim Bain
I don't have direct experience using ActiveMQ via SSL so I don't have a
recommended solution at the moment, but I notice that the error message
says that the expected class is org.apache.activemq.broker.SslContext, and
I doubt that that's the package for the SslContext class that
SpringSslContext extends.

Tim

On Nov 8, 2017 6:59 AM, "[hidden email]" <[hidden email]> wrote:

> We are upgrading servicemix 4.4.1 to 5.6.0,ActiveMQ 5.5.1 to 5.12.2.
>
> Existing bean creation xml is failing with
>
> Cannot convert value of type [com.myproduct.transport.bean.JcsSslContext]
> to
> required type [org.apache.activemq.broker.SslContext] for property
> 'sslContext': no matching editors or conversion strategy found
>
> Bean definition in xml is like below
>
> <bean id="mySslContext" class="com.myproduct.transport.bean.MYSslContext"
> init-method="afterPropertiesSet">
>     <property name="keyStore" value="file:MY/conf/ssl.keystore" />
>     <property name="keyStorePasswordProperty"
> value="com.myproduct.transport.sslcontext.keyStorePassword" />
>     <property name="trustStore" value="file:MY/conf/ssl.keystore" />
>     <property name="trustStorePasswordProperty"
> value="com.myproduct.transport.sslcontext.trustStorePassword" />
> </bean>
>
>
>
>
>
>
> <broker id="MY-broker"
>         brokerName="MY-broker"
>         dataDirectory="${karaf.data}/activemq"
>         xmlns="http://activemq.apache.org/schema/core"
>         sslContext="#MYSslContext"
> </broker>
> MYSslContext class definition is as below
>
> package com.myproduct.transport.bean;
> import org.apache.activemq.spring.SpringSslContext;
>
> public class MYSslContext extends SpringSslContext
>   {
>      /** The system property containing the key store password */
>       private String keyStorePasswordProperty;
>
>       /** The system property containing the trust store password */
>     private String trustStorePasswordProperty;
>
>     @Override
>    public void afterPropertiesSet() throws Exception
>     {
>        // The values are set in etc/system.properties.
>        // They should have been decoded during startup by
> YOsgiBootstrapBean.
>
>     String keyStorePassword = System.getProperty(keyStorePasswordProperty,
> "");
>     String trustStorePassword =
> System.getProperty(trustStorePasswordProperty, "");
>
>     setKeyStorePassword(keyStorePassword);
>     setTrustStorePassword(trustStorePassword);
> }
>
> /**
>  * Set the system property containing the key store password.
>  *
>  * @param keyStorePasswordProperty The system property containing the key
> store password.
>  */
> public void setKeyStorePasswordProperty(String keyStorePasswordProperty)
> {
>     this.keyStorePasswordProperty = keyStorePasswordProperty;
> }
>
> /**
>  * Set the system property containing the trust store password.
>  *
>  * @param trustStorePasswordProperty The system property containing the
> trust store password.
>  */
> public void setTrustStorePasswordProperty(String
> trustStorePasswordProperty)
> {
>     this.trustStorePasswordProperty = trustStorePasswordProperty;
>  }
> }
> Ideally there should not be any issue as MYSslContext extends
> SpringSslContext and SpringSslContext extends SslContext
>
> Any suggestions will be very helpful.
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>