You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jabbar <aj...@gmail.com> on 2010/12/15 10:32:26 UTC
Tapestry 5, jetty, jdbc drivers, class reloading
Hello all,
I want to use JNDI to access my datasource and I also want to make use of
tapestry class reloading. I don't know how to notify the maven jetty plugin
of the JDBC drivers and setup JNDI. Is it any easier to configure the run
jetty run eclipse plugin?
--
Thanks
A Jabbar Azam
Re: Tapestry 5, jetty, jdbc drivers, class reloading
Posted by Jabbar <aj...@gmail.com>.
Thanks. I'll have a look at this later on.
On 15 December 2010 13:17, Michael Gentry <mg...@masslight.net> wrote:
> The Run Jetty Run plugin doesn't include Jetty Plus, so it doesn't
> support JNDI. I run Jetty through Maven from the command-line (or the
> M2Eclipse plugin) and it works fine. To use JNDI, you'll need a
> jetty-env.xml file in your WEB-INF similar to:
>
> <?xml version="1.0"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
> "http://jetty.mortbay.org/configure.dtd">
> <Configure class="org.mortbay.jetty.webapp.WebAppContext">
> <Set name="contextPath">/QCsubmit</Set>
> <New id="DS_NAME" class="org.mortbay.jetty.plus.naming.Resource">
> <Arg>jdbc/DS</Arg>
> <Arg>
> <New
> class="org.apache.commons.dbcp.BasicDataSource">
> <Set
> name="Url">jdbc:mysql://server:3306/database</Set>
> <Set
> name="DriverClassName">com.mysql.jdbc.Driver</Set>
> <Set name="Username">username</Set>
> <Set name="Password">password</Set>
> <Set name="MaxActive">30</Set>
> <Set name="MaxIdle">10</Set>
> <Set name="MinIdle">2</Set>
> <Set name="MaxWait">5000</Set>
> <Set
> name="MinEvictableIdleTimeMillis">25000</Set>
> <Set
> name="TimeBetweenEvictionRunsMillis">30000</Set>
> </New>
> </Arg>
> </New>
> </Configure>
>
> And in your web.xml:
>
> <resource-ref>
> <res-ref-name>jdbc/DS</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> This is for Jetty 6 -- Jetty 7 is a little different. Change DS_NAME
> and jdbc/DS, plus the connection information.
>
> Some things from the pom.xml you'll want:
>
> <properties>
> <jetty.port>8484</jetty.port>
> <jetty.max-idle-time>60000</jetty.max-idle-time>
> <jetty.version>6.1.22</jetty.version>
> <tapestry.release-version>5.1.0.5</tapestry.release-version>
> </properties>
>
> <dependency>
> <!-- Used by mvn jetty:run to define JDNI data source -->
> <groupId>commons-dbcp</groupId>
> <artifactId>commons-dbcp</artifactId>
> <version>1.2.2</version>
> <scope>runtime</scope>
> </dependency>
>
> <dependency>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>jetty-plus</artifactId>
> <version>${jetty.version}</version>
> </dependency>
>
> and in the <build> section, I have this plugin defined:
>
> <!-- Run the application using "mvn jetty:run" -->
> <plugin>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>maven-jetty-plugin</artifactId>
> <version>${jetty.version}</version>
> <configuration>
> <connectors>
> <connector
> implementation="org.mortbay.jetty.nio.SelectChannelConnector">
> <port>${jetty.port}</port>
>
> <maxIdleTime>${jetty.max-idle-time}</maxIdleTime>
> </connector>
> </connectors>
>
> <dependencies>
> <dependency>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>jetty-plus</artifactId>
> <version>${jetty.version}</version>
> </dependency>
> </dependencies>
>
> <!-- Log to the console. -->
> <requestLog
> implementation="org.mortbay.jetty.NCSARequestLog">
> <!-- This doesn't do anything for Jetty, but
> is a workaround for a Maven bug that prevents the requestLog from
> being set. -->
> <append>true</append>
> </requestLog>
> </configuration>
> </plugin>
>
> mrg
>
>
> On Wed, Dec 15, 2010 at 4:32 AM, Jabbar <aj...@gmail.com> wrote:
> > Hello all,
> >
> > I want to use JNDI to access my datasource and I also want to make use of
> > tapestry class reloading. I don't know how to notify the maven jetty
> plugin
> > of the JDBC drivers and setup JNDI. Is it any easier to configure the run
> > jetty run eclipse plugin?
> > --
> > Thanks
> >
> > A Jabbar Azam
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Thanks
A Jabbar Azam
Re: Tapestry 5, jetty, jdbc drivers, class reloading
Posted by Jabbar <aj...@gmail.com>.
Thanks. I'll try this sometime today.
On 15 December 2010 13:17, Michael Gentry <mg...@masslight.net> wrote:
> The Run Jetty Run plugin doesn't include Jetty Plus, so it doesn't
> support JNDI. I run Jetty through Maven from the command-line (or the
> M2Eclipse plugin) and it works fine. To use JNDI, you'll need a
> jetty-env.xml file in your WEB-INF similar to:
>
> <?xml version="1.0"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
> "http://jetty.mortbay.org/configure.dtd">
> <Configure class="org.mortbay.jetty.webapp.WebAppContext">
> <Set name="contextPath">/QCsubmit</Set>
> <New id="DS_NAME" class="org.mortbay.jetty.plus.naming.Resource">
> <Arg>jdbc/DS</Arg>
> <Arg>
> <New
> class="org.apache.commons.dbcp.BasicDataSource">
> <Set
> name="Url">jdbc:mysql://server:3306/database</Set>
> <Set
> name="DriverClassName">com.mysql.jdbc.Driver</Set>
> <Set name="Username">username</Set>
> <Set name="Password">password</Set>
> <Set name="MaxActive">30</Set>
> <Set name="MaxIdle">10</Set>
> <Set name="MinIdle">2</Set>
> <Set name="MaxWait">5000</Set>
> <Set
> name="MinEvictableIdleTimeMillis">25000</Set>
> <Set
> name="TimeBetweenEvictionRunsMillis">30000</Set>
> </New>
> </Arg>
> </New>
> </Configure>
>
> And in your web.xml:
>
> <resource-ref>
> <res-ref-name>jdbc/DS</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> This is for Jetty 6 -- Jetty 7 is a little different. Change DS_NAME
> and jdbc/DS, plus the connection information.
>
> Some things from the pom.xml you'll want:
>
> <properties>
> <jetty.port>8484</jetty.port>
> <jetty.max-idle-time>60000</jetty.max-idle-time>
> <jetty.version>6.1.22</jetty.version>
> <tapestry.release-version>5.1.0.5</tapestry.release-version>
> </properties>
>
> <dependency>
> <!-- Used by mvn jetty:run to define JDNI data source -->
> <groupId>commons-dbcp</groupId>
> <artifactId>commons-dbcp</artifactId>
> <version>1.2.2</version>
> <scope>runtime</scope>
> </dependency>
>
> <dependency>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>jetty-plus</artifactId>
> <version>${jetty.version}</version>
> </dependency>
>
> and in the <build> section, I have this plugin defined:
>
> <!-- Run the application using "mvn jetty:run" -->
> <plugin>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>maven-jetty-plugin</artifactId>
> <version>${jetty.version}</version>
> <configuration>
> <connectors>
> <connector
> implementation="org.mortbay.jetty.nio.SelectChannelConnector">
> <port>${jetty.port}</port>
>
> <maxIdleTime>${jetty.max-idle-time}</maxIdleTime>
> </connector>
> </connectors>
>
> <dependencies>
> <dependency>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>jetty-plus</artifactId>
> <version>${jetty.version}</version>
> </dependency>
> </dependencies>
>
> <!-- Log to the console. -->
> <requestLog
> implementation="org.mortbay.jetty.NCSARequestLog">
> <!-- This doesn't do anything for Jetty, but
> is a workaround for a Maven bug that prevents the requestLog from
> being set. -->
> <append>true</append>
> </requestLog>
> </configuration>
> </plugin>
>
> mrg
>
>
> On Wed, Dec 15, 2010 at 4:32 AM, Jabbar <aj...@gmail.com> wrote:
> > Hello all,
> >
> > I want to use JNDI to access my datasource and I also want to make use of
> > tapestry class reloading. I don't know how to notify the maven jetty
> plugin
> > of the JDBC drivers and setup JNDI. Is it any easier to configure the run
> > jetty run eclipse plugin?
> > --
> > Thanks
> >
> > A Jabbar Azam
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Thanks
A Jabbar Azam
Re: Tapestry 5, jetty, jdbc drivers, class reloading
Posted by Michael Gentry <mg...@masslight.net>.
The Run Jetty Run plugin doesn't include Jetty Plus, so it doesn't
support JNDI. I run Jetty through Maven from the command-line (or the
M2Eclipse plugin) and it works fine. To use JNDI, you'll need a
jetty-env.xml file in your WEB-INF similar to:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/QCsubmit</Set>
<New id="DS_NAME" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/DS</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="Url">jdbc:mysql://server:3306/database</Set>
<Set name="DriverClassName">com.mysql.jdbc.Driver</Set>
<Set name="Username">username</Set>
<Set name="Password">password</Set>
<Set name="MaxActive">30</Set>
<Set name="MaxIdle">10</Set>
<Set name="MinIdle">2</Set>
<Set name="MaxWait">5000</Set>
<Set name="MinEvictableIdleTimeMillis">25000</Set>
<Set name="TimeBetweenEvictionRunsMillis">30000</Set>
</New>
</Arg>
</New>
</Configure>
And in your web.xml:
<resource-ref>
<res-ref-name>jdbc/DS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
This is for Jetty 6 -- Jetty 7 is a little different. Change DS_NAME
and jdbc/DS, plus the connection information.
Some things from the pom.xml you'll want:
<properties>
<jetty.port>8484</jetty.port>
<jetty.max-idle-time>60000</jetty.max-idle-time>
<jetty.version>6.1.22</jetty.version>
<tapestry.release-version>5.1.0.5</tapestry.release-version>
</properties>
<dependency>
<!-- Used by mvn jetty:run to define JDNI data source -->
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${jetty.version}</version>
</dependency>
and in the <build> section, I have this plugin defined:
<!-- Run the application using "mvn jetty:run" -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<connectors>
<connector
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>${jetty.port}</port>
<maxIdleTime>${jetty.max-idle-time}</maxIdleTime>
</connector>
</connectors>
<dependencies>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
<!-- Log to the console. -->
<requestLog
implementation="org.mortbay.jetty.NCSARequestLog">
<!-- This doesn't do anything for Jetty, but
is a workaround for a Maven bug that prevents the requestLog from
being set. -->
<append>true</append>
</requestLog>
</configuration>
</plugin>
mrg
On Wed, Dec 15, 2010 at 4:32 AM, Jabbar <aj...@gmail.com> wrote:
> Hello all,
>
> I want to use JNDI to access my datasource and I also want to make use of
> tapestry class reloading. I don't know how to notify the maven jetty plugin
> of the JDBC drivers and setup JNDI. Is it any easier to configure the run
> jetty run eclipse plugin?
> --
> Thanks
>
> A Jabbar Azam
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry 5, jetty, jdbc drivers, class reloading
Posted by Jabbar <aj...@gmail.com>.
Thank you I got the maven jetty plugin working with jetty 7.
On 15 December 2010 14:09, LLTYK <LL...@mailinator.com> wrote:
>
> This is for jetty 7. Jetty 6 has different package names, different plugin
> names, etc. A chore to switch between the two but much of the syntax is the
> same.
>
> <plugin>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>jetty-maven-plugin</artifactId>
> <version>7.2.0.v20101020</version>
> <dependencies>
> <dependency>
> <groupId>commons-dbcp</groupId>
> <artifactId>commons-dbcp</artifactId>
> <version>1.4</version>
> </dependency>
> <dependency>
> <groupId>mysql</groupId>
> <artifactId>mysql-connector-java</artifactId>
> <version>5.1.13</version>
> </dependency>
> <dependency>
> <groupId>xalan</groupId>
> <artifactId>xalan</artifactId>
> <version>2.7.0</version>
> </dependency>
> </dependencies>
> <configuration>
> <connectors>
> <connector
> implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
> <host>0.0.0.0</host>
> <port>8081</port>
> <maxIdleTime>120000</maxIdleTime>
> <acceptors>10</acceptors>
> </connector>
> </connectors>
> <requestLog
> implementation="org.eclipse.jetty.server.NCSARequestLog">
> <append>true</append>
> </requestLog>
> </configuration>
> </plugin>
>
> Then in WEB-INF/jetty-env.xml:
> <?xml version="1.0"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
> "http://jetty.mortbay.org/configure.dtd">
> <Configure class="org.eclipse.jetty.webapp.WebAppContext">
> <New id="ds" class="org.eclipse.jetty.plus.jndi.Resource">
> <Arg>java:jdbc/db</Arg>
> <Arg>
> <New
> class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
> <Set name="serverName"></Set>
> <Set name="databaseName"></Set>
> <Set name="user"></Set>
> <Set name="password"></Set>
> </New>
> </Arg>
> </New>
> </Configure>
> --
> View this message in context:
> http://tapestry-users.832.n2.nabble.com/Tapestry-5-jetty-jdbc-drivers-class-reloading-tp5837594p5837937.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Thanks
A Jabbar Azam
Re: Tapestry 5, jetty, jdbc drivers, class reloading
Posted by LLTYK <LL...@mailinator.com>.
This is for jetty 7. Jetty 6 has different package names, different plugin
names, etc. A chore to switch between the two but much of the syntax is the
same.
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.2.0.v20101020</version>
<dependencies>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.13</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
</dependencies>
<configuration>
<connectors>
<connector
implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<host>0.0.0.0</host>
<port>8081</port>
<maxIdleTime>120000</maxIdleTime>
<acceptors>10</acceptors>
</connector>
</connectors>
<requestLog
implementation="org.eclipse.jetty.server.NCSARequestLog">
<append>true</append>
</requestLog>
</configuration>
</plugin>
Then in WEB-INF/jetty-env.xml:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<New id="ds" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>java:jdbc/db</Arg>
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<Set name="serverName"></Set>
<Set name="databaseName"></Set>
<Set name="user"></Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
</Configure>
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Tapestry-5-jetty-jdbc-drivers-class-reloading-tp5837594p5837937.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org