I have another error now (Null Pointer Exception) when I run my code :

[                          main] DefaultCamelContext            INFO  JMX
enabled. Using InstrumentationLifecycleStrategy.
[                          main] DefaultCamelContext            DEBUG Adding
routes from: Routes: [Route[ [From[event://default]] -> [To[stream:out]]]]
routes: []
[                          main] DefaultInstrumentationAgent    DEBUG
Starting JMX agent on server: [EMAIL PROTECTED]
[                          main] DefaultInstrumentationAgent    DEBUG
Registered MBean with objectname:
org.apache.camel:context=WDBED0002003/camel-1,name=context
[                          main] DefaultComponentResolver       DEBUG Found
component: event via type: org.apache.camel.component.event.EventComponent
via META-INF/services/org/apache/camel/component/event
[                          main] DefaultComponent               DEBUG
Creating endpoint uri=[event://default], path=[default], parameters=[{}]
[                          main] DefaultCamelContext            DEBUG
event://default converted to endpoint: Endpoint[event://default] by
component: [EMAIL PROTECTED]
[                          main] DefaultInstrumentationAgent    DEBUG
Registered MBean with objectname:
org.apache.camel:context=WDBED0002003/camel-1,type=endpoints,name="event://default\?id=0xdaebda6"
[                          main] DefaultInstrumentationAgent    DEBUG
Registered MBean with objectname:
org.apache.camel:context=WDBED0002003/camel-1,type=processors,nodeid=to1,name="To[stream:out]"
[                          main] DefaultComponentResolver       DEBUG Found
component: stream via type:
org.apache.camel.component.stream.StreamComponent via
META-INF/services/org/apache/camel/component/stream
[                          main] DefaultComponent               DEBUG
Creating endpoint uri=[stream:out], path=[out], parameters=[{}]
[                          main] DefaultCamelContext            DEBUG
stream:out converted to endpoint: Endpoint[stream:out] by component:
[EMAIL PROTECTED]
[                          main] DefaultInstrumentationAgent    DEBUG
Registered MBean with objectname:
org.apache.camel:context=WDBED0002003/camel-1,type=endpoints,name="stream:out\?id=0xb3679825"
[                          main] DefaultInstrumentationAgent    DEBUG
Registered MBean with objectname:
org.apache.camel:context=WDBED0002003/camel-1,type=routes,name="node1"
[                          main] DefaultInstrumentationAgent    DEBUG
Registered MBean with objectname:
org.apache.camel:context=WDBED0002003/camel-1,type=consumers,name=EventConsumer(0x15212bc)
[                          main] ProducerCache                  DEBUG >>>>
Endpoint[event://default] Exchange[Message: Hello there!]
[                          main] ResolverUtil                   DEBUG
Searching for annotations of org.apache.camel.Converter in packages:
[org.apache.camel.converter, org.apache.camel.component.cxf.converter,
org.apache.camel.spring.converter]
[                          main] ResolverUtil                   DEBUG Using
only regular classloaders
[                          main] ResolverUtil                   DEBUG
Loading from jar:
C:\Opensource\repository\org\apache\camel\camel-core\1.5-SNAPSHOT\camel-core-1.5-SNAPSHOT.jar
[                          main] ResolverUtil                   DEBUG Using
only regular classloaders
[                          main] ResolverUtil                   DEBUG
Loading from jar:
C:\Opensource\repository\org\apache\camel\camel-cxf\1.5-SNAPSHOT\camel-cxf-1.5-SNAPSHOT.jar
[                          main] ResolverUtil                   DEBUG Using
only regular classloaders
[                          main] ResolverUtil                   DEBUG Found:
[class org.apache.camel.converter.jaxp.StaxConverter, class
org.apache.camel.converter.jaxp.DomConverter, class
org.apache.camel.converter.CamelConverter, class
org.apache.camel.converter.jaxp.StreamSourceConverter, class
org.apache.camel.converter.NIOConverter, class
org.apache.camel.component.cxf.converter.CxfConverter, class
org.apache.camel.converter.jaxp.XmlConverter, class
org.apache.camel.converter.ObjectConverter, class
org.apache.camel.converter.stream.StreamCacheConverter, class
org.apache.camel.converter.CollectionConverter, class
org.apache.camel.converter.IOConverter]
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.jaxp.StaxConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.jaxp.DomConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.CamelConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class:
org.apache.camel.converter.jaxp.StreamSourceConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.NIOConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class:
org.apache.camel.component.cxf.converter.CxfConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.jaxp.XmlConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.ObjectConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class:
org.apache.camel.converter.stream.StreamCacheConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.CollectionConverter
[                          main] AnnotationTypeConverterLoader  DEBUG
Loading converter class: org.apache.camel.converter.IOConverter
[                          main] DefaultTypeConverter           WARN 
Overriding type converter from: InstanceMethodTypeConverter: public
java.lang.String
org.apache.camel.converter.jaxp.XmlConverter.toString(javax.xml.transform.Source)
throws javax.xml.transform.TransformerException to:
StaticMethodTypeConverter: public static java.lang.String
org.apache.camel.converter.IOConverter.toString(javax.xml.transform.Source)
throws javax.xml.transform.TransformerException,java.io.IOException
org.apache.camel.RuntimeCamelException: java.lang.NullPointerException
        at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:685)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:90)
        at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:85)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeader(DefaultProducerTemplate.java:123)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeader(DefaultProducerTemplate.java:118)
        at com.xpectis.test.ProcessEvent.startCamel(ProcessEvent.java:44)
        at com.xpectis.test.ProcessEvent.main(ProcessEvent.java:63)
Caused by: java.lang.NullPointerException
        at
org.apache.camel.component.event.EventEndpoint$1.process(EventEndpoint.java:68)
        at 
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:151)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:88)
        ... 5 more

Can someone help me ?

Here is the code :

package com.xpectis.test;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ProcessEvent {

        private static final transient Log LOG =
LogFactory.getLog(ProcessEvent.class);

        protected CamelContext camelContext;

        protected Object expectedBody = "Hello there!";
        protected String uri = "event://default";
        protected ProducerTemplate<Exchange> template = null;

        public void startCamel() throws Exception {
                camelContext = new DefaultCamelContext();
                
                camelContext.addRoutes(createRouteBuilder());
                camelContext.start();

                template = camelContext.createProducerTemplate();
                template.sendBodyAndHeader(uri, expectedBody, "cheese", 123);
        }
        
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
                        public void configure() throws Exception {
                from("event://default").to("stream:out");
            }
        };
    }

        /**
         * @param args
         */
        public static void main(String[] args) {
                
                ProcessEvent event = new ProcessEvent();
                try {
                        event.startCamel();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
        
}


cmoulliard wrote:
> 
> The ticket has been created. Temporary, I have created locally an event
> file and regenerated a camel-snapshot.
> 
> kr,
> 
> Charles
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi Charles
>> 
>> Could you create a ticket in the bug database.
>> 
>> "event" is missing to be auto registered by Camel. (a event file in
>> META-INF/sevices
>> 
>> As a workaround you can create the component in spring style from the
>> spring xml file.
>> 
>> Something like this:
>> <bean id="event"
>> class="org.apache.camel.component.event.EventComponent"/>
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: cmoulliard [mailto:[EMAIL PROTECTED] 
>> Sent: 16. oktober 2008 15:49
>> To: [email protected]
>> Subject: Re: No SuchEndpointException is raised when a route is defined
>> for the following uri ("event://default") !!
>> 
>> 
>> Doug,
>> 
>> camel-spring jar is well defined in my classpath !!
>> 
>> kr,
>> 
>> Charles
>> 
>> 
>> Doug Douglass-2 wrote:
>>> 
>>> Charles,
>>> 
>>> The event component[1] is for interacting with the Spring
>>> ApplicationContext
>>> event subsystem[2]. No where in your code are you starting a Spring
>>> ApplicationContext so the subsystem is not available.
>>> 
>>> Also, be sure you are including the camel-spring jar in your classpath.
>>> 
>>> HTH,
>>> Doug
>>> 
>>> 
>>> [1] http://activemq.apache.org/camel/event.html
>>> [2]
>>> http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#context-functionality-events
>>> 
>>> On Fri, Oct 10, 2008 at 8:15 AM, cmoulliard <[EMAIL PROTECTED]>
>>> wrote:
>>> 
>>>>
>>>> Hi,
>>>>
>>>> I have the following error generated when I launch camel.
>>>>
>>>> Here is the error :
>>>>
>>>> org.apache.camel.NoSuchEndpointException: No endpoint could be found
>>>> for:
>>>> event://default, please check your classpath contains the needed camel
>>>> component jar.
>>>>        at
>>>>
>>>> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:54)
>>>>        at
>>>> org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:99)
>>>>        at
>>>>
>>>> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)
>>>>        at
>>>>
>>>> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)
>>>>        at
>>>> org.apache.camel.model.FromType.resolveEndpoint(FromType.java:73)
>>>>        at
>>>>
>>>> org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:81)
>>>>        at
>>>> org.apache.camel.model.RouteType.addRoutes(RouteType.java:213)
>>>>        at org.apache.camel.model.RouteType.addRoutes(RouteType.java:89)
>>>>        at
>>>>
>>>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:641)
>>>>        at
>>>>
>>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:633)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>>        at com.xpectis.test.CamelEvent.startCamel(CamelEvent.java:40)
>>>>        at com.xpectis.test.CamelEvent.main(CamelEvent.java:62)
>>>>
>>>> and the code :
>>>>
>>>> package com.xpectis.test;
>>>>
>>>> import org.apache.camel.CamelContext;
>>>> import org.apache.camel.ProducerTemplate;
>>>> import org.apache.camel.builder.RouteBuilder;
>>>> import org.apache.camel.impl.DefaultCamelContext;
>>>> import org.apache.commons.logging.Log;
>>>> import org.apache.commons.logging.LogFactory;
>>>>
>>>> public class CamelEvent {
>>>>
>>>>        private static final transient Log LOG =
>>>> LogFactory.getLog(CamelEvent.class);
>>>>
>>>>        protected CamelContext camelContext;
>>>>
>>>>        protected Object expectedBody = "Hello there!";
>>>>        protected String uri = "event:::default";
>>>>        protected ProducerTemplate<?> template = null;
>>>>
>>>>        public void startCamel() throws Exception {
>>>>                camelContext = new DefaultCamelContext();
>>>>
>>>>                camelContext.addRoutes(createRouteBuilder());
>>>>                camelContext.start();
>>>>
>>>>                template = camelContext.createProducerTemplate();
>>>>                template.sendBodyAndHeader(uri, expectedBody, "cheese",
>>>> 123);
>>>>        }
>>>>
>>>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>>>        return new RouteBuilder() {
>>>>            @Override
>>>>                        public void configure() throws Exception {
>>>>                from("event://default").to("stream:out");
>>>>            }
>>>>        };
>>>>    }
>>>>
>>>>        /**
>>>>         * @param args
>>>>         */
>>>>        public static void main(String[] args) {
>>>>
>>>>                CamelEvent camelEvent = new CamelEvent();
>>>>                try {
>>>>                        camelEvent.startCamel();
>>>>                } catch (Exception e) {
>>>>                        e.printStackTrace();
>>>>                }
>>>>        }
>>>>
>>>> }
>>>>
>>>> REMARK : the camel-spring jar is well defined in my maven dependency.
>>>>
>>>> Charles Moulliard
>>>>
>>>> -----
>>>> Enterprise Architect
>>>>
>>>> Xpectis
>>>> 12, route d'Esch
>>>> L-1470 Luxembourg
>>>>
>>>> Phone +352 25 10 70 470
>>>> Mobile +352 621 45 36 22
>>>>
>>>> e-mail : [EMAIL PROTECTED]
>>>> web site :  www.xpectis.com www.xpectis.com
>>>> My Blog :  http://cmoulliard.blogspot.com/
>>>> http://cmoulliard.blogspot.com/
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/No-SuchEndpointException-is-raised-when-a-route-is-defined-for-the-following-uri-%28%22event%3A--default%22%29-%21%21-tp19918878s22882p19918878.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>> 
>>> 
>> 
>> 
>> -----
>> Enterprise Architect
>> 
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>> 
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>> 
>> e-mail : [EMAIL PROTECTED]
>> web site :  www.xpectis.com www.xpectis.com 
>> My Blog :  http://cmoulliard.blogspot.com/
>> http://cmoulliard.blogspot.com/  
>> -- 
>> View this message in context:
>> http://www.nabble.com/No-SuchEndpointException-is-raised-when-a-route-is-defined-for-the-following-uri-%28%22event%3A--default%22%29-%21%21-tp19918878s22882p20014092.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : [EMAIL PROTECTED]
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://www.nabble.com/No-SuchEndpointException-is-raised-when-a-route-is-defined-for-the-following-uri-%28%22event%3A--default%22%29-%21%21-tp19918878s22882p20015297.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to