On 02/11/16 03:10, [email protected] 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. "

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.

In building your application,  what does this do:

<?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


-----Original Message-----
From: Andy Seaborne [mailto:[email protected]]
Sent: Tuesday, November 01, 2016 12:10 PM
To: [email protected]
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror



On 01/11/16 14:54, [email protected] wrote:
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




-----Original Message-----
From: Andy Seaborne [mailto:[email protected]]
Sent: Tuesday, November 01, 2016 5:49 AM
To: [email protected]
Subject: Re: JDBC in Teiid/JBoss NodeValue / ClassNotFounderror


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


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

Reply via email to