• Post Reply Bookmark Topic Watch Topic
  • New Topic

A JSP consisting of a single jsp:useBean won't compilef

 
Jeff Wachhorst
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone seen this problem before?
I am running Tomcat 4.1.24. I have created a JSP called 'useB' and it consists of:

<%@page import="tstg.*" %>
<jsp:useBean id="myBean1" class="MyBean1" />

useB resides as a standalone JSP in my TstApp application folder. (TstApp is my document root).
myBean1 consists of:

package tstg;

public class MyBean1 implements java.io.Serializable
{
private String name="harry";

public String getName()
{
return name;
}
public void setName(String name)
{
this.name=name;
}
}
--------
The package 'tstg' resides in my classes file as it should. If this isn't SIMPLE enough yet, please tell me!
I launch Internet Explorer 5.0 and enter this is the address window:
http://localhost/TstApp/useB.jsp
(I've changed the port attribute in server.xml from 8080 to 80 so that I don't have to type localhost:8080).
I get back a error page showing error code 500. Under 'root cause', the first couple of lines are:

root cause
javax.servlet.ServletException: MyBean1
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
at org.apache.jsp.useB_jsp._jspService(useB_jsp.java:62)

Right. The offending line in useB.jsp is 62. Following is the servlet that is compiled from useB.jsp.
To the left of line 62, you'll see '62'.

package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import tstg.*;

public class useB_jsp extends HttpJspBase {


private static java.util.Vector _jspx_includes;

public java.util.List getIncludes() {
return _jspx_includes;
}

public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {

JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;


try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;

out.write("\r\n\r\n");
MyBean1 myBean1 = null;
synchronized (pageContext) {
myBean1 = (MyBean1) pageContext.getAttribute("myBean1", PageContext.PAGE_SCOPE);
if (myBean1 == null){
try {
myBean1 = (MyBean1) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "MyBean1");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException("Cannot create bean of class " + "MyBean1", exc);
}
pageContext.setAttribute("myBean1", myBean1, PageContext.PAGE_SCOPE);
}
}
out.write("\r\n");
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
62 if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}

A JSP that does not contain a <jsp:useBean.../> in it works fine.
Can you tell me WHAT the problem IS?

Thank you in advance!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Jeff Wachhorst
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear- THANK YOU for your reply. OK, that was embarrassing. A couple of things made it easier for me to miss on this end. I really appreciate another pair of eyes!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!