I had some trouble with setting up JNDI support for jetty.
Here is my solution. Hopefully someone will find it useful.
jetty plugin for maven in pom.xml
<plugins>
...
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.5</version>
<configuration>
...
<jettyEnvXml>${basedir}/etc/jetty/jetty-env.xml</jettyEnvXml>
...
</configuration>
</plugin>
...
</plugins>
And jetty-env.xml itself is following
<?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">
<New id="datasource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/dsname</Arg>
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://localhost:3306/databasename</Set>
<Set name="User">...</Set>
<Set name="Password">...</Set>
</New>
</Arg>
</New>
</Configure>
Quite simple, isn't it?
Here is my solution. Hopefully someone will find it useful.
jetty plugin for maven in pom.xml
<plugins>
...
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.5</version>
<configuration>
...
<jettyEnvXml>${basedir}/etc/jetty/jetty-env.xml</jettyEnvXml>
...
</configuration>
</plugin>
...
</plugins>
And jetty-env.xml itself is following
<?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">
<New id="datasource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/dsname</Arg>
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://localhost:3306/databasename</Set>
<Set name="User">...</Set>
<Set name="Password">...</Set>
</New>
</Arg>
</New>
</Configure>
Quite simple, isn't it?
Best Online Casino Sites in Malaysia | Lucky Club
ReplyDeleteThis site is the easiest to use for all luckyclub.live the best online casinos. The aim of the site is to provide the best What are the best online casinos in Malaysia?What are the best casino in Malaysia?