Hi
these are some things you have to do for setting a datasource:
1: put two additionnals jars in your classpath: jetty-naming-6.1.11.jar and
jetty-plus-6.1.11.jar to add some J2EE features on Jetty
2: change the startup JettyLauncher to your own custom JettyLauncher (works
with -server option ) : put this line in the tab Arguments eclipse setting
run program option:
-server com.myproject.MyCustomJettyLauncher
3 create your own MyCustomJettyLauncher : copy and past the JettyLauncher
to add some "Configuration"
private static String[] __dftConfigurationClasses =
{
"org.mortbay.jetty.webapp.WebInfConfiguration", //
"org.mortbay.jetty.plus.webapp.EnvConfiguration",//jetty-env
"org.mortbay.jetty.plus.webapp.Configuration", //web.xml
"org.mortbay.jetty.webapp.JettyWebXmlConfiguration",//jettyWeb
} ;
and at the end of the start() method call
wac.setConfigurationClasses(__dftConfigurationClasses);
WebAppContext wac = new WebAppContextWithReload(
appRootDir.getAbsolutePath(), "/");
wac.setConfigurationClasses(__dftConfigurationClasses);
server.setHandler(wac);
server.start();
server.setStopAtShutdown(true);
4) edit a jetty-env.xml on the web-inf to specify a dataSource
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "
http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="DSTest" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/projectDS</Arg>
<Arg>
<New
class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://localhost:3306/database
</Set>
<Set name="User">myUserName</Set>
<Set name="Password">myPassword</Set>
</New>
</Arg>
</New>
</Configure>
5) make a reference on it in your web-inf/web.xml
<resource-ref>
<description>DataSource's project</description>
<res-ref-name>jdbc/projectDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
it works for me
regards,
Nicolas Wetzel
On Thu, Mar 12, 2009 at 5:16 AM, wiltonj <[email protected]> wrote:
>
> Hi,
> How to setting DataSource in GWT 1.6 (Hosted mode - Jetty)?
>
> Hoping for some guidance.
>
> Thanks & Regards,
> Wilton
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---