On Tue, Jun 2, 2009 at 11:04 PM, stevenmaring <steve.mar...@gmail.com> wrote: > > I'm probably doing something stupidly wrong here but I can't seem to figure > it out. I keep getting a NullPointerException when I try to use my > camelTemplate property in my class. I think, perhaps, I'm not understanding > how camel:template gets instrumented by JmsComponent, but I can't find the > documentation on this. >
Hi welcome on board the Camel ride. You almost got it. The camel:template XML tag should be inside the camel:context XML tag. So it should be: <camel:camelContext id="camel"> <camel:template id="camelTemplate"/> </camel:camelContext> > > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:jaxws="http://cxf.apache.org/jaxws" > xmlns:camel="http://camel.apache.org/schema/spring" > xmlns:context="http://www.springframework.org/schema/context" > xmlns:jee="http://www.springframework.org/schema/jee" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd > http://cxf.apache.org/jaxws > http://cxf.apache.org/schemas/jaxws.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context-2.5.xsd > http://activemq.apache.org/camel/schema/spring > http://activemq.apache.org/camel/schema/spring/camel-spring.xsd > http://www.springframework.org/schema/jee > http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"> > > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> > > <camel:camelContext id="camel"/> > <camel:template id="camelTemplate"/> > > <bean id="imq" class="org.apache.camel.component.jms.JmsComponent"> > <property name="connectionFactory" ref="imqConnectionFactory"/> > </bean> > > <bean id="voiceGenerator" class="com.ess.tts.ws.VoiceGeneratorService"> > <property name="camelTemplate" ref="camelTemplate"/> > </bean> > > <bean id="imqConnectionFactory" > class="com.ess.tts.engine.util.IMQConnectionFactory"> > <property name="hostname" value="localhost" /> > <property name="port" value="7676" /> > <property name="username" value="admin" /> > <property name="password" value="admin" /> > </bean> > > > <jaxws:endpoint > id="voiceGeneratorWS" > implementor="com.ess.tts.ws.VoiceGeneratorService" > address="/voiceGeneratorService" > /> > > </beans> > > > @WebService(endpointInterface="com.ess.tts.ws.VoiceGenerator", > serviceName="VoiceGeneratorService", > portName="VoiceGeneratorPort") > public class VoiceGeneratorService implements VoiceGenerator { > > private static Logger log = > LoggerFactory.getLogger(VoiceGeneratorService.class); > > private ProducerTemplate camelTemplate; > > public void generateVoice(TTSAudioConfig audioConfig) { > camelTemplate.sendBody("imq:queue:voiceRequestQueue", > ExchangePattern.InOut, audioConfig); > } > > public ProducerTemplate getCamelTemplate() { > return camelTemplate; > } > > public void setCamelTemplate(ProducerTemplate camelTemplate) { > this.camelTemplate = camelTemplate; > } > > } > > > -Steve Maring > > -- > View this message in context: > http://www.nabble.com/using-ProducerTemplate-for-JMS-with-Spring-tp23840855p23840855.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus