6 Replies Latest reply on Mar 28, 2011 10:01 PM by dead devil

    error when executing a camel routing program...

    dead devil Newbie

      Greetings.

       

      I have this code:

       

      public class RouteExample{

       

              private Main main;

          /**

            

      • A main() so we can easily run these routing rules in our IDE

            

      • @throws Exception

           */

              public static void main(String[] args) throws Exception {

                      RouteExample example = new RouteExample();

              example.boot();

          }

       

          public void boot() throws Exception {

              // create a Main instance

              main = new Main();

              // enable hangup support so you can press ctrl + c to terminate the JVM

              main.enableHangupSupport();

              // add routes

              main.addRouteBuilder(new MyRouteBuilder());

       

              // run until you terminate the JVM

              System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");

              main.run();

          }

           

          private static class MyRouteBuilder extends RouteBuilder {

              @Override

              public void configure() throws Exception {

              from("file:/home/echo66/data/inbox/")

                              .to("file:/home/echo66/data/outbox/");

              }

          }

      }

       

       

      when i run through eclipse, i get this output:

       

       

      Starting Camel. Use ctrl + c to terminate the JVM.

       

      26/Mar/2011 3:12:59 org.apache.camel.impl.MainSupport doStart

      INFO: Apache Camel 2.6.0 starting

      26/Mar/2011 3:12:59 org.springframework.context.support.AbstractApplicationContext prepareRefresh

      INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@16fa474: startup date ; root of context hierarchy

      26/Mar/2011 3:12:59 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

      INFO: Loading XML bean definitions from file /home/echo66/workspace/FileRouter/target/classes/META-INF/spring/camel-context.xml

      26/Mar/2011 3:13:00 org.apache.camel.impl.MainSupport doStop

      INFO: Apache Camel 2.6.0 stopping

      Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from file /home/echo66/workspace/FileRouter/target/classes/META-INF/spring/camel-context.xml is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://activemq.apache.org/camel/schema/spring/camel-spring.xsd; lineNumber: 2; columnNumber: 207; TargetNamespace.1: Expecting namespace 'http://activemq.apache.org/camel/schema/spring', but the target namespace of the schema document is 'http://camel.apache.org/schema/spring'.

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)

              at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)

              at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)

              at org.springframework.context.support.ClassPathXmlApplicationContext.. After this edit, i get the following output:

       

       

      Starting Camel. Use ctrl + c to terminate the JVM.

       

      26/Mar/2011 3:15:15 org.apache.camel.impl.MainSupport doStart

      INFO: Apache Camel 2.6.0 starting

      26/Mar/2011 3:15:15 org.springframework.context.support.AbstractApplicationContext prepareRefresh

      INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@95c083: startup date ; root of context hierarchy

      26/Mar/2011 3:15:15 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

      INFO: Loading XML bean definitions from file /home/echo66/workspace/FileRouter/target/classes/META-INF/spring/camel-context.xml

      26/Mar/2011 3:15:15 org.apache.camel.impl.MainSupport doStop

      INFO: Apache Camel 2.6.0 stopping

      Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 27 in XML document from file /home/echo66/workspace/FileRouter/target/classes/META-INF/spring/camel-context.xml is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 63; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'camelContext'.

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)

              at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)

              at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)

              at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)

              at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:185)

              at org.apache.camel.spring.Main.doStart(Main.java:139)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)

              at org.apache.camel.impl.MainSupport.run(MainSupport.java:136)

              at myexample.camel.FileRouter.RouteExample.boot(RouteExample.java:56)

              at myexample.camel.FileRouter.RouteExample.main(RouteExample.java:43)

      Caused by: org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 63; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'camelContext'.

              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)

              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)

              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:387)

              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:321)

              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:421)

              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185)

              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1930)

              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:709)

              at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)

              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)

              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)

              at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)

              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)

              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)

              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:741)

              at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)

              at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)

              at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288)

              at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)

              ... 20 more

       

       

       

      It's a strange thing to say that no declaration was found to camelContext because, in another camel xml file, i have the same url for the namespace and i had no problems in running those programs.

       

      so...what is wrong now?