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 <aja...@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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org