lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon mcIlwaine" <smcilwa...@lendac.ie>
Subject Re: Lucene Search Applet
Date Mon, 23 Aug 2004 11:55:04 GMT
Thanks Jon that works by putting the jar file in the archive attribute. Now
im getting the disablelock error cause of the unsigned applet. Do I just
comment out the code anywhere where System.getProperty() appears in the
files that you specified and then update the JAR Archive?? Is it possible
you could show me one of the hacked files so that I know what I'm modifying?
Does anyone else know if there is another way of doing this without having
to hack the source code?

Many thanks.

Simon

----- Original Message ----- 
From: "Jon Schuster" <jons@wrq.com>
To: "Lucene Users List" <lucene-user@jakarta.apache.org>
Sent: Saturday, August 21, 2004 2:08 AM
Subject: Re: Lucene Search Applet


> I have Lucene working in an applet and I've seen this problem only when
> the jar file really was not available (typo in the jar name), which is
> what you'd expect. It's possible that the classpath for your
> application is not the same as the classpath for the applet; perhaps
> they're using different VMs or JREs from different locations.
>
> Try referencing the Lucene jar file in the archive attribute of the
> applet tag.
>
> Also, to get Lucene to work from an unsigned applet, I had to modify a
> few classes that call System.getProperty(), because the properties that
> were being requested were disallowed for applets. I think the classes
> were IndexWriter, FSDirectory, and BooleanQuery.
>
> --Jon
>
>
> On Aug 20, 2004, at 6:57 AM, Simon mcIlwaine wrote:
>
> > Im a new Lucene User and I'm not too familiar with Applets either but
> > I've
> > been doing a bit of testing on java applet security and if im correct
> > in
> > saying that applets can read anything below there codebase then my
> > problem
> > is not a security restriction one. The error is reading
> > java.lang.NoClassDefFoundError and the classpath is set as I have it
> > working
> > in a Swing App. Does someone actually have Lucene working in an
> > Applet? Can
> > it be done?? Please help.
> >
> > Thanks
> >
> > Simon
> >
> > ----- Original Message -----
> >
> > From: "Terry Steichen" <terry@net-frame.com>
> > To: "Lucene Users List" <lucene-user@jakarta.apache.org>
> > Sent: Wednesday, August 18, 2004 4:17 PM
> > Subject: Re: Lucene Search Applet
> >
> >
> > I suspect it has to do with the security restrictions of the applet,
> > 'cause
> > it doesn't appear to be finding your Lucene jar file.  Also, regarding
> > the
> > lock files, I believe you can disable the locking stuff just for
> > purposes
> > like yours (read-only index).
> >
> > Regards,
> >
> > Terry
> >   ----- Original Message -----
> >   From: Simon mcIlwaine
> >   To: Lucene Users List
> >   Sent: Wednesday, August 18, 2004 11:03 AM
> >   Subject: Lucene Search Applet
> >
> >
> >   Im developing a Lucene CD-ROM based search which will search html
> > pages on
> > CD-ROM, using an applet as the UI. I know that theres a problem with
> > lock
> > files and also security restrictions on applets so I am using the
> > RAMDirectory. I have it working in a Swing application however when I
> > put it
> > into an applet its giving me problems. It compiles but when I go to
> > run the
> > applet I get the error below. Can anyone help? Thanks in advance.
> >   Simon
> >
> >   Error:
> >
> >   Java.lang.noClassDefFoundError: org/apache/lucene/store/Directory
> >
> >   At: Java.lang.Class.getDeclaredConstructors0(Native Method)
> >
> >   At: Java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
> >
> >   At: Java.lang.Class.getConstructor0(Class.java:1922)
> >
> >   At: Java.lang.Class.newInstance0(Class.java:278)
> >
> >   At: Java.lang.Class.newInstance(Class.java:261)
> >
> >   At: sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
> >
> >   At: sun.applet.AppletPanel.runloader(AppletPanel.java:546)
> >
> >   At: sun.applet.AppletPanel.run(AppletPanel.java:298)
> >
> >   At: java.lang.Thread.run(Thread.java:534)
> >
> >   Code:
> >
> >   import org.apache.lucene.search.IndexSearcher;
> >
> >   import org.apache.lucene.search.Query;
> >
> >   import org.apache.lucene.search.TermQuery;
> >
> >   import org.apache.lucene.store.RAMDirectory;
> >
> >   import org.apache.lucene.store.Directory;
> >
> >   import org.apache.lucene.index.Term;
> >
> >   import org.apache.lucene.search.Hits;
> >
> >   import java.awt.*;
> >
> >   import java.awt.event.*;
> >
> >   import javax.swing.*;
> >
> >   import java.io.*;
> >
> >   public class MemorialApp2 extends JApplet implements ActionListener{
> >
> >   JLabel prompt;
> >
> >   JTextField input;
> >
> >   JButton search;
> >
> >   JPanel panel;
> >
> >   String indexDir = "C:/Java/lucene/index-list";
> >
> >   private static RAMDirectory idx;
> >
> >   public void init(){
> >
> >   Container cp = getContentPane();
> >
> >   panel = new JPanel();
> >
> >   panel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));
> >
> >   prompt = new JLabel("Keyword search:");
> >
> >   input = new JTextField("",20);
> >
> >   search = new JButton("Search");
> >
> >   search.addActionListener(this);
> >
> >   panel.add(prompt);
> >
> >   panel.add(input);
> >
> >   panel.add(search);
> >
> >   cp.add(panel);
> >
> >   }
> >
> >   public void actionPerformed(ActionEvent e){
> >
> >   if (e.getSource() == search){
> >
> >   String surname = (input.getText());
> >
> >   try {
> >
> >   findSurname(indexDir, surname);
> >
> >   } catch(Exception ex) {
> >
> >   System.err.println(ex);
> >
> >   }
> >
> >   }
> >
> >   }
> >
> >   public static void findSurname(String indexDir, String surname)
> > throws
> > Exception{
> >
> >   idx = new RAMDirectory(indexDir);
> >
> >   IndexSearcher searcher = new IndexSearcher(idx);
> >
> >   Query query = new TermQuery(new Term("surname", surname));
> >
> >   Hits hits = searcher.search(query);
> >
> >   for (int i = 0; i < hits.length(); i++) {
> >
> >   //Document doc = hits.doc(i);
> >
> >   System.out.println("Surname: " + hits.doc(i).get("surname"));
> >
> >   }
> >
> >   }
> >
> >   }
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message