I am getting an exception NoSuchMethodError when to convert a tag file to an RDF file by using the TagToRDF class by the convertTagFileToRdf function..
I am using the test file tools-java/testResources/SPDXTagExample-v2.2.spdx from the Github repo. Loading the tag example file works fine and logging the annotations from the file by using the SpdxElement and Annotation classes. The exception is thrown when converting the tag file to RDF, when the function sets behavior by creating a new BuildDocument class. None of the input parameters are null.
Exception
org.spdx.tag.BuildDocument.<init>([Lorg/spdx/rdfparser/SpdxDocumentContainer;Ljava/util/Properties;Ljava/util/List;)V
java.lang.NoSuchMethodError
at org.clearbyte.persistance.test.SpdxManagerTest.spdxTagFileToRDFTest(SpdxManagerTest.java:61)
TagToRdf class
public static SpdxDocumentContainer convertTagFileToRdf(InputStream spdxTagFile, String outputFormat, List<String> warnings) throws RecognitionException, TokenStreamException,InvalidSpdxTagFileException,InvalidFileFormatException, Exception {
…
HandBuiltParser parser = new HandBuiltParser(nci);
SpdxDocumentContainer[] result = new SpdxDocumentContainer[1];
parser.setBehavior(new BuildDocument(result, constants, warnings));
parser.data();
My code
public void convertSpdxTagFileToTurtleRdf(InputStream spdxTagFile, OutputStream outputTurtleRdf) {
List<String> warnings = new ArrayList<>();
try {
TagToRDF.convertTagFileToRdf(spdxTagFile, outputTurtleRdf, "TURTLE", warnings);
} catch (Exception ex) {
warnings.stream().forEach(x -> log.debug(x));
log.debug(ex.getLocalizedMessage());
}
}
Included libs
<dependency>
<groupId>org.spdx</groupId>
<artifactId>java-spdx-library</artifactId>
<version>1.0.10</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-jackson-store</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-rdf-store</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-tagvalue-store</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-tools</artifactId>
<version>2.2.7</version>
</dependency>
I am including the spdx-tools-2.2.7.jar and using Java 11. I haven’t been able to try Java 8 since my project will only accept version 11 or higher. And I didn't find documentation for the intended java version for the /spdx/tools-java.
I am getting an exception
NoSuchMethodErrorwhen to convert a tag file to an RDF file by using theTagToRDFclass by theconvertTagFileToRdffunction..I am using the test file tools-java/testResources/SPDXTagExample-v2.2.spdx from the Github repo. Loading the tag example file works fine and logging the annotations from the file by using the
SpdxElementandAnnotationclasses. The exception is thrown when converting the tag file to RDF, when the function sets behavior by creating a new BuildDocument class. None of the input parameters are null.Exception
TagToRdf class
My code
Included libs
I am including the spdx-tools-2.2.7.jar and using Java 11. I haven’t been able to try Java 8 since my project will only accept version 11 or higher. And I didn't find documentation for the intended java version for the /spdx/tools-java.