Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-09 Thread Joel Bernstein
Yes, /sql has been in trunk / master for a long time (more then 6 months).
But it was not released in the 5x branch because it requires Java 8.

I'm wondering what the issue is with the server setup that you have that is
throwing the NPE.

Joel Bernstein
http://joelsolr.blogspot.com/

On Mon, May 9, 2016 at 4:21 AM, deniz <denizdurmu...@gmail.com> wrote:

> was able to get "gettingstarted" example running with sql, on my local only
> with a single zk...
>
> still not sure why the core/collection i have tried, didnt work till now...
>
> thanks a lot for pointing out for the version related issues, it made me
> change my focus from client to server side :)
>
>
>
> -
> 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-tp4274451p4275447.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-09 Thread deniz
was able to get "gettingstarted" example running with sql, on my local only
with a single zk... 

still not sure why the core/collection i have tried, didnt work till now...

thanks a lot for pointing out for the version related issues, it made me
change my focus from client to server side :) 



-
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-tp4274451p4275447.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-08 Thread deniz
Joel Bernstein wrote
> It appears that the /sql handler is not sending the metadata Tuple.
> According to the log the parameter includeMetadata=true is being sent.
> This
> should trigger the sending of the metadata Tuple.
> 
> Is it possible that you are using a pre 6.0 release version of Solr from
> the master branch? The JDBC client appears to be from the 6.0 release but
> the server could be an older version.
> 
> The reason I ask this, is that older versions of the /sql handler don't
> have the metadata Tuple logic. So the query would be processed correctly
> but the metadata Tuple wouldn't be there.
> 
> Joel Bernstein
> http://joelsolr.blogspot.com/


I have checked once more about the version of solr and clean up all of the
zookeeper data as well and restarted, but the problem is still going on... 

pre-6 versions actually support /sql handler? 



-
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-tp4274451p4275437.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-06 Thread Joel Bernstein
It appears that the /sql handler is not sending the metadata Tuple.
According to the log the parameter includeMetadata=true is being sent. This
should trigger the sending of the metadata Tuple.

Is it possible that you are using a pre 6.0 release version of Solr from
the master branch? The JDBC client appears to be from the 6.0 release but
the server could be an older version.

The reason I ask this, is that older versions of the /sql handler don't
have the metadata Tuple logic. So the query would be processed correctly
but the metadata Tuple wouldn't be there.

Joel Bernstein
http://joelsolr.blogspot.com/

On Fri, May 6, 2016 at 4:50 AM, deniz <denizdurmu...@gmail.com> wrote:

> I went on digging and debug the code and here is what I got on the point it
> breaks:
>
>
> <http://lucene.472066.n3.nabble.com/file/n4275053/metaDataIssue.png>
>
> so basically the tuple doesnt have anything for "isMetadata" hence getting
> null on that point... is this a bug or there is missing configs on
> clientside or classpath?
>
>
>
> -
> 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-tp4274451p4275053.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-06 Thread deniz
I went on digging and debug the code and here is what I got on the point it
breaks:


<http://lucene.472066.n3.nabble.com/file/n4275053/metaDataIssue.png> 

so basically the tuple doesnt have anything for "isMetadata" hence getting
null on that point... is this a bug or there is missing configs on
clientside or classpath? 



-
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-tp4274451p4275053.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-05 Thread deniz
Joel Bernstein wrote
>> Can you post your classpath?

classpath as follows:


solr-solrj-6.0.0
commons-io-2.4
httpclient-4.4.1
httpcore-4.4.1
httpmime-4.4.1
zookeeper-3.4.6
stax2-api-3.1.4
woodstox-core-asl-4.4.1
noggit-0.6
jcl-over-slf4j-1.7.7
slf4j-api-1.7.7




-
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-tp4274451p4274979.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-05 Thread Joel Bernstein
Also since the same query is working from curl, it's a pretty strong
indication that the error is occurring on the client. The logs show that
the includeMetadata  parameter is being sent properly. This is done
automatically by the JDBC driver. So the /sql handler should be sending the
metadata Tuple. The error you are seeing will occur if the metadata Tuple
is not present or if the first Tuple is null. My guess is the first Tuple
is null do to a ClassNotFoundException which is getting swallowed up during
the parse.

Joel Bernstein
http://joelsolr.blogspot.com/

On Thu, May 5, 2016 at 8:37 AM, Joel Bernstein <joels...@gmail.com> wrote:

> In looking at the logs things look good on the server side. The sql query
> is sent to the /sql handler. It's translated to a solr query and sent to
> the select handler. Results are returned and no errors.
>
> So, I'm going to venture a guess that problem is on the client side. I'm
> wondering if you're tripping a ClassNotFoundException once the parsing of
> the json result comes back. I've seen instances where
> ClassNotFoundExceptions get swallowed.
>
> Can you post your classpath?
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Thu, May 5, 2016 at 4:57 AM, deniz <denizdurmu...@gmail.com> wrote:
>
>> Also found
>>
>> // JDBC requires metadata like field names from the SQLHandler. Force
>> this property to be true.
>> props.setProperty("includeMetadata", "true");
>>
>>
>> in org.apache.solr.client.solrj.io.sql.DriverImpl
>>
>> are there any other ways to get response on solrj without metaData to
>> avoid
>> the error?
>>
>>
>>
>> -----
>> 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-tp4274451p4274739.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-05 Thread Joel Bernstein
In looking at the logs things look good on the server side. The sql query
is sent to the /sql handler. It's translated to a solr query and sent to
the select handler. Results are returned and no errors.

So, I'm going to venture a guess that problem is on the client side. I'm
wondering if you're tripping a ClassNotFoundException once the parsing of
the json result comes back. I've seen instances where
ClassNotFoundExceptions get swallowed.

Can you post your classpath?



Joel Bernstein
http://joelsolr.blogspot.com/

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

> Also found
>
> // JDBC requires metadata like field names from the SQLHandler. Force
> this property to be true.
> props.setProperty("includeMetadata", "true");
>
>
> in org.apache.solr.client.solrj.io.sql.DriverImpl
>
> are there any other ways to get response on solrj without metaData to avoid
> the error?
>
>
>
> -
> 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-tp4274451p4274739.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-05 Thread deniz
Also found 

// JDBC requires metadata like field names from the SQLHandler. Force
this property to be true.
props.setProperty("includeMetadata", "true");


in org.apache.solr.client.solrj.io.sql.DriverImpl 

are there any other ways to get response on solrj without metaData to avoid
the error? 



-
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-tp4274451p4274739.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-05 Thread deniz
could it be something with includeMetaData=true param? I have tried to set it
to false but then the logs look like:

webapp=/solr path=/sql
params={includeMetadata=true=false=1=json=2.2=select+id,+text+from+test+where+tits%3D1+limit+5=map_reduce}
status=0 QTime=3 



-
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-tp4274451p4274733.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-05 Thread deniz

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

The logs are the full logs which I got on the console when I run the code,
and there is no exception on server side at all (it prints the incoming
query and shows the hits actually, already pasted above)

the same query is fine if I run with curl only though...



-
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-tp4274451p4274715.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-04 Thread Kevin Risden
>
> 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.(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=map_reduce=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=1=json=2.2=select+id,+text+from+test+where+tits%3D1+limit+5=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")=false=id,text,score=score+desc=5=json=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.
>


Solr 6 / Solrj RuntimeException: First tuple is not a metadata tuple

2016-05-04 Thread deniz
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.(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=map_reduce=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=1=json=2.2=select+id,+text+from+test+where+tits%3D1+limit+5=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")=false=id,text,score=score+desc=5=json=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.