camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: Null pointer exception created for a CamelEvent !
Date Fri, 17 Oct 2008 08:49:21 GMT
Hi

Event is for Spring events, so you need to use Spring XML as well (the application context).

So I guess if you have the route in spring XML and just start the application (without sending
to it) don't you receive some events from Spring, such as callbacks when the application context
has been started etc.

PS: maybe it should be named: spring-event instead of event?


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:cmoulliard@gmail.com] 
Sent: 17. oktober 2008 10:43
To: camel-user@activemq.apache.org
Subject: RE: Null pointer exception created for a CamelEvent !


This is done Claus.

KR,

Charles


Claus Ibsen wrote:
> 
> Hi Charles
> 
> Could you create a ticket in the bug tracker. Looks like the event
> component has an issue with sending (producing).
> 
> This component hasn't been used (much).
> 
> 
> 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:cmoulliard@gmail.com] 
> Sent: 17. oktober 2008 09:28
> To: camel-user@activemq.apache.org
> Subject: Null pointer exception created for a CamelEvent !
> 
> 
> Hi,
> 
> I have the following error generated :
> 
> [                          main] DefaultCamelContext            INFO  JMX
> enabled. Using InstrumentationLifecycleStrategy.
> [                          main] DefaultCamelContext            DEBUG
> Adding
> routes from: Routes: [Route[ [From[event://default]] -> [To[mock:test]]]]
> routes: []
> [                          main] DefaultInstrumentationAgent    DEBUG
> Starting JMX agent on server:
> com.sun.jmx.mbeanserver.JmxMBeanServer@1503a3
> [                          main] DefaultInstrumentationAgent    DEBUG
> Registered MBean with objectname:
> org.apache.camel:context=dell-charles/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: org.apache.camel.component.event.EventComponent@872380
> [                          main] DefaultInstrumentationAgent    DEBUG
> Registered MBean with objectname:
> org.apache.camel:context=dell-charles/camel-1,type=endpoints,name="event://default\?id=0xdaebda6"
> [                          main] DefaultInstrumentationAgent    DEBUG
> Registered MBean with objectname:
> org.apache.camel:context=dell-charles/camel-1,type=processors,nodeid=to1,name="To[mock:test]"
> [                          main] DefaultComponentResolver       DEBUG
> Found
> component: mock via type: org.apache.camel.component.mock.MockComponent
> via
> META-INF/services/org/apache/camel/component/mock
> [                          main] DefaultComponent               DEBUG
> Creating endpoint uri=[mock:test], path=[test], parameters=[{}]
> [                          main] DefaultCamelContext            DEBUG
> mock:test converted to endpoint: Endpoint[mock:test] by component:
> org.apache.camel.component.mock.MockComponent@e0b6f5
> [                          main] DefaultInstrumentationAgent    DEBUG
> Registered MBean with objectname:
> org.apache.camel:context=dell-charles/camel-1,type=endpoints,name="mock:test\?id=0x1f9866cb"
> [                          main] DefaultInstrumentationAgent    DEBUG
> Registered MBean with objectname:
> org.apache.camel:context=dell-charles/camel-1,type=routes,name="node1"
> [                          main] DefaultInstrumentationAgent    DEBUG
> Registered MBean with objectname:
> org.apache.camel:context=dell-charles/camel-1,type=consumers,name=EventConsumer(0x97a560)
> [                          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:\.m2\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:\.m2\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.stream.StreamCacheConverter, class
> org.apache.camel.converter.CamelConverter, class
> org.apache.camel.converter.IOConverter, class
> org.apache.camel.converter.jaxp.DomConverter, class
> org.apache.camel.converter.jaxp.StaxConverter, class
> org.apache.camel.converter.jaxp.StreamSourceConverter, class
> org.apache.camel.converter.ObjectConverter, 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.CollectionConverter]
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class:
> org.apache.camel.converter.stream.StreamCacheConverter
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class: org.apache.camel.converter.CamelConverter
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class: org.apache.camel.converter.IOConverter
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class: org.apache.camel.converter.jaxp.DomConverter
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class: org.apache.camel.converter.jaxp.StaxConverter
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class:
> org.apache.camel.converter.jaxp.StreamSourceConverter
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class: org.apache.camel.converter.ObjectConverter
> [                          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] DefaultTypeConverter           WARN 
> Overriding type converter from: StaticMethodTypeConverter: public static
> java.lang.String
> org.apache.camel.converter.IOConverter.toString(javax.xml.transform.Source)
> throws javax.xml.transform.TransformerException,java.io.IOException to:
> InstanceMethodTypeConverter: public java.lang.String
> org.apache.camel.converter.jaxp.XmlConverter.toString(javax.xml.transform.Source)
> throws javax.xml.transform.TransformerException
> [                          main] AnnotationTypeConverterLoader  DEBUG
> Loading converter class: org.apache.camel.converter.CollectionConverter
> 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.sendBody(DefaultProducerTemplate.java:102)
> 	at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:108)
> 	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
> 
> when I run the code above :
> 
> /**
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 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 body = "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.sendBody(uri, body);
> 	}
> 	
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
> 			public void configure() throws Exception {
>                 from("event://default").to("mock:test");
>             }
>         };
>     }
> 
> 	/**
> 	 * @param args
> 	 */
> 	public static void main(String[] args) {
> 		
> 		ProcessEvent event = new ProcessEvent();
> 		try {
> 			event.startCamel();
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 	}
> 	
> }
> 
> 
> 
> KR,
> 
> 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 : cmoulliard@xpectis.com
> 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/Null-pointer-exception-created-for-a-CamelEvent-%21-tp20027804s22882p20027804.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 : cmoulliard@xpectis.com
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/Null-pointer-exception-created-for-a-CamelEvent-%21-tp20027804s22882p20029370.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message