velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Austin" <reaus...@popmail.ucsd.edu>
Subject DataSourceResourceLoader
Date Thu, 19 Dec 2002 02:55:38 GMT
I am trying to have Velocity load templates from a database without any
success.

I get this error:

Wed Dec 18 18:41:40 PST 2002  [error] DataSourceResourceLoader Error:
database problem trying to load resource layouts/Test.vm:
java.lang.ClassCastException

My properties file has this:

resource.loader = ds
ds.resource.loader.public.name = DataSource
ds.resource.loader.description = Velocity DataSource Resource Loader
ds.resource.loader.class =
org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader
ds.resource.loader.resource.datasource = java:comp/env/jdbc/newapp
ds.resource.loader.resource.table = TEMPLATE
ds.resource.loader.resource.keycolumn = TEMPLATE_ID
ds.resource.loader.resource.templatecolumn = TEMPLATE_DEFINITION
ds.resource.loader.resource.timestampcolumn = TEMPLATE_TIMESTAMP
ds.resource.loader.cache = false
ds.resource.loader.modificationCheckInterval = 60

My web.xml has this:

<resource-ref>
        <description>Turbine template DataSource</description>
        <res-ref-name>jdbc/newapp</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

My server.xml has this:

<Context path="/newapp" docBase="newapp" reloadable="true" debug="0">
         <ResourceParams name="jdbc/newapp">
           <parameter>
             <name>driverClassName</name>
             <value>org.gjt.mm.mysql.Driver</value>
           </parameter>
           <parameter>
             <name>driverName</name>
             <value>jdbc:mysql:database</value>
           </parameter>
           <parameter>
             <name>user</name>
             <value>cgi</value>
           </parameter>
           <parameter>
             <name>password</name>
             <value>cgi</value>
           </parameter>
         </ResourceParams>
       </Context>

I have a Table called TEMPLATE with the corresponding fields.

The log file shows that it loads DataSourceResourceLoader fine:

Wed Dec 18 17:09:23 PST 2002 AvalonLogSystem initialized using logfile
/usr/local/tdk/bin/./../webapps/newapp/logs/velocity.log
Wed Dec 18 17:09:23 PST 2002   [info]   [info] Default Properties File:
org/apache/velocity/runtime/defaults/velocity.properties
Wed Dec 18 17:09:23 PST 2002   [info] Resource Loader Instantiated:
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Dec 18 17:09:23 PST 2002   [info] FileResourceLoader : initialization
starting.
Wed Dec 18 17:09:23 PST 2002   [info] FileResourceLoader : adding path
'/usr/local/tdk/bin/./../webapps/newapp/templates/app'
Wed Dec 18 17:09:23 PST 2002   [info] FileResourceLoader : adding path
'/usr/local/tdk/bin/./../webapps/newapp/templates/flux'
Wed Dec 18 17:09:23 PST 2002   [info] FileResourceLoader : initialization
complete.
Wed Dec 18 17:09:23 PST 2002   [info] Resource Loader Instantiated:
org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader
Wed Dec 18 17:09:23 PST 2002   [info] Resources Loaded From:
java:comp/env/jdbc/newapp/TEMPLATE
Wed Dec 18 17:09:23 PST 2002   [info] Resource Loader using columns:
TEMPLATE_ID, TEMPLATE_DEFINITION and TEMPLATE_TIMESTAMP
Wed Dec 18 17:09:23 PST 2002   [info] Resource Loader Initalized.
Wed Dec 18 17:09:23 PST 2002   [info] Resource Loader Instantiated:
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
Wed Dec 18 17:09:23 PST 2002   [info] ClasspathResourceLoader :
initialization starting.
Wed Dec 18 17:09:23 PST 2002   [info] ClasspathResourceLoader :
initialization complete.

Any ideas??

Thanks,
Ryan


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message