Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.