Discussion:
JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
o***@wellsfargo.com
2016-10-31 06:24:10 UTC
Permalink
Hi - I'm trying to use the JDBC driver with Teiid in a JBoss environment.

I have a query that will execute fine (redacted)

prefix example: <http://semanticweb.com/entity#>
select DISTINCT *
{?a example:hasName ?b . } LIMIT 100

But when I add a filter as below, it breaks with java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue

prefix example: <http://semanticweb.com/entity#>
select DISTINCT *
{?a example:hasName ?b . FILTER regex(?b, "value", "i") } LIMIT 100

It's interesting how I can make queries without a FILTER clause, it doesn't seem to be syntax, but I could be mistaken?

Caused by: java.sql.SQLException: Not a valid SPARQL query/update
at org.apache.jena.jdbc.statements.JenaStatement.execute(JenaStatement.java:273)
at org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:182)
at org.teiid.translator.jdbc.JDBCDirectQueryExecution.execute(JDBCDirectQueryExecution.java:83)
... 17 more
Caused by: org.apache.jena.query.QueryParseException: Could not initialize class org.apache.jena.sparql.expr.NodeValue
at org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:118)
at org.apache.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:52)
at org.apache.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:34)
at org.apache.jena.query.QueryFactory.parse(QueryFactory.java:147)
at org.apache.jena.query.QueryFactory.create(QueryFactory.java:79)
at org.apache.jena.query.QueryFactory.create(QueryFactory.java:52)
at org.apache.jena.query.QueryFactory.create(QueryFactory.java:40)
at org.apache.jena.jdbc.statements.JenaStatement.execute(JenaStatement.java:266)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue
at org.apache.jena.sparql.util.ExprUtils.nodeToExpr(ExprUtils.java:56)
at org.apache.jena.sparql.lang.ParserBase.asExpr(ParserBase.java:410)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.PrimaryExpression(SPARQLParser11.java:3865)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.UnaryExpression(SPARQLParser11.java:3772)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.MultiplicativeExpression(SPARQLParser11.java:3639)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.AdditiveExpression(SPARQLParser11.java:3537)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.NumericExpression(SPARQLParser11.java:3530)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.RelationalExpression(SPARQLParser11.java:3490)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.ValueLogical(SPARQLParser11.java:3455)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.ConditionalAndExpression(SPARQLParser11.java:3434)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.ConditionalOrExpression(SPARQLParser11.java:3413)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Expression(SPARQLParser11.java:3406)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.BrackettedExpression(SPARQLParser11.java:3900)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Constraint(SPARQLParser11.java:2177)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Filter(SPARQLParser11.java:2168)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.GraphPatternNotTriples(SPARQLParser11.java:1856)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.GroupGraphPatternSub(SPARQLParser11.java:1738)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.GroupGraphPattern(SPARQLParser11.java:1675)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.WhereClause(SPARQLParser11.java:431)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.SelectQuery(SPARQLParser11.java:124)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Query(SPARQLParser11.java:29)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.QueryUnit(SPARQLParser11.java:20)
at org.apache.jena.sparql.lang.ParserSPARQL11$1.exec(ParserSPARQL11.java:48)
at org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:97)
... 26 more

My Teiid module.xml definition is below, maybe I'm missing a class ? Seems like I am from the message, but I couldn't find the class.

(I also did try the : jena-jdbc-driver-bundle-3.1.0.jar without the individual declares but same behavior)

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.jena">
<resources>
<resource-root path="jena-jdbc-core-3.1.0.jar"/>
<resource-root path="jena-jdbc-driver-remote-3.1.0.jar"/>
<resource-root path="jena-arq-3.1.0.jar"/>
<resource-root path="jena-core-3.1.0.jar"/>
<resource-root path="jena-base-3.1.0.jar"/>
<resource-root path="jena-cmds-3.1.0.jar"/>
<resource-root path="jena-shaded-guava-3.1.0.jar"/>
<resource-root path="log4j-1.2.17.jar"/>
<resource-root path="slf4j-api-1.7.20.jar"/>
<resource-root path="slf4j-log4j12-1.7.20.jar"/>
<resource-root path="xml-apis-1.4.01.jar"/>
<resource-root path="xercesImpl-2.11.0.jar"/>
<resource-root path="jena-iri-3.1.0.jar"/>
<resource-root path="httpcore-4.2.5.jar"/>
<resource-root path="httpclient-4.2.6.jar"/>
<resource-root path="httpclient-cache-4.2.6.jar"/>
<resource-root path="commons-io-2.4.jar"/>
<resource-root path="commons-cli-1.3.jar"/>
<resource-root path="commons-lang3-3.3.2.jar"/>
<resource-root path="commons-codec-1.9.jar"/>
<resource-root path="commons-csv-1.0.jar"/>
<resource-root path="collection-0.6.jar"/>
<resource-root path="jcl-over-slf4j-1.7.20.jar"/>
<resource-root path="jackson-annotations-2.3.0.jar"/>
<resource-root path="jackson-core-2.3.3.jar"/>
<resource-root path="jackson-databind-2.3.3.jar"/>
<resource-root path="libthrift-0.9.2.jar"/>
<resource-root path="jsonld-java-0.7.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Andy Seaborne
2016-10-31 11:08:07 UTC
Permalink
Post by o***@wellsfargo.com
Hi - I'm trying to use the JDBC driver with Teiid in a JBoss environment.
I have a query that will execute fine (redacted)
prefix example: <http://semanticweb.com/entity#>
select DISTINCT *
{?a example:hasName ?b . } LIMIT 100
But when I add a filter as below, it breaks with java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue
prefix example: <http://semanticweb.com/entity#>
select DISTINCT *
{?a example:hasName ?b . FILTER regex(?b, "value", "i") } LIMIT 100
It's interesting how I can make queries without a FILTER clause, it doesn't seem to be syntax, but I could be mistaken?
The problem is not the query. It's to do with system initialization ...
see below.
Post by o***@wellsfargo.com
Caused by: java.sql.SQLException: Not a valid SPARQL query/update
at org.apache.jena.jdbc.statements.JenaStatement.execute(JenaStatement.java:273)
at org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:182)
at org.teiid.translator.jdbc.JDBCDirectQueryExecution.execute(JDBCDirectQueryExecution.java:83)
... 17 more
Caused by: org.apache.jena.query.QueryParseException: Could not initialize class org.apache.jena.sparql.expr.NodeValue
at org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:118)
at org.apache.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:52)
at org.apache.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:34)
at org.apache.jena.query.QueryFactory.parse(QueryFactory.java:147)
at org.apache.jena.query.QueryFactory.create(QueryFactory.java:79)
at org.apache.jena.query.QueryFactory.create(QueryFactory.java:52)
at org.apache.jena.query.QueryFactory.create(QueryFactory.java:40)
at org.apache.jena.jdbc.statements.JenaStatement.execute(JenaStatement.java:266)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue
This indicates an initialization problem.
Post by o***@wellsfargo.com
at org.apache.jena.sparql.util.ExprUtils.nodeToExpr(ExprUtils.java:56)
at org.apache.jena.sparql.lang.ParserBase.asExpr(ParserBase.java:410)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.PrimaryExpression(SPARQLParser11.java:3865)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.UnaryExpression(SPARQLParser11.java:3772)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.MultiplicativeExpression(SPARQLParser11.java:3639)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.AdditiveExpression(SPARQLParser11.java:3537)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.NumericExpression(SPARQLParser11.java:3530)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.RelationalExpression(SPARQLParser11.java:3490)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.ValueLogical(SPARQLParser11.java:3455)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.ConditionalAndExpression(SPARQLParser11.java:3434)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.ConditionalOrExpression(SPARQLParser11.java:3413)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Expression(SPARQLParser11.java:3406)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.BrackettedExpression(SPARQLParser11.java:3900)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Constraint(SPARQLParser11.java:2177)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Filter(SPARQLParser11.java:2168)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.GraphPatternNotTriples(SPARQLParser11.java:1856)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.GroupGraphPatternSub(SPARQLParser11.java:1738)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.GroupGraphPattern(SPARQLParser11.java:1675)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.WhereClause(SPARQLParser11.java:431)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.SelectQuery(SPARQLParser11.java:124)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.Query(SPARQLParser11.java:29)
at org.apache.jena.sparql.lang.sparql_11.SPARQLParser11.QueryUnit(SPARQLParser11.java:20)
at org.apache.jena.sparql.lang.ParserSPARQL11$1.exec(ParserSPARQL11.java:48)
at org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:97)
... 26 more
My Teiid module.xml definition is below, maybe I'm missing a class ? Seems like I am from the message, but I couldn't find the class.
(I also did try the : jena-jdbc-driver-bundle-3.1.0.jar without the individual declares but same behavior)
(I have not used Teiid / JBoss)

Jena uses the Java platform ServiceLoader to initialize the various
components. Each component has a
META-INF/services/org.apache.jena.system.JenaSubsystemLifecycle
file. jena-core and jena-arq both have one and they are different.

If there is any repackaging of the bianries going on, then the
JenaSubsystemLifecycle files need to be combined.

For example, if using the maven-shade-plugin:

<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
/>

I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.

But I don't immediately see why using the jars directly does not work,
but that's due to my lack of knowledge about Teiid and JBoss.

Is there any repackaging going on?

Andy
Post by o***@wellsfargo.com
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.jena">
<resources>
<resource-root path="jena-jdbc-core-3.1.0.jar"/>
<resource-root path="jena-jdbc-driver-remote-3.1.0.jar"/>
<resource-root path="jena-arq-3.1.0.jar"/>
<resource-root path="jena-core-3.1.0.jar"/>
<resource-root path="jena-base-3.1.0.jar"/>
<resource-root path="jena-cmds-3.1.0.jar"/>
<resource-root path="jena-shaded-guava-3.1.0.jar"/>
<resource-root path="log4j-1.2.17.jar"/>
<resource-root path="slf4j-api-1.7.20.jar"/>
<resource-root path="slf4j-log4j12-1.7.20.jar"/>
<resource-root path="xml-apis-1.4.01.jar"/>
<resource-root path="xercesImpl-2.11.0.jar"/>
<resource-root path="jena-iri-3.1.0.jar"/>
<resource-root path="httpcore-4.2.5.jar"/>
<resource-root path="httpclient-4.2.6.jar"/>
<resource-root path="httpclient-cache-4.2.6.jar"/>
<resource-root path="commons-io-2.4.jar"/>
<resource-root path="commons-cli-1.3.jar"/>
<resource-root path="commons-lang3-3.3.2.jar"/>
<resource-root path="commons-codec-1.9.jar"/>
<resource-root path="commons-csv-1.0.jar"/>
<resource-root path="collection-0.6.jar"/>
<resource-root path="jcl-over-slf4j-1.7.20.jar"/>
<resource-root path="jackson-annotations-2.3.0.jar"/>
<resource-root path="jackson-core-2.3.3.jar"/>
<resource-root path="jackson-databind-2.3.3.jar"/>
<resource-root path="libthrift-0.9.2.jar"/>
<resource-root path="jsonld-java-0.7.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Andy Seaborne
2016-11-01 09:49:13 UTC
Permalink
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a
development with it in.

Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not work,
but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-01 14:54:40 UTC
Permalink
Thanks Andy!

Question - who is responsible for loading the JDBC driver, and how does one load it?

I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .

Can you look at the bottom of this thread for the question from Ramesh?

https://developer.jboss.org/thread/272656


-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 5:49 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.

Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not work,
but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Andy Seaborne
2016-11-01 16:09:58 UTC
Permalink
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of
expertise is limited. The initialization of Jena in shaded jars is
something that has come up before.

It looks like the problem is at the Jena initialization step, not the
loading the JDBC driver. That's supposed to be automatic and is - the
crash happens because the initialization is incomplete or is happening
in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling
it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver
to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not work,
but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-02 03:10:03 UTC
Permalink
Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Andy Seaborne
2016-11-02 09:45:00 UTC
Permalink
Post by o***@wellsfargo.com
"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "
Yes - that is what the jena-jdbc does in jena-jdbc-driver-remote and
also jena-jdbc-bundle-driver. The latter had a problem (JENA-1255) which
is fixed but you report it happening with jena-jdbc-driver-remote and a
list of jars.

If the jars are used as jars, no repacking then all the service files
will be present and, subject to classlaoder weirdness, it is the test
form in Jena development.

What is not clear from your messages is why when using the dependency
'jena-jdbc-driver-remote' directly, you get the same error.


jena-core, jena-arq have

META-INF/service/org.apache.jena.system.JenaSubsystemLifecycle

files

----------------------

Caused by: java.sql.SQLException: Not a valid SPARQL query/update
at
org.apache.jena.jdbc.statements.JenaStatement.execute(JenaStatement.java:273)

^^^^^^^^^^^^^^^^^^^^^^^^ Jena JDBC code is running so driver found
presumably.
at
org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:182)
at
org.teiid.translator.jdbc.JDBCDirectQueryExecution.execute(JDBCDirectQueryExecution.java:83)
... 17 more


Then there is an attempt to parse a query that fails because jena is
partially initialized. This is not the driver.

The question is why Jena is partially initialized.
Post by o***@wellsfargo.com
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.jena">
<resources>
<resource-root path="jena-jdbc-core-3.1.0.jar"/>
<resource-root path="jena-jdbc-driver-remote-3.1.0.jar"/>
<resource-root path="jena-arq-3.1.0.jar"/>
<resource-root path="jena-core-3.1.0.jar"/>
<resource-root path="jena-base-3.1.0.jar"/>
<resource-root path="jena-cmds-3.1.0.jar"/>
<resource-root path="jena-shaded-guava-3.1.0.jar"/>
does this get repacked into a combined jar or war file? I don't know
JBoss let alone Teiid.

If so, that step has to correctly combine services files for:

META-INF/services/org.apache.jena.system.JenaSubsystemLifecycle

and it should contain at least:

org.apache.jena.riot.system.InitRIOT
org.apache.jena.sparql.system.InitARQ
org.apache.jena.system.InitJenaCore

(order does not matter)



Or try the latest development jena-jdbc-bundle-driver snapshot build.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 12:10 PM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.
It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.
In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.
Hopefully RobV can give a better answer for the JDBC aspects.
There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.
Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Rob Vesse
2016-11-02 09:59:41 UTC
Permalink
They seem to be conflating two different things here

We do use and support Standard JDBC Driver initialisation. We also use the same underlying Java mechanism i.e. ServiceLoader to initialise Jena itself. Our JDBC driver initialisation invokes our Jena initialisation. So as far as we’re concerned we are not doing anything wrong:

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90

As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.

lists.apache.org provides a much more modern interface to our mailing lists

Rob

On 02/11/2016 03:10, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-02 13:19:18 UTC
Permalink
Rob/Andy - thanks!

I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver

I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
I still get:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue

I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..

Anything else I could try to troubleshoot this? I'm at a loss


-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 6:00 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

They seem to be conflating two different things here

We do use and support Standard JDBC Driver initialisation. We also use the same underlying Java mechanism i.e. ServiceLoader to initialise Jena itself. Our JDBC driver initialisation invokes our Jena initialisation. So as far as we’re concerned we are not doing anything wrong:

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90

As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.

lists.apache.org provides a much more modern interface to our mailing lists

Rob

On 02/11/2016 03:10, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Andy Seaborne
2016-11-02 13:42:11 UTC
Permalink
The FILTER requires value processing - which is NodeValue - otherwise
your query does not need it.

NodeValue calls "JenaSystem.init()" when the class is loaded so that
suggests that full initialization has not happened.

Try putting this code before doing anything related to jena including
touching a JDBC URL.

InitJenaCore.init();
RIOT.init();
ARQ.init();

This is not the right way to do initialization but it will work because
it is hardcoding what should happen.

Can you get more of the stacktraces? Where in NodeValue is there an
exception causing NoClassDefFoundError? (Java does not make this easy)

Andy
Post by o***@wellsfargo.com
Rob/Andy - thanks!
I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver
I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue
I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..
Anything else I could try to troubleshoot this? I'm at a loss
-----Original Message-----
Sent: Wednesday, November 02, 2016 6:00 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
They seem to be conflating two different things here
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90
As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.
lists.apache.org provides a much more modern interface to our mailing lists
Rob
"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "
-----Original Message-----
Sent: Tuesday, November 01, 2016 12:10 PM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.
It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.
In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.
Hopefully RobV can give a better answer for the JDBC aspects.
There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.
Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-02 13:53:50 UTC
Permalink
Andy thanks! I'm hoping Ramesh will be able to answer some of this

I’m not sure where I actually would make the code call for the below , because from what I'm seeing - there is only driver configuration and no place to insert code in Teiid, but I'm probably mistaken.
-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Wednesday, November 02, 2016 9:42 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

The FILTER requires value processing - which is NodeValue - otherwise your query does not need it.

NodeValue calls "JenaSystem.init()" when the class is loaded so that suggests that full initialization has not happened.

Try putting this code before doing anything related to jena including touching a JDBC URL.

InitJenaCore.init();
RIOT.init();
ARQ.init();

This is not the right way to do initialization but it will work because it is hardcoding what should happen.

Can you get more of the stacktraces? Where in NodeValue is there an exception causing NoClassDefFoundError? (Java does not make this easy)

Andy
Post by o***@wellsfargo.com
Rob/Andy - thanks!
I'm not sure if I made this clear ... My query does work fine as long
as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o
{?s ?p ?o} with no issues from the driver
I did just try the latest snapshot bundle jar, unfortunately... If I
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
org.apache.jena.sparql.expr.NodeValue
I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..
Anything else I could try to troubleshoot this? I'm at a loss
-----Original Message-----
Sent: Wednesday, November 02, 2016 6:00 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
They seem to be conflating two different things here
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-
remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.
java#L178
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-
tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-
mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90
As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.
lists.apache.org provides a much more modern interface to our mailing lists
Rob
"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "
-----Original Message-----
Sent: Tuesday, November 01, 2016 12:10 PM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.
It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.
In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.
Hopefully RobV can give a better answer for the JDBC aspects.
There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.
Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Rob Vesse
2016-11-02 15:15:48 UTC
Permalink
One possibility is that there is JAR/class caching going on. You may need to completely remove your application from JBoss and then redeploy it as the fact that you still see this behaviour implies that you still aren’t getting the correct services files from the JAR files. Restart of the container/JVM may also be necessary

Note that if you choose to use the individual driver JAR files then you would need to also add all the dependencies explicitly as that could also lead to missing classes and initialisations

Rob

On 02/11/2016 13:19, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Rob/Andy - thanks!

I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver

I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
I still get:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue

I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..

Anything else I could try to troubleshoot this? I'm at a loss


-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 6:00 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

They seem to be conflating two different things here

We do use and support Standard JDBC Driver initialisation. We also use the same underlying Java mechanism i.e. ServiceLoader to initialise Jena itself. Our JDBC driver initialisation invokes our Jena initialisation. So as far as we’re concerned we are not doing anything wrong:

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90

As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.

lists.apache.org provides a much more modern interface to our mailing lists

Rob

On 02/11/2016 03:10, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-02 16:15:52 UTC
Permalink
Rob - I restarted and tried much of the below , but same behavior - Ramesh has just responded with a question here at the bottom of the thread:

https://developer.jboss.org/thread/272656

-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 11:16 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

One possibility is that there is JAR/class caching going on. You may need to completely remove your application from JBoss and then redeploy it as the fact that you still see this behaviour implies that you still aren’t getting the correct services files from the JAR files. Restart of the container/JVM may also be necessary

Note that if you choose to use the individual driver JAR files then you would need to also add all the dependencies explicitly as that could also lead to missing classes and initialisations

Rob

On 02/11/2016 13:19, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Rob/Andy - thanks!

I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver

I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
I still get:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue

I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..

Anything else I could try to troubleshoot this? I'm at a loss


-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 6:00 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

They seem to be conflating two different things here

We do use and support Standard JDBC Driver initialisation. We also use the same underlying Java mechanism i.e. ServiceLoader to initialise Jena itself. Our JDBC driver initialisation invokes our Jena initialisation. So as far as we’re concerned we are not doing anything wrong:

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90

As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.

lists.apache.org provides a much more modern interface to our mailing lists

Rob

On 02/11/2016 03:10, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-04 01:16:22 UTC
Permalink
Rob/Andy - I added more to this thread, I was able to create a simple Java program and query a triplestore - to gain a better understanding of the JDBC driver outside of Teiid, could either of you take a look at the bottom of this thread and add some colour?
I'm not sure what guidance to give to Ramesh to help bridge the gap:

https://developer.jboss.org/thread/272656

I think this is an excellent opportunity to get an open-source data virtualization working with semantics and think there are some interesting possibilities for combining data in this manner.

I really appreciate you both helping out with this. I see it as a way to build views on to SPARQL and vice versa and believe it would help further with adoption within large organizations that have legacy RDBMSs ; I've already leveraged Teiid on the Ontop to perform federated queries from r2rml to create materialized RDF in a really easy way, and this flexibility would just pile on to that.

-----Original Message-----
From: ***@wellsfargo.com [mailto:***@wellsfargo.com]
Sent: Wednesday, November 02, 2016 12:16 PM
To: ***@jena.apache.org
Subject: RE: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

Rob - I restarted and tried much of the below , but same behavior - Ramesh has just responded with a question here at the bottom of the thread:

https://developer.jboss.org/thread/272656

-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 11:16 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

One possibility is that there is JAR/class caching going on. You may need to completely remove your application from JBoss and then redeploy it as the fact that you still see this behaviour implies that you still aren’t getting the correct services files from the JAR files. Restart of the container/JVM may also be necessary

Note that if you choose to use the individual driver JAR files then you would need to also add all the dependencies explicitly as that could also lead to missing classes and initialisations

Rob

On 02/11/2016 13:19, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Rob/Andy - thanks!

I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver

I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
I still get:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue

I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..

Anything else I could try to troubleshoot this? I'm at a loss


-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 6:00 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

They seem to be conflating two different things here

We do use and support Standard JDBC Driver initialisation. We also use the same underlying Java mechanism i.e. ServiceLoader to initialise Jena itself. Our JDBC driver initialisation invokes our Jena initialisation. So as far as we’re concerned we are not doing anything wrong:

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90

As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.

lists.apache.org provides a much more modern interface to our mailing lists

Rob

On 02/11/2016 03:10, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
o***@wellsfargo.com
2016-11-04 16:25:04 UTC
Permalink
Update.... Great news! The JDBC driver for Jena will work fine in Teiid!!!! (thanks again for your help, Rob/Andy)

Ramesh noticed something from my comment and I noticed something from his:

https://developer.jboss.org/message/965015?tstart=0#965015

Perhaps the Teiid team could include this in their next release so that it would support the JENA JDBC driver out of the box, would make it easier for others to take advantage of all of this great work.


-----Original Message-----
From: ***@wellsfargo.com [mailto:***@wellsfargo.com]
Sent: Thursday, November 03, 2016 9:16 PM
To: ***@jena.apache.org
Subject: RE: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

Rob/Andy - I added more to this thread, I was able to create a simple Java program and query a triplestore - to gain a better understanding of the JDBC driver outside of Teiid, could either of you take a look at the bottom of this thread and add some colour?
I'm not sure what guidance to give to Ramesh to help bridge the gap:

https://developer.jboss.org/thread/272656

I think this is an excellent opportunity to get an open-source data virtualization working with semantics and think there are some interesting possibilities for combining data in this manner.

I really appreciate you both helping out with this. I see it as a way to build views on to SPARQL and vice versa and believe it would help further with adoption within large organizations that have legacy RDBMSs ; I've already leveraged Teiid on the Ontop to perform federated queries from r2rml to create materialized RDF in a really easy way, and this flexibility would just pile on to that.

-----Original Message-----
From: ***@wellsfargo.com [mailto:***@wellsfargo.com]
Sent: Wednesday, November 02, 2016 12:16 PM
To: ***@jena.apache.org
Subject: RE: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

Rob - I restarted and tried much of the below , but same behavior - Ramesh has just responded with a question here at the bottom of the thread:

https://developer.jboss.org/thread/272656

-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 11:16 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

One possibility is that there is JAR/class caching going on. You may need to completely remove your application from JBoss and then redeploy it as the fact that you still see this behaviour implies that you still aren’t getting the correct services files from the JAR files. Restart of the container/JVM may also be necessary

Note that if you choose to use the individual driver JAR files then you would need to also add all the dependencies explicitly as that could also lead to missing classes and initialisations

Rob

On 02/11/2016 13:19, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Rob/Andy - thanks!

I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver

I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
I still get:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue

I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..

Anything else I could try to troubleshoot this? I'm at a loss


-----Original Message-----
From: Rob Vesse [mailto:***@dotnetrdf.org]
Sent: Wednesday, November 02, 2016 6:00 AM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror

They seem to be conflating two different things here

We do use and support Standard JDBC Driver initialisation. We also use the same underlying Java mechanism i.e. ServiceLoader to initialise Jena itself. Our JDBC driver initialisation invokes our Jena initialisation. So as far as we’re concerned we are not doing anything wrong:

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95

https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90

As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.

lists.apache.org provides a much more modern interface to our mailing lists

Rob

On 02/11/2016 03:10, "***@wellsfargo.com" <***@wellsfargo.com> wrote:

Hi Andy - further info from Ramesh ; thanks for your patience - he was having access accessing /reading MarkMail - so I'm relaying (original from bottom of https://developer.jboss.org/thread/272656) :

"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "

-----Original Message-----
From: Andy Seaborne [mailto:***@apache.org]
Sent: Tuesday, November 01, 2016 12:10 PM
To: ***@jena.apache.org
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.

It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.

In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.

Hopefully RobV can give a better answer for the JDBC aspects.

There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.

Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Andy Seaborne
2016-11-06 16:33:28 UTC
Permalink
Good!

Yes, Jena has a tight association with Xerces and has been in te past
quite version sensitive. Jena also has source code from Xerces as well.

Xerces is used not only for XML parsing but also for XSD datatype
handling so Jena calls into Xerces not just org.apache.xerces.parser.

It is tempting to shade a copy of Xerces to isolate it from system
provided parsers. Shading was around/reliable when we had recurring
problems when some JRE had it as an endorsed jar.

Andy
Post by o***@wellsfargo.com
Update.... Great news! The JDBC driver for Jena will work fine in Teiid!!!! (thanks again for your help, Rob/Andy)
https://developer.jboss.org/message/965015?tstart=0#965015
Perhaps the Teiid team could include this in their next release so that it would support the JENA JDBC driver out of the box, would make it easier for others to take advantage of all of this great work.
-----Original Message-----
Sent: Thursday, November 03, 2016 9:16 PM
Subject: RE: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Rob/Andy - I added more to this thread, I was able to create a simple Java program and query a triplestore - to gain a better understanding of the JDBC driver outside of Teiid, could either of you take a look at the bottom of this thread and add some colour?
https://developer.jboss.org/thread/272656
I think this is an excellent opportunity to get an open-source data virtualization working with semantics and think there are some interesting possibilities for combining data in this manner.
I really appreciate you both helping out with this. I see it as a way to build views on to SPARQL and vice versa and believe it would help further with adoption within large organizations that have legacy RDBMSs ; I've already leveraged Teiid on the Ontop to perform federated queries from r2rml to create materialized RDF in a really easy way, and this flexibility would just pile on to that.
-----Original Message-----
Sent: Wednesday, November 02, 2016 12:16 PM
Subject: RE: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
https://developer.jboss.org/thread/272656
-----Original Message-----
Sent: Wednesday, November 02, 2016 11:16 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
One possibility is that there is JAR/class caching going on. You may need to completely remove your application from JBoss and then redeploy it as the fact that you still see this behaviour implies that you still aren’t getting the correct services files from the JAR files. Restart of the container/JVM may also be necessary
Note that if you choose to use the individual driver JAR files then you would need to also add all the dependencies explicitly as that could also lead to missing classes and initialisations
Rob
Rob/Andy - thanks!
I'm not sure if I made this clear ... My query does work fine as long as I don't include "FILTER"; I'm able to get back a select ?s ?p ?o {?s ?p ?o} with no issues from the driver
I did just try the latest snapshot bundle jar, unfortunately... If I include FILTER regex(?var,"value")
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.sparql.expr.NodeValue
I don't believe Teiid is doing any repackaging, and I'm also confused if I include the individual jar files it won't work ..
Anything else I could try to troubleshoot this? I'm at a loss
-----Original Message-----
Sent: Wednesday, November 02, 2016 6:00 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
They seem to be conflating two different things here
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/RemoteEndpointDriver.java#L178
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-tdb/src/main/java/org/apache/jena/jdbc/tdb/TDBDriver.java#L95
https://github.com/apache/jena/blob/master/jena-jdbc/jena-jdbc-driver-mem/src/main/java/org/apache/jena/jdbc/mem/MemDriver.java#L90
As Andy has pointed out there was a bug in how the bundle JAR with all the drivers was being created which meant that Jena initialisation wasn’t happening properly because the composites services file for Jena initialisers wasn’t being created properly. If you use the latest 3.1.1-SNAPSHOT builds then this is resolved.
lists.apache.org provides a much more modern interface to our mailing lists
Rob
"Basically what they need to do, replace their ServiceLoader mechanism with standard JDBC4 ServiceLoader mechanism like
https://github.com/rareddy/teiid/tree/master/client/src/main/resources/META-INF/services
That will register their Driver class, and in their driver class possibly in a "static block" call ARQ.init() that will initialize every time one uses their JDBC driver. "
-----Original Message-----
Sent: Tuesday, November 01, 2016 12:10 PM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by o***@wellsfargo.com
Thanks Andy!
Question - who is responsible for loading the JDBC driver, and how does one load it?
I'm not clear on exact details on how to get it to work. I reached out to the Teiid team, and Ramesh has a question for you .
Can you look at the bottom of this thread for the question from Ramesh?
https://developer.jboss.org/thread/272656
Firstly - I didn't write and don't use jena-jdbc so my level of expertise is limited. The initialization of Jena in shaded jars is something that has come up before.
It looks like the problem is at the Jena initialization step, not the loading the JDBC driver. That's supposed to be automatic and is - the crash happens because the initialization is incomplete or is happening in the wrong order because the normal sequence isn't happening.
In yoru code, if you can, call ARQ.init() before anything else. Calling it repeatedly is safe and cheap.
Hopefully RobV can give a better answer for the JDBC aspects.
There is a services/java.sql.Driver - that should cause the JDBC driver to load. Standard way for Java.
Andy
Post by o***@wellsfargo.com
-----Original Message-----
Sent: Tuesday, November 01, 2016 5:49 AM
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror
Post by Andy Seaborne
I checked and the jena-jdbc-driver-bundle does not set up the
ServiceLoader services correctly. We'll fix that.
jena-jdbc-driver-bundle should be fixed (JENA-1255) now. There is a development with it in.
Andy
Post by Andy Seaborne
But I don't immediately see why using the jars directly does not
work, but that's due to my lack of knowledge about Teiid and JBoss.
Is there any repackaging going on?
Andy
Loading...