Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cannot create bean of class

Posted on 2002-06-14
13
Medium Priority
?
262 Views
Last Modified: 2010-05-18
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 now...it was working before and i have not changed the code, so it must be my settings...and ideas?
0
Comment
Question by:menreeq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7079569
Can u post the code for app.MyBean.
0
 

Author Comment

by:menreeq
ID: 7079699
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 7079720
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.

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:menreeq
ID: 7079783
Here is the stack trace

javax.servlet.ServletException:  Cannot create bean of class ies.InformesEstudiantesBean
 at _0002fInformesEstudiantes_0002ejspInformesEstudiantes_jsp_0._jspService(_0002fInformesEstudiantes_0002ejspInformesEstudiantes_jsp_0.java:84)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
 at org.apache.tomcat.core.Handler.service(Handler.java:287)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
 at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
 at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
 at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
 at java.lang.Thread.run(Thread.java:484)

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(){
    super();
    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 )
      flushTempFolder();

  }
0
 
LVL 92

Expert Comment

by:objects
ID: 7079798
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.
0
 

Author Comment

by:menreeq
ID: 7079805
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=...?

0
 
LVL 92

Expert Comment

by:objects
ID: 7079815
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
0
 

Author Comment

by:menreeq
ID: 7079863
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 7079870
good to hear you got it working :-)
0
 

Author Comment

by:menreeq
ID: 7079894
What do you suggest i do with this question?
0
 
LVL 92

Accepted Solution

by:
objects earned 400 total points
ID: 7079898
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.

:-)

0
 

Author Comment

by:menreeq
ID: 7080096
Thanks once again for the help, Objects.
0
 
LVL 92

Expert Comment

by:objects
ID: 7080922
Anytime.
Thanks for the points :-)

http://www.objects.com.au/staff/mick
Brainbench MVP for Java 1
http://www.brainbench.com
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question