struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: Datasource not found by Plugin on startup
Date Mon, 03 Oct 2005 18:50:06 GMT
Mahmoud-

If your webapp is called foo, create a file 
$TOMCAT_HOME/conf/Catalina/localhost/foo.xml
You will need to match the exact name of the identified resource contained 
within foo.xml
<Resource name="jdbc/sampdb" type="javax.sql.DataSource"/>
later on you will reference
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
if(envCtx == null )
throw new Exception("Boom - No Environment Context");
// the following matches the resource name defined in foo.xml
DataSource ds =
(DataSource) envCtx.lookup("jdbc/sampdb");

http://forums.devshed.com/archive/t-120081

Please dont hesitate to contact me if you need any help,
Marty Gainty

(US)
001-617-852-7822
----- Original Message ----- 
From: "Faisal Mahmoud" <faisalmahmoud33@gmail.com>
To: <user@struts.apache.org>
Sent: Monday, October 03, 2005 1:09 PM
Subject: Datasource not found by Plugin on startup


Hi,
 I have written a plugin for a Struts app which accesses a DB connection via
a datasource. The datasource is defined in the Tomcat server.xml file, and
is loaded via a library we wrote. I know the datasource works fine because I
can access if from other classes in the app. But when I start up Tomcat, I
get the following exception thrown:

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Is there something I need to do to make the DS available to my Plugin?
 -Faisal
--
http://www.quidprocode.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message