ConcurrentModificationException on filterSource

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ConcurrentModificationException on filterSource

jeroen.vandensteen

Hi,

 

I found a stack trace in the logs with a ConcurrentModificationException during the execution of filterSource. At first, I thought it was because maybe we were reusing execution contexts, but this is not the case. I am however reusing the Smooks object, as it takes quite a lot of time to create it using the XSD. Is that the normal way to do this? I am not able to reproduce the error immediately, but maybe you can help me which parts of my code I should check, to make sure I do not have this error in the future.

 

Stack trace:

13:40:05,488 ERROR [be.client.pushmrostatus.service.PushMROTransformer] (ajp-/10.242.194.28:8309-32) PushMROTransformer : applySmooks: org.milyn.SmooksException: Smooks Filtering operation failed.
  at org.milyn.Smooks._filter(Smooks.java:548) [milyn-smooks-all-1.5.1.jar:]
  at org.milyn.Smooks.filterSource(Smooks.java:482) [milyn-smooks-all-1.5.1.jar:]
  at be.client.pushmrostatus.service.PushMROTransformer.applySmooks(PushMROTransformer.java:87) [PushMroStatus.jar:]
  at be.client.pushmrostatus.service.PushMROTransformer.transformPushMroReq(PushMROTransformer.java:48) [PushMroStatus.jar:]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09-icedtea]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
  at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
  at org.switchyard.transform.internal.TransformerUtil$1.transform(TransformerUtil.java:238) [switchyard-transform-1.1.1-p5-redhat-1.jar:1.1.1-p5-redhat-1]
  at org.switchyard.transform.TransformSequence.apply(TransformSequence.java:124) [switchyard-api-1.1.1-p5-redhat-1.jar:1.1.1-p5-redhat-1]
  at org.switchyard.transform.TransformSequence.applySequence(TransformSequence.java:206) [switchyard-api-1.1.1-p5-redhat-1.jar:1.1.1-p5-redhat-1]
  at org.switchyard.handlers.TransformHandler.handleMessage(TransformHandler.java:95) [switchyard-runtime-1.1.1-p5-redhat-1.jar:1.1.1-p5-redhat-1]
  at org.switchyard.bus.camel.processors.HandlerProcessor.process(HandlerProcessor.java:62) [switchyard-bus-camel-1.1.1-p5-redhat-1.jar:1.1.1-p5-redhat-1]
  at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.switchyard.bus.camel.audit.FaultProcessor.process(FaultProcessor.java:46) [switchyard-bus-camel-1.1.1-p5-redhat-1.jar:1.1.1-p5-redhat-1]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:81) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
  at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]
Caused by: java.util.ConcurrentModificationException
  at java.util.HashMap$HashIterator.nextEntry(HashMap.java:894) [rt.jar:1.7.0_09-icedtea]
  at java.util.HashMap$KeyIterator.next(HashMap.java:928) [rt.jar:1.7.0_09-icedtea]
  at org.milyn.javabean.context.StandaloneBeanContextFactory.createBeanMap(StandaloneBeanContextFactory.java:82) [milyn-smooks-all-1.5.1.jar:]
  at org.milyn.javabean.context.StandaloneBeanContextFactory.create(StandaloneBeanContextFactory.java:35) [milyn-smooks-all-1.5.1.jar:]
  at org.milyn.container.standalone.StandaloneExecutionContext.getBeanContext(StandaloneExecutionContext.java:204) [milyn-smooks-all-1.5.1.jar:]
  at org.milyn.Smooks._filter(Smooks.java:517) [milyn-smooks-all-1.5.1.jar:]
  ...
148 more

 

 

I am using Smooks 1.5.1 shipped with Redhat Fuse Service Works 6.0

 

A code snippet:

package be.client.pushmrostatus.service;

 

import java.io.ByteArrayInputStream;

import java.io.IOException;

 

import javax.xml.transform.Result;

import javax.xml.transform.stream.StreamSource;

 

import org.milyn.Smooks;

import org.milyn.container.ExecutionContext;

import org.milyn.payload.JavaResult;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.switchyard.annotations.Transformer;

import org.xml.sax.SAXException;

 

import be.client.pushmrostatus.bo.PushMROStatusRequest;

 

public final class PushMROTransformer {

 

    private static final Logger LOGGER = LoggerFactory.getLogger(PushMROTransformer.class);

 

    private JavaResult javaResult;

 

    private static final Smooks SMOOKS;

 

    private final MandatoryValidations mandatoryValidation = new MandatoryValidations();

 

    static {

        try {

            SMOOKS = new Smooks("/smooks/PushMROStatusRequestBO.xml");

        } catch (IOException e) {

            throw new RuntimeException("Error in creating Smooks", e);

        } catch (SAXException e) {

            throw new RuntimeException("Error in creating Smooks", e);

        }

    }

 

    @Transformer(from = "{http://www.client.be/PushMROStatus/}PushMROStatusRequest")

    public PushMROStatusRequest transformPushMroReq(final String request) {

 

        PushMROStatusRequest pushMROStatusBo = new PushMROStatusRequest();

 

        boolean mandatoryFieldCheck;

        try {

            mandatoryFieldCheck = mandatoryValidation.checkRequiredFields(request, "/xsd/PushMro.xsd");

            if (mandatoryFieldCheck) {

                javaResult = applySmooks(request);

                pushMROStatusBo = (PushMROStatusRequest) javaResult.getBean("PushMROStatusRequest");

                LOGGER.debug("PUSH MRO EAN:" + pushMROStatusBo.getMro().getActivityList().get(0).getEan());

                LOGGER.debug("pushMROStatusBo : " + pushMROStatusBo);

                pushMROStatusBo.setValidationCode(true);

            } else {

                pushMROStatusBo.setValidationCode(false);

            }

 

        } catch (Exception e) {

            LOGGER.error("Exception ==> PushMROTransformer : transformPushMroReq");

        }

        return pushMROStatusBo;

    }

 

    @Transformer(to = "{http://www.client.be/PushMROStatus/}PushMROStatusResponse")

    public String transformPushMroRes(final String response) {

 

        LOGGER.debug("Inside Update Response Transormer" + response);

        return "<cap:PushMROStatusResponse xmlns:cap=\"http://www.client.be/MROStatus/\">"

            + "<responseCode>" + response + "</responseCode>" + "</cap:PushMROStatusResponse>";

    }

 

    @Transformer(to = "{http://www.client.be/MF876/SPI896}MT_PushMROStatus")

    public String transformSOAPReq(final String response) {

 

        LOGGER.debug("Inside outbound Transformer" + response);

        return response;

    }

 

    public JavaResult applySmooks(final String request) {

 

        ExecutionContext executionContext = null;

 

        try {

 

            javaResult = new JavaResult();

            executionContext = SMOOKS.createExecutionContext();

            LOGGER.debug("inside applysmooks");

            SMOOKS.filterSource(executionContext,

                new StreamSource(new ByteArrayInputStream(request.getBytes("utf-8"))), new Result[] {javaResult});

            LOGGER.debug("after actualt transformation");

            LOGGER.debug("javaResult : " + javaResult.getResultMap());

        } catch (Exception e) {

            LOGGER.error("PushMROTransformer : applySmooks", e);

        }

        return javaResult;

    }

}

 

 

Or could this be a bug and should I log a bug?

 

 

If I need to provide more info, please let me know.

 

 

Thanks

 

 

Best regards,

 

Jeroen

 

________________________________________

Jeroen Vandensteen

Accenture Advanced Technology & Architecture

Waterloolaan 16 Bd. de Waterloo, 1000 Brussels, Belgium

mobile: +32 497 147 225

email: [hidden email]

 

 




This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com