Kodları lütfen aşağıdaki butonları kullanarak renklendirin. Örnek: <php> echo "Selam Dünya"; </php>
Yardım
karakter kaldı

Jsp Derlenmiş class çalışmıyor

hata kodu

HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

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

exception

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

An error occurred at line: [14] in the generated java file: [C:\Program Files\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\_\org\apache\jsp\index_jsp.java]
Only a type can be imported. com.Test.Hello resolves to a package

An error occurred at line: 5 in the jsp file: /index.jsp
Hello cannot be resolved to a type
2: 
3: <% 
4: 
5: 	Hello say = new Hello();
6: 	out.println(say.sayWord("HELLO WORLD"));
7: 
8:  %>


An error occurred at line: 5 in the jsp file: /index.jsp
Hello cannot be resolved to a type
2: 
3: <% 
4: 
5: 	Hello say = new Hello();
6: 	out.println(say.sayWord("HELLO WORLD"));
7: 
8:  %>


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:485)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


class kodu

package com.Test;

public class Hello{
	
	
	public String sayWord(String arg){
		
		return arg;
		
		
	}
	
	
}

jsp sayfasının kodu


<%@ page import="com.Test.Hello"%>

<% 

	Hello say = new Hello();
	out.println(say.sayWord("HELLO WORLD"));

 %>


<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  version="3.0"
  metadata-complete="true">

  <display-name>Welcome to Tomcat</display-name>
  <description>
     Welcome to Tomcat
  </description>

</web-app>

web xml kodu



apache tomcat installer versiyonu ROOT klasörü içerisinde /ROOT/WEB-INF/classes/com/Test/Hello.class

aynı zamanda ROOT içerisinde /ROOT/index.jsp şeklindedir
+0
-0
Cevaba KatılıyorumKatılmıyorum
Cevap Yaz Yorum Yaz Arşivime Ekle Takip Et

Cevaplar

  • max1299 adlı üyenin fotoğrafı
    8 yıl önce yazılmış
    28 cevap - 30 soru
    cevap yazan yok mu arkadaşlar classpath hangi dizine vermeme gerekiyor yapamadım