Hi Joe, This is exactly what I am looking for. I also need to setup connection pooling, so this will get me going quickly. Thank you very much..
Mike Warne. Opihi Systems. On Fri, Dec 12, 2008 at 12:00 PM, Joe Cole <[email protected]>wrote: > > Here is our way: > > In: > tomcat/webapps/ROOT/WEB-INF/web.xml > > <resource-ref> > <res-ref-name>jdbc/dbsource</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > <listener> > <listener-class>com.yourcompany.LocalConfiguration</listener- > class> > </listener> > > The only gotcha with this is that when you upgrade gwt it changes the > web.xml - we just revert it from version control and all works well. > > That listener sets up the entire servlet side, including properties & > guice bindings: > > public class LocalConfiguration extends AbstractConfiguration { > protected IPropertyManager createPropertyManager( > final ServletContext context) { > return new LocalPropertyManager(); > } > public IBindings getBindings() { > return new LocalBindings(); > } > } > > This allows us to ship different setups to the system depending on > where it's being used (one for hosted mode, production, test, staging > etc). > The datasource is container managed which is why it's defined in the > file. > > The other file you will need for hosted mode is: > tomcat/conf/gwt/localhost/ROOT.xml > <Context privileged="true" antiResourceLocking="false" > antiJARLocking="false" debug="1" reloadable="true" path=""> > > > <!-- GWT uses Tomcat 5.0.28 - use the 5.0 "style" for > defining resources --> > <!-- note that you ALSO have to add stuff like commons- > pool, commons-dbcp > and your JDBC driver to the GWTShell classpath --> > > <Resource name="jdbc/ToopsterDB" auth="Container" > type="javax.sql.DataSource" /> > > <ResourceParams name="jdbc/dbsource"> > > <parameter> > <name>factory</name> > <value> > > org.apache.commons.dbcp.BasicDataSourceFactory > </value> > </parameter> > > <parameter> > <name>username</name> > <value>YOURDBUSERNAME</value> > </parameter> > <parameter> > <name>password</name> > <value>SECRET</value> > </parameter> > <parameter> > <name>driverClassName</name> > <value>org.postgresql.Driver</value> > </parameter> > <parameter> > <name>url</name> > <value>jdbc:postgresql://URL/DB</value> > </parameter> > > </ResourceParams> > </Context> > > Let me know if this is useful - it took us a while to get this right, > and we have used it in multiple deployed apps and it works well. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
