8 Replies Latest reply on Sep 3, 2014 12:02 PM by reyasuresh

    xmljson could not be created

    reyasuresh

      Hi

       

      I am trying to read a json file and convert it into a xml. When I run the attached blueprint in my local jboss studio it runs without any error. When I deploy it as a OSGI bundle it fails with the following Error

       

      Error occurred during starting Camel: CamelContext(blueprintContext) due Failed to create route route15 at: >>> Unmarshal[ref:xmljsonWithOptions] <<< in route: Route(route15)[[From[stream:file?fileName=data/inbox/json.js... because of Data format 'xmljson' could not be created. Ensure that the data format is valid and the associated Camel component is present on the classpath

       

      org.apache.camel.FailedToCreateRouteException: Failed to create route route15 at: >>> Unmarshal[ref:xmljsonWithOptions] <<< in route: Route(route15)[[From[stream:file?fileName=data/inbox/json.js... because of Data format 'xmljson' could not be created. Ensure that the data format is valid and the associated Camel component is present on the classpath

        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:912)[org.apache.camel:camel-core:2.12.0.redhat-610379 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]

        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)[org.apache.camel:camel-core:2.12.0.redhat-610379 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]

        at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:778)[org.apache.camel:camel-core:2.12.0.redhat-610379 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]

        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1955)[org.apache.camel:camel-core:2.12.0.redhat-610379 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]

       

      Here is my copy of my blueprint.xml

       

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

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

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

             xsi:schemaLocation="

             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

             http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.12.0.xsd">

       

        <camelContext trace="true" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">

          <dataFormats>

              <xmljson id="json"/>

              <xmljson forceTopLevelObject="false" rootName="root" trimSpaces="true" skipNamespaces="false" removeNamespacePrefixes="false" expandableProperties="d e" id="xmljsonWithOptions"/>

          </dataFormats>

          <route>

          <from uri="stream:file?fileName=data/inbox/json.json"/>

              <unmarshal ref="xmljsonWithOptions"/>       

              <to uri="stream:out"/>

          </route>

      </camelContext>

      </blueprint>

       

      I have included the following features to my fabric profile

       

      fabric:profile-edit --features camel-stream jboss-fuse-full

       

      fabric:profile-edit --features camel-xmljson jboss-fuse-full

       

      fabric:profile-edit --features camel-gson jboss-fuse-full

       

      fabric:profile-edit --features camel-xstream jboss-fuse-full

       

      fabric:profile-edit --features camel-jackson jboss-fuse-full

       

      regards

      Suresh

        • 1. Re: xmljson could not be created
          davsclaus

          If you run a osgi:list command do you see a bundle with the camel-xmljson being installed?

           

          And you can also try a restart on the bundle that has your custom application in case you have added those features after you installed your application.

          • 2. Re: xmljson could not be created
            bibryam

            Strangely enough I also get this error for other data formats only when we restart the whole container.

            Can you try to adding this and see if it works:

             

            <reference interface="org.apache.camel.spi.DataFormatResolver" filter="(dataformat=xmljson)"/>
            • 3. Re: xmljson could not be created
              reyasuresh

              Hi Claus,

               

              Thanks for you quick reply. When I tried to list my containers... I do see the following error, Might be this is an issue ?

               

              JBossFuse:admin@root> fabric:container-list

              [id]                           [version] [connected] [profiles]                                         [provision status]

              root*                          1.0       true        fabric, fabric-ensemble-0000-1, jboss-fuse-full    error - org.osgi.service.resolver.ResolutionException: Unable to

              resolve dummy/0.0.0: missing requir

               

              regards

              Suresh

              • 4. Re: xmljson could not be created
                reyasuresh

                Hi Claus,

                 

                Thanks for your quick Reply. When I try to list (osgi:list) I am not able to find the camel-xmljson.

                 

                But when I list the features I find the camel-xmljson been installed to the profile.

                 

                features:list

                 

                [installed  ] [2.12.0.redhat-610379   ] camel-xmljson                           camel-2.12.0.redhat-610379

                 

                When I tried to list my containers... I do see the following error, Might be this is an issue ?

                 

                JBossFuse:admin@root> fabric:container-list

                [id]                           [version] [connected] [profiles]                                         [provision status]

                root*                          1.0       true        fabric, fabric-ensemble-0000-1, jboss-fuse-full    error - org.osgi.service.resolver.ResolutionException: Unable to

                resolve dummy/0.0.0: missing requir

                 

                regards

                Suresh

                • 5. Re: xmljson could not be created
                  davsclaus

                  You can see the error with

                   

                  log:display-exception

                   

                   

                  Also you should prefer to set all the features in one command, eg this

                   

                  fabric:profile-edit --features camel-jackson jboss-fuse-full

                   

                  To do that you just repeat the --features command, eg such as:


                  fabric:profile-edit --features camel-jackson --features camel-xstream --features camel-xstream --features camel-xstream --features camel-xstream jboss-fuse-full

                  • 6. Re: xmljson could not be created
                    reyasuresh

                    Hi Claus,

                     

                    Thanks for your reply.

                     

                    I have added the following features to my profile

                     

                    Container settings

                    --------------------------

                    Features :

                            camel-core

                            camel-gson

                            camel-spring

                            camel-xmljson

                            camel-blueprint

                            camel-saxon

                            camel-stream

                            camel-jackson

                            camel-xstream

                     

                    I am able to deploy the application to the console and the application is Active. (All the dependency has been loaded successfully).

                     

                    From the Logs,  Application is started but I dont see the Xml output. But If I comment out the <!--   <unmarshal ref="xmljsonWithOptions"/> --> part then I am able to get the output without converting to xml.

                     

                    I dont see any errors in the log when the UnMarshal is not commented out.

                     

                    Is there any other Dependency I need to load ?

                     

                    Logs

                    -----------

                    Started bundle: blueprint:file:/C:/Users/sankarap/Desktop/Softwares/jboss-fuse-full-6.1.0.redhat-379/jboss-fuse-6.1.0.redhat-379/instances/child1/deploy/JsonRead_blueprint.xml

                     

                    JsonRead_blueprint.xml

                     

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

                    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

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

                           xsi:schemaLocation="

                        http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

                           http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.12.0.xsd">

                      <camelContext trace="true" id="blueprint" xmlns="http://camel.apache.org/schema/blueprint">

                       <dataFormats>   

                      <xmljson id="xmljsonWithOptions" encoding="UTF-8" forceTopLevelObject="true" trimSpaces="true" rootName="newRoot" skipNamespaces="true"

                                 removeNamespacePrefixes="true" expandableProperties="d e"/>

                        </dataFormats>

                        <route>

                            <from uri="stream:file?fileName=c:/Users/sankarap/Desktop/json.json"/>

                      <log message="***** File Read Completed !!! *****" loggingLevel="INFO"/>

                      <unmarshal ref="xmljsonWithOptions"/>

                             <setBody>

                                    <simple>${body}</simple>

                             </setBody>

                            <to uri="log:test"/>  

                      <log message="***** Completed !!! *****" loggingLevel="INFO"/>

                      <to uri="stream:file?fileName=c:/Users/sankarap/Desktop/json.txt"/>

                        </route>

                    </camelContext>

                    </blueprint>

                     

                    Dependencies from the console.

                    dependency.jpg

                    regards

                    Suresh

                    • 7. Re: xmljson could not be created
                      reyasuresh

                      Hi Claus,

                       

                      Any update to this ? still I have the same error.

                       

                      regards

                      Suresh

                      • 8. Re: xmljson could not be created
                        reyasuresh

                        Hi Bilgin,

                         

                        I have tried the same, still the bundle is started... But I don't see any errors or the converted xml

                         

                        Here is my blueprint.xml

                         

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

                        <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

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

                               xsi:schemaLocation="

                               http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

                               http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.12.0.xsd">

                              

                          <reference interface="org.apache.camel.spi.DataFormatResolver" filter="(dataformat=xmljson)"/>      

                         

                         

                          <camelContext trace="true" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint"> 

                            <dataFormats>

                                <xmljson id="json"/>

                                <xmljson forceTopLevelObject="false" rootName="root" trimSpaces="true" skipNamespaces="false" removeNamespacePrefixes="false" expandableProperties="d e" id="xmljsonWithOptions"/>

                            </dataFormats>

                            <route id="jsonRead">

                                <from uri="stream:file?fileName=c:/Users/sankarap/Desktop/json.json"/>

                                <unmarshal ref="xmljsonWithOptions"/>

                                <log message = "**** Json Content :: ${body} ******** " loggingLevel = "INFO"/>        

                                <to uri="stream:file?fileName=c:/Users/sankarap/Desktop/jsonContent.txt"/>

                            </route>

                        </camelContext>

                        </blueprint>

                         

                        regards

                        Suresh