Git Product home page Git Product logo

org.smooks.cdr.SmooksConfigurationException: Unable to locate Smooks digest configuration '/META-INF/xsd/smooks/edi-2.0.xsd-smooks.xml' for extended resource configuration namespace 'https://www.smooks.org/xsd/smooks/edi-2.0.xsd'. This resource must be available on the classpath. at org.smooks.cdr.XMLConfigDigester.assertExtendedConfigOK(XMLConfigDigester.java:554) about smooks HOT 8 CLOSED

agnissh avatar agnissh commented on June 20, 2024
org.smooks.cdr.SmooksConfigurationException: Unable to locate Smooks digest configuration '/META-INF/xsd/smooks/edi-2.0.xsd-smooks.xml' for extended resource configuration namespace 'https://www.smooks.org/xsd/smooks/edi-2.0.xsd'. This resource must be available on the classpath. at org.smooks.cdr.XMLConfigDigester.assertExtendedConfigOK(XMLConfigDigester.java:554)

from smooks.

Comments (8)

cjmamo avatar cjmamo commented on June 20, 2024

Smooks should be initiated only once. Can you post the Java code which starts Smooks and filters the doc?

from smooks.

agnissh avatar agnissh commented on June 20, 2024

Hi @claudemamo ,

Thank you so much for the response.
We have a common function in Utility class for converting RAW EDI to XML.
The reason for calling convertToXML multiple is because the message content is different for FeedEntry.

public String convertToXml(String messageContent, String smookConfigPath) {
    byte[] messageIn = messageContent.getBytes();
    Locale defaultLocale = Locale.getDefault();
    Locale.setDefault(new Locale("en", "IE"));

    // Instantiate Smooks with the config...
    Smooks smooks = new Smooks(smookConfigPath);

    try {
        // Create an exec context - no profiles....
        ExecutionContext executionContext = smooks.createExecutionContext();
        StringResult result = new StringResult();
        smooks.filterSource(executionContext, new StreamSource(new ByteArrayInputStream(messageIn)), result);
        Locale.setDefault(defaultLocale);
        //smooks.close();
        return result.getResult();
    } catch (Exception Ex) {
        logger.error(Ex.printStackTrace())
        throw Ex;
    } finally {
        smooks.close();
    }
}

This above common function is called from a ServiceClass=>

List < CompletableFuture < String >> futures = evaluateXMLFeed.entrySet().parallelStream().map(eachRecord - > CompletableFuture.supplyAsync(
    () - > {
        try {
            String messageContent_PerKey = new String(evaluateXMLFeed.get(eachRecord.getKey()));
            //Call to ConvertXML
            String xmlText = utility.convertToXml(messageContent_PerKey, "/<ResourcesFolder>/smooks-config.xml");

            //Processing Logic Further
            
            return ("ProcessContent");

        } catch (Exception ex) {
            errorFiles.add(eachRecord.getKey());
            Thread.currentThread().interrupt();
            logger.error("Failed to process=>" + eachRecord.getKey() + ex.getMessage());
            return "Error";
        }


    }, executor)).collect(Collectors.toList());

from smooks.

cjmamo avatar cjmamo commented on June 20, 2024

It appears to be a defect. I'll follow it up but, in the meantime, can you use Smook profiles instead? It should even lead to better performance.

from smooks.

agnissh avatar agnissh commented on June 20, 2024

Thank you @claudemamo for the suggestion. We tried that actually our conversion logic remain the for a specific type of payload and does not vary depending on the content. Any suggestion on when this fix will be be available ?

from smooks.

cjmamo avatar cjmamo commented on June 20, 2024

I might be misunderstanding the problem. If your Smooks configuration remains the same across executions, then you should construct Smooks once outside the parallelStream block. Only the createExecutionContext and filterSource methods need to be inside the block.

from smooks.

agnissh avatar agnissh commented on June 20, 2024

Hi @claudemamo , thank you!! i followed your recommendation and that results in below error . For single threaded execution it works fine.

Caused by: org.xml.sax.SAXException: SAX2 driver class org.smooks.cartridges.dfdl.parser.DfdlParser not found
java.lang.ClassNotFoundException: org.smooks.cartridges.dfdl.parser.DfdlParser
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:221)
at org.smooks.delivery.AbstractParser.createXMLReader(AbstractParser.java:313)
at org.smooks.delivery.sax.SAXParser.parse(SAXParser.java:89)
at org.smooks.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:112)

from smooks.

cjmamo avatar cjmamo commented on June 20, 2024

Please post the updated Java code Agnish along with the configs. I will try to reproduce it locally.

from smooks.

cjmamo avatar cjmamo commented on June 20, 2024

Closing stale issue.

from smooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.