tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject issue with <Resource> differences between 5.0.xx and 5.5.x
Date Sat, 27 Nov 2004 05:53:05 GMT

I created a custom resource factory for Tomcat which works great in 
5.0.xx.  However, I'm having an issue with the new configuration 5.5.x 
where all config is done via attributes rather than as nested <parameter> 
elements.  Basically, I've got a parameter of which the value needs to 
include newlines as it is really a set of properties to be loaded into a 
java.util.Properties object and this simply doesn't work if the config is 
provided as an attribute.  I didn't expect this to work, but I made an 
attempt and verified that it didn't.  Here it is....

<Resource name="jdo/kodoJDO" auth="Container" 
type="javax.resource.cci.ConnectionFactory"
               factory="com.mycompany.container.jdo.JDOHelperWrapperJNDIFactory"
               config="kodo.LicenseKey: [some license key]
                       javax.jdo.PersistenceManagerFactoryClass: 
kodo.jdbc.runtime.JDBCPersistenceManagerFactory
                       javax.jdo.option.ConnectionURL: 
jdbc:oracle:thin:@somedomain.com:1521:somedb
                       javax.jdo.option.ConnectionDriverName: 
oracle.jdbc.driver.OracleDriver
                       javax.jdo.option.ConnectionUserName: username
                       javax.jdo.option.ConnectionPassword: password
                       javax.jdo.option.Optimistic: true
                       javax.jdo.option.RetainValues: true
                       javax.jdo.option.NontransactionalRead: true
                       kodo.jdbc.Schemas: SOMESCHEMA"/>

This is supposed to configure a Kodo JDO connection factory to be accessed 
via JNDI (mimicking more standard mechanisms in full J2EE 
servers).  However, using this config in Tomcat-5.5.4 results in Kodo 
saying that the property "javax.jdo.PersistenceManagerFactoryClass" is 
missing and must be specified.  Well, I've obviously attempted to specify 
it above (along with many others).  It just can't deal with the newlines in 
the attribute.  How do I get around this?  Is there an option for nested 
parameters defined by XML elements rather than attributes like in 
Tomcat-5.0.xx?  Here's the equivalent config that works perfectly well 
under Tomcat-5.0.xx....

<Resource name="jdo/nbsJDO" auth="Container"
	          type="javax.resource.cci.ConnectionFactory"/>
     <ResourceParams name="jdo/nbsJDO">
         <parameter>
             <name>factory</name>
             <value>com.mycompany.container.jdo.JDOHelperWrapperJNDIFactory</value>
         </parameter>
         <parameter>
             <name>config</name>
             <value>
             kodo.LicenseKey: [some license key]
             javax.jdo.PersistenceManagerFactoryClass: 
kodo.jdbc.runtime.JDBCPersistenceManagerFactory
             javax.jdo.option.ConnectionURL: 
jdbc:oracle:thin:@somedomain.com:1521:somedb
             javax.jdo.option.ConnectionDriverName: 
oracle.jdbc.driver.OracleDriver
             javax.jdo.option.ConnectionUserName: username
             javax.jdo.option.ConnectionPassword: password
             javax.jdo.option.Optimistic: true
             javax.jdo.option.RetainValues: true
             javax.jdo.option.NontransactionalRead: true
             kodo.jdbc.Schemas: SOMESCHEMA
             </value>
         </parameter>
     </ResourceParams>

Please don't tell me to implement each of these properties as config 
attributes of the <Resource> element.  The properties are free-form and 
there are many more possible, quite a few of them kodo-specific that I 
would like to be able to add without having to modify the custom resource 
factory constantly.  It is vastly simpler to be able to load all this stuff 
up in a Properties object which is what Kodo expects anyway for 
configuration.

I can understand why the whole <Resource> + <ResourceParams> + <parameter>

was eschewed in favor of less verbose attributes, but attributes don't 
offer all the functionality of the nested elements.  Can nested <parameter> 
elements be an option for Tomcat-5.5.x's <Resource> config?

thanks,


Jake


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


Mime
View raw message