Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Help! Why am I getting a null RequestDispatcher instance?

Posted on 2003-03-20
5
Medium Priority
?
392 Views
Last Modified: 2012-08-13
Hi all,

I'm absolutly baffled. I am trying to forward the request from a Servlet to a JSP using
getRequestDispatcher. The code I'm 'suffering' with is:

ServletContext servCont = getServletContext();
objTraza.write("Real Path: " + servCont.getRealPath(sURI));
RequestDispatcher dispatcher = servCont.getRequestDispatcher(sURI);
if (dispatcher == null)
{
   objTraza.write("Dispatcher is NULL");
}
dispatcher.forward(request,response);


objTraza is an instance of a custom class, which uses the 'write' method to write in a log file the string that is passed as a parameter. All is ok so far: getRealPath(sUrl) shows me the right path in which I have my JSP.

But afterwards, I've read in the log file "Dispatcher is NULL", so the third line is not getting the proper RequestDispatcher and after executing the las line, this is the error message I can see in the console (I'm working with JRun4):


20/03 12:35:27 error Exception parsing the TLD null : The string "--" is not permitted within comments.
[2]org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at jrun.jsp.compiler.JRunTagLibraryInfo.init(JRunTagLibraryInfo.java:190)
        at jrun.jsp.compiler.JRunTagLibraryInfo.<init>(JRunTagLibraryInfo.java:119)
        at jrun.jsp.JSPEngine.initBuiltInTagLibrary(JSPEngine.java:183)
        at jrun.jsp.JSPEngine.<init>(JSPEngine.java:135)
        at jrun.jsp.JSPServlet.init(JSPServlet.java:55)
        at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1204)
        at jrun.servlet.JRunRequestDispatcher.init(JRunRequestDispatcher.java:650)
        at jrun.servlet.JRunRequestDispatcher.<init>(JRunRequestDispatcher.java:68)
        at jrun.servlet.WebApplicationService.getRequestDispatcher(WebApplicationService.java:1035)
        at jrun.servlet.WebApplicationService.getRequestDispatcher(WebApplicationService.java:1013)
        at jrun.servlet.JRunServletContext.getRequestDispatcher(JRunServletContext.java:181)
        at servlets.WSControlador.gotoPage(WSControlador.java:36)
        at servlets.WSControlador.service(WSControlador.java:91)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
        at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
        at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:226)
        at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
        at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
        at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
        at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

[1]jrun.jsp.compiler.JRunTagLibraryInfo$TLDParseException: Exception parsing the TLD null : The string "--" is not permitted within comments.
        at jrun.jsp.compiler.JRunTagLibraryInfo.init(JRunTagLibraryInfo.java:198)
        at jrun.jsp.compiler.JRunTagLibraryInfo.<init>(JRunTagLibraryInfo.java:119)
        at jrun.jsp.JSPEngine.initBuiltInTagLibrary(JSPEngine.java:183)
        at jrun.jsp.JSPEngine.<init>(JSPEngine.java:135)
        at jrun.jsp.JSPServlet.init(JSPServlet.java:55)
        at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1204)
        at jrun.servlet.JRunRequestDispatcher.init(JRunRequestDispatcher.java:650)
        at jrun.servlet.JRunRequestDispatcher.<init>(JRunRequestDispatcher.java:68)
        at jrun.servlet.WebApplicationService.getRequestDispatcher(WebApplicationService.java:1035)
        at jrun.servlet.WebApplicationService.getRequestDispatcher(WebApplicationService.java:1013)
        at jrun.servlet.JRunServletContext.getRequestDispatcher(JRunServletContext.java:181)
        at servlets.WSControlador.gotoPage(WSControlador.java:36)
        at servlets.WSControlador.service(WSControlador.java:91)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
        at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
        at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:226)
        at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
        at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
        at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
        at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

[0]javax.servlet.ServletException: Exception parsing the TLD null : The string "--" is not permitted within comments.
        at jrun.jsp.JSPEngine.initBuiltInTagLibrary(JSPEngine.java:189)
        at jrun.jsp.JSPEngine.<init>(JSPEngine.java:135)
        at jrun.jsp.JSPServlet.init(JSPServlet.java:55)
        at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1204)
        at jrun.servlet.JRunRequestDispatcher.init(JRunRequestDispatcher.java:650)
        at jrun.servlet.JRunRequestDispatcher.<init>(JRunRequestDispatcher.java:68)
        at jrun.servlet.WebApplicationService.getRequestDispatcher(WebApplicationService.java:1035)
        at jrun.servlet.WebApplicationService.getRequestDispatcher(WebApplicationService.java:1013)
        at jrun.servlet.JRunServletContext.getRequestDispatcher(JRunServletContext.java:181)
        at servlets.WSControlador.gotoPage(WSControlador.java:36)
        at servlets.WSControlador.service(WSControlador.java:91)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
        at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
        at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:226)
        at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
        at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
        at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
        at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


Any help??
0
Comment
Question by:pacazo
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:akshayxx
ID: 8173205
using JNI , u can call C/C++ functions  from java objects,
while the other way round is also possible , calling java code from C/C++ , but i dont think u'll need that for now, as the 'communication between java and c" can be achieved with JNI

u have to be more specific about your requirement.

if u have already written most of code in C and u want to use it in java, then JNI is the way to go ,
while if u have bunch of java classes and u want to invoke them from C/C++ then  the "other way"
0
 
LVL 8

Expert Comment

by:akshayxx
ID: 8173207
please ignore . it wasnt for ur question
0
 
LVL 35

Accepted Solution

by:
girionis earned 225 total points
ID: 8173399
> error Exception parsing the TLD null : The string "--" is not permitted within comments.

  Look at the XML file you are using. You cannot have the "--" inside comments. For example this is not allowed:

<!-- hello -- there -->

  Hope it helps.
0
 

Author Comment

by:pacazo
ID: 8175132
Well, I had a look at web.xml file (actually, I've checked so many xml files as I could) and I did not find the string "--".
But I think you're right, because I've tried to use response.sendRedirect, as well as invoke directly the JSP from another one ('action'), and I'm always getting the same error message.

I'm looking at JRun Application Server console like a man looking at the Keops Pyramid: "What the fu... secret are you keeping inside?"

Thanks girionis, anyway.

0
 
LVL 35

Expert Comment

by:girionis
ID: 8175217
 Thank you for the points :-) If you are running Windows here is a very good tool that helps you search files for specific characters/words/phrases: http://www.inforapid.com/ . It is free if not used on any commercial running computer, otherwise you will have to pay a license fee.

  Maybe you can use this and search the XML file for the "--" character. I am sure it will come up with something :-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

569 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