• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP error using tomcat

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can not get the below code to work
---------------------------------------
jsp
----
<html>
<head>Second Felipe Bean Page</head>
<body>
<jsp:useBean id="test" class="FelipeBean"/>
<p> Your last name is: <%= request.getParameter( "lname" )%>
</body>
</html>

bean
-------
public class FelipeBean{
String name;
public FelipeBean(){
name = "Felipe";
}
public String getName(){
String firstName = name;
return firstName;
}
}


I keep getting the below error
-------------------------------------
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

An error occurred at line: 4 in the jsp file: /FelipeBean.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\BeanDemo\org\apache\jsp\FelipeBean_jsp.java:45: cannot resolve symbol
symbol : class FelipeBean
location: class org.apache.jsp.FelipeBean_jsp
FelipeBean test = null;
^


An error occurred at line: 4 in the jsp file: /FelipeBean.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\BeanDemo\org\apache\jsp\FelipeBean_jsp.java:47: cannot resolve symbol
symbol : class FelipeBean
location: class org.apache.jsp.FelipeBean_jsp
test = (FelipeBean) _jspx_page_context.getAttribute("test", PageContext.PAGE_SCOPE);
^


An error occurred at line: 4 in the jsp file: /FelipeBean.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\BeanDemo\org\apache\jsp\FelipeBean_jsp.java:49: cannot resolve symbol
symbol : class FelipeBean
location: class org.apache.jsp.FelipeBean_jsp
test = new FelipeBean();
^
3 errors



org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
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:802
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Felipe,

Your jsp cannot resolve the bean properly. Where in the war file is that bean located? Is this bean in the default package?

cheers
skini
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Place the bean in a package other than the default.
 
Felipe Walker
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the information. Do you know of a good site that shows how to setup a WAR file and where to put it once it is created.
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to put the war file in the webapps folder of you tomcat installation. Usually tomcat is setup to pick the war file automatically (hot deployment). So you don't have to deploy anything. If it is not automatically deployed you could go through the server logs for errors or to the tomcat administration to deploy the application manually.
 
Felipe Walker
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the help, I realized the problem was that it was not in a package. During my search I found ANT and that works wonderful to deploy application to Tomcat
 
reply
    Bookmark Topic Watch Topic
  • New Topic