3

I am new here. I would like to get some help. I searched but coudl not find an explanation whz I am getting this error:

Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules slf4j.log4j12 and log4j export package org.apache.log4j to module org.apache.jena.base

I want to read the rdf file and this I do in a method within a javafx controller.

The contriller is ....

import java.io.File;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.util.FileManager;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
import javafx.stage.FileChooser.ExtensionFilter;
import javafx.stage.Stage;
....
    @FXML
    private void actionOpenButton(ActionEvent event)
    {
        FileChooser filechooser = new FileChooser();
        filechooser.getExtensionFilters().addAll(new ExtensionFilter("RDF files", "*.rdf"));
        File selectedFile = filechooser.showOpenDialog(null);
        if (selectedFile != null) {
            System.out.println(selectedFile);
            Model model = FileManager.get().loadModel(selectedFile.toString());
            model.write(System.out,"TURTLE");

        } else {
            System.out.println("File is not OK");
        }
    }

in the module-info file I have

    exports application;
    opens application;

    requires javafx.base;
    requires javafx.fxml;
    requires javafx.graphics;
    requires javafx.controls;
    requires javafx.media;
    requires javafx.swing;
    requires javafx.web;
    requires org.apache.jena.core;
    requires org.apache.jena.arq;

All is working well with the GUI. Only when I add the line to read the rdf I get the error I reported. I am doing this in Eclipse and Apache Jena library is added to the project.

Thanks in advance.

Chavi
  • 31
  • 1
  • 4
  • Are you using a build tool such as Maven or Gradle? If so, please post your `pom.xml` or `build.gradle` – Jacob G. Oct 23 '19 at 18:38
  • Perhaps a duplicate of: [Modules A and B export package some.package to module C in Java 9](https://stackoverflow.com/questions/46277188/modules-a-and-b-export-package-some-package-to-module-c-in-java-9) – jewelsea Oct 23 '19 at 23:02
  • No I didn't use Maven, but planned to try if by using Maven the problem will go away. – Chavi Oct 24 '19 at 06:25
  • Dear Jewelsea, I was looking into that, but I got confused as these are not my modules, but Apache Jena library so I thought that the proper linkage is already ensured. So I do not know... – Chavi Oct 24 '19 at 06:29

0 Answers0