Remove the JSTL TLD files from WEB-INF.

Remove the JSTL <taglib> entries from web.xml.

Use a Servlet 2.4 deployment descriptor:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
         version="2.4">
  ...
</web-app>

Quoting Anna Lissa Saupan <[EMAIL PROTECTED]>:

> Thanks for the help.  
> 
> The solution provided fixed the error
> java.lang.NoClassDefFoundError:       javax/servlet/jsp/tagext/TagLibraryValidator.
>  
> JAVA_HOME/jre/lib/ext contained standard.jar and jstl.jar which I
> moved/deleted.
> 
> The other JAR files in JAVA_HOME/jre/lib/ext are:
> dnsns.jar  ldapsec.jar  localedata.jar  sunjce_provider.jar
> 
> I got a weird result though from the simple webapp below.  Here is the
> result I got:
> ${i} 
> ${i} 
> ${i} 
> ${i} 
> ${i} 
> ${i} 
> ${i} 
> ${i} 
> ${i} 
> ${i}
> 
> I thought, the code will have a result of:
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 
> Thanks again for all the help.
> 
>  On Tue, 2003-11-25 at 20:10, Hans Bergsten wrote:
> > Anna Lissa Saupan wrote:
> > > Thanks for the help.  
> > > 
> > > I've been toiling away with the suggestion mentioned below the last few
> > > days, migrating my JSTL1.0/TC 4.* to JSTL1.1/TC5.*, and I still cannot
> > > make it work :(  So, I tried to run a really simple webapp to test if
> > > the JSTL Core library will run on my server.  Unfortunately, even this
> > > simple webapp doesn't run.  I still get the error:
> > > java.lang.NoClassDefFoundError:
> > > javax/servlet/jsp/tagext/TagLibraryValidator
> > 
> > It looks like Tomcat is picking up an old (JSP 1.1) version of the
> > JSP classes. Make sure you don't have any JSP or Servlet related JAR
> > files in the JAVA_HOME/jre/lib/ext directory, because JAR files there
> > override the ones bundled with Tomcat (or any other servlet container,
> > for that matter).
> > 
> > Hans
> > 
> > > Here is the structure of the simple webapp.  I'm also adding the source
> > > code of the JSP file and web.xml.  Please correct any errors that I
> > > might have missed since I'm such a newbie at this thing.  
> > > 
> > > Thanks again for any help.
> > > 
> > > Web-app directory structure:
> > > .:
> > > index.html  jstl-simple.jsp  WEB-INF
> > >  
> > > ./WEB-INF:
> > > classes  c.tld  lib  web.xml  
> > >  
> > > ./WEB-INF/classes:
> > >  
> > > ./WEB-INF/lib:
> > > jstl.jar  standard.jar
> > > 
> > > ********jstl-simple.jsp
> > > <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> > > <html>
> > >   <head>
> > >     <title>Count to 10 Example (using JSTL)</title>
> > >   </head>
> > >                                                                          
>       
> > >   <body>
> > >     <c:forEach var="i" begin="1" end="10" step="1">
> > >       <c:out value="${i}" />
> > >                                                                          
>       
> > >       <br />
> > >     </c:forEach>
> > >   </body>
> > > </html>
> > > *************web.xml
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >                                                                          
>                                                    
> > > <!DOCTYPE web-app PUBLIC
> > >   '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
> > >   'http://java.sun.com/dtd/web-app_2_3.dtd'>
> > >                                                                          
>                                                    
> > > <web-app>
> > >   <servlet>
> > >     <servlet-name>Home Page</servlet-name>
> > >     <jsp-file>/index.html</jsp-file>
> > >   </servlet>
> > >   <servlet>
> > >     <servlet-name>JSTL-Simple</servlet-name>
> > >     <jsp-file>/jstl-simple.jsp</jsp-file>
> > >   </servlet>
> > >   <servlet-mapping>
> > >     <servlet-name>JSTL-Simple</servlet-name>
> > >     <url-pattern>/jstl-simple</url-pattern>
> > >   </servlet-mapping>
> > >   <taglib>
> > >     <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
> > >     <taglib-location>/WEB-INF/c.tld</taglib-location>
> > >   </taglib>
> > >   <resource-ref>
> > >     <res-ref-name>jdbc/conversion</res-ref-name>
> > >     <res-type>javax.sql.DataSource</res-type>
> > >     <res-auth>Container</res-auth>
> > >   </resource-ref>
> > > </web-app>
> > > 
> > > 
> > > On Wed, 2003-11-19 at 11:28, Kris Schneider wrote:
> > > 
> > >>If you're using TC 5, you should also be using JSTL 1.1. Instead of
> putting the
> > >>JSTL JAR files in $CATALINA_HOME/common/lib, put them in your app's
> WEB-INF/lib
> > >>directory. Note that the taglib URIs have changed between JSTL 1.0 and
> 1.1. For
> > >>example:
> > >>
> > >>1.0:
> > >>http://java.sun.com/jstl/core
> > >>
> > >>1.1:
> > >>http://java.sun.com/jsp/jstl/core
> > >>
> > >>Quoting Anna Lissa Saupan <[EMAIL PROTECTED]>:
> > >>
> > >>
> > >>>Thanks for the help.
> > >>>
> > >>>I did what you suggested.  I deployed the application-examples.war
> that
> > >>>came with the JSTL distribution, which runs properly.  It was also
> > >>>suggested that:
> >
>
>>>CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/*.jar:$JAVA_HOME/jre/lib/*.jar:$AXISCLASSPATH
> > >>>cannot be properly parsed by Linux/Unix.  "The /*.jar statements won't
> > >>>parse correctly under any version of *nix that I
> > >>>know of ;-)."
> > >>>so I modified my CLASSPATH to:
> > >>>CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$AXISCLASSPATH
> > >>>
> > >>>When I run application-examples.war, I get this result (selected):
> > >>>org.apache.catalina.jsp_classpath =
> >
> >>>/opt/jakarta-tomcat-5.0.12/webapps/application-examples/WEB-INF/classes/
> > >>>
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/webapps/application-examples/WEB-INF/lib/taglibs-application.jar
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/shared/classes/:/opt/jakarta-tomcat-5.0.12/common/classes/
> > >>
> > >>>:/opt/jakarta-tomcat-5.0.12/common/endorsed/xercesImpl.jar
> > >>>:/opt/jakarta-tomcat-5.0.12/common/endorsed/xmlParserAPIs.jar
> > >>>:/opt/jakarta-tomcat-5.0.12/common/lib/jasper-compiler.jar
> > >>>
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/jmx.jar:/opt/jakarta-tomcat-5.0.12/common/lib/commons-el.jar
> > >>
> > >>>:/opt/jakarta-tomcat-5.0.12/common/lib/commons-collections.jar
> > >>>:/opt/jakarta-tomcat-5.0.12/common/lib/naming-java.jar
> > >>>:/opt/jakarta-tomcat-5.0.12/common/lib/commons-pool.jar
> > >>>
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/jasper-runtime.jar:/opt/jakarta-tomcat-5.0.12/common/lib/naming-factory.jar
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/servlet-api.jar:/opt/jakarta-tomcat-5.0.12/common/lib/naming-resources.jar
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/commons-dbcp.jar:/opt/jakarta-tomcat-5.0.12/common/lib/ant.jar
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/naming-common.jar:/opt/jakarta-tomcat-5.0.12/common/lib/jsp-api.jar
> > >>
> >
>
>>>:/opt/jakarta-tomcat-5.0.12/common/lib/mysql-connector-java-3.0.9-stable-bin.jar
> > >>>
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/j2ee.jar:/opt/jakarta-tomcat-5.0.12/common/lib/jstl.jar
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/common/lib/standard.jar:/opt/j2sdk_nb/j2sdk1.4.2/lib/tools.jar
> > >>
> >
>
>>:/opt/jakarta-tomcat-5.0.12/bin/bootstrap.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/sunjce_provider.jar
> > >>
> >
>
>>:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/dnsns.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/jstl.jar
> > >>
> >
>
>>:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/ldapsec.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/localedata.jar
> > >>
> > >>>:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/standard.jar
> > >>>
> > >>>I also added jstl.jar and standard.jar to <CATALINA_HOME>/common/lib
> so
> > >>>all my web-apps can use it.
> > >>>
> > >>>JSP applications with custom taglibs can be run properly in my server,
> > >>>only when I try to use the JSTL distribution that it fails.
> > >>>
> > >>>Can one reason be that taglibs v1.0 is not supported by Tomcat 5.*.*? 
> > >>>I'm trying to run JSTL application examples that came with "Tomcat
> Kick
> > >>>Start" by M. Bond, and D. Law.  This book applies to Tomcat 4.* and
> > >>>Taglib v1.0.  
> > >>>
> > >>>My next recourse is to convert the apps to its most current version.
> > >>>
> > >>>Thanks again.
> > >>>
> > >>>On Tue, 2003-11-18 at 16:05, Kris Schneider wrote:
> > >>>
> > >>>>Your classpath shouldn't matter. The TC startup script will ignore it
> and
> > >>>
> > >>>build
> > >>>
> > >>>>its own. Have you tried deploying the standard-examples.war
> application
> > >>>
> > >>>that
> > >>>
> > >>>>comes with the JSTL distribution? Have you modified either your TC or
> JDK
> > >>>>install? For example, by adding or removing JAR files, perhaps for
> XML
> > >>>
> > >>>parsers?
> > >>>
> > >>>>Quoting Anna Lissa Saupan <[EMAIL PROTECTED]>:
> > >>>>
> > >>>>
> > >>>>>Hi,
> > >>>>>
> > >>>>>Any help will be greatly appreciated.
> > >>>>>
> > >>>>>My current server has the following environment:
> > >>>>>Tomcat Version => Apache Tomcat/5.0.12
> > >>>>>JVM Version => 1.4.2-b28
> > >>>>>JVM Vendor => Sun Microsystems Inc.
> > >>>>>Redhat Linux 9
> > >>>>>   OS Name => Linux
> > >>>>>   OS Version => 2.4.20-8
> > >>>>>   OS Architecture => i386
> > >>>>>Tag Library => 1.1
> > >>>>>
> > >>>>>Profile setup (selected):
> > >>>>>
> > >>>
> >
>
>>>CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/*.jar:$JAVA_HOME/jre/lib/*.jar:$AXISCLASSPATH
> > >>>
> >
>
>>AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:$AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:$AXIS_LIB/log4j-1.2.8.jar:$CATALINA_HOME/common/endorsed/xercesImpl.jar:$CATALINA_HOME/common/endorsed/xml-apis.jar:$CATALINA_HOME/common/endorsed/xmlParserAPIs.jar:$AXIS_LIB/wsdl4j.jar:$CATALINA_HOME/common/lib/activation.jar
> > >>
> > >>>>>servlet-api.jar can be found in <CATALINA_HOME>/common/lib 
> > >>>>> 
> > >>>>>I'm trying to run JSP applications that uses JSTL but I get this
> error
> > >>>>>all the time.  I get the same error even while running the simplest
> > >>>
> > >>>JSTL
> > >>>
> > >>>>>application.
> > >>>>>
> > >>>>>Here is the Server Error that I get:
> > >>>>>
> > >>>>>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:
> > >>>>>javax/servlet/jsp/tagext/TagLibraryValidator
> > >>>>>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256)
> > >>>>>       javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> > >>>>>
> > >>>>>root cause
> > >>>>>
> > >>>>>
> > >>>>>java.lang.NoClassDefFoundError:
> > >>>>>javax/servlet/jsp/tagext/TagLibraryValidator
> > >>>>>       java.lang.ClassLoader.defineClass0(Native Method)
> > >>>>>       java.lang.ClassLoader.defineClass(ClassLoader.java:537)
> > >>>>>
> > >>>
> >
> >>>   java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> > >>>
> > >>>>>       java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> > >>>>>       java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> > >>>>>       java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> > >>>>>       java.security.AccessController.doPrivileged(Native Method)
> > >>>>>       java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> > >>>>>       java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> > >>>>>       java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> > >>>>>       java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> > >>>>>       java.lang.ClassLoader.defineClass0(Native Method)
> > >>>>>       java.lang.ClassLoader.defineClass(ClassLoader.java:537)
> > >>>>>
> > >>>
> >
> >>>   java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> > >>>
> > >>>>>       java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> > >>>>>       java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> > >>>>>       java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> > >>>>>       java.security.AccessController.doPrivileged(Native Method)
> > >>>>>       java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> > >>>>>       java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> > >>>>>       java.lang.ClassLoader.loadClass(ClassLoader.java:282)
> > >>>>>       sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> > >>>>>       java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> > >>>>>
> > >>>>
> >
>
>>org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1278)
> > >>
> >
>
>>org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1212)
> > >>
> >
>
>>org.apache.jasper.compiler.TagLibraryInfoImpl.createValidator(TagLibraryInfoImpl.java:654)
> > >>
> >
>
>>org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:293)
> > >>
> >
> >>>   org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:204)
> > >>>
> >
> >>>   org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
> > >>>
> > >>>>>       org.apache.jasper.compiler.Parser.parseDirective(Parser.java:525)
> > >>>>>       org.apache.jasper.compiler.Parser.parseElements(Parser.java:1625)
> > >>>>>       org.apache.jasper.compiler.Parser.parse(Parser.java:173)
> > >>>>>
> > >>>
> >
> >>>   org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
> > >>>
> >
> >>>   org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
> > >>>
> >
> >>>   org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
> > >>>
> > >>>>>       org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
> > >>>>>       org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
> > >>>>>       org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
> > >>>>>
> > >>>
> >
> >>>
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
> > >>>
> >
> >>>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
> > >>>
> >
> >>>   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
> > >>>
> > >>>>>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
> > >>>>>       javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> > >>>>>
> > >>>>>note The full stack trace of the root cause is available in the
> Tomcat
> > >>>>>logs.
> > >>>>>
> > >>>>>
> > >>>>>************
> > >>>>>************
> > >>>>>
> > >>>>>Thanks.

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to