• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Getting JNDI to work on Resin 2.1.14

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to get JNDI and connection pooling to work correctly on Resin 2.1.14 that runs against MySQL 4.0.20. I've modified my resin.conf so that I have the <resource-ref> element within my <web-app> to specify the connection pooling that I want to use. However, when I try to get the JNDI context within my code with the following,
Context jndi = (Context)new InitialContext().lookup("java:comp/env");
DataSource ds = (DataSource)jndi.lookup("jdbc/mydatabaseref");

I see the error, "javax.naming.NameNotFoundException: java:comp/env/jdbc/mydatabaseref"

My resin.conf has the follwing:

<init-param driver-name="org.gjt.mm.mysql.Driver"/>
<init-param url="jdbc:mysql://localhost/mydatabase?autoReconnectForPools=true"/>
<init-param user="dbusr"/>
<init-param password="password"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30s"/>
<init-param max-active-time="12h"/>
<init-param max-pool-time="24h"/>
<init-param connection-wait-time="10m"/>
<init-param max-overflow-connections="5"/>
<init-param ping-table="PingTable"/>
<init-param ping-on-reuse="true"/>
<init-param ping-on-free="false/>
<init-param ping-on-idle="false/>
<init-param ping-interval="60s"/>

Can some one tell me what I'm doing wrong that's not allowing for the correct JNDI lookup?

What a stench! Central nervous system shutting down. Save yourself tiny ad!
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic