You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ahmed baseet <ah...@gmail.com> on 2009/05/04 08:40:05 UTC
org.apache.*.*.... class not found exception in Internet Explorer
Hi,
I'm trying to query solr indexer thru a web page and trying to display the
result. I've the following class to query solr [I'm using the query(string)
method],
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrDocument;
import java.util.Map;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.FacetField;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
public class SolrjTest
{
public String query(String q)
{
CommonsHttpSolrServer server = null;
try
{
server = new CommonsHttpSolrServer("http://localhost:8983/solr/
");
}
catch(Exception e)
{
e.printStackTrace();
}
SolrQuery query = new SolrQuery();
query.setQuery(q);
query.setQueryType("dismax");
query.setIncludeScore(true);
try
{
QueryResponse qr = server.query(query);
SolrDocumentList sdl = qr.getResults();
//System.out.println("Found: " + sdl.getNumFound());
//System.out.println("Start: " + sdl.getStart());
//System.out.println("Max Score: " + sdl.getMaxScore());
//System.out.println("--------------------------------");
//System.out.println("Result doc : " + sdl);
return sdl.toString();
}
catch (SolrServerException e)
{
e.printStackTrace();
return null;
}
}
}
and the following to pass the queries to solr, get results and display it on
the browser,
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Font;
public class ControlJava extends Applet {
Font f = new Font("TimesRoman", Font.BOLD, 20);
String Message;
public void init() {
Message = new String("ubuntu");
}
public void SetMessage(String MsgText) {
SolrjTest solr = new SolrjTest();
Message = solr.query(MsgText);
repaint();
}
public void paint(Graphics g) {
g.setFont(f);
g.drawString(Message, 15, 50);
}
}
and finally the html page is this,
<HTML>
<HEAD>
<TITLE>Control a Java Applet</TITLE>
</HEAD>
<BODY>
<H1>Control a Java Applet</H1>
<HR>
The Java applet below displays text in a large font. You can enter
new text to display in the form below, and JavaScript will call the
Java applet to change the text.
<HR>
<FORM NAME="form1">
<INPUT TYPE="TEXT" NAME="text1">
<INPUT TYPE="BUTTON" VALUE="Change Text"
onClick="document.ControlJava.SetMessage(document.form1.text1.value);">
</FORM>
<HR>
<APPLET NAME="ControlJava" CODE="ControlJava.class" WIDTH=450 HEIGHT=125>
</APPLET>
<HR>
End of page.
</BODY>
</HTML>
When I'm trying to access this page and putting the query in the box that
this html shows, the browser [IE] gives some error and after checking I
found that the error is some class not found exception, its not able to find
the org.apache.*.*.... classes and hence giving errors. Now instead of
calling that I wrote a simpe class not using any apache.solr classes and
called the method therein [just returns a string] and it worked fine. I
added both both the classes [.class files] given above to the same location
where this web page resides.
The problem is that browser is not able to find those org.apache.*** classes
and creating the mess. Can anyone help this newbie fixing the problem.
Thanks a lot.
Do let me know if some information is missing/want some extra information on
this issue.
--Ahmed.
Re: org.apache.*.*.... class not found exception in Internet Explorer
Posted by ahmed baseet <ah...@gmail.com>.
Missed some information.
I'm working on Windows XP and my class path is this,
.;E:\Program Files\Java\jdk1.6.0_05\bin;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-httpclient-3.1.jar;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-common.jar;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\apache-solr-1.3.0.jar;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\solr-solrj-1.3.0.jar;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-io-1.3.1.jar;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-codec-1.3.jar;D:\firefox
download\apache-solr-1.3.0\apache-solr-1.3.0\dist\solrj-lib\commons-logging-1.0.4.jar
Thanks,
Ahmed.
On Mon, May 4, 2009 at 12:10 PM, ahmed baseet <ah...@gmail.com>wrote:
> Hi,
> I'm trying to query solr indexer thru a web page and trying to display the
> result. I've the following class to query solr [I'm using the query(string)
> method],
>
> import org.apache.solr.common.SolrDocumentList;
> import org.apache.solr.common.SolrDocument;
> import java.util.Map;
> import java.util.Iterator;
> import java.util.List;
> import java.util.ArrayList;
> import java.util.HashMap;
>
> import org.apache.solr.client.solrj.SolrServerException;
> import org.apache.solr.client.solrj.SolrQuery;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.client.solrj.response.FacetField;
> import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
>
>
> public class SolrjTest
> {
> public String query(String q)
> {
> CommonsHttpSolrServer server = null;
>
> try
> {
> server = new CommonsHttpSolrServer("
> http://localhost:8983/solr/");
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
>
> SolrQuery query = new SolrQuery();
> query.setQuery(q);
> query.setQueryType("dismax");
> query.setIncludeScore(true);
>
> try
> {
> QueryResponse qr = server.query(query);
>
> SolrDocumentList sdl = qr.getResults();
>
> //System.out.println("Found: " + sdl.getNumFound());
> //System.out.println("Start: " + sdl.getStart());
> //System.out.println("Max Score: " + sdl.getMaxScore());
> //System.out.println("--------------------------------");
> //System.out.println("Result doc : " + sdl);
>
> return sdl.toString();
>
> }
> catch (SolrServerException e)
> {
> e.printStackTrace();
> return null;
> }
>
>
> }
>
> }
>
>
> and the following to pass the queries to solr, get results and display it
> on the browser,
>
> import java.applet.Applet;
> import java.awt.Graphics;
> import java.awt.Font;
>
> public class ControlJava extends Applet {
> Font f = new Font("TimesRoman", Font.BOLD, 20);
> String Message;
>
> public void init() {
> Message = new String("ubuntu");
> }
>
> public void SetMessage(String MsgText) {
> SolrjTest solr = new SolrjTest();
> Message = solr.query(MsgText);
>
> repaint();
> }
>
> public void paint(Graphics g) {
> g.setFont(f);
> g.drawString(Message, 15, 50);
> }
> }
>
> and finally the html page is this,
>
> <HTML>
> <HEAD>
> <TITLE>Control a Java Applet</TITLE>
> </HEAD>
> <BODY>
> <H1>Control a Java Applet</H1>
> <HR>
> The Java applet below displays text in a large font. You can enter
> new text to display in the form below, and JavaScript will call the
> Java applet to change the text.
> <HR>
> <FORM NAME="form1">
> <INPUT TYPE="TEXT" NAME="text1">
> <INPUT TYPE="BUTTON" VALUE="Change Text"
> onClick="document.ControlJava.SetMessage(document.form1.text1.value);">
> </FORM>
> <HR>
> <APPLET NAME="ControlJava" CODE="ControlJava.class" WIDTH=450 HEIGHT=125>
> </APPLET>
> <HR>
> End of page.
> </BODY>
> </HTML>
>
> When I'm trying to access this page and putting the query in the box that
> this html shows, the browser [IE] gives some error and after checking I
> found that the error is some class not found exception, its not able to find
> the org.apache.*.*.... classes and hence giving errors. Now instead of
> calling that I wrote a simpe class not using any apache.solr classes and
> called the method therein [just returns a string] and it worked fine. I
> added both both the classes [.class files] given above to the same location
> where this web page resides.
> The problem is that browser is not able to find those org.apache.***
> classes and creating the mess. Can anyone help this newbie fixing the
> problem. Thanks a lot.
> Do let me know if some information is missing/want some extra information
> on this issue.
>
> --Ahmed.
>
>
>