dear all,
again i am facing problem i am able to run Listener class also the ContextListener is initialised but it is giving me error on Tomcat 6.0 command prompt
Here is my Listener Class Sample.java i am able to compile the code but it is giving java.lang.nullpointer exception at runtime on Tomcat.exe
kindly help me to resolve this issue Is there is problem in my code
Print out the entire stack trace instead of just the error message. Then you'll know exactly in which line of code the exception occurred. You'd do that by "ex.printStrackTrace()".
I would guess that this points to the line that is #132 in the code above. There's only a single object that could be null, so that makes it pretty easy to find the problem :-)
You seem to have changed your code, so that the problem is now in line 136. What happens in that line? Which object could be null (you know what a NullPointerException is and why it happens, right) ? Why could it be null?
That's probably the one. Think about it for a minute, and answer these question: 1) What is a NullPointerException, and why does it happen? 2) Which objects are used in this line of code? 3) Could any of them be null?
A null pointer exception happens when you declare (create) a variable, but do not initialize it. An integer is zero by default,
but a non-number variable that doesn't have a value has the value null.Attempting to use a null object generates this exception,
because the program does not know what to do with that object
but i have already declared stmt1 in my code above in my code
and also executeUpdate
i have written the below line because i want to update the rows whose flag are 0 previously are set to 1 after sending the mail
Going by your previous post I thought you understood the difference between declaring an object, and initialising it, but apparently not. Post the lines of code where you are 1) declaring the object and 2) initialising the object.
Very important: You need to cut down the length of your posts to a minimum. There is no point in posting identical error messages 10 times, or output from loops that doesn't differ. Please edit your previous post and delete all that extraneous material. You can indicate if any of the messages occurred more than once, instead.
I'm confused. You said there was no error. But now there is an error?
Seems a DB-specific problem that you could ask about in the JDBC forum. If this was my problem I would convert this to a standalone desktop app that does all the DB and mail interaction, and only once I got that to work would I run it in a servlet environment. That would make testing so much easier and quicker, instead of having to start and restart web apps all the time.
Could you hold this puppy for a sec? I need to adjust this tiny ad:
Gift giving made easy with the permaculture playing cards