I use jena version 3.14.0.

<dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>apache-jena-libs</artifactId>
            <type>pom</type>
            <version>3.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>jena-fuseki-main</artifactId>
            <version>3.14.0</version>
        </dependency>
________________________________
Från: Glenn Eriksson <[email protected]>
Skickat: den 30 mars 2020 14:49
Till: [email protected] <[email protected]>
Ämne: Embed Fuseki in Spring Boot (Jetty 9.4)

Hi, in my use-case use the Spring Boot container for handling repository 
connections (Spring Data),  RESTful web services et cetera. I also want to use 
a embedded Fuseki Servers to provide a SPARQL endpoint.

When The Fuseki Servers start it throws a exception saying that the 
address/port already in use.

java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:3330
java.net.BindException: Address already in use

My Spring bean fuseki service:

@Service
public class FusekiService {
...
public void initModel() {
        model = ModelFactory.createDefaultModel();
        InputStream in1 = FileManager.get().open(ARTIST_MODEL_FILE);
        model.read(in1, BASE_URL, "TURTLE");
        LOGGER.debug("Statements read from file: {}", model.size());
    }

    @PostConstruct
    public void initService() {
        initModel();
        Dataset dataset = DatasetFactory.createTxnMem();
        dataset.addNamedModel(BASE_URL, model);
        server = FusekiServer.create().add("/data", 
dataset).verbose(true).build();
        server.start();
        LOGGER.debug("Fuseki service started.");
    }

Questions:

  1.  Can I configure Fuseki to run inside a Spring container which already 
uses a Jetty 9.4. Or do I need to runt to separate Jetty instances. Please 
provide code pattern?
  2.  Where am I suppose to place the configure file (config.ttl). The static 
web files in Spring Boot is placed under main/resources/static?

Best regards.

Reply via email to