This discussion is archived
5 Replies Latest reply: Sep 7, 2012 9:26 AM by alwu RSS

Issue opening Oracle model through Tomcat

957861 Newbie
Currently Being Moderated
Hello,

We have an application running in Tomcat 7.0 using the Oracle Jena adapter for 11.2.0.3 and Jena 2.6.4. I am experiencing an issue opening an existing Oracle model. The issue appears to be when I try to copy the data to an in-memory model, Jena is throwing a NPE:

Caused by: java.lang.NullPointerException: null
at com.hp.hpl.jena.graph.Triple.hashCode(Triple.java:150) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.graph.TripleCache.get(TripleCache.java:66) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.graph.Triple.create(Triple.java:160) ~[jena-2.6.4.jar:na]
at oracle.spatial.rdf.client.jena.OracleBatchTripleIterator.processNodes(OracleBatchTripleIterator.java:85) ~[sdordfclient-11.2.0.3.0.jar:na]
at oracle.spatial.rdf.client.jena.OracleBatchSemIterator.next(OracleBatchSemIterator.java:233) ~[sdordfclient-11.2.0.3.0.jar:na]
at com.hp.hpl.jena.util.iterator.NiceIterator$1.next(NiceIterator.java:99) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.util.IteratorCollection.iteratorToList(IteratorCollection.java:52) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler.addIterator(SimpleBulkUpdateHandler.java:57) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler.add(SimpleBulkUpdateHandler.java:67) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.rdf.model.impl.ModelCom.add(ModelCom.java:170) ~[jena-2.6.4.jar:na]
at com.hp.hpl.jena.rdf.model.impl.ModelCom.add(ModelCom.java:167) ~[jena-2.6.4.jar:na]

I am able to use the same code running in a simple Java app just fine, but when included in the Tomcat war, the same code fails. Here is the sample of the loading code:

oConn = new Oracle(url, username, password);
ModelOracleSem oModel = ModelOracleSem.createInstance(oConn, getModelName());

I've tried this two different ways; adding the connected model to an in-memory simple Jena Model, and also to TDB-backed dataset, and they both throw this exception at that point. Nothing gets thrown by the ModelOracleSem call.

Any help you can provide would be appreciated.

Adam
  • 1. Re: Issue opening Oracle model through Tomcat
    alwu Pro
    Currently Being Moderated
    Hi Adam,

    This is a bit odd. Please send a reproducible test case.

    Do you use the same JDBC driver?

    Thanks,

    Zhe Wu
  • 2. Re: Issue opening Oracle model through Tomcat
    957861 Newbie
    Currently Being Moderated
    I have a little more information about this, but no solution yet; and, unfortunately, no reproducible test case that I can give you (yet). I attempted to put together a small example that would illustrate the problem, but was unsuccessful. I put together the simplest web app I could that opened an Oracle model, but unlike our full-fledged app, the test worked correctly, eliminating Tomcat by itself as the culprit.

    I has since started trying to remove as much complexity I can little by little from the code in our webapp, and I am still seeing the issue. This leads me to believe that there is something about the way our WAR is packaged that is causing the problem, especially given that the attempt to open the model fails both when run as a REST request, as well as when run via a Quartz job (both in the same WAR with the same error).

    All of the dependencies are the same, including the JDBC driver. Here are the versions of everything (relevant) we're using:

    Oracle - 11.1.0.7.0
    OJDBC6 - 11.1.0.7.0
    Jena - 2.6.4
    ARQ - 2.8.8
    TDB - 0.8.10
    Jena Oracle Adapter - 11.2.0.3.0
    Tomcat - 7.0

    I realize we have a mismatch between the Jena Adapter and the version of Oracle we're on, but since it works outside of Tomcat I don't suspect this is the problem. We're currently in the infancy of trying to upgrade our Oracle instances, but it could be quite some time before we complete that.

    I'm going to continue to try and eliminate variables to see if I can figure out what about our WAR is causing the problem, but I wanted to post an update in case there was any advice you can provide.
  • 3. Re: Issue opening Oracle model through Tomcat
    alwu Pro
    Currently Being Moderated
    Hi,

    Thanks for the update! I think it is a good idea to upgrade to 11.2.0.3. After all, that is what Jena Adapter for 11.2.0.3 was certified against.

    Zhe Wu
  • 4. Re: Issue opening Oracle model through Tomcat
    957861 Newbie
    Currently Being Moderated
    I managed to solve this. We had another module in our WAR including a dependency on a 10g Oracle driver. Removing the stray dependency fixed the issue.
  • 5. Re: Issue opening Oracle model through Tomcat
    alwu Pro
    Currently Being Moderated
    Cool.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points