• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in getting the datasource for mysql

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get the mysql datasource from servlet.
I have configured the datasource in mysql-ds.xml as follows:


Then, I configured web.xml and jboss-web.xml as follows:




In servlet, I am trying to get the datasource as follows:


But I am getting the followin exception:


Please help on it. And alos, I have another doubt, when will the objects are registered with JNDI. During deployment time, will the jboss app. server register the objects with JNDI on referring web.xml and ejb-jar.xml?
[ January 03, 2009: Message edited by: Mike Thomson ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The jndi-name is incorrect here. It should point to the JNDI name of the datasource. So it should be:



In your servlet, you can then lookup the resource at java:comp/env/jdbc/test
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic