Velocity / Solritas not works in solr 4.3 and Tomcat 6

2013-06-08 Thread andy tang
*Could anyone help me to see what is the reason which Solritas page failed?*

*I can go to http://localhost:8080/solr without problem, but fail to go to
http://localhost:8080/solr/browse*

*As below is the status report! Any help is appreciated.*

*Thanks!*

*Andy*

*
*

*type* Status report

*message* *{msg=lazy loading
error,trace=org.apache.solr.common.SolrException: lazy loading error at
org.apache.solr.core.SolrCore$LazyQueryResponseWriterWrapper.getWrappedWriter(SolrCore.java:2260)
at
org.apache.solr.core.SolrCore$LazyQueryResponseWriterWrapper.getContentType(SolrCore.java:2279)
at
org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:623)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:372)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:155)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
at java.lang.Thread.run(Unknown Source) Caused by:
org.apache.solr.common.SolrException: Error Instantiating Query Response
Writer, solr.VelocityResponseWriter failed to instantiate
org.apache.solr.response.QueryResponseWriter at
org.apache.solr.core.SolrCore.createInstance(SolrCore.java:539) at
org.apache.solr.core.SolrCore.createQueryResponseWriter(SolrCore.java:604)
at org.apache.solr.core.SolrCore.access$200(SolrCore.java:131) at
org.apache.solr.core.SolrCore$LazyQueryResponseWriterWrapper.getWrappedWriter(SolrCore.java:2255)
... 16 more Caused by: java.lang.ClassCastException: class
org.apache.solr.response.VelocityResponseWriter at
java.lang.Class.asSubclass(Unknown Source) at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:458)
at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:396)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:518) ... 19
more ,code=500}*

*description* *The server encountered an internal error that prevented it
from fulfilling this request.*


Adding Documents to Solr by using Java Client API is failed

2018-03-16 Thread Andy Tang
I have the code to add document to Solr. I tested it in Both Solr 6.6.2 and
Solr 7.2.1 and failed.

import java.io.IOException;  import
org.apache.solr.client.solrj.SolrClient; import
org.apache.solr.client.solrj.SolrServerException; import
org.apache.solr.client.solrj.impl.HttpSolrClient; import
org.apache.solr.common.SolrInputDocument;
public class AddingDocument {
   public static void main(String args[]) throws Exception {

String urlString ="http://localhost:8983/solr/Solr_example";;
 SolrClient Solr = new HttpSolrClient.Builder(urlString).build();

  //Preparing the Solr document
  SolrInputDocument doc = new SolrInputDocument();

  //Adding fields to the document
  doc.addField("id", "007");
  doc.addField("name", "James Bond");
  doc.addField("age","45");
  doc.addField("addr","England");

  //Adding the document to Solr
  Solr.add(doc);

  //Saving the changes
  Solr.commit();
  System.out.println("Documents added");
   } }

The compilation is successful like below.

javac -cp .:/opt/solr/solr-6.6.2/dist/solr-solrj-6.6.2.jar
AddingDocument.java

However, when I run it, it gave me some errors message confused.

java -cp .:/opt/solr/solr-6.6.2/dist/solr-solrj-6.6.2.jar AddingDocument

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/http/Header
at 
org.apache.solr.client.solrj.impl.HttpSolrClient$Builder.build(HttpSolrClient.java:892)
at AddingDocument.main(AddingDocument.java:13)Caused by:
java.lang.ClassNotFoundException: org.apache.http.Header
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more

What is wrong with it? Is this urlString correct?

Any help is appreciated!
Andy Tang


Re: Adding Documents to Solr by using Java Client API is failed

2018-03-16 Thread Andy Tang
Erik,

Thank you for reminding.
javac -cp
.:/opt/solr/solr-6.6.2/dist/*:/opt/solr/solr-6.6.2/dist/solrj-lib/*
 AddingDocument.java

java -cp
.:/opt/solr/solr-6.6.2/dist/*:/opt/solr/solr-6.6.2/dist/solrj-lib/*
 AddingDocument

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details.
Documents added

All jars are included and documents added successfully. However, there are
some error message coming out.

Thank you.


On Fri, Mar 16, 2018 at 12:43 PM, Erick Erickson 
wrote:

> this is the important bit:
>
> java.lang.NoClassDefFoundError: org/apache/http/Header
>
> That class is not defined in the Solr code at all, it's in
> httpcore-#.#.#.jar
>
> You probably need to include /opt/solr/solr-6.6.2/dist/solrj-lib in
> your classpath.
>
> Best,
> Erick
>
> On Fri, Mar 16, 2018 at 12:14 PM, Andy Tang 
> wrote:
> > I have the code to add document to Solr. I tested it in Both Solr 6.6.2
> and
> > Solr 7.2.1 and failed.
> >
> > import java.io.IOException;  import
> > org.apache.solr.client.solrj.SolrClient; import
> > org.apache.solr.client.solrj.SolrServerException; import
> > org.apache.solr.client.solrj.impl.HttpSolrClient; import
> > org.apache.solr.common.SolrInputDocument;
> > public class AddingDocument {
> >public static void main(String args[]) throws Exception {
> >
> > String urlString ="http://localhost:8983/solr/Solr_example";;
> >  SolrClient Solr = new HttpSolrClient.Builder(urlString).build();
> >
> >   //Preparing the Solr document
> >   SolrInputDocument doc = new SolrInputDocument();
> >
> >   //Adding fields to the document
> >   doc.addField("id", "007");
> >   doc.addField("name", "James Bond");
> >   doc.addField("age","45");
> >   doc.addField("addr","England");
> >
> >   //Adding the document to Solr
> >   Solr.add(doc);
> >
> >   //Saving the changes
> >   Solr.commit();
> >   System.out.println("Documents added");
> >} }
> >
> > The compilation is successful like below.
> >
> > javac -cp .:/opt/solr/solr-6.6.2/dist/solr-solrj-6.6.2.jar
> > AddingDocument.java
> >
> > However, when I run it, it gave me some errors message confused.
> >
> > java -cp .:/opt/solr/solr-6.6.2/dist/solr-solrj-6.6.2.jar AddingDocument
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/apache/http/Header
> > at org.apache.solr.client.solrj.impl.HttpSolrClient$Builder.
> build(HttpSolrClient.java:892)
> > at AddingDocument.main(AddingDocument.java:13)Caused by:
> > java.lang.ClassNotFoundException: org.apache.http.Header
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > ... 2 more
> >
> > What is wrong with it? Is this urlString correct?
> >
> > Any help is appreciated!
> > Andy Tang
>


Re: Adding Documents to Solr by using Java Client API is failed

2018-03-19 Thread Andy Tang
Erik,

Thank you so much!

On Sat, Mar 17, 2018 at 5:50 PM, Erick Erickson 
wrote:

> So if you're saying that the docs are successfully added, then you can
> ignore the SLF4J messages. They're just telling you that you don't have
> logging configured. If your client application wants to use a logging
> framework you have to do additional work.
>
> Solr (and SolrJ) allow you to use whatever SLF4J-compliant implementation
> you want for logging, but you must configure it. The referenced link will
> give
> you a start.
>
> But for test programs it's not _necessary_
>
> Best,
> Erick
>
>
> On Fri, Mar 16, 2018 at 2:02 PM, Andy Tang  wrote:
> > Erik,
> >
> > Thank you for reminding.
> > javac -cp
> > .:/opt/solr/solr-6.6.2/dist/*:/opt/solr/solr-6.6.2/dist/solrj-lib/*
> >  AddingDocument.java
> >
> > java -cp
> > .:/opt/solr/solr-6.6.2/dist/*:/opt/solr/solr-6.6.2/dist/solrj-lib/*
> >  AddingDocument
> >
> > SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> > SLF4J: Defaulting to no-operation (NOP) logger implementation
> > SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
> further
> > details.
> > Documents added
> >
> > All jars are included and documents added successfully. However, there
> are
> > some error message coming out.
> >
> > Thank you.
> >
> >
> > On Fri, Mar 16, 2018 at 12:43 PM, Erick Erickson <
> erickerick...@gmail.com>
> > wrote:
> >
> >> this is the important bit:
> >>
> >> java.lang.NoClassDefFoundError: org/apache/http/Header
> >>
> >> That class is not defined in the Solr code at all, it's in
> >> httpcore-#.#.#.jar
> >>
> >> You probably need to include /opt/solr/solr-6.6.2/dist/solrj-lib in
> >> your classpath.
> >>
> >> Best,
> >> Erick
> >>
> >> On Fri, Mar 16, 2018 at 12:14 PM, Andy Tang 
> >> wrote:
> >> > I have the code to add document to Solr. I tested it in Both Solr
> 6.6.2
> >> and
> >> > Solr 7.2.1 and failed.
> >> >
> >> > import java.io.IOException;  import
> >> > org.apache.solr.client.solrj.SolrClient; import
> >> > org.apache.solr.client.solrj.SolrServerException; import
> >> > org.apache.solr.client.solrj.impl.HttpSolrClient; import
> >> > org.apache.solr.common.SolrInputDocument;
> >> > public class AddingDocument {
> >> >public static void main(String args[]) throws Exception {
> >> >
> >> > String urlString ="http://localhost:8983/solr/Solr_example";;
> >> >  SolrClient Solr = new HttpSolrClient.Builder(urlString).build();
> >> >
> >> >   //Preparing the Solr document
> >> >   SolrInputDocument doc = new SolrInputDocument();
> >> >
> >> >   //Adding fields to the document
> >> >   doc.addField("id", "007");
> >> >   doc.addField("name", "James Bond");
> >> >   doc.addField("age","45");
> >> >   doc.addField("addr","England");
> >> >
> >> >   //Adding the document to Solr
> >> >   Solr.add(doc);
> >> >
> >> >   //Saving the changes
> >> >   Solr.commit();
> >> >   System.out.println("Documents added");
> >> >} }
> >> >
> >> > The compilation is successful like below.
> >> >
> >> > javac -cp .:/opt/solr/solr-6.6.2/dist/solr-solrj-6.6.2.jar
> >> > AddingDocument.java
> >> >
> >> > However, when I run it, it gave me some errors message confused.
> >> >
> >> > java -cp .:/opt/solr/solr-6.6.2/dist/solr-solrj-6.6.2.jar
> AddingDocument
> >> >
> >> > Exception in thread "main" java.lang.NoClassDefFoundError:
> >> > org/apache/http/Header
> >> > at org.apache.solr.client.solrj.impl.HttpSolrClient$Builder.
> >> build(HttpSolrClient.java:892)
> >> > at AddingDocument.main(AddingDocument.java:13)Caused by:
> >> > java.lang.ClassNotFoundException: org.apache.http.Header
> >> > at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> >> > at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
> >> > at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >> > ... 2 more
> >> >
> >> > What is wrong with it? Is this urlString correct?
> >> >
> >> > Any help is appreciated!
> >> > Andy Tang
> >>
>