On 23/05/18 16:19, Bart van Leeuwen wrote:
code:
with apache-jena-libs in pom
Finding only one init is a symptom repacked jars that have not the right
ServiceLoader files.
It looks like classpath has a repacked set of jena jars on it or a jar
with jena inside it, as well as those from apache-jena-libs. The
repacking did not merge the ServiceLoader files.
If it not a case of unjar, copy into one place and rejar.
http://jena.apache.org/documentation/notes/jena-repack.html
What to look for:
in any jars
META-INF/services/org.apache.jena.sys.JenaSubsystemLifecycle
it should have multiple lines in it if it has multiple Jena jars
combined in it (example from the Fuseki server jar):
org.apache.jena.tdb.sys.InitTDB
org.apache.jena.riot.system.InitRIOT
org.apache.jena.sparql.system.InitARQ
org.apache.jena.sys.InitJenaCore
org.apache.jena.tdb2.sys.InitTDB2
org.apache.jena.query.text.InitJenaText
org.apache.jena.query.spatial.InitJenaSpatial
Andy
##############
public static void main(String... args) {
JenaSystem.DEBUG_INIT = true;
String update = "INSERT DATA {}";
UpdateFactory.create(update);
System.out.println("DONE");
}
###############
This is what I get
##############
JenaSystem.init - start
Found:
InitTDB [40]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinderfor further
details.
Initialization sequence:
JenaInitLevel0 [0]
InitTDB [40]
Init: JenaInitLevel0
Init: InitTDB
TDB.init - start
Exception in thread "main" java.lang.ExceptionInInitializerError
at
org.apache.jena.rdf.model.impl.ResourceImpl.fresh(ResourceImpl.java:135)
at
org.apache.jena.rdf.model.impl.ResourceImpl.<init>(ResourceImpl.java:85)
at
org.apache.jena.rdf.model.ResourceFactory$Impl.createResource(ResourceFactory.java:297)
at
org.apache.jena.rdf.model.ResourceFactory.createResource(ResourceFactory.java:92)
at org.apache.jena.vocabulary.RDFS.resource(RDFS.java:35)
at org.apache.jena.vocabulary.RDFS$Init.Class(RDFS.java:68)
at org.apache.jena.vocabulary.RDFS.<clinit>(RDFS.java:40)
at
org.apache.jena.shared.PrefixMapping.<clinit>(PrefixMapping.java:219)
at org.apache.jena.sparql.core.Prologue.<init>(Prologue.java:38)
at
org.apache.jena.update.UpdateRequest.<init>(UpdateRequest.java:46)
at
org.apache.jena.update.UpdateFactory.create(UpdateFactory.java:77)
at
org.apache.jena.update.UpdateFactory.create(UpdateFactory.java:56)
at
org.apache.jena.update.UpdateFactory.create(UpdateFactory.java:46)
at com.example.netage.App.main(App.java:19)
Caused by: java.lang.NullPointerException
at
org.apache.jena.tdb.sys.EnvTDB.processGlobalSystemProperties(EnvTDB.java:33)
at org.apache.jena.tdb.TDB.init(TDB.java:252)
at org.apache.jena.tdb.sys.InitTDB.start(InitTDB.java:29)
at
org.apache.jena.system.JenaSystem.lambda$init$2(JenaSystem.java:119)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:194)
at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:171)
at org.apache.jena.system.JenaSystem.init(JenaSystem.java:117)
at org.apache.jena.graph.NodeFactory.<clinit>(NodeFactory.java:32)
... 14 more
#####################3
Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen
twitter: @semanticfire
tel. +31(0)6-53182997
Netage B.V.
http://netage.nl <http://netage.nl/>
Esdoornstraat 3
3461ER Linschoten
The Netherlands
From: Andy Seaborne <[email protected]>
To: [email protected]
Date: 23-05-2018 17:05
Subject: Re: Update Query Parsing error
------------------------------------------------------------------------
On 23/05/18 12:40, Bart van Leeuwen wrote:
> I mean this:
>
> #####
>
> public static void main(String[] args) throws Exception {
> JenaSystem.DEBUG_INIT = true;
> JenaSystem.init();
> ARQ.getContext().isTrue(ARQ.constantBNodeLabels) ;
>
> ####
>
> which crashes at the ARQ line.
And no output? DEBUG_INIT causes init() to print all details of startup.
The first thing the code does is print "JenaSystem.init - start" even
before it's got to looking for components to initialize.
See my other code experiment which is Jena-only code - no 3rd party code.
Can you share the POM?
Andy
>
>
> Met Vriendelijke Groet / With Kind Regards
> Bart van Leeuwen
>
>
> twitter: @semanticfire
> tel. +31(0)6-53182997
> Netage B.V.
> http://netage.nl <http://netage.nl/><http://netage.nl/>
> Esdoornstraat 3
> 3461ER Linschoten
> The Netherlands
>
>
>
>
> From: Andy Seaborne <[email protected]>
> To: [email protected]
> Date: 23-05-2018 13:39
> Subject: Re: Update Query Parsing error
> ------------------------------------------------------------------------
>
>
>
>
>
> On 23/05/18 12:15, Bart van Leeuwen wrote:
> > I just tried your little addition and indeed it crashes before the
> update.
> > So what's next ?
>
> To be clear here - you mean this:
>
> public static void main(String[] args) throws Exception {
> JenaSystem.DEBUG_INIT = true;
> JenaSystem.init();
> ARQ.getContext().isTrue(ARQ.constantBNodeLabels) ;
>
> not the complete "main" below.
>
> What got printed by DEBUG_INIT?
>
> Andy
>
> >
> > Met Vriendelijke Groet / With Kind Regards
> > Bart van Leeuwen
> >
> >
> > twitter: @semanticfire
> > tel. +31(0)6-53182997
> > Netage B.V.
> > http://netage.nl
<http://netage.nl/><http://netage.nl/><http://netage.nl/>
> > Esdoornstraat 3
> > 3461ER Linschoten
> > The Netherlands
> >
> >
> >
> >
> > From: Andy Seaborne <[email protected]>
> > To: [email protected]
> > Date: 23-05-2018 13:11
> > Subject: Re: Update Query Parsing error
> >
------------------------------------------------------------------------
> >
> >
> >
> > This code has the same Jena sequence without the StarDog code:
> >
> > The stacktrace indicates an exception before parsing even starts
so the
> > update itself is not a factro.
> >
> > public static void main(String... args) {
> > JenaSystem.DEBUG_INIT = true;
> > String update = "INSERT DATA {}";
> > UpdateFactory.create(update);
> > System.out.println("DONE");
> > }
> >
> > This works for me with a maven dependency on
> > org.apache.jena:apache-jena-libs:pom:3.7.0
> >
> > Andy
> >
> >
>
>