title: org.apache.jasper.JasperException: Unable to load class for JSP
body: <p>I am new to jsp and I am trying to run a test file using javabeans in jsp on tomcat 6. Here is the code for main.jsp file:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Using JavaBeans in JSP&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt; 
  &lt;h2&gt;Using JavaBeans in JSP&lt;/h2&gt; 
  &lt;jsp:useBean id="test" class="action.TestBean" /&gt; 
  &lt;jsp:setProperty name="test" property="message" value="Hello JSP..." /&gt; 
  &lt;p&gt;Got message....&lt;/p&gt; 
  &lt;jsp:getProperty name="test" property="message" /&gt; 
  &lt;/center&gt; 
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the code for javabean TestBean.java</p>
  
  <pre><code>/* File: TestBean.java */ 
  package action; 
  public class TestBean
  {
  private String message = "No message specified";
  public String getMessage() {
      return(message);
  }
  public void setMessage(String message)
  { 
      this.message = message;
  }
  }
  </code></pre>
  
  <p>When I try to run main.jsp on localhost, I get following error:</p>
  
  <pre><code>type Exception report
  
  message
  
  description The server encountered an internal error () that prevented it from fulfilling this request.
  
  exception
  
  org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
  org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:161)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  
  root cause
  
  org.apache.jasper.JasperException: Unable to load class for JSP
  org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:630)
  org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:149)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  
  root cause
  
  java.lang.ClassNotFoundException: org.apache.jsp.main_jsp
  java.net.URLClassLoader$1.run(Unknown Source)
  java.security.AccessController.doPrivileged(Native Method)
  java.net.URLClassLoader.findClass(Unknown Source)
  org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
  org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
  org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:628)
  org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:149)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  </code></pre>