>
> java.sql.SQLException: java.lang.RuntimeException: First tuple is not a
> metadata tuple
>

That is a client side error message meaning that the statement couldn't be
handled. There should be better error handling around this, but its not in
place currently.

And on Solr side, the logs seem okay:


The logs you shared don't seem to be the full logs. There will be a related
exception on the Solr server side. The exception on the Solr server side
will explain the cause of the problem.

Kevin Risden

On Wed, May 4, 2016 at 2:57 AM, deniz <denizdurmu...@gmail.com> wrote:

> I am trying to go through the steps  here
> <http://https://sematext.com/blog/2016/04/26/solr-6-as-jdbc-data-source/>
> to start playing with the new api, but I am getting:
>
> java.sql.SQLException: java.lang.RuntimeException: First tuple is not a
> metadata tuple
>         at
>
> org.apache.solr.client.solrj.io.sql.StatementImpl.executeQuery(StatementImpl.java:70)
>         at com.sematext.blog.App.main(App.java:28)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> Caused by: java.lang.RuntimeException: First tuple is not a metadata tuple
>         at
>
> org.apache.solr.client.solrj.io.sql.ResultSetImpl.<init>(ResultSetImpl.java:75)
>         at
>
> org.apache.solr.client.solrj.io.sql.StatementImpl.executeQuery(StatementImpl.java:67)
>         ... 6 more
>
>
>
> My code is
>
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.Statement;
>
>
> /**
>  * Hello world!
>  *
>  */
> public class App
> {
>     public static void main( String[] args )
>     {
>
>
>         Connection connection = null;
>         Statement statement = null;
>         ResultSet resultSet = null;
>
>         try{
>             String connectionString =
>
> "jdbc:solr://zkhost:port?collection=test&aggregationMode=map_reduce&numWorkers=1";
>             connection = DriverManager.getConnection(connectionString);
>             statement  = connection.createStatement();
>             resultSet = statement.executeQuery("select id, text from test
> where tits=1 limit 5");
>             while(resultSet.next()){
>                 String id = resultSet.getString("id");
>                 String nickname = resultSet.getString("text");
>
>                 System.out.println(id + " : " + nickname);
>             }
>         }catch(Exception e){
>             e.printStackTrace();
>         }finally{
>             if (resultSet != null) {
>                 try {
>                     resultSet.close();
>                 } catch (Exception ex) {
>                 }
>             }
>             if (statement != null) {
>                 try {
>                     statement.close();
>                 } catch (Exception ex) {
>                 }
>             }
>             if (connection != null) {
>                 try {
>                     connection.close();
>                 } catch (Exception ex) {
>                 }
>             }
>         }
>
>
>     }
> }
>
>
> I tried to figure out what is happening, but there is no more logs other
> than the one above. And on Solr side, the logs seem okay:
>
> 2016-05-04 15:52:30.364 INFO  (qtp1634198-41) [c:test s:shard1 r:core_node1
> x:test] o.a.s.c.S.Request [test]  webapp=/solr path=/sql
>
> params={includeMetadata=true&numWorkers=1&wt=json&version=2.2&stmt=select+id,+text+from+test+where+tits%3D1+limit+5&aggregationMode=map_reduce}
> status=0 QTime=3
> 2016-05-04 15:52:30.382 INFO  (qtp1634198-46) [c:test s:shard1 r:core_node1
> x:test] o.a.s.c.S.Request [test]  webapp=/solr path=/select
>
> params={q=(tits:"1")&distrib=false&fl=id,text,score&sort=score+desc&rows=5&wt=json&version=2.2}
> hits=5624 status=0 QTime=1
>
>
> The error is happening because of some missing handlers on errors on the
> code or because of some strict checks on IDE(Ideaj)? Anyone had similar
> issues while using sql with solrj?
>
>
> Thanks
>
> Deniz
>
>
>
> -----
> Zeki ama calismiyor... Calissa yapar...
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-6-Solrj-RuntimeException-First-tuple-is-not-a-metadata-tuple-tp4274451.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to