Hi Enrico,

I was hoping to see the rest of the stack trace to see where the first entry point that causes initialization in Jena is happening.

Do you have something I can build+run that is smaller? There are 4 maven modules there and 42 java files. There is an environmental factor here and I want to be runnign exactly what you are.

A POM file, and code that is minimal (just Application? Does that fail?) would be helpful.

Fuseki does:

public void contextInitialized(ServletContextEvent sce) {
        JenaSystem.init() ;


        Andy

On 12/04/16 18:44, Enrico Daga (enridaga) wrote:
Hi Andy, thank you for you reply. You’re right, I was hoping it was
not a class loading issue and I simplified the question :)

This happens within a ServletContextListener in a Jetty embedded
application [1]. In fact, I do not have any failure when I launch the
environment using mvn jetty:run, which I do during development. But
when I package the server, and I try to start it programmatically
[2], it fails as described in the previous email.

However, if I force JenaSystem.init() in any way (included static
blocks in Application or Main), it still fails! I understand the app
class loader is different from the main one, but this consideration
alone does not help me much…

Best, Enrico


[1]
https://github.com/enridaga/dka-robo/blob/master/server/src/main/java/dkarobo/server/webapp/Application.java


[2] https://github.com/enridaga/dka-robo/blob/master/server/src/main/java/dkarobo/server/cli/Main.java


— Enrico Daga (enridaga) http://www.enridaga.net Il budda e’ nel
parco.





On 12 Apr 2016, at 18:16, Andy Seaborne <[email protected]> wrote:

On 12/04/16 17:22, Enrico Daga (enridaga) wrote:
Hi,

I want to use a TDB instance programmatically inside my
application, but I am having troubles on TDB initialisation.
Particularly, when I try to TDBFactory.create(…) I get a
NullPointerException as follows:

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:250)
at org.apache.jena.tdb.sys.InitTDB.start(InitTDB.java:29) at
org.apache.jena.system.JenaSystem.lambda$init$40(JenaSystem.java:114)


at org.apache.jena.system.JenaSystem$$Lambda$4/661672156.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1249) at
org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:179) at
org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:156) at
org.apache.jena.system.JenaSystem.init(JenaSystem.java:111) […]

What's the rest? In particular, what's causing the initialization
process to start?


The strange thing is that it looks like ARQ.getContext() returns
null in EnvTDB.java:33, meaning it still needs to be initialised.
But then I see the call to JenaSystem.init() in a static block
inside the ARQ class, that is supposed to be at the bottom of the
above stack … Here I got confused.

I also tried to force JenaSystem.init(); in my main class, with
the same behaviour. I am using the following maven artefacts:

jena-tdb:3.0.1 jena-core:3.0.1 jena-arq:3.0.1

Maybe I am missing something?

Thank you for any hint!

Possibly an unexpected way in the system.  Thats' what can cause
ARQ.getContext() to be null - Java class initialization madness.

Do you have a complete, minimal example?


Enrico


— Enrico Daga (enridaga) http://www.enridaga.net Il budda e’ nel
parco.


Reply via email to