Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Anyone using EL with newer Tomcat Servlet Environment and JNDI datasource?

Am 2014-10-16 14:54, schrieb Edson Richter:

[...]
3) My code to obtain a connection is plain standard:

  public static DataSource getDataSource() {
    try {
      Context ctx = new InitialContext();
      Context env = (Context) ctx.lookup("java:comp/env");
      DataSource ds = (DataSource) env.lookup("jdbc/myApp");
      return ds;
    } catch (Exception e) {
      Util.debug("******** ERROR ********");
      Util.debug(e);
      return null;
    }
  }
[...]


Hi Edson,

the myself coded lookup works here, too.
I've tested this to check if there would be any misconfiguration in Tomcat config. But I get the NullPointerException when EclipseLink wants to lookup the datasource during the connection try, although my lookup just a few code lines before doesn't have any problem. Well, I use Jetty now. Spent enough time with this stuff. I opened a bug report. Link is in my first mail. If it is boring I'll do another test with different DB driver/pool.

txl
Markus



Back to the top