MySQL configuration for FUSEKI

I need to test a particular database solution against an old one that used fuseki+mysql as a triple store. Basically all I need to do is some query against a database, that i previously created, with SPARQL. The problem is that I don't seem to be able to configure fuseki to give me an endpoint of this database. I've created the database with normal standard java coding (JDBC without using Jena SDB Component). The version of mysql I'm using is:

mysql  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.3

Basically I've a ClassNotFoundException that i can't solve. Here the details of the exception:

    com.hp.hpl.jena.shared.JenaException: java.lang.ClassNotFoundException: net.rootdev.fusekisdbconnect.SDBConnect
    at com.hp.hpl.jena.assembler.AssemblerHelp.loadClassNamedBy(AssemblerHelp.java:145)
    at com.hp.hpl.jena.assembler.AssemblerHelp.loadArbitraryClass(AssemblerHelp.java:129)
    at com.hp.hpl.jena.assembler.AssemblerHelp.loadArbitraryClasses(AssemblerHelp.java:93)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.loadClasses(AssemblerGroup.java:86)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:79)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:52)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:48)
    at org.apache.jena.fuseki.server.FusekiConfig.processService(FusekiConfig.java:241)
    at org.apache.jena.fuseki.server.FusekiConfig.configure(FusekiConfig.java:149)
    at org.apache.jena.fuseki.FusekiCmd.exec(FusekiCmd.java:364)
    at arq.cmdline.CmdMain.mainMethod(CmdMain.java:97)
    at arq.cmdline.CmdMain.mainRun(CmdMain.java:59)
    at arq.cmdline.CmdMain.mainRun(CmdMain.java:46)
    at org.apache.jena.fuseki.FusekiCmd.main(FusekiCmd.java:101)
Caused by: java.lang.ClassNotFoundException: net.rootdev.fusekisdbconnect.SDBConnect
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at com.hp.hpl.jena.assembler.AssemblerHelp.loadClassNamedBy(AssemblerHelp.java:144)
    ... 13 more

The invocation of fuseki adds the libraries needed to the classpath (i stored them in a lib dir inside the fuseki main dir):

java -cp lib/arq-2.8.8.jar:lib/arq-2.8.9-SNAPSHOT.jar:lib/jena-iri-0.9.0-incubating.jar:lib/mysql-connector-java-5.1.19.jar:lib/ReconnectingSDB-0.1-SNAPSHOT.jar:lib/sdb-1.3.4.jar -jar fuseki-server.jar --config=fuseki-mysql.ttl

My configuration file:

    # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

@prefix :        <#> .
@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix jumble:  <http://rootdev.net/vocab/jumble#> .
@prefix sdb:     <http://jena.hpl.hp.com/2007/sdb#> .

[] rdf:type fuseki:Server ;
   # Timeout - server-wide default: milliseconds.
   # Format 1: "1000" -- 1 second timeout
   # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
   # See java doc for ARQ.queryTimeout
   ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "10000,60000" ] ;

   fuseki:services (
     <#service_MySQL_read_only>
   ) .

# SDB
[] ja:loadClass "net.rootdev.fusekisdbconnect.SDBConnect" .
jumble:SDBConnect rdfs:subClassOf ja:RDFDataset .

<#service_MySQL_read_only> rdf:type fuseki:Service ;
    rdfs:label                      "UF MySQL Service (R)" ;
    fuseki:name                     "MySQL" ;
    fuseki:serviceQuery             "query" ;
    fuseki:serviceQuery             "sparql" ;
    fuseki:serviceUpdate            "update" ;
    fuseki:serviceUpload            "upload" ;
    fuseki:serviceReadWriteGraphStore      "data" ;
    # A separate read-only graph store endpoint:
    fuseki:serviceReadGraphStore       "get" ;
    fuseki:dataset           <#ufmysql_dataset_read> ;
    #fuseki:dataset           <#MySQLStore> ;
        .
<#ufmysql_dataset_read> rdf:type      sdb:DatasetStore ;
    sdb:store <#MySQLStore>
    .
<#MySQLStore> rdf:type jumble:SDBConnect;
    rdfs:label                  "UF MySQL SDB Store";
    sdb:layout                  "layout2";
    sdb:connection
    [ rdf:type sdb:SDBConnection;
        sdb:sdbHost "localhost";
        sdb:sdbType "MySQL";
        sdb:sdbName "EA_db_test";
        sdb:sdbUser "*****";
        sdb:sdbPassword "*****";
        sdb:driver "com.mysql.jdbc.Driver";
    ]
        .

If i put instead of ja:loadClass "net.rootdev.fusekisdbconnect.SDBConnect" (that i think is a bit of an old one) ja:loadClass "com.hp.hpl.jena.sdb.SDB" I get the same exception but with SDB class

com.hp.hpl.jena.shared.JenaException: java.lang.ClassNotFoundException: com.hp.hpl.jena.sdb.SDB

The list of jar that I've inside the lib folder in fuseki is:

2247124 mag 12  2012 arq-2.8.8.jar
2259436 mag 12  2012 arq-2.8.9-SNAPSHOT.jar
154157 mag 12  2012 jena-iri-0.9.0-incubating.jar
801912 mag 12  2012 mysql-connector-java-5.1.19.jar
6657 mag 12  2012 ReconnectingSDB-0.1-SNAPSHOT.jar
529092 mag 12  2012 sdb-1.3.4.jar

My version of FUSEKI:

Jena:       VERSION: 2.7.1-incubating-SNAPSHOT
Jena:       BUILD_DATE: 20120426-0201
ARQ:        VERSION: 2.9.1-incubating-SNAPSHOT
ARQ:        BUILD_DATE: 20120430-1956
TDB:        VERSION: 0.9.1-incubating-SNAPSHOT
TDB:        BUILD_DATE: 20120430-2052
Fuseki:     VERSION: 0.2.2-incubating-SNAPSHOT
Fuseki:     BUILD_DATE: 20120501-1232

There's any particular combination of jar version I should use? Any pointer on where I can find the jar missing (if something is missing or if I need a different version). Or am I just wrong with the configuration file and I should use something different?

Thx for the help

Answers


  1. Don't mix versions of Jena jars - use a set of jars from a single distribution
  2. -cp and -jar don't work togther - the classpath setting will be ignored.

because of (2) net.rootdev.fusekisdbconnect.SDBConnect isn't coming from the jar.


it looks like it is pure classpath issue, has nothing to do with any other stuff you have. I found awesome link on classpaths. Main point there:

Its also worth noting that when you use the java -jar command line option to run your Java program as an executable JAR, then the CLASSPATH environment variable will be ignored, and also the -cp and -classpath switches will be ignored. In this case you can set your Java classpath in the META-INF/MANIFEST.MF file by using the Class-Path attribute. In short Class-path attribute in manifest file overrides classpath specified by -cp, -classpath or CLASSPATH environment variable.

Hope this helps.


Need Your Help

what is the meaning of $(this) in javascript

javascript jquery calendar

I have following code for Calendar Pop-Up which is working fine

Bootstrap Affix plugin with fluid layout

twitter-bootstrap fluid-layout

If I would like to use the affix plugin for sidebar in fluid layout but the width of the sidebar always change when it is affixed and the responsive design don't work too.