Hi
I am working with the Tomcat 5.5 on Eclipse, and is getting the error when my servlet calls the jsp using request dispatcher, the error is:
HTTP status 500
The server encountered an internal error () that prevented it from fulfilling this request.
and the log of the exception is:
Oct 27, 2008 9:41:15 AM org.apache.cata lina.core.Stand ardWrapperValve invoke
SEVERE: Servlet.service () for servlet Controller threw exception
java.lang.NullP ointerException
at Controller.doGe t(Controller.ja va:46)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:627)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:729)
at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(Applicatio nFilterChain.ja va:269)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:188)
at org.apache.cata lina.core.Stand ardWrapperValve .invoke(Standar dWrapperValve.j ava:213)
at org.apache.cata lina.core.Stand ardContextValve .invoke(Standar dContextValve.j ava:172)
at org.apache.cata lina.core.Stand ardHostValve.in voke(StandardHo stValve.java:12 7)
at org.apache.cata lina.valves.Err orReportValve.i nvoke(ErrorRepo rtValve.java:11 7)
at org.apache.cata lina.core.Stand ardEngineValve. invoke(Standard EngineValve.jav a:108)
at org.apache.cata lina.connector. CoyoteAdapter.s ervice(CoyoteAd apter.java:174)
at org.apache.coyo te.http11.Http1 1Processor.proc ess(Http11Proce ssor.java:875)
at org.apache.coyo te.http11.Http1 1BaseProtocol$H ttp11Connection Handler.process Connection(Http 11BaseProtocol. java:665)
at org.apache.tomc at.util.net.Poo lTcpEndpoint.pr ocessSocket(Poo lTcpEndpoint.ja va:528)
at org.apache.tomc at.util.net.Lea derFollowerWork erThread.runIt( LeaderFollowerW orkerThread.jav a:81)
at org.apache.tomc at.util.threads .ThreadPool$Con trolRunnable.ru n(ThreadPool.ja va:689)
at java.lang.Threa d.run(Unknown Source)
and when I go to the line in the controller.java which is giving me the exception, I do not find anything wrong with it, this is the line:
RequestDispatch er dispatcher = getServletConfi g().getServletC ontext().getReq uestDispatcher( "/view.jsp");
dispatcher.forw ard(request, response);
Any clarifications highly appreciated.
When I debug my code, I find that the config is null just before the RequestDispatch er line. What does that mean ?
thanks.
3 18715 JosAH 11,448
Recognized Expert MVP
You either didn't store your .jsp at the correct location or you have overridden the
init(ServletCon fig config) method without calling the super.init(conf ig) method.
kind regards,
Jos
My code looks like this: -
-
-
-
import java.io.IOException;
-
import java.util.*;
-
import javax.servlet.*;
-
import javax.servlet.http.HttpServlet;
-
import javax.servlet.http.HttpServletRequest;
-
import javax.servlet.http.HttpServletResponse;
-
import javax.servlet.http.HttpSession;
-
-
/**
-
* Servlet implementation class Controller
-
*/
-
public class Controller extends HttpServlet {
-
-
private static ArrayList<String> list_operations = new ArrayList<String>();
-
private static final long serialVersionUID = 1L;
-
-
/**
-
* @see HttpServlet#HttpServlet()
-
*/
-
public Controller() {
-
super();
-
// TODO Auto-generated constructor stub
-
}
-
-
/**
-
* @see Servlet#init(ServletConfig)
-
*/
-
public void init(ServletConfig config) throws ServletException {
-
// TODO Auto-generated method stub
-
}
-
-
/**
-
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
-
*/
-
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
// TODO Auto-generated method stub
-
-
-
String val = request.getParameter("value1");
-
System.out.println(val);
-
-
HttpSession session = request.getSession(true);
-
System.out.println(session.getId());
-
RequestDispatcher dispatcher = getServletConfig().getServletContext().getRequestDispatcher("/view.jsp");
-
dispatcher.forward(request, response);
-
}
-
-
/**
-
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
-
*/
-
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
// TODO Auto-generated method stub
-
-
-
this.doGet(request, response);
-
-
}
-
-
}
-
-
-
I dont think i did anything like that !! Any idea what is going wrong with the code !!
Reply awaited.
JosAH 11,448
Recognized Expert MVP
I dont think i did anything like that !!
Yes you did; you committed sin #2 (see my previous reply).
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ray Stevens |
last post by:
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
That is not a particularly useful error message. It is being thrown by a
remoting server accessing the bll/dal layers from a web. I turned off
customErrors in the remote config file, but still get this error.
Anyone have a clue as to what to do about it?
|
by: Patrick Masson |
last post by:
Hello,
Our configuration :
Apache 2.0.53
PHP 5.0.4
PC Windows 2000
MATLAB 6.1
We work on a consulting project in France which involves MATLAB Web server,
|
by: Ray Stevens |
last post by:
"Server encountered an internal error. For more information, turn off
customErrors in the server's .config file."
The above is not a particularly helpful error message. It is being thrown by
a remoting C# application server accessing the bll/dal layers from a web
server. I turned off customErrors in the remote config file, but still get
this nearly useless error message. Worse, everything works fine if the
layers are all run on the same...
|
by: Lieven |
last post by:
Hey,
I had a hard disc problem last week on my server. I replaced the disc and
copied al the files to the new hard disc, everything works fine again except
some php scripts that are using the mail() function. When executing these
scripts I get this error:
"500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
|
by: mathersj |
last post by:
Hello
I was wondering whether anybody knew what this error may be telling me:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
| |
by: ticfranca |
last post by:
Hi, I'm getting this error in the code below:
sub Pega_recorde {
$database = 'bundinha';
$host = 'localhost';
$usuario = 'myhumoradm';
$senha = 'my8xr2d2';
$dbh=DBI->connect("DBI:mysql:database=$database;host=$host","$usuario","$senha") or die "Can't open DB: $!";
|
by: ticfranca |
last post by:
i'm getting an error at the line : $sth->execute() or die $dbh->errstr;
the error is : The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator
I already check permission of cgi-bin folder and the permission of this script file.
Everything is OK. Somebody help me?Please..
Internal Server Error
|
by: Ntuthuko |
last post by:
Hi
I would like some help with regards to setting up IIS on my machine, it seems I'm doing something wrong. I installed IIS on a new Windows XP machine with intentions of copying all my ASP projects from the old machine. after installing IIS and opening http://localhost i get this error: "(HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying." I also get the...
|
by: giridharpolaki |
last post by:
I am getting the error below mentioned while I am trying to acess msaccess data base from apache , I have cross checked the program , its entirely perfect, I think there should be some problem with enviroment setup and Data source connection.
Could anybody help me resolve the issue. Thank you very much for yout time.
HTTP Status 500 -
|
by: evoloyeu |
last post by:
hi buddy,the error is:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |