tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Fwd: Re: servlet works, jsp not, why? (Tomcat 5.0)
Date Thu, 14 Aug 2008 18:00:37 GMT
Please see in text my answer.

ge wrote:
> <sql:query var="rs"
> dataSource="jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude">
>  select id, foo, bar from testdata </sql:query>

I think you want to use the name of the dataSourced, here, not the URL.
You want something like "jdbc/MyDataSource" -- it should match whatever
you have in your server.xml (or context.xml) to configure the
datasource's name.

- -chris

When I use 
<sql:query var="rs" dataSource="jdbc/TestDB">
I get:
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException:
No suitable driver found for jdbc/TestDB"

my  server.xml loks:
<!-- Server Configuration File for Tomcat 5 on Debian
     You can find a more complete example in /usr/share/doc/tomcat5/examples/

<!-- 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">

  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"

  <!-- Global JNDI resources -->

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
       description="User database that can be updated and saved">
    <ResourceParams name="UserDatabase">


  <!-- 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.

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8180 -->
    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
               port="8180" minProcessors="5" maxProcessors="75"
               enableLookups="true" acceptCount="10" debug="0"
               connectionTimeout="20000" useURIValidationHack="false" />

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" acceptCount="10" debug="0"
               connectionTimeout="20000" useURIValidationHack="false"

    <!-- 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 
         The name must be Catalina for correct function of the admin webapp -->
    <Engine name="Catalina" defaultHost="localhost" debug="0">

      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_" suffix=".log" timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             debug="0" resourceName="UserDatabase"/>

      <!-- Define the default virtual host -->
      <Host name="localhost" debug="0" appBase="webapps" 
            unpackWARs="true" autoDeploy="true">

        <!-- Logger shared by all Contexts related to this virtual host. -->
        <Logger className="org.apache.catalina.logger.FileLogger"
                directory="logs" prefix="localhost_" suffix=".log"

	<Context path="/jli/Q2_JSPs"
		 reloadable="true" />
	<Context path="/jli/Q3_JSPs"
		 reloadable="true" />
	<Context path="/jli/Q4_JSPs"
		 reloadable="true" />
	<Context path="/jli/DB"
		 reloadable="true" />
	<Context path="/ajax/k2"
		 reloadable="true" />
	<Context path="/DBTest" docBase="DBTest"
		 debug="5" reloadable="true" crossContext="true">
		<Logger className="org.apache.catalina.logger.FileLogger"
			prefix="localhost_DBTest_log." suffix=".txt"
		<Resource name="jdbc/TestDB"
		<ResourceParams name="jdbc/TestDB">
			<!-- Maximum number of dB connections in pool. Make sure you
			     configure your mysqld max_connections large enough to handle
			     all of your db connections. Set to 0 for no limit.
			<!-- Maximum number of idle dB connections to retain in pool.
			     Set to -1 for no limit.  See also the DBCP documentation on this
			     and the minEvictableIdleTimeMillis configuration parameter.
			<!-- Maximum time to wait for a dB connection to become available
			     in ms, in this example 10 seconds. An Exception is thrown if
			     this timeout is exceeded.  Set to -1 to wait indefinitely.
			<!-- MySQL dB username and password for dB connections  -->
			<!-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment
			     if you want to use this driver - we recommend using Connector/J though
			     <!-- Class name for the official MySQL Connector/J driver -->
			     <!-- The JDBC connection url for connecting to your MySQL dB.
				  The autoReconnect=true argument to the url makes sure that the
				  mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
				  connection.  mysqld by default closes idle connections after 8 hours.




Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message