jsp error "only a type can be imported"

Allgemeines EE: jsp error "only a type can be imported"



Erstellt von Gaston  |  Antworten: 2

  1. #1
    Gaston


    jsp error "only a type can be imported"
    Hi, also ich habe ein simples Test.jsp Script dass das lucene.jar benötigt.Mein Provider gewährt mir jsp Unterstützung, jedoch werden die Files im public_html ordner gespeichert, sprich es es gibt keinen typischen webapps bzw webapp ordner mit der bekannten struktur (WEB-INF,META-INF etc.). nun liegt das benötigte lucene.jar im selben ordner wie das
    test jsp skript welches dieses lucene.jar benötigt. Nun bekomme ich eine Fehlerlaufzeitmeldung wie:

    org.apache.jasper.JasperException: Unable to compile class for JSP

    Generated servlet error:
    Only a type can be imported. org.apache.lucene.analysis.Analyzer resolves to a package

    Generated servlet error:
    Only a type can be imported. org.apache.lucene.analysis.standard.StandardAnalyzer resolves to a package

    Generated servlet error:
    Only a type can be imported. org.apache.lucene.document.Document resolves to a package

    Generated servlet error:
    Only a type can be imported. org.apache.lucene.document.Field resolves to a package

    Generated servlet error:
    Only a type can be imported. org.apache.lucene.index.IndexWriter resolves to a package

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    Analyzer cannot be resolved or is not a type

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    StandardAnalyzer cannot be resolved or is not a type

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    IndexWriter cannot be resolved or is not a type

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    IndexWriter cannot be resolved or is not a type

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    Document cannot be resolved or is not a type

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    Document cannot be resolved or is not a type

    An error occurred at line: 3 in the jsp file: /serverindex.jsp
    Generated servlet error:
    Field cannot be resolved


    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


    Mein jsp Script

    Code:
    <%@ page import=" javax.servlet.*, javax.servlet.http.*,java.io.*,org.apache.lucene.analysis.Analyzer,org.apache.lucene.analysis.standard.StandardAnalyzer,org.apache.lucene.document.Document,org.apache.lucene.document.Field,org.apache.lucene.index.IndexWriter" %>
    <%
    
    
    
    		try
    		{
    		String[] text = { "Indexierung mit Lucene", "Suche mit Lucene" };
    		String indexDir = "/home/sn/public_html/";
    		Analyzer analyzer = new StandardAnalyzer();
    		boolean create = true;
    
    		IndexWriter writer = new IndexWriter(indexDir, analyzer, create);
    		out.println("hmmmmmmmm.........");
    		for (int i = 0; i < text.length; i++)
    		{
    			Document document = new Document();
    			document.add(Field.Text("textfeld", text[i]));
    			writer.addDocument(document);
    			out.println("Es klappt");
    		}
    		
    		writer.close();
    		
    		}catch(Exception e)
    		{}
    
    %>

    Bin für jeden Tip dankbar wo der Fehler liegen könnte..


    Danke im Vorraus


    Gaston

  2. #2
    Gast

    Only a type can be imported. org.apache.lucene.analysis.Analyzer resolves to a package
    Sieth so aus als ob das Package org.apache.lucene.analysis.analyzer heist..

  3. #3
    Gaston


    mein anliegen hat sich erledigt weil mein webprovider mir entsprechende verzeichnisse eingerichtet hat.


    Gruß

    Gaston


Keine Antwort auf Deine Suche gefunden? Registriere Dich kostenlos und stelle Deine eigene Frage zu Java!

Jetzt kostenlos registrieren