File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Problem in getting the datasource for mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problem in getting the datasource for mysql" Watch "Problem in getting the datasource for mysql" New topic
Author

Problem in getting the datasource for mysql

Mike Thomson
Ranch Hand

Joined: Nov 07, 2007
Posts: 115
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 ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10201
    
166



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


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in getting the datasource for mysql