Try <camel:package> under <camel:camelContext id="camelContext">.
The parser isn't understanding where "<package>" comes from. -Jeff On Thu, Mar 3, 2011 at 2:59 PM, lone squirrely <[email protected]> wrote: > For some reason it didn't like the XML: > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xmlns:camel="http://camel.apache.org/schema/spring" > xmlns:amq="http://activemq.apache.org/schema/core" > xmlns:p="http://www.springframework.org/schema/p" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://activemq.apache.org/schema/core > http://activemq.apache.org/schema/core/activemq-core.xsd" > > > <context:component-scan base-package="com.nrf" /> > > <bean id="service" class="com.service.Service"> > <constructor-arg index="0"><ref bean="nrfCamelContext" > /></constructor-arg> > </bean> > > <!-- Setup a broker for testing --> > <amq:broker> > <amq:transportConnectors> > <amq:transportConnector name="openWire" uri="tcp://localhost:61616" /> > <amq:transportConnector name="stomp" uri="tcp://localhost:61613" /> > </amq:transportConnectors> > </amq:broker> > > <bean id="activemqBroker" > class="org.apache.activemq.camel.component.ActiveMQComponent"> > <property name="brokerURL" value="tcp://localhost:61616" /> > </bean> > > <camel:camelContext id="camelContext"> > <package>com.camel</package> > </camel:camelContext> > </beans> > > Sorry for the trouble > > On Thu, Mar 3, 2011 at 11:56 AM, thelonesquirrely > <[email protected]> wrote: >> Hello, >> >> I am having a few problems with camel and spring, i will start with the >> simple one and then move on to the harder problem in another email/post. >> >> I am trying to just setup a bogus camel route, something that goes from >> test:orig -> test:dest. Mainly to verify that I can build and am doing this >> right. >> >> I have a spring service: service.java (really simple) >> >> @Service(value = "service") >> public class Service { >> >> ProducerTemplate _pTemplate = null; >> >> public NrfService (CamelContext camelContext) { >> _pTemplate = camelContext.createProducerTemplate (); >> greet (); >> >> System.out.println ("ProducerTemplate! " + _pTemplate); >> for (Route r : camelContext.getRoutes ()) { >> System.out.println (r.getEndpoint ()); >> } >> >> } >> >> public void greet () { >> System.out.println ("Welcome to the Service"); >> } >> } >> >> ----------------------------------------------------------------------------- >> >> a simple route builder: MarsRouteBuilder.java: >> >> package com.camel; >> >> import org.apache.camel.builder.RouteBuilder; >> >> public class MarsRouteBuilder extends RouteBuilder{ >> >> @Override >> public void configure () throws Exception { >> >> from ("test:orig").to ("test:dest"); >> } >> } >> >> ----------------------------------------------------------------------------- >> >> and then in my WEB-INF/spring/springApplicationContext.xml: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.camel >> >> >> >> ------------------------------------------------------------------------------------------------ >> >> This causes an error about the package line (if I remove it it starts up >> fine...): >> 11:35:34,457 ERROR ContextLoader:220 - Context initialization failed >> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line >> 32 in XML document from ServletContext resource >> [/WEB-INF/spring/springApplicationContext.xml] is invalid; nested exception >> is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content >> was found starting with element 'package'. One of >> '{"http://camel.apache.org/schema/spring":properties, "http://camel.apache.o >> rg/schema/spring":propertyPlaceholder, >> "http://camel.apache.org/schema/spring":package, >> "http://camel.apache.org/schema/spring":packageScan, >> "http://camel.apache.org/schema/spring":contextScan, "http: >> //camel.apache.org/schema/spring":jmxAgent, >> "http://camel.apache.org/schema/spring":beanPostProcessor, >> "http://camel.apache.org/schema/spring":template, >> "http://camel.apache.org/schema/spring":consume >> rTemplate, "http://camel.apache.org/schema/spring":proxy, >> "http://camel.apache.org/schema/spring":export, >> "http://camel.apache.org/schema/spring":errorHandler, >> "http://camel.apache.org/schema/spring": >> routeBuilder, "http://camel.apache.org/schema/spring":routeContextRef, >> "http://camel.apache.org/schema/spring":threadPoolProfile, >> "http://camel.apache.org/schema/spring":threadPool, "http://camel.apac >> he.org/schema/spring":endpoint, >> "http://camel.apache.org/schema/spring":dataFormats, >> "http://camel.apache.org/schema/spring":onException, >> "http://camel.apache.org/schema/spring":onCompletion, "http:// >> camel.apache.org/schema/spring":intercept, >> "http://camel.apache.org/schema/spring":interceptFrom, >> "http://camel.apache.org/schema/spring":interceptSendToEndpoint, >> "http://camel.apache.org/schema/sprin >> g":route}' is expected. >> 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) >> .....(more stack trace)... >> >> Could you help me to specify this? I think there is something small and >> fundamental that I am missing! please help! >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Simple-test-setup-and-error-basic-w-Spring-tp3408562p3408562.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >
