1 Reply Latest reply on Apr 10, 2019 11:35 AM by Ângelo Costa

    WildFly 8.0.0.Final - Camel crypto example

    Ângelo Costa Newbie

      Hello everyone,

       

      I'm looking for a simple example of camel crypto usage to be deployed on wildfly 8.0.0.Final.

       

      Does anyone here have a simple example? All the examples that i've found on the internet do not work.

       

      Appreciated any help.

       

      Regards,

      Ângelo Costa

        • 1. Re: WildFly 8.0.0.Final - Camel crypto example
          Ângelo Costa Newbie

          Right now i've built an example:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <beans xmlns="http://www.springframework.org/schema/beans"

              xmlns:cxf="http://camel.apache.org/schema/cxf"

              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.xsd                        http://camel.apache.org/schema/spring                 http://camel.apache.org/schema/spring/camel-spring.xsd                http://camel.apache.org/schema/cxf                http://camel.apache.org/schema/cxf/camel-cxf.xsd">

           

           

          <bean id="desKey" class="org.apache.camel.converter.crypto.SpringCryptoDataFormatTest" factory-method="getDesKey" />

           

           

              <camelContext id="smart_translator_context" xmlns="http://camel.apache.org/schema/spring">

           

           

                  <dataFormats>

           

           

                      <crypto id="basic" algorithm="DES" shouldAppendHMAC="false" keyRef="desKey"  />

           

           

                  </dataFormats>

                 

                  <route>

                  <from uri="file://C:/temp" />

                  <log message="Got file: ${body}" />

                

                  <to uri="direct-vm:basic-encryption" />

                  </route>

                 

          <route>

          <from uri="direct-vm:basic-encryption" />

           

           

          <marshal ref="basic" />

           

           

          </route>

           

           

              </camelContext>

           

           

          </beans>




          but getting an error:





          Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route8 at: >>> Marshal[ref:basic] <<< in route: Route(route8)[[From[direct-vm:basic-encryption]] -> [Marshal... because of No bean could be found in the registry for: desKey of type: java.security.Key

          at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1039)

          at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)

          at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:841)

          at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2911)

          at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2634)

          at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167)

          at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2483)

          at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2479)

          at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2502)

          at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2479)

          at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)

          at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2448)

          at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:255)

          at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)

          ... 15 more

          Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: desKey of type: java.security.Key

          at org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:159)

          at org.apache.camel.model.dataformat.CryptoDataFormat.createDataFormat(CryptoDataFormat.java:71)

          at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:96)

          at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:72)

          at org.apache.camel.model.MarshalDefinition.createProcessor(MarshalDefinition.java:171)

          at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:505)

          at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:217)

          at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1036)

          ... 28 more