Compilando o RMI!

1 resposta
B

Pessoal, estou com um problema no Java 1.6.0 para compilar com o rmic.

Tenho minha classe Interface:

package jsearchserver;

import java.util.ArrayList;
import java.rmi.*;

public interface IClientSearch extends Remote {
    
    public ArrayList<String> doSearch(String p_query, String p_field) throws RemoteException;
    
}
Ai fiz minha classe de implementação:
/*
 * ClientSearchImpl.java
 *
 * Created on 20 de Novembro de 2006, 12:08
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package jsearchserver;

import java.io.*;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.util.*;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Searcher;

/**
 *
 * @author sergio.junior
 */

public class ClientSearchImpl implements IClientSearch {
    
    private String index_dir = "";
    static final long serialVersionUID = 42L;

    public ClientSearchImpl() throws RemoteException {
        UnicastRemoteObject.exportObject(this);
        this.index_dir = JSearchServer.getIndexDir();
    }
    
    public ArrayList<String> doSearch(String p_query, String p_field) throws RemoteException {
        try{
            ArrayList<String> arr = new ArrayList<String>() ;
            //Fields: contents, title, path
            String field = "contents";
            
            if(p_field != null)
                field = p_field;
            
            IndexReader reader = IndexReader.open(index_dir);
            Searcher searcher = new IndexSearcher(reader);
            Analyzer analyzer = new StandardAnalyzer();
            QueryParser parser = new QueryParser(field, analyzer);
            
            Query query = parser.parse(p_query);
            System.out.println("Procurando por: " + query.toString(field));
            
            Hits hits = searcher.search(query);
            
            Date start = new Date();
            
            hits = searcher.search(query);
            Date end = new Date();
            System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
            
            System.out.println(hits.length() + " documento(s) encontrado(s).");
            
            for( int i=0; i<hits.length(); i++){
                Document doc = hits.doc(i);
                String path = doc.get("path");
                if (path != null) {
                    String title = doc.get("title");
                    if (title != null)
                        System.out.println((i+1) + ". " + path + " Titulo: " + title);
                    else
                        System.out.println((i+1) + ". " + path);
                    
                    arr.add(path); //Adiciona o retorno...
                }
            }
            
            reader.close();
            return arr;
            
        }catch(Exception e){
            e.printStackTrace();
            return null;
        }
    }
    
}

Mas quando tento compilar a classe de implementação acima com o rmic, tenho o seguinte resultado:

D:\NetbeansWorkspace\JSearchServerL\src>javac -cp "%CLASSPATH%;." jsearchserver/JSearchServer.java

D:\NetbeansWorkspace\JSearchServerL\src>rmic -classpath "%CLASSPATH%;." jsearchserver.ClientSearchIm
pl
Exception in thread "main" java.lang.ClassFormatError: java.lang.AbstractStringBuilder (erroneous me
thod access flags)
   at 0x0042c9ce (Unknown Source)
   at 0x0042cec2 (Unknown Source)

Sabem o que pode ser ?

1 Resposta

T

Tente desabilitar o seu firewall, se for linux rode como root

Criado 22 de novembro de 2006
Ultima resposta 28 de nov. de 2006
Respostas 1
Participantes 2