Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Configuring Eclipse Jetty 8.1.5, MySQL 5.1 aka (where the <bleep> does a <resource-ref> go?)

Hi Jan,

Thanks for writing, I appreciate it!

I'm obviously a jetty newb, and haven't played with servlets in 10 years, so bear with me.

Searching the whole Jetty tree, there's no jetty-env.xml, and the only WEB-INF directory is in ${jetty}/webapps/gcm.

Okay, so I create jetty-env.xml in there with the xml you sent.

On restart I get an error:
java.lang.IllegalStateException: Unknown configuration type: New in org.eclipse.jetty.xml.XmlConfiguration
...blah,blah,blah...

Hrm...maybe the jetty-env.xml file needs to be somewhere else? So I try it in ${jetty}/etc. Same error. ${jetty}/contexts. Same error.

All I want to do is put up a simple servlet that can talk to the database efficiently.

On 07/08/2012 00:18, Jan Bartel wrote:
There are generally many different ways to acheive the same outcome in
jetty, so that's probably why you've seen different ways documented.
Generally having options is a good thing :)

Too many options, documented poorly, is less than optimal.

In case there's any confusion, this is the definitive page:
http://wiki.eclipse.org/Jetty/Feature/JNDI
If there's something missing, then please let us know so we can update the page.

Trying not to be snarky, adding more verbage to an already incomprehensible page won't help.

Your case is a little out-of-the-ordinary in that you are using
javaee-style features, but without a web.xml. This is not something
I've encountered before, but it sounds like something I should add to
the documentation.

I have no reason that I know of to want javaee features. In fact, that sounds like the wrong way to go, because my intuition at this point says it's going to end in twisty little passages, all the same.

Like I said: simple, single servlet, with efficient database access. That's all I want.

I would recommend (as does the page above) that you put any jndi
definitions into  a WEB-INF/jetty-env.xml file and *not* the context
xml file. If you do that, then you can effectively do what a web.xml
<resource-ref> element would do and bind your datasource into the
java:comp/env namespace by defining your resource and binding it into
java:comp/env in the one go (note this will *NOT* work in a context
xml file, it *must* be jetty-env.xml):

Sounds a lot like the scene from Monty Python:
Humphrey: I do wish you'd listen, Wymer. It's perfectly simple. If you're not getting your hair cut, you don't have to move your brother's clothes down to the lower peg. You simply collect his note before lunch, after you've done your scripture prep, when you've written your letter home, before rest, move your own clothes onto the lower peg, greet the visitors, and report to Mr. Viney that you've had your chit signed.

*sigh*

-Ken


Back to the top