This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 10067
    
163



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