?
Solved

Help! Why am I getting a null RequestDispatcher instance?

Posted on 2003-03-20
5
Medium Priority
?
380 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
[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
  • 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

Independent Software Vendors: 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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 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