Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty-8.1.1 - JNDI DB Resource not working with jetty-env.xml, works in jetty-web.xml

Hi Jamie,

Updates made, thanks for the doc review.

cheers
Jan

On 3 March 2012 05:26, Jamie Maher <jamie.maher@xxxxxxxxx> wrote:
> Hi Jan,
>
>  That section is a lot easier to help standard "official" eclipse
> distribution users get up and running with JNDI!
>
> Originally thought the start.ini OPTIONS=plus, etc would load the JNDI
> support, and because the distribution start.ini configuration options didn't
> have that /etc/jetty-plus line present at all (unlike other commented out
> config files) I wasn't aware that I needed to add it to activate the jars
> that were put on the OPTIONS line.
>
> I come from using primarily Tomcat, and had a bit of a time navigating
> through the Wiki and examples on the net.
> Some of them reporting having to use jetty-web.xml not the jetty-env.xml
> probably because of a similar configuration issue, so this should help
> people just starting out with Jetty.
>
>
>
> The only other suggestions I would make for the Wiki is to give a concrete
> example for the <resource-ref> under "Configuring DataSources" for instance
> after:
>
> If you have the appropriate <resource-ref> setup in your web.xml, then it is
> available from application lookups as java:comp/env/jdbc/myds.
>
>
> It would be nice to give a simple code example:
>
>     <resource-ref>
>         <description>Example Datasource reference</description>
>         <res-ref-name>jdbc/myds</res-ref-name>
>
>         <res-type>javax.sql.DataSource</res-type>
>         <res-auth>Container</res-auth>
>     </resource-ref>
>
> (I was a bit confused by the <Arg><Ref id="wac"/></Arg> in the example, I
> didn't know where/if I needed to reference this in
> the web.xml <resource-ref>)
>
>
>
> On a side note, I noticed in the "Configuring Links" section it seems like
> the the example for the jetty-env.xml section got mangled in with the
> context.xml file example.
>
> See the second code block section above "Setting JNDI Entries as Global or
> Scoped" section
> it looks like the "in a <code>jetty-env.xm</code>l file: .."  got mashed in
> with the context xml file.
>
>
> Thanks,
> Jamie
>
>
> From: Jan Bartel <janb@xxxxxxxxxxx>
> Date: Fri, 2 Mar 2012 11:14:48 +1100
>
> Hi Jamie,
>
> Glad things are working for you now.
>
> I've modified the wiki page a bit - is that any better?
>
> http://wiki.eclipse.org/Jetty/Feature/JNDI
>
> cheers
> Jan
>
>
> On 3/1/2012 9:29 AM, Jamie Maher wrote:
>
> Hi Jan,
>
> Thanks for your suggestions!
> I did have my commons-dbcp-1.4.jar in the lib/ext/ folder..  no
> classloading issues just config mis-configuration :)
>
> I decided to try a few things after I read your reply:
>
> The following two tests failed:
>
> - Updating the list of configuration classes that you mentioned below in
> the jetty.xml
> - I Copied the contents of the etc/jetty-plus.xml into etc/jetty.xml eg.
> array of items, then reference that in Call setAttribute
>
>
> Then I tried the following, which did work:
>
> Commented out the configuration classes I had added to jetty.xml (which
> seemed like they should be added per the wiki)
> and added etc/jetty-plus.xml to the start.ini below etc/jetty-ssl.xml
>
> Suddenly it picks up the WEB-INF/jetty-env.xml config..
>
> I'm not sure why that method would allow it to work, but it didn't when
> I copied the jetty-plus.xml contents into jetty.xml?
>
>
>
> It might be nice for the wiki to be a little more specific under
> "Setting up the list of Configurations"
> http://wiki.eclipse.org/Jetty/Feature/JNDI
>
> It doesn't really mention where the list of configurations should be
> setup, only the "correct order they must be defined".
>
> Maybe the 2nd paragraph in that wiki page should give a quick answer as
> to how to enable JNDI for all webapps, then launch into the specifics of
> what is going on:
>
> eg.
>
> You can enable JNDI for all your web applications in Jetty simply by
> adding or enabling the /etc/jetty-plus.xml in your start.ini file.
> The /etc/jetty-plus.xml file contains an augmented list of
> Configurations that enable the following: read WEB-INF/jetty-env.xml,
> setting up a java:comp/env context, and hooking up JNDI entries from
> the environment into your web app. The listing below shows the 2 extra
> Configurations in the correct order they must be defined:..
>
> Thanks,
> Jamie
>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>


Back to the top