aspose file tools*
The moose likes Servlets and the fly likes RequestDispatcher forward and Unable to compile class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher forward and Unable to compile class" Watch "RequestDispatcher forward and Unable to compile class" New topic
Author

RequestDispatcher forward and Unable to compile class

Jerry Mcguire
Greenhorn

Joined: Mar 16, 2011
Posts: 5
Hello everyone,

My new guy has created a small prototype webapp for us which runs on his notebook with Tomcat6 and SunJDK. The 'jar' is then deployed to our machine with Tomcat5.5 and OpenJDK, which doesn't look good.

The web browser reports an HTTP Status 500 saying 'Unable to compile class for JSP...'


When I trace the java source code, I find that the exception is generated from the following line:


The CLASSPATH and java version:


What are we missing and how to make it work just like on the the new guy's machine? Please help. Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
What can't be compiled is a JSP page, not a servlet. Which page are you trying to access when the error occurs? That's where you need to look for the problem.


Ping & DNS - updated with new look and Ping home screen widget
Jerry Mcguire
Greenhorn

Joined: Mar 16, 2011
Posts: 5
Thanks for replying...

The URL in the web browser that display the error is
http://localhost:8080/myproj/do

Line number 09. of the MainServlet says 'url' is "/myproj/home.jsp", and which we intend to mean $TOMCAT_HOME/webapps/myproj/home.jsp

$ cat web.xml :
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Jerry,

Since your url-pattern is /do/*,

try sending the request like,
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 507
Hello,
"home.jsp" is the place where the compilation error is coming.
You will need to debug that to resolve the problem.
Check what is happening in the "home.jsp" and let us know.


regards,
amit
Jerry Mcguire
Greenhorn

Joined: Mar 16, 2011
Posts: 5
Same error screen with do/abc do/something ... any specific action should follow do/?

I confess that I'm completely new to java, javascripts... had only done some helloworld with JSP before.
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Jerry,

Could you please send complete source code of "MainServlet" and your jsp?
Jerry Mcguire
Greenhorn

Joined: Mar 16, 2011
Posts: 5
Hold on a second...

following amit punkar's advice...
By removing the following import in the home.jsp, everything suddenly shows up. I haven't verified the functionalities of the content yet, but it's progress.



What is wrong with this line?
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
I think 'Session' is not a class here. I think this causes the problem
Jerry Mcguire
Greenhorn

Joined: Mar 16, 2011
Posts: 5
Thank you amit punekar and Chinmaya Chowdary.

I find hope today!
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 507
Hello,
"org.apache.catalina.Session" is an internal Tomcat API.
Why you needed to import that?
Anyway its good that your problem is resolved.

Regds,
amit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher forward and Unable to compile class
 
Similar Threads
Compile Error! help!!!
JAVA_HOME does not point to the JDK
Help - problem with a fresh install of tomcat and JSP - SOLVED
Jsp Error 500
Error : The code of method _jspService(...) is exceeding the 65535 bytes