Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to Compile JSP problem in WebApp  RSS feed

 
Nikhil Sun
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a web application and it contains a jsp named abc.jsp.I am calling a java program myjava.java from within abc.jsp.Now myjava.java class extends another class extended.java.
This extended.java class is inside a jar file named myjar.jar.
The abc.jsp is compiled fine but at runtime when i call abc.jsp it gives
"unable to compile jsp" error and states that it could not find extended.java class.Can anyone please give some idea?Is it that any jar that is reference HAS to be placed in the web-inf/lib folder???Currently I am noy having extended.jar in lib folder.It is located in another project in my workspace.
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nikhil.

Originally posted by Nikhil Sun:
... The abc.jsp is compiled fine but at runtime when i call abc.jsp it gives "unable to compile jsp" error and states that it could not find extended.java class.Can anyone please give some idea?Is it that any jar that is reference HAS to be placed in the web-inf/lib folder???Currently I am noy having extended.jar in lib folder.It is located in another project in my workspace.


Then I guess the jsp doesn't compile fine, right? A jsp will be compiled in either start up of the server (if you configured you app. server to do so) or whenever it's accessed for the first time. So, I guess the error you're having at run-time is actually because your jsp is not compiling.

If you're instantiating a Java class in your jsp, you must make this class visible to jsp. If the class is in another project you must somehow add it to the classpath of your project. Placing it (the jar) in the lib folder is a good option.
 
Nikhil Sun
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Melo,I see that if I copy the required jars in lib folder error doesn't come.But is there any alternative to always placing the jars in the lib folder?
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

You can create an ant task to do that for you!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!