• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic