Hi Brijesh,
I guess that it fails on
exchange.setMessage(out,"out");
It looks like the out message has been already defined on the exchange.
Have you specified a MEP ?
What is your SMX version (I will try to reproduce) ?
Thanks
JB
brijesh wrote:
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("<","<");
inputMessage = inputMessage.replaceAll(">",">");
inputMessage = inputMessage.replaceAll(" ","");
out.setContent(new StringSource(inputMessage));
exchange.setMessage(out, "out");
println exchange;
println "Stopping JSR-223 groovy processor";
Any idea?
Brijesh N K