Skip to main content

how to configure JNDI for jetty

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?



Comments

  1. Best Online Casino Sites in Malaysia | Lucky Club
    This 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?

    ReplyDelete

Post a Comment

Popular posts from this blog

brew, "pear install ...", Log for example..

I had issues while installing Log package from Pear. I used brew to get PHP (5.5.17) running on my MBP. So, back to the installing issue - if I tried to execute following command I got an error .. $ pear install Log No releases available for package "pear.php.net/Log" intallation failed So, failed. Then I tried to download the package using "pear download Log". Failed too. Solution was to go to Log package Pear page  and manually download the package. And in terminal you should executed the same installation command and point to downloaded file.. $ pear install /path/to/downloaded/Log-1.12.8.tar .. output skipped .. install ok: channel://pear.php.net/Log-1.12.8 Done. Anyway, there are probably other (better, more modern) logging libraries out there for PHP applications. Feel free to post your favorite one with short description to comments. Thanks in advance!

How did I enable debugging of PHP for PHPStorm?

There is a "debug" button next to "run" button in PHPStorm. What for? (c: From PHPStorm web help I read that xdebug is supported. There was a nice wizard that helped me through the installation process. I got stuck by the 5th and 6th point - "./configure" and "make". Found a solution here . Also it was necessary to update my XCode to enable command line tools like "make" for OS X. In the wizard, there is a following step "cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20100525". Be aware that "no-debug-non-zts-20100525" should be a folder. And "xdebug.so" should be copied inside this folder. Had some issues where "xdebug.so" were copied as file named "no-debug-non-zts-20100525" into "extensions" folder. And it works now..