Hi Andy,

Hi Andy,

The full stack trace is below.

I also prepared a stand alone project to reproduce the problem [1,2].
In this example, while the problem is still there (ARQ context being null), the 
point is different (this time in SystemTDB.java:381);

Best,
Enrico

[1] https://github.com/enridaga/jena-system-in-jetty-debug/
[2] 
https://github.com/enridaga/jena-system-in-jetty-debug/blob/master/src/main/java/enridaga/jenainjetty/Application.java

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


Stack trace in the original application:

2016-04-13 10:48:34 INFO  Application:41 - Initializing context.
JenaSystem.init - start
  InitTDB
Init: JenaInitLevel0
Init: InitTDB
TDB.init - start
2016-04-13 10:48:35 INFO  ServerConnector:270 - Started 
ServerConnector@6356695f{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
Exception in thread "main" java.lang.ExceptionInInitializerError
        at 
dkarobo.server.webapp.Application.contextInitialized(Application.java:56)
        at 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:794)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:522)
        at 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:785)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:341)
        at 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1357)
        at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1350)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:734)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:258)
        at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:512)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:405)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:372)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at dkarobo.server.cli.Main.main(Main.java:45)
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$5/1615056168.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)
        at org.apache.jena.tdb.TDBFactory.<clinit>(TDBFactory.java:40)
        ... 18 more



> On 13 Apr 2016, at 10:04, Enrico Daga (enridaga) <[email protected]> wrote:
> 
> Thank you Andy,
> I’ll try that and let you know, eventually I will pack a thin maven project 
> trying to reproduce the issue.
> 
> Thanks a lot!
> 
> Enrico
> —
> Enrico Daga (enridaga)
> http://www.enridaga.net
> Il budda e’ nel parco.
> 
> 
> 
> 
> 
>> On 13 Apr 2016, at 09:59, Andy Seaborne <[email protected]> wrote:
>> 
>> On 13/04/16 09:56, Andy Seaborne wrote:
>>> 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
>> 
>> PS As the first line in Application.contextInitialized
>> 
>> try putting
>> 
>>     JenaSystem.DEBUG_INIT = true ;
>> 
>> and see what comes out.
>> 
>>      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