Cannot create bean of class

After suffering from a virus attack and having to format and reinstall everything i am having troulbe get my java application to function once again.  Although i think i have set everything up correctly i must have missed something.  I am getting the following error when i try to access one of my jsp pages using Jbuilders tomcat 3.2

javax.servlet.ServletException:  Cannot create bean of class app.MyBean

and when i run the application directly from tomcat (ver 4) i get this error

javax.servlet.ServletException: class app.MyBean: java.lang.NullPointerException

I have no idea what to do, i have double check all the settings and i think it should be working was working before and i have not changed the code, so it must be my settings...and ideas?
Who is Participating?
objectsConnect With a Mentor Commented:
It's up to you.
You can award me the points (I did mention above that there may be some required files missing :) , or delete the question if you can't 'afford' the points.


Can u post the code for app.MyBean.
menreeqAuthor Commented:
Objects, i am glad that you have answered my request for help. I have no problem posting the code expect that this one bean is about 700 lines of code and tad complicated/confusing.  Perhaps you can tell me what it is that you are looking for.  Remember, that this same exact code worked before i formated my computer.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Just post the ctor then.
Not really looking for a problem in the code, more trying to see what it is doing. And what external things could influence it. Does it load any config files on startup, that may be missing.

A stack trace for the NPE would also be helpful to determine exactly where the exception is occurring.

menreeqAuthor Commented:
Here is the stack trace

javax.servlet.ServletException:  Cannot create bean of class ies.InformesEstudiantesBean
 at _0002fInformesEstudiantes_0002ejspInformesEstudiantes_jsp_0._jspService(
 at org.apache.jasper.runtime.HttpJspBase.service(
 at javax.servlet.http.HttpServlet.service(
 at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(
 at javax.servlet.http.HttpServlet.service(
 at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(
 at org.apache.jasper.servlet.JspServlet.service(
 at javax.servlet.http.HttpServlet.service(
 at org.apache.tomcat.core.ServletWrapper.doService(
 at org.apache.tomcat.core.Handler.service(
 at org.apache.tomcat.core.ServletWrapper.service(
 at org.apache.tomcat.core.ContextManager.internalService(
 at org.apache.tomcat.core.ContextManager.service(
 at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(
 at org.apache.tomcat.service.TcpWorkerThread.runIt(
 at org.apache.tomcat.util.ThreadPool$

And i think this is what you mean by ctor:

import java.lang.String;
import java.util.Vector;
import ies.EstudiantesBean;
import java.sql.ResultSet;
import java.sql.Statement;

public class InformesEstudiantesBean extends EstudiantesBean {

  // Fields
  private ResultSet resultSet;
  private Statement statement;
  private Vector estudiantes;
  private Vector universidads;
  private String _filtorPorUniversidad;
  private String _filtorPorPractica;
  private String _filtorPorCodigo;

  // Constructors
  public InformesEstudiantesBean() { }
  public InformesEstudiantesBean(String p0) { }

  // Methods
  public void loadSingleEstudiante(String p0) { }
  public Vector getAllEstudianteIds(String p0, String p1, String p2, String p3) { }
  public Vector getAllUniversidads(String p0) { }
  public void set_filtorPorUniversidad(String p0) { }
  public void set_filtorPorPractica(String p0) { }
  public void set_filtorPorCodigo(String p0) { }
  public String get_filtorPorUniversidad() { }
  public String get_filtorPorPractica() { }
  public String get_filtorPorCodigo() { }

This part may be help too:

import java.sql.*;
import java.util.*;

public class InformesEstudiantesBean extends EstudiantesBean{

  public InformesEstudiantesBean(){
    statement = ConnectToDB.connectToDB();

And estudiantesBean:

public class EstudiantesBean {

  public EstudiantesBean(){
    statement = ConnectToDB.connectToDB();

    //Only deletes the contents of the temp folder when the application is first started
    if( tempPhotoCount == 0 && !tempPhotoFolderFlushed )

Check your classpath that tomcat can find your bean class.
Maybe try commenting out the contents of the ctor so that ihe default ctor does nothing and then try it.
If you get the same error then it's pretty sure that the problem is that tomcat cannot find the class.
menreeqAuthor Commented:
If i comment out from the following from the jsp file that call that bean

<jsp:useBean id="informesEstudiantesHandler" class="ies.InformesEstudiantesBean" scope="request"/>

then i no longer get the error.  I also think that it is unable to find that bean or more likely a package that the bean uses...smartUpload.  How do i verify this, where should the classpath be specified, is it in windows environments? And is it just classpath=...?

Check if your classes are in the web-inf directory of your webapp.
jars should be in <webapp>/web-inf/lib
classes should be in <webapp>/web-inf/classes
menreeqAuthor Commented:
Turns out that my application needed to have a folder available which I had forgotten to create.  So there was nothing wrong with the code or setup.
good to hear you got it working :-)
menreeqAuthor Commented:
What do you suggest i do with this question?
menreeqAuthor Commented:
Thanks once again for the help, Objects.
Thanks for the points :-)
Brainbench MVP for Java 1
All Courses

From novice to tech pro — start learning today.