Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Faced with the same problem. My <em>project/WEB-INF/jetty-env.xml</em> was:</p> <pre><code>&lt;New id="DS" class="org.eclipse.jetty.plus.jndi.Resource"&gt; &lt;Arg&gt;&lt;Ref id="studentsApp"/&gt;&lt;/Arg&gt; &lt;Arg&gt;jdbc/DS&lt;/Arg&gt; &lt;Arg&gt; &lt;New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"&gt; &lt;Set name="Url"&gt;jdbc:mysql://localhost:3306/students&lt;/Set&gt; &lt;Set name="User"&gt;root&lt;/Set&gt; &lt;Set name="Password"&gt;root&lt;/Set&gt; &lt;/New&gt; &lt;/Arg&gt; &lt;/New&gt; </code></pre> <p>And same error was occured. I tried to switch jndi scopes - didn't work. Event when I've tried to look into java:comp/ to look what jndi entries available, it returns nothing. Code for jndi listing used:</p> <pre><code>Context t = (Context)new InitialContext().lookup("java:comp"); listContext(t, ""); private static final void listContext(Context ctx, String indent) { try { NamingEnumeration list = ctx.listBindings(""); while (list.hasMore()) { Binding item = (Binding) list.next(); String className = item.getClassName(); String name = item.getName(); System.out.println(indent + className + " " + name); Object o = item.getObject(); if (o instanceof javax.naming.Context) { listContext((Context) o, indent + " "); } } } catch (NamingException ex) { System.out.println(ex); } } </code></pre> <p>I knew for sure that <strong>jetty-web.xml</strong> was loaded - I've added: </p> <pre><code>&lt;Call class="org.eclipse.jetty.util.log.Log" name="info"&gt;&lt;Arg&gt;Starting my super test application&lt;/Arg&gt;&lt;/Call&gt; </code></pre> <p>on top of the <strong>jetty-web.xml</strong> and it outputs at the server start. </p> <p>Than, I decided to move from non-portable <strong>jetty-web.xml</strong> to <strong>context.xml</strong> file, placed it into <em>$JETTY_HOME/contexts</em>, placed MySQL connector jar into <em>$JETTY_HOME/lib/ext</em> and it started to work. </p> <p>Looks like Jetty have a problem with JNDI entries if they are loaded from <strong>jetty-web.xml</strong>. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload