You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Toone <jo...@btinternet.com> on 2003/05/09 15:39:19 UTC
Re: Issue with tag library descriptor configuration [long] [SOLVED]
Resolved the issue.
added commons-logging, got loads of trace info in logs, realised I was a
berk :)
I'd put the <resource-ref></resource-ref> gubbins before I'd closed the
<servlet> entries. Error 51 Exception initializing TldLocationsCache: XML
parsing error on file /WEB-INF/web.xml etc. gave the game away. Valuable
learning experience, time for a coffee.
thanks for the assistance chaps
----- Original Message -----
From: "John Toone" <jo...@btinternet.com>
To: "STRUTS-USER" <st...@jakarta.apache.org>
Sent: Thursday, May 08, 2003 7:38 PM
Subject: Issue with tag library descriptor configuration [long]
> I've an issue with mapping the tag library descriptors to the tag library
> locations.
> If I use
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> in the header of my jsps they compile fine, the back end database is
> accessed successfully and all tags are parsed successfully.
>
> If I use the format
> <%@ taglib uri="/tags/struts-html" prefix="html" %>
> I receive the following error when the jsp is accessed
>
> org.apache.jasper.JasperException: Exception forwarding for name welcome:
> org.apache.jasper.JasperException: File "/tags/struts-html" not found
>
>
> My understanding from the code examples included with Struts is that the
> previous format should work. It is not an urgent problem (I think) as
there
> is a work around available, use the syntax in the first example, however
> I'm concerned that this may reflect a deeper problem that I may trip over
> later. I would appreciate it if someone could indicate where the problem
> may lie. I'm using Tomcat 4.1.18 and the Struts nightly build from the
7th
> May on a Linux box, Though I had the same problem with Struts 1.0.2. The
> problem seemed to start when I added connection pooling to Tomcat and
> doesn't occur with the other apps included in the Struts distribution.
I've
> added my server.xml, struts-config.xml and web.xml to the end of the
mail.
> In an attempt to resolve the issue I've performed the following tasks
> 1. Compared my versions of the config files with those in the example
apps.
> Seem to be similar other than the resource definitions.
> 2. Upgraded from Struts 1.0.2 to Struts nightly build (7th May)
> 3. Reverted to the original server.xml file included in the Tomcat
> distribution, removed my application. From under web-apps, deleting the
> directory and contents.
> 4. Re-created the app from the blank war and amended the server.xml to
> include a context for the app to support postgresql connection pooling.
No
> problems with the tag libs at this point.
> 5. Added the action classes, business layer class sources and so on from
> backup. Recreate the web.xml and struts-config.xml from scratch, just in
> case, whatever. Taglib location problem recurs.
>
> In between each of these steps I've bounced Tomcat and reloaded the app.
> Problem persists. In addition I've googled, searched mailing list
> archives, and whether it reflects on my search skills or lack of info,
come
> up with naught. I've spent the last seven hours on this and my head
hurts.
> Help would be appreciated.
>
> thanks in advance.
>
> Web.xml
> ======================================
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
> <web-app>
> <!-- Country Pursuits Action Servlet Configuration (with debugging) -->
> <servlet>
> <servlet-name>action</servlet-name>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
> <param-name>application</param-name>
> <param-value>resources.application</param-value>
> </init-param>
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>debug</param-name>
> <param-value>2</param-value>
> </init-param>
> <init-param>
> <param-name>detail</param-name>
> <param-value>2</param-value>
> </init-param>
> <load-on-startup>2</load-on-startup>
> <resource-ref>
> <description>postgreSQL Datasource</description>
> <res-ref-name>jdbc/postgres</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> </servlet>
> <!-- Standard Action Servlet Mapping -->
> <servlet-mapping>
> <servlet-name>action</servlet-name>
> <url-pattern>*.do</url-pattern>
> </servlet-mapping>
>
>
> <!-- The Usual Welcome File List -->
> <welcome-file-list>
> <welcome-file>/index.jsp</welcome-file>
> </welcome-file-list>
>
> <!-- Struts Tag Library Descriptors -->
> <taglib>
> <taglib-uri>/tags/struts-bean</taglib-uri>
> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
> </taglib>
>
> <taglib>
> <taglib-uri>/tags/struts-html</taglib-uri>
> <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
> </taglib>
>
> <taglib>
> <taglib-uri>/tags/struts-logic</taglib-uri>
> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
> </taglib>
>
> <taglib>
> <taglib-uri>/tags/struts-nested</taglib-uri>
> <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
> </taglib>
>
> <taglib>
> <taglib-uri>/tags/struts-tiles</taglib-uri>
> <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
> </taglib>
>
>
> </web-app>
> =====================================
>
> struts-config.xml
> =====================================
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration
1.0//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
>
> <struts-config>
>
>
> <!-- ========== Form Bean Definitions
> =================================== -->
> <form-beans>
> <!-- -->
> <form-bean
> name="logonForm"
> type="app.LogonForm"/>
> <form-bean
> name="eventForm"
> type="app.EventForm"/>
> <form-bean
> name="eventListForm"
> type="app.EventList"/>
>
> </form-beans>
>
>
> <!-- ========== Global Forward Definitions
> ============================== -->
> <global-forwards>
> <forward
> name="logoff"
> path="/Logoff.do"/>
> <forward
> name="logon"
> path="/Logon.do"/>
> <forward
> name="welcome"
> path="/Welcome.do"/>
> <forward
> name="event_list"
> path="/EventList.do"/>
> <forward
> name="event_input"
> path="/EventAdd.do"/>
> <forward
> name="event_amend"
> path="/EventAmend.do"/>
> <forward
> name="event_amend_display"
> path="/EventAmendDisplay.do"/>
> </global-forwards>
>
>
> <!-- ========== Action Mapping Definitions
> ============================== -->
> <action-mappings>
>
> <!-- Welcome action -->
> <action
> path="/Logoff"
> type="app.LogoffAction">
> <forward
> name="success"
> path="/pages/Welcome.jsp"/>
> </action>
> <action
> path="/Logon"
> type="org.apache.struts.actions.ForwardAction"
> parameter="/pages/Logon.jsp"/>
> <action
> path="/Welcome"
> type="org.apache.struts.actions.ForwardAction"
> parameter="/pages/Welcome.jsp"/>
> <action
> path="/EventList"
> type="app.EventListAction"
> name="eventListForm"
> scope="request"
> input="/pages/Welcome.jsp">
> <forward
> name="event_display"
> path="/pages/EventHome.jsp"/>
> </action>
> <action
> path="/EventAdd"
> type="org.apache.struts.actions.ForwardAction"
> parameter="/pages/EventInput.jsp"/>
> <action
> type="app.EventAmendAction"
> path="/EventAmend"
> name="eventForm"
> scope="request"
> validate="false"
> input="/pages/Welcome.jsp">
> <forward
> name="event_amend_display"
> path="/pages/EventAmend.jsp"/>
> </action>
> <action
> path="/EventAmendDisplay"
> type="org.apache.struts.actions.ForwardAction"
> parameter="/pages/EventAmend.jsp"/>
> <action
> path="/EventEntry"
> type="app.EventAddAction"
> name="eventForm"
> scope="request"
> input="/EventAdd.do">
> <forward
> name="event_display"
> path="/EventList.do"/>
> </action>
> <action
> type="app.LogonAction"
> path="/LogonSubmit"
> name="logonForm"
> scope="request"
> validate="true"
> input="/pages/Logon.jsp"/>
> <action
> type="app.EventAmendSubmitAction"
> path="/EventAmendSubmit"
> name="eventForm"
> scope="request"
> validate="true"
> input="/pages/EventAmend.jsp">
> <forward
> name="event_display"
> path="/EventList.do"/>
> </action>
> </action-mappings>
> </struts-config>
> ==============================================
>
> server.xml
> ==============================================
> <!-- Alternate Example-less Configuration File -->
> <!-- Note that component elements are nested corresponding to their
> parent-child relationships with each other -->
>
> <!-- A "Server" is a singleton element that represents the entire JVM,
> which may contain one or more "Service" instances. The Server
> listens for a shutdown command on the indicated port.
>
> Note: A "Server" is not itself a "Container", so you may not
> define subcomponents such as "Valves" or "Loggers" at this level.
> -->
>
> <Server port="8005" shutdown="SHUTDOWN" debug="0">
>
>
> <!-- Uncomment this entry to enable JMX MBeans support -->
> <!--
> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
> debug="0" port="-1" login="admin" password="admin"/>
> -->
>
>
> <!-- A "Service" is a collection of one or more "Connectors" that share
> a single "Container" (and therefore the web applications visible
> within that Container). Normally, that Container is an "Engine",
> but this is not required.
>
> Note: A "Service" is not itself a "Container", so you may not
> define subcomponents such as "Valves" or "Loggers" at this level.
> -->
>
> <!-- Define the Tomcat Stand-Alone Service -->
> <Service name="Tomcat-Standalone">
>
> <!-- A "Connector" represents an endpoint by which requests are
received
> and responses are returned. Each Connector passes requests on to
> the
> associated "Container" (normally an Engine) for processing.
>
> By default, a non-SSL HTTP/1.1 Connector is established on port
> 8080.
> You can also enable an SSL HTTP/1.1 Connector on port 8443 by
> following the instructions below and uncommenting the second
> Connector
> entry. SSL support requires the following steps (see the SSL
> Config
> HOWTO in the Tomcat 4.0 documentation bundle for more detailed
> instructions):
> * Download and install JSSE 1.0.2 or later, and put the JAR files
> into "$JAVA_HOME/jre/lib/ext".
> * Execute:
> %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
> (Windows)
> $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
> (Unix)
> with a password value of "changeit" for both the certificate
and
> the keystore itself.
>
> By default, DNS lookups are enabled when a web application calls
> request.getRemoteHost(). This can have an adverse impact on
> performance, so you can disable it by setting the
> "enableLookups" attribute to "false". When DNS lookups are
> disabled,
> request.getRemoteHost() will return the String version of the
> IP address of the remote client.
> -->
>
> <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
> <Connector
className="org.apache.catalina.connector.http.HttpConnector"
> port="8080" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443"
> acceptCount="10" debug="0" connectionTimeout="60000"/>
> <!-- Note : To disable connection timeouts, set connectionTimeout
value
> to -1 -->
>
> <!-- Define an SSL HTTP/1.1 Connector on port 8443 -->
> <!--
> <Connector
className="org.apache.catalina.connector.http.HttpConnector"
> port="8443" minProcessors="5" maxProcessors="75"
> enableLookups="true"
> acceptCount="10" debug="0" scheme="https" secure="true">
> <Factory className="org.apache.catalina.net.SSLServerSocketFactory"
> clientAuth="false" protocol="TLS"/>
> </Connector>
> -->
>
> <!-- Define an AJP 1.3 Connector on port 8009 -->
> <!--
> <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
> port="8009" minProcessors="5" maxProcessors="75"
> acceptCount="10" debug="0"/>
> -->
>
> <!-- Define a Proxied HTTP/1.1 Connector on port 8081 -->
> <!-- See proxy documentation for more information about using
this. -->
> <!--
> <Connector
className="org.apache.catalina.connector.http.HttpConnector"
> port="8081" minProcessors="5" maxProcessors="75"
> enableLookups="true"
> acceptCount="10" debug="0" connectionTimeout="60000"
> proxyPort="80"/>
> -->
>
> <!-- Define a non-SSL HTTP/1.0 Test Connector on port 8082 -->
> <!--
> <Connector
> className="org.apache.catalina.connector.http10.HttpConnector"
> port="8082" minProcessors="5" maxProcessors="75"
> enableLookups="true" redirectPort="8443"
> acceptCount="10" debug="0"/>
> -->
>
> <!-- An Engine represents the entry point (within Catalina) that
> processes
> every request. The Engine implementation for Tomcat stand alone
> analyzes the HTTP headers included with the request, and passes
> them
> on to the appropriate Host (virtual host). -->
>
> <!-- Define the top level container in our container hierarchy -->
> <Engine name="Standalone" defaultHost="localhost" debug="0">
>
> <!-- The request dumper valve dumps useful debugging information
about
> the request headers and cookies that were received, and the
> response
> headers and cookies that were sent, for all requests received
by
> this instance of Tomcat. If you care only about requests to a
> particular virtual host, or a particular application, nest this
> element inside the corresponding <Host> or <Context> entry
> instead.
>
> For a similar mechanism that is portable to all Servlet 2.3
> containers, check out the "RequestDumperFilter" Filter in the
> example application (the source for this filter may be found in
> "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
>
> Request dumping is disabled by default. Uncomment the
following
> element to enable it. -->
> <!--
> <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
> -->
>
> <!-- Global logger unless overridden at lower levels -->
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="catalina_log." suffix=".txt"
> timestamp="true"/>
>
> <!-- Because this Realm is here, an instance will be shared
> globally -->
>
> <Realm className="org.apache.catalina.realm.MemoryRealm" />
>
> <!-- Replace the above Realm with one of the following to get a
Realm
> stored in a database and accessed via JDBC -->
>
> <!--
> <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
> driverName="org.gjt.mm.mysql.Driver"
> connectionURL="jdbc:mysql://localhost/authority"
> connectionName="test" connectionPassword="test"
> userTable="users" userNameCol="user_name"
> userCredCol="user_pass"
> userRoleTable="user_roles" roleNameCol="role_name" />
> -->
>
> <!--
> <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
> driverName="oracle.jdbc.driver.OracleDriver"
> connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
> connectionName="scott" connectionPassword="tiger"
> userTable="users" userNameCol="user_name"
> userCredCol="user_pass"
> userRoleTable="user_roles" roleNameCol="role_name" />
> -->
>
> <!--
> <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
> driverName="sun.jdbc.odbc.JdbcOdbcDriver"
> connectionURL="jdbc:odbc:CATALINA"
> userTable="users" userNameCol="user_name"
> userCredCol="user_pass"
> userRoleTable="user_roles" roleNameCol="role_name" />
> -->
>
> <!-- Define the default virtual host -->
> <Host name="localhost" debug="0" appBase="webapps"
> unpackWARs="true" autoDeploy="true">
>
> <!-- Normally, users must authenticate themselves to each web app
> individually. Uncomment the following entry if you would
like
> a user to be authenticated the first time they encounter a
> resource protected by a security constraint, and then have
that
> user identity maintained across *all* web applications
> contained
> in this virtual host. -->
> <!--
> <Valve className="org.apache.catalina.authenticator.SingleSignOn"
> debug="0"/>
> -->
>
> <!-- Access log processes all requests for this virtual host. By
> default, log files are created in the "logs" directory
relative
> to
> $CATALINA_HOME. If you wish, you can specify a different
> directory with the "directory" attribute. Specify either a
> relative
> (to $CATALINA_HOME) or absolute path to the desired
directory.
> -->
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="localhost_access_log."
> suffix=".txt"
> pattern="common"/>
>
> <!-- Logger shared by all Contexts related to this virtual host.
By
> default (when using FileLogger), log files are created in the
> "logs"
> directory relative to $CATALINA_HOME. If you wish, you can
> specify
> a different directory with the "directory" attribute.
Specify
> either a
> relative (to $CATALINA_HOME) or absolute path to the desired
> directory.-->
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="localhost_log." suffix=".txt"
> timestamp="true"/>
>
> <!-- Define properties for each web application. This is only
> needed
> if you want to set non-default properties, or have web
> application
> document roots in places other than the virtual host's
appBase
> directory. -->
>
> <!-- Tomcat Root Context -->
> <!--
> <Context path="" docBase="ROOT" debug="0"/>
> -->
> <Context path="/country-pursuits" docBase="country-pursuits"
> debug="5" reloadable="true" crossContext="true">
>
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="country-pursuits_log." suffix=".txt"
> timestamp="true"/>
> <Resource name="jdbc/postgres" auth="Container"
> type="javax.sql.DataSource"/>
>
> <ResourceParams name="jdbc/postgres">
> <parameter>
> <name>factory</name>
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>org.postgresql.Driver</value>
> </parameter>
> <parameter>
> <name>url</name>
> <value>jdbc:postgresql://braehead:5432/web</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>web</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value></value>
> </parameter>
> <parameter>
> <name>maxActive</name>
> <value>20</value>
> </parameter>
> <parameter>
> <name>maxIdle</name>
> <value>10</value>
> </parameter>
> <parameter>
> <name>maxWait</name>
> <value>-1</value>
> </parameter>
> </ResourceParams>
> </Context>
>
> </Host>
>
> </Engine>
>
> </Service>
>
> <!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat
> 4.0
> as its servlet container. Please read the README.txt file coming
with
> the WebApp Module distribution on how to build it.
> (Or check out the "jakarta-tomcat-connectors/webapp" CVS
repository)
>
> To configure the Apache side, you must ensure that you have the
> "ServerName" and "Port" directives defined in "httpd.conf". Then,
> lines like these to the bottom of your "httpd.conf" file:
>
> LoadModule webapp_module libexec/mod_webapp.so
> WebAppConnection warpConnection warp localhost:8008
> WebAppDeploy examples warpConnection /examples/
>
> The next time you restart Apache (after restarting Tomcat, if
needed)
> the connection will be established, and all applications you make
> visible via "WebAppDeploy" directives can be accessed through
Apache.
> -->
>
> <!-- Define an Apache-Connector Service -->
> <Service name="Tomcat-Apache">
>
> <Connector
className="org.apache.catalina.connector.warp.WarpConnector"
> port="8008" minProcessors="5" maxProcessors="75"
> enableLookups="true"
> acceptCount="10" debug="0"/>
>
> <!-- Replace "localhost" with what your Apache "ServerName" is set
> to -->
> <Engine className="org.apache.catalina.connector.warp.WarpEngine"
> name="Apache" debug="0" appBase="webapps">
>
> <!-- Global logger unless overridden at lower levels -->
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="apache_log." suffix=".txt"
> timestamp="true"/>
>
> <!-- Because this Realm is here, an instance will be shared
> globally -->
> <Realm className="org.apache.catalina.realm.MemoryRealm" />
>
> </Engine>
>
> </Service>
>
> </Server>
> ==========================================================================
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org