camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thelonesquirrely <thelonesquirr...@gmail.com>
Subject Simple test setup and error (basic w/Spring)
Date Thu, 03 Mar 2011 19:56:45 GMT
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.

Mime
View raw message