Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 20th, 2006, 08:56 AM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default cannot include jar file in jsp

Hi

I am new to JSP. Could anyone plz tell as to how we include a jar file in the jsp. All I know is that we put it in WEB-INF/lib folder. But it does not fix my problem. If I write : <%@ page import = "WEB-INF/lib/*.jar" %> I get the following error in TOMCAT:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
E:\Tomcat\work\Catalina\localhost\RssHelper\org\ap ache\jsp\displaynews_jsp.java:10: '.' expected
import WEB-INF/lib/*.jar;
         ^


Generated servlet error:
E:\Tomcat\work\Catalina\localhost\RssHelper\org\ap ache\jsp\displaynews_jsp.java:10: unclosed comment
import WEB-INF/lib/*.jar;
                 ^


Generated servlet error:
E:\Tomcat\work\Catalina\localhost\RssHelper\org\ap ache\jsp\displaynews_jsp.java:128: <identifier> expected
^
3 errors


If I remove the import tag from the jsp, but have the jar in the lib folder, even then i get the following error:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: org/apache/xerces/framework/XMLParser
    org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:825)
    org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:758)
    org.apache.jsp.displaynews_jsp._jspService(display news_jsp.java:119)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    web.NewsSelect.doPost(NewsSelect.java:35)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


root cause

java.lang.NoClassDefFoundError: org/apache/xerces/framework/XMLParser
    org.apache.jsp.displaynews_jsp.ParseXML(displaynew s_jsp.java:17)
    org.apache.jsp.displaynews_jsp._jspService(display news_jsp.java:103)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    web.NewsSelect.doPost(NewsSelect.java:35)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Actually, I want to include the xerces.jar file from apache in the jsp.

Thnx in advance
Reply With Quote
  #2 (permalink)  
Old November 28th, 2006, 03:22 AM
Registered User
 
Join Date: Nov 2006
Location: New Delhi, Delhi, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to LordRamChandra Send a message via Yahoo to LordRamChandra
Default

I am getting the same error (500) when I try to run a jsp that fetches server time. I am using java.util.Date package. It also says it cannot find out.write() even when I have not used it!

Perfection is difficult to improve
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading xml file which is in a JAR file pradheepayyanar J2EE 2 December 26th, 2007 05:52 AM
cant use jar file SweeT EviL Java Basics 1 October 9th, 2007 11:48 AM
how to include jsp page in xsl vijayanmsc XSLT 2 August 23rd, 2006 05:04 AM
difference between include file & include virtual crmpicco Classic ASP Basics 2 January 23rd, 2006 11:50 AM
Accessing properties file outside jar file anand_indya J2EE 0 December 8th, 2004 06:34 AM



All times are GMT -4. The time now is 07:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.