I tried to access Stardog from RDF4J.
In my mab=in i have the following line of code Stardog aStardog = Stardog.builder().create();
So, when I execute my maven project through mvn exec:java I get the following exception
[StardogTestDriver.main()] INFO c.c.common.LinuxDistribution - Determined Linux distribution from file '/etc/os-release': CentOS 7.0 (7)
15:41:36.313 [StardogTestDriver.main()] ERROR com.stardog.starrocks.StarrocksUtils - Unable to load native library(Starrocks-CentOS-7):
java.library.path = </opt/software/slurm/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib>
LD_LIBRARY_PATH = {/opt/software/slurm/lib}
java.lang.UnsatisfiedLinkError: no Starrocks-CentOS-7 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) ~[na:1.8.0_121]
at java.lang.Runtime.loadLibrary0(Runtime.java:870) ~[na:1.8.0_121]
at java.lang.System.loadLibrary(System.java:1122) ~[na:1.8.0_121]
at com.stardog.starrocks.StarrocksUtils.loadLibrary(StarrocksUtils.java:94) ~[stardog-7.3.0.jar:na]
at com.complexible.stardog.Stardog.<init>(Stardog.java:168) [stardog-7.3.0.jar:na]
at com.complexible.stardog.Stardog.<init>(Stardog.java:66) [stardog-7.3.0.jar:na]
at com.complexible.stardog.Stardog$StardogBuilder.create(Stardog.java:655) [stardog-7.3.0.jar:na]
at StardogTestDriver.main(StardogTestDriver.java:33) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) [exec-maven-plugin-1.2.1.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
15:41:36.315 [StardogTestDriver.main()] ERROR com.stardog.starrocks.StarrocksUtils - Unable to load native library(native library name =Starrocks-CentOS-7)
java.lang.UnsatisfiedLinkError: no Starrocks-CentOS-7 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) ~[na:1.8.0_121]
at java.lang.Runtime.loadLibrary0(Runtime.java:870) ~[na:1.8.0_121]
at java.lang.System.loadLibrary(System.java:1122) ~[na:1.8.0_121]
at com.stardog.starrocks.StarrocksUtils.loadLibrary(StarrocksUtils.java:94) ~[stardog-7.3.0.jar:na]
at com.complexible.stardog.Stardog.<init>(Stardog.java:168) [stardog-7.3.0.jar:na]
at com.complexible.stardog.Stardog.<init>(Stardog.java:66) [stardog-7.3.0.jar:na]
at com.complexible.stardog.Stardog$StardogBuilder.create(Stardog.java:655) [stardog-7.3.0.jar:na]
at StardogTestDriver.main(StardogTestDriver.java:33) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) [exec-maven-plugin-1.2.1.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsatisfiedLinkError: no Starrocks-CentOS-7 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.stardog.starrocks.StarrocksUtils.loadLibrary(StarrocksUtils.java:94)
at com.complexible.stardog.Stardog.<init>(Stardog.java:168)
at com.complexible.stardog.Stardog.<init>(Stardog.java:66)
at com.complexible.stardog.Stardog$StardogBuilder.create(Stardog.java:655)
at StardogTestDriver.main(StardogTestDriver.java:33)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.040 s
[INFO] Finished at: 2020-05-13T15:41:36-07:00
[INFO] Final Memory: 33M/1278M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project rdf4j-getting-started: An exception occured while executing the Java class. null: InvocationTargetException: no Starrocks-CentOS-7 in java.library.path -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
So, someone has an idea how to solve this issue please
I am going to assume you desire a new instance of Stardog within your Java code because that's what you're doing here. Stardog requires non-Java native code (DLLs) to run. You need to set the java.library.path variable to the lib/ directory of the distribution.
You can either set it at the command line when starting your Java process, eg. -Djava.library.path=/path/to/stardog/lib or in Java code System.setProperty("java.library.path", "/path/to/stardog/lib");.
Can you try passing the argument on the command line? It's possible that you are setting the system property too late in the process; after it has been used and cached.
You'll need to use either $STARDOG or $STARDOG_HOME depending on how exactly you've installed Stardog but just make it where you fine the lib directory.
I’m a little confused when you say you have a folder called STARDOG_HOME that might indicate a problem with your installation. Do you have a folder that is actually named STARDOG_HOME or do you have some folder who’s path is set to the environment variable STARDOG_HOME?
You should most likely change the environment variable in my previous examples from STARDOG to STARDOG_HOME.
stardog-admin server start --home /project/6008168/tamouze/STARDOG_HOME
and the startdog starts where i was asked to enter my email and that i have 60 days trial and now the
stardog-license-key.bin appears in
/project/6008168/tamouze/STARDOG_HOME
So, this is how i installed stardog where I can create throughthe command line a datbase and to query this database. The problem is only where I try to access this database through the code RDF4J
Your setup looks good. Try the options I previously mentioned but using the STARDOG_HOME variable instead as shown below. You can try the first one just to see if it works and then the second one so you don'e have to enter such a long command.
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project rdf4j-getting-started: An exception occured while executing the Java class. null: InvocationTargetException: no Starrocks-CentOS-7 in java.library.path -> [Help 1]
So, please you suggestion to solve that. /STARDOG_HOME/ lib does not exist. What I have in STARDOG_HOME is a folder called data, another one called myDB which i created from the command line, etc, but NO lib inside
Or if possible to explicitly specify how i can install without any problem.
By the way, the following documentation is not clear at least for me;
You should not set STARDOG_HOME to be the same as the directory where you put the Stardog binary. Our convention is to put Stardog in /opt/stardog/{$version} and set STARDOG_HOME to /var/stardog
can you please explain please
I so appreciate your help
I can see how it can be a little confusing. In the simplest setup you can simply unzip the Stardog distribution and set the STARDOG_HOME environment variable to the directory containing Stardog. (ie. stardog-x.x.x). With this setup your database files will be contained in the same directory as the stardog distribution. This makes for an easier setup but can cause some problems when upgrading because the files are mixed together. To overcome this you can separate the Stardog distribution from the database files (the files that contain your data) into two directories. The directory containing your database files is set to the env variable STARDOG_HOME. (ie STARDOG_HOME=/var/stardog) and you'd set the env variable STARDOG to the Stardog distribution (ie STARDOG=/opt/stardog/{$version})
If you set it up this way there should be a lib folder in your $STARDOG directory /opt/stardog/7.3.0/lib. This is the directory you'd set in java.library.path
Thank you so much but it doesnt work. I do exactly the same but the error still. I can see that startdog is starting but with maven the same exception still raised
Can you try the second option of updating the config in your pom.xml file? I suspect that the exec plugin may fork off a separate JVM and doesn't pass through the option.