You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Petr Fejfar <pe...@gmail.com> on 2009/07/06 22:22:44 UTC
How to configure data source for Jetty server?
Hi all,
When I've started learning Wicket, I followed configuration described
in the book Enjoy web dev ...
Now I'm trying to migrate my project under Maven's management. I seem
to be almost
finished except data source configuration in the Tomcat's context file:
<Resource
name="jdbc/trackerDataSource"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost/tracker"
username="xxx"
password="xxx"
maxActive="20"
maxIdle="8"
defaultAutoCommit="false"
defaultTransactionIsolation="SERIALIZABLE"
testOnBorrow="true"
validationQuery="select 1"/>
Please, could somebody show me how to achieve
the same effect in Jetty's configuration?
Thanks, Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to configure data source for Jetty server?
Posted by Petr Fejfar <pe...@gmail.com>.
On Mon, Jul 6, 2009 at 10:38 PM, Igor Vaynberg<ig...@gmail.com> wrote:
> http://docs.codehaus.org/display/JETTY/JNDI
Hi Igor,
thanks for you prompt reply, but I was not able to utilize it (I had a
glance at some Jetty docs before asking my question), because I don't
know, how is Jetty integrated into Eclipse IDE, hence I do not know
where to put/modify its configurations files.
I didn't install Jetty server on my machine, I do not have Jetty's
plugin installed in Eclipse.
I can find its .jar files in local Maven's repository only.
In spite of it, I can run it from Eclipse and it works (e.g. with some
wicketstuff examples) :-OOO
Thanks, Petr
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to configure data source for Jetty server?
Posted by Petr Fejfar <pe...@gmail.com>.
> A couple of tips to do the Jetty DataSource JNDI configuration the 'wicket
> way' - in code, instead of xml.
Hi Peter,
thanks for your help. I like your solution without those .xml files
everywere around...
I completed dependencies into my POM and some additional
BasicDataSource() settings into code and it works.
Thanks, Petr
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to configure data source for Jetty server?
Posted by Roman Zechner <ro...@Liland.at>.
Peter Thomas wrote:
> On Tue, Jul 7, 2009 at 2:08 AM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>
>> http://docs.codehaus.org/display/JETTY/JNDI
>>
>> -igor
>>
>> On Mon, Jul 6, 2009 at 1:22 PM, Petr Fejfar<pe...@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> When I've started learning Wicket, I followed configuration described
>>> in the book Enjoy web dev ...
>>>
>>> Now I'm trying to migrate my project under Maven's management. I seem
>>> to be almost
>>> finished except data source configuration in the Tomcat's context file:
>>>
>>> <Resource
>>> name="jdbc/trackerDataSource"
>>> auth="Container"
>>> type="javax.sql.DataSource"
>>> driverClassName="org.postgresql.Driver"
>>> url="jdbc:postgresql://localhost/tracker"
>>> username="xxx"
>>> password="xxx"
>>> maxActive="20"
>>> maxIdle="8"
>>> defaultAutoCommit="false"
>>> defaultTransactionIsolation="SERIALIZABLE"
>>> testOnBorrow="true"
>>> validationQuery="select 1"/>
>>>
>>> Please, could somebody show me how to achieve
>>> the same effect in Jetty's configuration?
>>>
>>>
>
> A couple of tips to do the Jetty DataSource JNDI configuration the 'wicket
> way' - in code, instead of xml.
>
> Use a datasource implementation like org.apache.commons.dbcp.BasicDataSource
>
> In the Start.java that you get after following the instructions here:
> http://wicket.apache.org/quickstart.html
>
> Add the following:
>
> BasicDataSource ds = new BasicDataSource();
> ds.setUrl("jdbc:hsqldb:.");
> ds.setDriverClassName("org.hsqldb.jdbcDriver");
> ds.setUsername("sa");
> ds.setPassword("");
>
> NamingEntry.setScope(NamingEntry.SCOPE_GLOBAL);
> // this line actually registers object in jetty jndi
> new Resource("java:/mydatasource", ds);
>
> And you can refer the documentation of Apache DPCP to set properties like
> this:
>
> ds.setValidationQuery("SELECT 1");
>
> Thanks,
>
> Peter.
>
>
In development we are using jetty with a data source from a
src/main/webapp/WEB-INF/jetty-env.xml. We also deploy to jetty servers
in production and use the jetty-env.xml. Btw, does anyone know how to
set the hibernate.dialect via JNDI?
Thanks,
Roman
>>> Thanks, Peter
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
--
Liland ...does IT better
Liland IT GmbH
Creative Master
email: Roman.Zechner@Liland.at
http://www.Liland.at
office: +43 (0)463 220-111 | fax: +43 463 220-111 DW 33
mobil: +43 (0) 699 122 011 28
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to configure data source for Jetty server?
Posted by Peter Thomas <pt...@gmail.com>.
On Tue, Jul 7, 2009 at 2:08 AM, Igor Vaynberg <ig...@gmail.com>wrote:
> http://docs.codehaus.org/display/JETTY/JNDI
>
> -igor
>
> On Mon, Jul 6, 2009 at 1:22 PM, Petr Fejfar<pe...@gmail.com> wrote:
> > Hi all,
> >
> > When I've started learning Wicket, I followed configuration described
> > in the book Enjoy web dev ...
> >
> > Now I'm trying to migrate my project under Maven's management. I seem
> > to be almost
> > finished except data source configuration in the Tomcat's context file:
> >
> > <Resource
> > name="jdbc/trackerDataSource"
> > auth="Container"
> > type="javax.sql.DataSource"
> > driverClassName="org.postgresql.Driver"
> > url="jdbc:postgresql://localhost/tracker"
> > username="xxx"
> > password="xxx"
> > maxActive="20"
> > maxIdle="8"
> > defaultAutoCommit="false"
> > defaultTransactionIsolation="SERIALIZABLE"
> > testOnBorrow="true"
> > validationQuery="select 1"/>
> >
> > Please, could somebody show me how to achieve
> > the same effect in Jetty's configuration?
> >
>
A couple of tips to do the Jetty DataSource JNDI configuration the 'wicket
way' - in code, instead of xml.
Use a datasource implementation like org.apache.commons.dbcp.BasicDataSource
In the Start.java that you get after following the instructions here:
http://wicket.apache.org/quickstart.html
Add the following:
BasicDataSource ds = new BasicDataSource();
ds.setUrl("jdbc:hsqldb:.");
ds.setDriverClassName("org.hsqldb.jdbcDriver");
ds.setUsername("sa");
ds.setPassword("");
NamingEntry.setScope(NamingEntry.SCOPE_GLOBAL);
// this line actually registers object in jetty jndi
new Resource("java:/mydatasource", ds);
And you can refer the documentation of Apache DPCP to set properties like
this:
ds.setValidationQuery("SELECT 1");
Thanks,
Peter.
>
> >
> > Thanks, Peter
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: How to configure data source for Jetty server?
Posted by Igor Vaynberg <ig...@gmail.com>.
http://docs.codehaus.org/display/JETTY/JNDI
-igor
On Mon, Jul 6, 2009 at 1:22 PM, Petr Fejfar<pe...@gmail.com> wrote:
> Hi all,
>
> When I've started learning Wicket, I followed configuration described
> in the book Enjoy web dev ...
>
> Now I'm trying to migrate my project under Maven's management. I seem
> to be almost
> finished except data source configuration in the Tomcat's context file:
>
> <Resource
> name="jdbc/trackerDataSource"
> auth="Container"
> type="javax.sql.DataSource"
> driverClassName="org.postgresql.Driver"
> url="jdbc:postgresql://localhost/tracker"
> username="xxx"
> password="xxx"
> maxActive="20"
> maxIdle="8"
> defaultAutoCommit="false"
> defaultTransactionIsolation="SERIALIZABLE"
> testOnBorrow="true"
> validationQuery="select 1"/>
>
> Please, could somebody show me how to achieve
> the same effect in Jetty's configuration?
>
>
> Thanks, Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org