Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Can't configure JNDI global datasource with jetty maven plugin

Hi again Jan,

You were totally right about resource-ref and web.xml

I tried and it just worked.

I never read the full servlet specification and I always tough it wasn't necessary... Actually I always tough it wasn't necessary to read the documentation at all to write JEE documentation but I may have always been wrong.

I thank you for helping solving me this issue and for teaching me that.


On 10/31/2012 10:16 PM, Jan Bartel wrote:
Hi Daniele,

Actually, the servlet specification dictates that users use Resource
entries in web.xml to hook up resources in the container to the
webapp. It just so happens that tomcat is relaxed about that and seems
to make all global resources available to the webapp - but that
behaviour is outside of the spec. So, the upshot is, if you want to be
container-agnostic, you're better off to stick to the spec.


On 1 November 2012 08:00, Daniele Segato <daniele.segato@xxxxxxxxx> wrote:
Hi Jan,

no I don't have any resource definition in the web.xml

I shouldn't need one actually.

As proof of that the same war works on other containers (example: Tomcat6).

The jndi resource is dinamically read by spring thanks to the
jee:lookup-jndi tag which means there's no need of defining it in the

Looking at the jetty debug log I don't see any log about the registration of
the jndi datasource I defined.

But I see it being parsed.

So I think the issue here is that jetty is simply not registering the JNDI.

I also tried connecting with jconsole to the instance (after merging the
jetty-jmx.xml into my jetty-plus.xml, the one included in jetty maven
plugin) but I do not see any datasource there.

Feel free to correct me if you think I'm saying something wrong but I would
be surprised if I need to set the web.xml resource ref: that wouldn't
explain why it works with tomcat6.

Thank you for your reply

Back to the top