Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to following this tutorial https://sites.google.com/site/smooksorg/documentation/documentation-smooks-1-1-x/examples/example---edi-to-xml but I am getting in the following error:[^]

Failed to locate jar file for EDI Mapping Model URN 'org.milyn.edi.unedifact:d03b-mapping:1.7.1.0'.  Jar must be available on classpath.


This is my code snippet:


public class Main {

    protected static String runSmooksTransform() throws IOException, SAXException, SmooksException {

        // Configure Smooks using a Smooks config...
        //Smooks smooks = new Smooks("smooks-config.xml");

        // Or, configure Smooks programmatically...
        Smooks smooks = new Smooks();
        smooks.setReaderConfig(new UNEdifactReaderConfigurator("urn:org.milyn.edi.unedifact:d03b-mapping:1.7.1.0"));

        try {
            StringWriter writer = new StringWriter();
//I AM GETTING ERROR THIS LINE
            smooks.filterSource(new StreamSource(new FileInputStream("to-xml/apis.txt")), new StreamResult(writer));

            return writer.toString();
        } finally {
            smooks.close();
        }
    }

    public static void main(String[] args) throws IOException, SAXException, SmooksException {
        System.out.println("\n\n==============Message In==============");
        System.out.println(readInputMessage());
        System.out.println("======================================\n");

        String messageOut = Main.runSmooksTransform();

        System.out.println("==============Message Out=============");
        System.out.println(messageOut);
        System.out.println("======================================\n\n");
    }

    private static String readInputMessage() throws IOException {
        return StreamUtils.readStreamAsString(new FileInputStream("to-xml/apis.txt"));
    }
}


and this is my pom xml file:



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
="" xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelversion>4.0.0
<parent>
<groupid>org.milyn
<artifactid>unedifact-examples
<version>1.5-SNAPSHOT

<name>Milyn Smooks Example - UN/EDIFACT - To XML
<artifactid>milyn-smooks-example-unedifact-to-xml

<dependencies>
<dependency>
<groupid>org.milyn
<artifactid>milyn-smooks-edi
<version>1.7.1

<dependency>
<groupid>org.milyn.edi.unedifact
<artifactid>d03b-mapping
<version>1.7.1.0






What I have tried:

What exactly do am I? I don't know where I went wrong? I would be glad if you help.
Posted
Updated 2-Mar-23 8:24am
Comments
Richard MacCutchan 2-Mar-23 11:18am    
You need to do what the error message tells you and ensure the requested jar file is located in one of the directories named in your classpath. But you will probably get a more detailed answer by asking the person who wrote the tutorial.

1 solution

It seems you're missing a file, at least the code cannot find it in the directory paths listed in your CLASSPATH environment variable.

Why do you not have this file or why is it not installed in a locatable place? No idea. You're going to have to ask the people that wrote the library. Since it looks like the site hasn't been updated in years, good luck with getting support on it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900