Nao consigo executar .jsp

15 respostas
A

Pessoal sou iniciante em J2EE e to com um problema.
quando tento executar uma pagina .jsp do meu sistema, da o seguinte erro:

HTTP Status 500 -

type Exception report

message

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

exception

org.apache.jasper.JasperException: /manipulacliente.jsp(17,26) quote symbol expected
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
	org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:199)
	org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:144)
	org.apache.jasper.compiler.Parser.parseSetProperty(Parser.java:963)
	org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1239)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
	org.apache.jasper.compiler.Parser.parse(Parser.java:127)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
Apache Tomcat/5.5.25

obs: servidor tomcat funcionando

Alguem pode me ajudar?

15 Respostas

pablofaria

Posta o código do JSP

samuelhenriquerj

posta o código, mas pelo q vi parece q está faltando aspas ou algo parecido.

A
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%-- configuraçoes de pagina --%>
<%@ page errorPage = "guestBookErrorPage.jsp"; %>
<%-- beans usados neste JSP --%>
<jsp:useBean id="guest" scope="page"
	class="GuestBean" />
<jsp:useBean id="guestData" scope = "request"
	class = "GuestDataBean" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Guest Book Login</title>
<style type = "text/css">
	body
	{
		font-family: tahoma, helvetica, arial, sans-serife;
	}
	table, tr, td
	{
		font-size: .9em;
		border: 3px groove;
		padding: 5px;
		background-color: #dddddd;
	}
</style>	
</head>
<body>
	<jsp:setProperty name ="guest" property = "*" />
	<% 
		if(guest.getFirstName() == null ||
				guest.getLastName() == null ||
				guest.getEmail() == null)
		{
	%><%-- fim do scriplet para inserir dados de template fixo --%>			
		<form action= "guestBookLogin.jsp" method="post">
			<p>Enter your first name, last name and email
				address to register in our guest book.</p>
			<table>
				<tr>
					<td>First name</td>
					<td>
						<input type = "text" name= "firstName" />
					</td>
				</tr>
				<tr>
					<td>LastName</td>
					<td>
						<input type = "text" name = "lastName" />
					</td>
				</tr>
				<tr>
					<td>Email</td>
					<td>
						<input type = "text" name = "email" />
					</td>
				</tr>
				<tr>
					<td colspan = "2">
						<input type = "submit" name = "Submit" />
					</td>
				</tr>
			</table>				
		</form>
	<% 
		}
		else
		{
			guestData.addGuest(guest);		
	%>
		<jsp:forward page = "guestBookView.jsp" />
	<%
		}
	%>

</body>
</html>
samuelhenriquerj

na linha 4 tira o ponto e virgula, mas com ctz deve ser algo q ainda nao vi…

A

Ok, ta dando o seguinte erro agora:

HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

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: 
JSP FileName:/guestBookLogin.jsp
Java FileName:/C:/eclipse_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/LivroVisitas//org/apache/jsp\guestBookLogin_jsp.java

An error occurred at line: 6 in the jsp file: /guestBookLogin.jsp
GuestBean cannot be resolved to a type
3: <%-- configuraçoes de pagina --%>
4: <%@ page errorPage = "guestBookErrorPage.jsp" %>
5: <!-- beans usados neste JSP  -->
6: <jsp:useBean id="guest" scope="page"
7: 	class="GuestBean" /> 
8: <jsp:useBean id="guestData" scope = "request"
9: 	class = "GuestDataBean" /> 

JSP FileName:/guestBookLogin.jsp
Java FileName:/C:/eclipse_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/LivroVisitas//org/apache/jsp\guestBookLogin_jsp.java

An error occurred at line: 6 in the jsp file: /guestBookLogin.jsp
GuestBean cannot be resolved to a type
3: <%-- configuraçoes de pagina --%>
4: <%@ page errorPage = "guestBookErrorPage.jsp" %>
5: <!-- beans usados neste JSP  -->
6: <jsp:useBean id="guest" scope="page"
7: 	class="GuestBean" /> 
8: <jsp:useBean id="guestData" scope = "request"
9: 	class = "GuestDataBean" /> 

JSP FileName:/guestBookLogin.jsp
Java FileName:/C:/eclipse_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/LivroVisitas//org/apache/jsp\guestBookLogin_jsp.java

An error occurred at line: 6 in the jsp file: /guestBookLogin.jsp
GuestBean cannot be resolved to a type
3: <%-- configuraçoes de pagina --%>
4: <%@ page errorPage = "guestBookErrorPage.jsp" %>
5: <!-- beans usados neste JSP  -->
6: <jsp:useBean id="guest" scope="page"
7: 	class="GuestBean" /> 
8: <jsp:useBean id="guestData" scope = "request"
9: 	class = "GuestDataBean" /> 

JSP FileName:/guestBookLogin.jsp
Java FileName:/C:/eclipse_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/LivroVisitas//org/apache/jsp\guestBookLogin_jsp.java

An error occurred at line: 8 in the jsp file: /guestBookLogin.jsp
GuestDataBean cannot be resolved to a type
5: <!-- beans usados neste JSP  -->
6: <jsp:useBean id="guest" scope="page"
7: 	class="GuestBean" /> 
8: <jsp:useBean id="guestData" scope = "request"
9: 	class = "GuestDataBean" /> 
10: <html xmlns="http://www.w3.org/1999/xhtml">
11: <head>

JSP FileName:/guestBookLogin.jsp
Java FileName:/C:/eclipse_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/LivroVisitas//org/apache/jsp\guestBookLogin_jsp.java

An error occurred at line: 8 in the jsp file: /guestBookLogin.jsp
GuestDataBean cannot be resolved to a type
5: <!-- beans usados neste JSP  -->
6: <jsp:useBean id="guest" scope="page"
7: 	class="GuestBean" /> 
8: <jsp:useBean id="guestData" scope = "request"
9: 	class = "GuestDataBean" /> 
10: <html xmlns="http://www.w3.org/1999/xhtml">
11: <head>

JSP FileName:/guestBookLogin.jsp
Java FileName:/C:/eclipse_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/LivroVisitas//org/apache/jsp\guestBookLogin_jsp.java

An error occurred at line: 8 in the jsp file: /guestBookLogin.jsp
GuestDataBean cannot be resolved to a type
5: <!-- beans usados neste JSP  -->
6: <jsp:useBean id="guest" scope="page"
7: 	class="GuestBean" /> 
8: <jsp:useBean id="guestData" scope = "request"
9: 	class = "GuestDataBean" /> 
10: <html xmlns="http://www.w3.org/1999/xhtml">
11: <head>


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:98)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.25

Segue a GuestBean.java que gera o GuestBean.class que esta no diretorio WEB-INF/classes

public class GuestBean 
{
	private String firstName;
	private String lastName;
	private String email;	
	
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
}
samuelhenriquerj

pode não ter nada a ver, mas tenta tirar a quebra de linha, e colocar tudo em 1 linha so, em todos os casos:
<jsp:useBean id=“guest” scope=“page” class=“GuestBean” />

A

coloquei em uma linha so mas continua mesmo erro

jpcasati

as classes não estariem dentro de pacotes?

A

jpcasati como assim? as classes estao em WEB-INF/classes

A

acho que entendi, nao estao em pacotes nao, pelo menos no codigo java nao tem package.

jpcasati

bom, sei lá se é isso, ou se não tem nda a ver, mas coloca as classes em src/java/

A

coloquei mas da o mesmo erro, será que tem a ver com o web.xml ele esta assim:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>
	LivroVisitas</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>
jpcasati

crie um construtor vazio pra sua classe.

A

cara em uma classe ja tinha na outra criei mas continua com erro.

jpcasat essa duvida que estou tendo é de um exemplo do livro JAVA DEITEL, tem como eu passar a pasta zipada e vc tentar rodar ai, tem apenas 18,5k.

Agradeço.

jpcasati

boa, manda ai [email removido]

Criado 18 de fevereiro de 2008
Ultima resposta 20 de fev. de 2008
Respostas 15
Participantes 4