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 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


> From: Jan Bartel <janb@xxxxxxxxxxx>
> Date: Thu, 1 Mar 2012 13:13:21 +1100
> Jamie,
>
> The set of configuration classes should be:
>
>     <Call name="setAttribute">
>       <Arg>org.eclipse.jetty.webapp.configuration</Arg>
>       <Arg>
>           <Array type="java.lang.String">
>                <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
>                <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
>                <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
>                <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
>                <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
>                <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
>                <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>
>                <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
>           </Array>
>       </Arg>
>     </Call>
>
> I don't think that is the cause of your problem, but worth getting
> that straight first. Note also that you don't need to put that into
> jetty.xml. There should be a etc/jetty-plus.xml file which has that
> defined, and that can be used by editing start.ini and either
> uncommenting it or adding it in. I'll update the wiki documentation
> page to reflect that.
>
> Are you sure there are no other errors? Anything about classes not
> found (eg where is the dbcp jar, is it in ext?)
>
> regards
> Jan
> PS you may find it easier to download the jetty-hightide distribution,
> which has jndi services enabled for all webapps by default:
> http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-hightide/8.1.1.v20120215/

On 1 March 2012 11:40, Jamie Maher <jamie.maher@xxxxxxxxx> wrote:

> > ------------------------
> > setup:
> >
> > start.ini contains the following OPTIONS:
> > OPTIONS=Server,jsp,jmx,resources,websocket,ext,plus,annotations
> >
> >
> > jetty.xml - added the following just above "extra options"
> >
> >    <!-- =========================================================== -->
> >    <!-- Support jetty-env.xml in webapps                         -->
> >    <!-- =========================================================== -->
> >    <Call name="setAttribute">
> >      <Arg>org.eclipse.jetty.webapp.configuration</Arg>
> >      <Arg>
> >          <Array type="java.lang.String">
> >          <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
> >          <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
> >          <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
> >          <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
> >          <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
> >          <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
> >          <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
> >          <Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
> >          </Array>
> >      </Arg>
> >    </Call>



Back to the top