File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes InjectionException 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 » Databases » JDBC
Bookmark "InjectionException" Watch "InjectionException" New topic
Author

InjectionException

Chetan Raju
Ranch Hand

Joined: Aug 02, 2006
Posts: 109
Hello All,
Not sure whether this is the right place to post this topic..

I have deployed a servlet on Sun Java System App Server 9.1. The code snippet for the problem area is


code:
--------------------------------------------------------------------------------



--------------------------------------------------------------------------------



I am getting a
code:
--------------------------------------------------------------------------------

com.sun.enterprise.InjectionException: Exception attempting to inject Res-Ref-Env-Property: servlets.GreetingServlet/myDB@javax.sql.DataSource@ resolved as: jndi: servlets.GreetingServlet/myDB@res principal: null@mail: null

--------------------------------------------------------------------------------



I am trying to connect to a MySQL database instance. I have also configured the web.xml for the resource which is a DataSource

code:
--------------------------------------------------------------------------------

myDB myDB javax.sql.DataSource

--------------------------------------------------------------------------------



What could be the problem ? Can anyone help ?

[Formated code - dave]
[ August 07, 2008: Message edited by: David O'Meara ]
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2379
    
    7

Is the JNDI name for the database defined in Sun App Server JDBC section? Have you use the traditional JDBC connection (using Driver class) to see if the connection really work?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
 
jQuery in Action, 2nd edition
 
subject: InjectionException