File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP error using tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP error using tomcat" Watch "JSP error using tomcat" New topic
Author

JSP error using tomcat

Felipe Walker
Ranch Hand

Joined: Sep 23, 2003
Posts: 41
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
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
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


Shailesh Kini.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Place the bean in a package other than the default.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Felipe Walker
Ranch Hand

Joined: Sep 23, 2003
Posts: 41
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

Joined: Oct 17, 2001
Posts: 153
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

Joined: Sep 23, 2003
Posts: 41
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JSP error using tomcat