Bill, This is the link to the page with the current docs: https://www.eclipse.org/jetty/documentation/
I don't see a link to a "jetty dependencies" page. Likely you are following out-of-date doco - alternatively post a link to the page linked from the one of the doc bundles above and I'll amend/remove it as necessary. jetty-plus is most definitely still in use. You'll need it. I suggest you look at either the embedded examples in the jetty repo or the test-jndi webapp in the jetty distro to see what you need to do. cheers Jan On 12 July 2015 at 02:45, Bill Ross <[email protected]> wrote: > By the way, I notice the 'Jetty dependencies site' is broken, and the jndi > intro page that mentions it looks out of date. > Why isn't the source for jetty-jndi.jar in the distribution? It would be > easier to debug. I found the jar on maven and got it via my build.gradle: > > compile group: 'org.eclipse.jetty', name: 'jetty-jndi', version: > '9.3.0.v20150612' > > But now it gives me this on lookup: > > 09:25:46.627 [qtp1963387170-11] ERROR com.priot.servlet.GetSession - Naming > javax.naming.NameNotFoundException > at > org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:532) > ~[jetty-jndi-9.3.0.v20150612.jar:9.3.0.v20150612] > at > org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:563) > ~[jetty-jndi-9.3.0.v20150612.jar:9.3.0.v20150612] > at > org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:578) > ~[jetty-jndi-9.3.0.v20150612.jar:9.3.0.v20150612] > at > org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:106) > ~[jetty-jndi-9.3.0.v20150612.jar:9.3.0.v20150612] > at javax.naming.InitialContext.lookup(InitialContext.java:417) > ~[?:1.8.0_45] > at com.priot.servlet.GetSession.doPost(GetSession.java:53) > [classes/:?] > > I wonder if this I got from the doc is right, since it defines the name - > what about the empty first arg? > Hm - it uses jetty.plus but jetty-plus.jar seems to be a thing of the past > (see note on out of date page above - jetty-plus.jar seems to have ended w/ > v7 in maven central). Another odd thing is that the name is in the Arg, not > in the id, which is normally what I'd expect to use to look up an object: > > <Configure class="org.eclipse.jetty.webapp.WebAppContext"> > <New id="prDataSource" class="org.eclipse.jetty.plus.jndi.Resource"> > <Arg></Arg> > <Arg>jdbc/pr</Arg> > <Arg> > <New class="com.mchange.v2.c3p0.ComboPooledDataSource"> > <Set name="driverClass">com.mysql.jdbc.Driver</Set> > <Set name="jdbcUrl">jdbc:mysql://localhost:3306/pr</Set> > <Set name="user">user</Set> > <Set name="password">pwd</Set> > </New> > </Arg> > </New> > </Configure> > > Thanks, > Bill > > > > On 7/10/2015 11:05 PM, Jan Bartel wrote: > > Looks to me that you don't have jetty-jndi.jar on the classpath - it > contains the jndi impl. > > Jan > > On 11 July 2015 at 14:52, Bill Ross <[email protected]> wrote: > > I have: > > ----- src/main/webapp/WEB-INF/web.xml > > ... > <resource-ref> > <description>DataSource</description> > <res-ref-name>jdbc/pr</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > ... > > ----- src/main/webapp/WEB-INF/jetty-env.xml > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" > "http://www.eclipse.org/jetty/configure.dtd"> > > <Configure class="org.eclipse.jetty.webapp.WebAppContext"> > <New id="prDataSource" class="org.eclipse.jetty.plus.jndi.Resource"> > <Arg></Arg> > <Arg>jdbc/pr</Arg> > <Arg> > <New class="com.mchange.v2.c3p0.ComboPooledDataSource"> > <Set name="driverClass">com.mysql.jdbc.Driver</Set> > <Set name="jdbcUrl">jdbc:mysql://localhost:3306/pr</Set> > <Set name="user">user</Set> > <Set name="password">pwd</Set> > </New> > </Arg> > </New> > </Configure> > > ------ src/main/java/com/priot/servlet/GetSession.java > > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > > InitialContext ic = new InitialContext(); > DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/pr"); > > --- Thrown on ic.lookup(): > > 01:19:19.592 [qtp1963387170-40] ERROR com.priot.servlet.GetSession - Naming > javax.naming.NoInitialContextException: Need to specify class name in > environment or system property, or as an applet parameter, or in an > application resource file: java.naming.factory.initial > at > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) > ~[?:1.8.0_45] > at > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) > ~[?:1.8.0_45] > at > javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) > ~[?:1.8.0_45] > at javax.naming.InitialContext.lookup(InitialContext.java:417) > ~[?:1.8.0_45] > at com.priot.servlet.GetSession.doPost(GetSession.java:53) > [classes/:?] > > It's as if my jetty-env.xml isn't being seen? But it is there in the war > file (along with the .swp). > > Am I missing something obvious? > > Thanks, > Bill > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users > > > > > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users -- Jan Bartel <[email protected]> www.webtide.com 'Expert assistance from the creators of Jetty and CometD' _______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
