Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:42:33+00:00 2026-06-16T00:42:33+00:00

I’m trying to query my solr database based off the code provided in this

  • 0

I’m trying to query my solr database based off the code provided in this question with SolrJ but it keeps throwing a null pointer exception.

My code is:

@PUT
@Produces(MediaType.TEXT_PLAIN)
public String returnText(String url) throws MalformedURLException, SolrServerException{
    SolrServer server = new HttpSolrServer("http://localhost:8080/apache-solr-1.4.0");

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.set("?q", "*:*");
    params.set("facet", true);
    params.set("rows", 5);

    QueryResponse response = server.query(params);
    System.out.println(response);
    return "success";
}

and if I run this url: http://localhost:8080/apache-solr-1.4.0/select/?q=*:*&facet=true&rows=5 in my browser then it returns the correct values however if I enter: http://localhost:8080/apache-solr-1.4.0/select/q=*:*&facet=true&rows=5 then I get the exact same error as when I run it in eclipse, the error is:

19/12/2012 1:09:01 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
org.apache.solr.client.solrj.SolrServerException: Server at http://localhost:8080/apache-solr-1.4.0 returned non ok status:500, message:null  java.lang.NullPointerException    at java.io.StringReader.<init>(StringReader.java:33)    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:197)    at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:78)  at org.apache.solr.search.QParser.getQuery(QParser.java:131)    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:89)     at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:174)    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)  at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)  at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)   at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)  at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)   at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)   at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)   at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)     at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)   at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)  at java.lang.Thread.run(Thread.java:619)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:328)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:211)
    at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:311)
    at geoportal.webservice.download.returnText(download.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    .......

If I change my code to params.set("q","*:*"); then I get this error:

19/12/2012 1:13:30 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
org.apache.solr.client.solrj.SolrServerException: Error executing query
    at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:311)
    at geoportal.webservice.download.returnText(download.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      .......

Any ideas as to what I’ve done wrong?

Thanks heaps

EDIT

Here is my new code for the solrQuery based off this:

@PUT
@Produces(MediaType.TEXT_PLAIN)
public String returnText(String url) throws MalformedURLException, SolrServerException{
    SolrServer server = new HttpSolrServer("http://localhost:8080/apache-solr-1.4.0");
    SolrQuery query = new SolrQuery();

    query.setQuery("*:*");
    query.setFacet(true);
    query.set("wt", "json");
    query.setRows(5);
    query.setStart(0);

    QueryResponse response = server.query(query);

    System.out.println(response);
    return "success";
}

But it still isn’t working 🙁
Console output:

19/12/2012 2:24:33 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
org.apache.solr.client.solrj.SolrServerException: Error executing query
    at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
    at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:311)
    at geoportal.webservice.download.returnText(download.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          ......

EDIT

I put a System.out.println(query.toString()); in my code and it outputted:

q=*%3A*&facet=true&wt=json&rows=5&start=0

If I enter this into my browser like

http://localhost:8080/apache-solr-1.4.0/select/q=*%3A*&facet=true&wt=json&rows=5&start=0

then it throws a null pointer exception again. However if I manually enter a ? in front of q=*%3A*... then it works. So I assume that my solr server needs this ? (is this because it’s so old?), is there any way to hard code one in?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:42:34+00:00Added an answer on June 16, 2026 at 12:42 am

    Try use the SolrQuery object instead of ModifiableSolrParams. Maybe it will help.

    If you cant use SolrQuery for any reason, try using statics names, like “CommonParams.Q” instead of hardcoded ones like “?q”

    EDITED

    I tested your problem and I think you are lacking configurations at your Application Server.

    Are you using JBoss 7.1? You need to add a line to .standalone.sh or standalone.bat telling where solr is. For example, in Jboss 7.1, in default configurations, you have to add \”-Dsolr.solr.home=$SOLR_HOME/example/solr\” \ to the standalone.sh

    I dont know about others Application Servers, but you can search a little and see how you can do that in another AS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.