Erro no TomCat ao executar um Bean

4 respostas
R

pessoal estou tentando rodar esse Bean só que o TomCAT está me reportando as seguintes linhas de erro… só lembrando que o TesteBean.class já está na substas web-inf\classes valeus… e obrigadu!! :roll: :frowning:

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

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:519)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)

javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

root cause

java.lang.ArrayIndexOutOfBoundsException: 374

org.apache.jasper.compiler.JspReader.peekChar(JspReader.java:156)

org.apache.jasper.compiler.JspReader.isSpace(JspReader.java:349)

org.apache.jasper.compiler.JspReader.isDelimiter(JspReader.java:432)

org.apache.jasper.compiler.JspReader.parseToken(JspReader.java:397)

org.apache.jasper.compiler.Parser.checkUnbalancedEndTag(Parser.java:1699)

org.apache.jasper.compiler.Parser.parseElements(Parser.java:1561)

org.apache.jasper.compiler.Parser.parse(Parser.java:126)

org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)

org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)

org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:461)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)

javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

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

4 Respostas

D

poe o seu bean ai pra gente ver. Soh pra desencargo de consciencia, ele eh realmente um bean neh?! Quer dizer, possui os gets e sets, construtor vazio, etc?!

R

/*

  • Created on 04/11/2004
  • TODO To change the template for this generated file go to
  • Window - Preferences - Java - Code Style - Code Templates
    */
    package testeBean;
public class TesteBean {

String txt = “”;

public void setTexto(String texto){

txt = texto;

}
public String getTexto(){
	return txt;
}

}

e em seguida a .jsp

<jsp:useBean id=“testeObj” class=“testeBean.TesteBean”>

<jsp:setProperty name=“testeObj” property=“texto” value=“Testando…”/>

</jsp:useBean>

<html>
<head>
<title>Teste Jsp</title>
</head>

<body>
<h1>Teste JSP</h1>
<p>A mensagem teste é:
<jsp:getProperty name=“testeObj” property=“texto”/>
</p>
</body>
</html

ta aí… :sad:

D

É, como eu imaginei, para essa sua classe realmente ser um Bean, vc deve trocar o nome do seu atributo txt para texto, e inserir um construtor sem parametros:

package testeBean; 

public class TesteBean &#123; 
  String texto = ""; 

  // construtor
  public void TesteBean&#40;&#41; &#123;
  &#125;

  public void setTexto&#40;String texto&#41;&#123; 
    this.texto = texto; 
  &#125; 

  public String getTexto&#40;&#41;&#123; 
    return texto; 
  &#125; 
&#125;

Agora deve funcionar… :okok:

R

valeu aí… vou testar daqui … :slight_smile: :slight_smile: obrigado!!

Criado 4 de novembro de 2004
Ultima resposta 5 de nov. de 2004
Respostas 4
Participantes 2