tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Help needed to run JSTL 1.1 in Tomcat 6.0.16
Date Wed, 20 May 2009 12:38:54 GMT
The setup looks good from what I can tell.  The only side note (and this
isn't causing your error) is to drop the ?autoconnect=true from your
mysql URL, replacing it with a validationQuery attribute in the
<Resource .../> element.  The error itself makes me think your jstl jars
aren't visible to tomcat.  Can you provide more information about your
file layout ... especially any differences between the working Eclipse
setup and the non-working setup?

--David

Deepa Annamalai wrote:
> ---------- Forwarded message ----------
> From: Deepa Annamalai <deardeepa76@gmail.com>
> Date: 2009/5/20
> Subject: Help needed to run JSTL 1.1 in Tomcat 6.0.16
> To: users@tomcat.apache.org
>
>
> Hi All,
>
> Help needed to run JSTL 1.1 in Tomcat 6.0.16
>
> I am trying to run the example given in
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
>
> The example tries to connect to MySQL database from JSP using JSTL and JNDI
> Datasource.I am running the example using Eclipse 3.4.2 using Sysdeo plugin
> to start and stop Tomcat server from Eclipse IDE.
>
> My *web.xml* file looks like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" *
> version="2.5"*>
>   <display-name>DBTest</display-name>
>   <description>MySQL Test App</description>
>   <resource-ref>
>       <description>DB Connection</description>
>       <res-ref-name>jdbc/TestDB</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>   </resource-ref>
> </web-app>
>
> and* test.jsp* looks like this
>
> *<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>*
>
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select id, foo, bar from testdata
> </sql:query>
>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>     pageEncoding="ISO-8859-1"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>DB Test</title>
> </head>
> <body>
> <h2>Results</h2>
>
> <c:forEach var="row" items="${rs.rows}">
>     Foo ${row.foo}<br/>
>     Bar ${row.bar}<br/>
> </c:forEach>
>
> </body>
> </html>
>
>
> I have placed the *jstl.jar* and *standard.jar* of
> the*jakarta-taglibs-standard-1.1.2.zip
> *  under E:\Deepa\workspace\DBTest\WebContent\WEB-INF\lib directory
>
> I have also placed context.xml file under
> E:\Deepa\workspace\DBTest\WebContent\META-INF and the content of *
> context.xml* is as below
>
> <Context path="/DBTest" docBase="DBTest"
>         debug="5" reloadable="true" crossContext="true">
>               <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
>                maxActive="100" maxIdle="30" maxWait="10000"
>                username="deepa" password="mysql"
>                driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>
> </Context>
>
> Now while running the example, Eclipse creates one *DBTest.xml* file
> under C:\Program
> Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
> which has the following line:
>
> <Context path="/DBTest" reloadable="true"
> docBase="E:\Deepa\workspace\DBTest" workDir="E:\Deepa\workspace\DBTest\work"
> />
>
>
> I am getting the following error in Firefox Browser:
>
> 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: *The absolute uri:
> http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml
> or the jar files deployed with this application*
>
> 	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
> 	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
> 	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
>
> 	org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
> 	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
> 	org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
>
> 	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
> 	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
> 	org.apache.jasper.compiler.Parser.parse(Parser.java:138)
> 	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
>
> 	org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
> 	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
> 	org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
> 	org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
>
> 	org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
> 	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>
> In the Tomcat Server console, I am getting the following error:
>
> May 20, 2009 6:33:30 AM org.apache.catalina.core.AprLifecycleListener init
> INFO: The APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path: C:\Program
> Files\Java\jdk1.6.0_13\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program
> Files\Java\jdk1.6.0_13\jre\bin;C:/Program
> Files/Java/jre6/bin/client;C:/Program
> Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
> Files\MySQL\MySQL Server 5.1\bin;C:\Program Files\Java\jdk1.6.0_10\bin;
> May 20, 2009 6:33:32 AM org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on http-80
> May 20, 2009 6:33:32 AM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 3798 ms
> May 20, 2009 6:33:32 AM org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> May 20, 2009 6:33:32 AM org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
> May 20, 2009 6:33:35 AM org.apache.catalina.startup.HostConfig deployWAR
> INFO: Deploying web application archive sample.war
> May 20, 2009 6:33:39 AM org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> May 20, 2009 6:33:39 AM org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> May 20, 2009 6:33:39 AM org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: attributeAdded('org.apache.catalina.Registry',
> 'org.apache.tomcat.util.modeler.Registry@e0420b')
> May 20, 2009 6:33:39 AM org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: attributeAdded('org.apache.catalina.MBeanServer',
> 'com.sun.jmx.mbeanserver.JmxMBeanServer@10ff62a')
> May 20, 2009 6:33:39 AM org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-80
> May 20, 2009 6:33:39 AM org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> May 20, 2009 6:33:39 AM org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/125  config=null
> May 20, 2009 6:33:39 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 7295 ms
> *May 20, 2009 6:36:48 AM org.apache.jasper.compiler.TldLocationsCache
> processWebDotXml
> WARNING: Internal Error: File /WEB-INF/web.xml not found
> May 20, 2009 6:36:48 AM org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet jsp threw exception
> org.apache.jasper.JasperException: The absolute uri:
> http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the
> jar files deployed with this application*
>     at
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
>     at
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
>     at
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
>     at
> org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
>     at
> org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
>     at
> org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
>     at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
>     at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
>     at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
>     at
> org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
>     at
> org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
>     at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
>     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
>     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
>     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
>     at
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
>     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
>     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>     at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>     at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>     at java.lang.Thread.run(Thread.java:619)
>
>
> what is the problem with my code?
>
> *When running the same example, by creating a local server in
> Eclipse(creating new Server connection pointing to same Tomcat 6.0
> installation) it runs fine without any error.*
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message