[ 
https://issues.apache.org/jira/browse/DRILL-2570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14381072#comment-14381072
 ] 

Daniel Barclay (Drill) commented on DRILL-2570:
-----------------------------------------------

Yes, it does seem to be a violation of Java's [service provider 
mechanism|http://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#Service_Provider]
 by Drill, because of a packaging inconsistency problem with the JDBC-all Jar 
file (e.g., drill-jdbc-all-0.8.0-SNAPSHOT.jar):

That Jar file contains a file at 
{{META-INF/services/javax.xml.parsers.SAXParserFactory}}, and that file says
"{{org.apache.xerces.jaxp.SAXParserFactoryImpl}}".

However, that Jar file does not contain the referenced class 
{{org.apache.xerces.jaxp.SAXParserFactoryImpl}} (does not contain file 
{{org/apache/xerces/jaxp/SAXParserFactoryImpl/class}}).

(Evidently:
- Java's {{javax.xml.parsers.SAXParserFactory.newInstance(...)}} uses Java's 
service provider mechanism for configuration, to know which implementation of 
{{SAXParserFactory}} to instantiate; 
- that mechanism finds Drill's  
{{META-INF/services/javax.xml.parsers.SAXParserFactory}} file; and
- either {{org.apache.xerces.jaxp.SAXParserFactoryImpl}} doesn't exist anywhere 
on the class path, or, more likely, the mechanism looks only in the same Jar 
file in which it found the {{.../services/...}} file and so doesn't find class 
{{org.apache.xerces.jaxp.SAXParserFactoryImpl}} because Drill doesn't include 
it in the Jar file.)

It seems that the tool and/or the configuration that Drill uses to repackage 
the contents of original depended-on Jar files into JDBC-all doesn't understand 
and/or isn't configured enough to keep SPM references and classes synchronized.


> Broken JDBC-All Jar packaging can cause missing XML classes
> -----------------------------------------------------------
>
>                 Key: DRILL-2570
>                 URL: https://issues.apache.org/jira/browse/DRILL-2570
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Daniel Barclay (Drill)
>         Attachments: ElementTraversal.rtf, xerces-error.rtf
>
>
> [Transcribed from other medium:]
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> - - - - - - - - - - - 
> When starting Spotfire Server using JDBC driver an error see attachment 
> (xerces-error) is produced.
> This error is then resolved by adding the jars/3rdparty/xercesImpl-2.11.0.jar 
> from the drillbit package to the classpath for the JDBC client driver.
> Then the following error is observed. See attachment (ElementTraversal).
> This requires to add jars/3rdparty/xml-apis-1.4.01.jar to the classpath from 
> the drillbit package.
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> - - - - - - - - - - - 
> The issue is Tomcat and Spotfire Server does not show any errors and starts 
> up fine without the Drill JDBC driver. Once the Drill driver is added the 
> application server fails to start with the errors shown.
> Adding the 2 jars to the classpath then resolves the issue.
> I have not looked at all the JDBC driver classes, but it is important to note 
> that the error occurs when the JDBC driver is added and resolved by adding 2 
> jars from the drillbit package.
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> - - - - - - - - - - - 
> > I do not see Drill classes in the stack trace. This seems to be a Tomcat 
> > configuration issue.
> I suspect another possibility: that the Drill JDBC-all Jar file contains a 
> stray reference to the unfound class (SAXParserFactoryImpl) in some file in 
> META-INF/services (left over from some package whose classes we either 
> excluded or renamed (with "shading")
> Xxx, Yyy: Can you try this?:
>     (Temporarily) removing the added XML Jar files from the class path to 
> re-confirm the problem.
>     Move the Drill JDBC-all Jar file to be last on the class path (and remove 
> ).
>     Report whether the symptoms change.
> Thanks.
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> - - - - - - - - - - - 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to