thanks a lot that worked,

regards
Brijesh NK


Gert Vanthienen wrote:
> 
> L.S.,
> 
> Looks like the out message already exists, so instead of creating a
> new message, you can do
> exchange.getMessage("out").setContent(new StringSource(inputMessage));
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/6/4 brijesh <[email protected]>:
>>
>> While calling scripting from cxf bc, getting error following error stack
>> ,
>>
>>
>> javax.script.ScriptException: Out message is already set
>>        at
>> com.sun.script.groovy.GroovyScriptEngine.eval(GroovyScriptEngine.java:245)
>>        at
>> com.sun.script.groovy.GroovyCompiledScript.eval(GroovyCompiledScript.java:46)
>>        at javax.script.CompiledScript.eval(CompiledScript.java:44)
>>        at
>> org.apache.servicemix.scripting.ScriptingEndpoint.process(ScriptingEndpoint.java:300)
>>        at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
>>        at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
>>        at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
>>        at
>> org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>        at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>        at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>        at java.lang.Thread.run(Thread.java:595)
>> Caused by: javax.jbi.messaging.MessagingException: Out message is already
>> set
>>        at
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java:360)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:585)
>>        at
>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>        at
>> org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
>>        at
>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>        at
>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>        at Script5.run(Script5.groovy:33)
>>        at
>> com.sun.script.groovy.GroovyScriptEngine.eval(GroovyScriptEngine.java:243)
>>        ... 14 more
>> Jun 4, 2009 5:34:15 PM org.apache.cxf.phase.PhaseInterceptorChain
>> doIntercept
>>
>>
>> groovy code  as below
>>
>>
>> import javax.jbi.messaging.MessageExchange;
>> import javax.jbi.messaging.NormalizedMessage;
>> import org.apache.servicemix.jbi.jaxp.StringSource;
>> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>>
>> println "Starting JSR-223 groovy processor  this is test ";
>> println exchange;
>> def inputMessage = new
>> SourceTransformer().toString(inMessage.getContent());
>> println "Hello, I got an input message " + inputMessage;
>> NormalizedMessage out = exchange.createMessage();
>>
>> inputMessage = inputMessage.replaceAll("&lt;","<");
>> inputMessage = inputMessage.replaceAll("&gt;",">");
>> inputMessage = inputMessage.replaceAll("&#13;","");
>>
>> out.setContent(new StringSource(inputMessage));
>> exchange.setMessage(out, "out");
>> println exchange;
>> println "Stopping JSR-223 groovy processor";
>>
>>
>>
>> Any idea?
>>
>> Brijesh N K
>>
>> --
>> View this message in context:
>> http://www.nabble.com/smx-scrpting-gives-Out-message-is-already-set-error-tp23868699p23868699.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: 
http://www.nabble.com/smx-scrpting-gives-Out-message-is-already-set-error-tp23868699p23872572.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to