urgent - data-source and container managed datasource

2004-03-16 Thread Janice
Hi There,

I'm getting ready to ship off my application and I'm trying to use the
application server (standalone oc4j) to hold the data source information
instead of having it in struts-config.xml.  Is this possible?

When jDeveloper deploys to the server it builds me a data-sources.xml file
which I presume is correct.  When I test the connection, its fine.

In web.xml I entered:

  resource-ref
res-ref-namejdbc/bartCoreDS/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref

Where jdbc/bartCoreDS matches the location entry of the data-source in
data-sources.xml.

Then I took out the data-sources from struts-config.xml.  I'm not terribly
surprised that now my application can't find the database.  The problem is I
don't know where to look for instructions on how to do this or if its even
possible.  Is there a way to put a data-source configuration in
struts-config.xml that tells it to look at the container, so that the
username and password aren't in it??

If I can provide more information, I will.  Time is running a bit short, so
I'd really, really appreciate a quick response.

Janice


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: urgent - data-source and container managed datasource

2004-03-16 Thread Richard Yee
Janice,
Check out these links:
http://otn.oracle.com/sample_code/tech/java/codesnippet/j2ee/jdbc/JDBC_in_J2EE.html
http://otn.oracle.com/products/jdev/tips/duff/mysql_and_oc4j3.html

It works fine for me.

-Richard


--- Janice [EMAIL PROTECTED] wrote:
 Hi There,
 
 I'm getting ready to ship off my application and I'm
 trying to use the
 application server (standalone oc4j) to hold the
 data source information
 instead of having it in struts-config.xml.  Is this
 possible?
 
 When jDeveloper deploys to the server it builds me a
 data-sources.xml file
 which I presume is correct.  When I test the
 connection, its fine.
 
 In web.xml I entered:
 
   resource-ref
 res-ref-namejdbc/bartCoreDS/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
   /resource-ref
 
 Where jdbc/bartCoreDS matches the location entry
 of the data-source in
 data-sources.xml.
 
 Then I took out the data-sources from
 struts-config.xml.  I'm not terribly
 surprised that now my application can't find the
 database.  The problem is I
 don't know where to look for instructions on how to
 do this or if its even
 possible.  Is there a way to put a data-source
 configuration in
 struts-config.xml that tells it to look at the
 container, so that the
 username and password aren't in it??
 
 If I can provide more information, I will.  Time is
 running a bit short, so
 I'd really, really appreciate a quick response.
 
 Janice
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: urgent - data-source and container managed datasource

2004-03-16 Thread Shyam A
Hello,

I have configured my data source on OC4J standalone
version. Given below are snippets from the relevant
files:

In my data-sources.xml , I have
data-source
class=com.evermind.sql.DriverManagerDataSource
name=TestDS
location=jdbc/OracleCoreDS
xa-location=jdbc/xa/OracleXADS
ejb-location=jdbc/TestDS
connection-driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@servername:1521:test
username=username
password=password
min-connections=5 
max-connections=20
inactivity-timeout=30
/

I lookup this data source in a DatabaseServlet,
which is loaded on server startup, and intialize a
static variable in my DBConnection class, which
manages database connections.

I use the code below:
snip
InitialContext ic = new InitialContext();
DataSource ds =
(DataSource)ic.lookup(jdbc/TestDS);
..
DBConnection.dataSource=ds; //initializeDataSource in
the DBConnection class
   
snip

In my DBConnection class, I have methods like
openConnection(), closeConnection() et al to handle
connections from the data source.

snip
public Connection openConnection() 
   {
Connection con=null;
try
   {
   con = dataSource.getConnection();
   }   
 catch(Exception e)
{ 
  System.out.println(Error: Unable to get
connection  + e.getMessage());

}
return con;   
   }
snip

In order to load the DatabaseServlet on starup, I have
the following in the web.xml file:

servlet
servlet-namedatabase/servlet-name
   
servlet-classobs.application.DatabaseServlet/servlet-class
   
load-on-startup1/load-on-startup
  /servlet


HTH,
Shyam


--- Janice [EMAIL PROTECTED] wrote:
 Hi There,
 
 I'm getting ready to ship off my application and I'm
 trying to use the
 application server (standalone oc4j) to hold the
 data source information
 instead of having it in struts-config.xml.  Is this
 possible?
 
 When jDeveloper deploys to the server it builds me a
 data-sources.xml file
 which I presume is correct.  When I test the
 connection, its fine.
 
 In web.xml I entered:
 
   resource-ref
 res-ref-namejdbc/bartCoreDS/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
   /resource-ref
 
 Where jdbc/bartCoreDS matches the location entry
 of the data-source in
 data-sources.xml.
 
 Then I took out the data-sources from
 struts-config.xml.  I'm not terribly
 surprised that now my application can't find the
 database.  The problem is I
 don't know where to look for instructions on how to
 do this or if its even
 possible.  Is there a way to put a data-source
 configuration in
 struts-config.xml that tells it to look at the
 container, so that the
 username and password aren't in it??
 
 If I can provide more information, I will.  Time is
 running a bit short, so
 I'd really, really appreciate a quick response.
 
 Janice
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



urgent - data-source and container managed datasource

2004-03-16 Thread Janice
A big thank you to Richard and Shyam!  I have things working again and am
back on track to get this app deployed!!

Janice

- Original Message - 
From: Janice
To: [EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 11:56 AM
Subject: urgent - data-source and container managed datasource


Hi There,

I'm getting ready to ship off my application and I'm trying to use the
application server (standalone oc4j) to hold the data source information
instead of having it in struts-config.xml.  Is this possible?

When jDeveloper deploys to the server it builds me a data-sources.xml file
which I presume is correct.  When I test the connection, its fine.

In web.xml I entered:

  resource-ref
res-ref-namejdbc/bartCoreDS/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref

Where jdbc/bartCoreDS matches the location entry of the data-source in
data-sources.xml.

Then I took out the data-sources from struts-config.xml.  I'm not terribly
surprised that now my application can't find the database.  The problem is I
don't know where to look for instructions on how to do this or if its even
possible.  Is there a way to put a data-source configuration in
struts-config.xml that tells it to look at the container, so that the
username and password aren't in it??

If I can provide more information, I will.  Time is running a bit short, so
I'd really, really appreciate a quick response.

Janice


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DataSource help

2004-02-13 Thread Raman
Hi All,

I have a problem regarding the DB connection. In my application i want to log the 
session time for each session. For that I am using the Session Listner in web.xml 
somthing like: 
listenerlistener-classactions.SessionListenerAction/listener-class/listener

My problem is:

In my struts-config.xml file I have data-sourceset-property defined for my 
database. 
what I am thinking is to call Insert query in 
public void sessionCreated(HttpSessionEvent event) { } 

and update query public void sessionDestroyed(HttpSessionEvent event) {} function

But my problem is how to get and pass the DataSource that refers to my DB defined in 
datasource tag of struts-conf file to my DAO file.

WHAT I TRIED IS:
   String name = event.getName();
   HttpSession session = event.getSession();
   ServletContext sc = session.getServletContext();   
   try{   
   DataSource dataSource =(DataSource)sc.getAttribute(Action.DATA_SOURCE_KEY);   
   UpdateSessionListenerDAO dao= new  UpdateSessionListenerDAO(dataSource);
   dao.insertSessionLogging(session.getId().toString());
   }catch(Exception e){
System.out.println(ERROR  + e.getMessage());
   }

But this is not working I was not able to figure out the reason.

Pls help.. 

-- Raman

RE: DataSource help

2004-02-13 Thread McCormack, Chris
put a trigger on the data table you are selecting from, that inserts a timestamp in to 
a timestamplog table, when a select is done on your data table. Or create a view and 
put a trigger on that, to preserve the functionality of the data table (ie not have a 
trigger fire when you are just doing dev etc.)

-Original Message-
From: Raman [mailto:[EMAIL PROTECTED]
Sent: 13 February 2004 12:06
To: Struts Users Mailing List
Subject: DataSource help


Hi All,

I have a problem regarding the DB connection. In my application i want to log the 
session time for each session. For that I am using the Session Listner in web.xml 
somthing like: 
listenerlistener-classactions.SessionListenerAction/listener-class/listener

My problem is:

In my struts-config.xml file I have data-sourceset-property defined for my 
database. 
what I am thinking is to call Insert query in 
public void sessionCreated(HttpSessionEvent event) { } 

and update query public void sessionDestroyed(HttpSessionEvent event) {} function

But my problem is how to get and pass the DataSource that refers to my DB defined in 
datasource tag of struts-conf file to my DAO file.

WHAT I TRIED IS:
   String name = event.getName();
   HttpSession session = event.getSession();
   ServletContext sc = session.getServletContext();   
   try{   
   DataSource dataSource =(DataSource)sc.getAttribute(Action.DATA_SOURCE_KEY);   
   UpdateSessionListenerDAO dao= new  UpdateSessionListenerDAO(dataSource);
   dao.insertSessionLogging(session.getId().toString());
   }catch(Exception e){
System.out.println(ERROR  + e.getMessage());
   }

But this is not working I was not able to figure out the reason.

Pls help.. 

-- Raman

***
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please 
notify the sender immediately and delete this 
e-mail from your system.
You must take no action based on this, nor must 
you copy or disclose it or any part of its contents 
to any person or organisation.
Statements and opinions contained in this email may 
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DataSource help

2004-02-13 Thread Niall Pemberton
What was the error message?

Niall

-Original Message-
From: Raman [mailto:[EMAIL PROTECTED]
Sent: 13 February 2004 12:06
To: Struts Users Mailing List
Subject: DataSource help


Hi All,

I have a problem regarding the DB connection. In my application i want to
log the session time for each session. For that I am using the Session
Listner in web.xml somthing like:
listenerlistener-classactions.SessionListenerAction/listener-class/li
stener

My problem is:

In my struts-config.xml file I have data-sourceset-property defined for
my database.
what I am thinking is to call Insert query in
public void sessionCreated(HttpSessionEvent event) { }

and update query public void sessionDestroyed(HttpSessionEvent event) {}
function

But my problem is how to get and pass the DataSource that refers to my DB
defined in datasource tag of struts-conf file to my DAO file.

WHAT I TRIED IS:
   String name = event.getName();
   HttpSession session = event.getSession();
   ServletContext sc = session.getServletContext();
   try{
   DataSource dataSource
=(DataSource)sc.getAttribute(Action.DATA_SOURCE_KEY);
   UpdateSessionListenerDAO dao= new  UpdateSessionListenerDAO(dataSource);
   dao.insertSessionLogging(session.getId().toString());
   }catch(Exception e){
System.out.println(ERROR  + e.getMessage());
   }

But this is not working I was not able to figure out the reason.

Pls help..

-- Raman

***
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please
notify the sender immediately and delete this
e-mail from your system.
You must take no action based on this, nor must
you copy or disclose it or any part of its contents
to any person or organisation.
Statements and opinions contained in this email may
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem in using DataSource with Informix9.x Database..?

2004-02-12 Thread Vishal Arora
Hi,

   I  m using Tomcat5.0  and Struts1.1   and Informix 9.x as database
  When i m trying to use DataSource  of
org.apache.commons.dbcp.BasicDataSource  in my struts application it
gives error
.I have  mentioned in struts-config file also abt sdatasource  like
username,password,drivername and url .


the error it's giving is..
DBCP borrowObject  failed
:java.sql.SQLException:com.informix.asf.IfxASFException:Invalid ASF API
input
parameters.

org.apache.commons.dbcp.DbcpException:java.sql.SQLException:com.informix.asf.IfxASFException:Invalid
ASF API
input parameters.


Even i tried to make a servlet and use Tomcat's inbuilt  DataSource
object  Informix9.x  as Database  and
Tomcat 5.0

 it gives erroor  connectionPool.exaushted.

Please anyone who has used Tomcat5.0 as webserver and Informix as
database and hence used tomcat's DataSource
object please help me by giving the code or what all neccessary things i
have to place and where  and what
neccessary changes i have to made and where.


Please this is very Urgent as i have to use this  thing in my project
and soo have to show to my superiors.

Thanks in advance.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Accessing Struts Datasource from another action servlet

2004-02-02 Thread James MacKenzie
Hi Guys,

I have a web application written in Stuts and am writing a scheduler which 
is a seperate action servlet which is configured in the web.xml file to 
start at startup. 
All of my other action classes are session based so they can get the 
default datasource (From the struts-config.xml)  from the session using;
DataSource ds = getDataSource(request); 
I also store this datasource in the session so that I can access it from 
jsp's or pass it to other standalone servlets for background database 
processing and this approach seems to work well. I can't use this approach 
for the scheduler though as I can't guarantee that anyone will start a 
session so I can pass the datasource.

My question is, how do I use the struts datasource in my scheduled 
servlet?

Thanks for any help!

Regards, James


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Accessing Struts Datasource from another action servlet

2004-02-02 Thread Mark Lowe
have you not seen the threads regarding the struts datasource?

the party line seems to frown upon it as it encourages breaking with 
MVC, unless you pass the connection up to the model tier.

that said, in your shoes I'd configure a datasource in the second 
webapp (albeit with the same config values) rather than trying to pass 
from one to the other.

I'd also suggest that storing datasources in the session isn't ideal 
but thats just my opinion.

Cheers Mark

On 2 Feb 2004, at 10:28, James MacKenzie wrote:

Hi Guys,

I have a web application written in Stuts and am writing a scheduler 
which
is a seperate action servlet which is configured in the web.xml file to
start at startup.
All of my other action classes are session based so they can get the
default datasource (From the struts-config.xml)  from the session 
using;
DataSource ds = getDataSource(request);
I also store this datasource in the session so that I can access it 
from
jsp's or pass it to other standalone servlets for background database
processing and this approach seems to work well. I can't use this 
approach
for the scheduler though as I can't guarantee that anyone will start a
session so I can pass the datasource.

My question is, how do I use the struts datasource in my scheduled
servlet?
Thanks for any help!

Regards, James

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


REPOST: newbie datasource config problems

2004-01-28 Thread Jim Anderson
(The original msg didn't seem to make it to the list.)

I'm trying to configure my Struts 1.1 app (Tomcat 4) for MySQL access 
and getting nothing but grief. Currently, I'm showing the following 
error in the log file:

	java.lang.NoClassDefFoundError: 
org/apache/struts/legacy/GenericDataSource

Could someone please send me samples of what web.xml and 
struts-config.xml should look like when properly configured?

Thanks very much,

jim





RE: REPOST: newbie datasource config problems

2004-01-28 Thread Matthias Wessendorf
hi jim!

did you add struts-legacy.jar in WEB-INF/lib ?

but in 1.2 its not more supported (GenericDataSource)

look here:
http://jakarta.apache.org/struts/faqs/database.html
(The Struts DataSource Manager)

then you need pool.jar and 
dbcp.jar

from the corresponding commons-projects
- http://jakarta.apache.org/commons/pool/
- http://jakarta.apache.org/commons/dbcp/


greetings 

matthias

-Original Message-
From: Jim Anderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 6:14 PM
To: Struts Users Mailing List
Subject: REPOST: newbie datasource config problems


(The original msg didn't seem to make it to the list.)

I'm trying to configure my Struts 1.1 app (Tomcat 4) for MySQL access 
and getting nothing but grief. Currently, I'm showing the following 
error in the log file:

java.lang.NoClassDefFoundError: 
org/apache/struts/legacy/GenericDataSource

Could someone please send me samples of what web.xml and 
struts-config.xml should look like when properly configured?

Thanks very much,

jim





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: newbie datasource config problems

2004-01-28 Thread Matthias Wessendorf
hi jim, 
again...

here in your struts-conf:

data-source type=org.apache.commons.dbcp.BasicDataSource
set-property property=driverClassName
value=com.mysql.jdbc.Driver /
set-property property=url
value=jdbc:mysql://localhost:3306/myDatabase /
set-property property=username value=root /
set-property property=password value= /
   set-property property=defaultAutoCommit value=true /
set-property property=defaultReadOnly value=false /
/data-source

but it needs the pool.jar and 
dbcp.jar

from the commons-projects
- http://jakarta.apache.org/commons/pool/
- http://jakarta.apache.org/commons/dbcp/

it for 1.2 and later

look here for more:
http://jakarta.apache.org/struts/faqs/database.html
(The Struts DataSource Manager)

greetings
matthias

-Original Message-
From: Jim Anderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 5:07 PM
To: Struts Users Mailing List
Subject: newbie datasource config problems


I'm trying to configure my Struts 1.1 app for MySQL access and getting 
nothing but grief. Currently, I'm showing the following error in the 
log file:

java.lang.NoClassDefFoundError: 
org/apache/struts/legacy/GenericDataSource

Could someone please send me samples of what web.xml and 
struts-config.xml should look like when properly configured?

Thanks very much,

jim


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: REPOST: newbie datasource config problems

2004-01-28 Thread Jim Anderson
Matthias,

Thanks very much for responding! It seems there's a misunderstanding on 
my side. I guess I'll have to rethink it. From what you say, there 
isn't any reason to include a data-sources element in struts-config 
since the persistence layer should be invisible to Struts. Am I 
understanding you correctly?

On Jan 28, 2004, at 12:26 PM, Matthias Wessendorf wrote:

hi jim!

did you add struts-legacy.jar in WEB-INF/lib ?

but in 1.2 its not more supported (GenericDataSource)

look here:
http://jakarta.apache.org/struts/faqs/database.html
(The Struts DataSource Manager)
then you need pool.jar and
dbcp.jar
from the corresponding commons-projects
- http://jakarta.apache.org/commons/pool/
- http://jakarta.apache.org/commons/dbcp/
greetings

matthias

-Original Message-
From: Jim Anderson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 6:14 PM
To: Struts Users Mailing List
Subject: REPOST: newbie datasource config problems
(The original msg didn't seem to make it to the list.)

I'm trying to configure my Struts 1.1 app (Tomcat 4) for MySQL access
and getting nothing but grief. Currently, I'm showing the following
error in the log file:
java.lang.NoClassDefFoundError:
org/apache/struts/legacy/GenericDataSource
Could someone please send me samples of what web.xml and
struts-config.xml should look like when properly configured?
Thanks very much,

jim





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

jim

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: REPOST: newbie datasource config problems

2004-01-28 Thread Matthias Wessendorf
jim,

in 1.2
there is no GenericDataSource.
(because legacy.jar will be removed)

you can still use a DataSource 
with BasicDataSource.

after 2.0 it will also be moved away
(see the faq)

with the datasource,
you write JDBC in an action-class.
do you really want it ? :-)


in my case i use (allways) a delegate-class, which
handles OJB (for storeing und getting objects from a database)
or EJB.
but action only speaks with interface of my delegate
see also 
http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
for delegate and other patterns inclusive of DAO.



cheers,


-Original Message-
From: Jim Anderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 7:29 PM
To: Struts Users Mailing List
Subject: Re: REPOST: newbie datasource config problems


Matthias,

Thanks very much for responding! It seems there's a misunderstanding on 
my side. I guess I'll have to rethink it. From what you say, there 
isn't any reason to include a data-sources element in struts-config 
since the persistence layer should be invisible to Struts. Am I 
understanding you correctly?

On Jan 28, 2004, at 12:26 PM, Matthias Wessendorf wrote:

 hi jim!

 did you add struts-legacy.jar in WEB-INF/lib ?

 but in 1.2 its not more supported (GenericDataSource)

 look here: http://jakarta.apache.org/struts/faqs/database.html
 (The Struts DataSource Manager)

 then you need pool.jar and
 dbcp.jar

 from the corresponding commons-projects
 - http://jakarta.apache.org/commons/pool/
 - http://jakarta.apache.org/commons/dbcp/


 greetings

 matthias

 -Original Message-
 From: Jim Anderson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 28, 2004 6:14 PM
 To: Struts Users Mailing List
 Subject: REPOST: newbie datasource config problems


 (The original msg didn't seem to make it to the list.)

 I'm trying to configure my Struts 1.1 app (Tomcat 4) for MySQL access 
 and getting nothing but grief. Currently, I'm showing the following 
 error in the log file:

   java.lang.NoClassDefFoundError: 
 org/apache/struts/legacy/GenericDataSource

 Could someone please send me samples of what web.xml and 
 struts-config.xml should look like when properly configured?

 Thanks very much,

 jim





 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



jim


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



LDAP + DataSource

2004-01-23 Thread Oliver Thiel
Hi all,
 
 
Is it possible to set up a DataSource for LDAP?
If yes how can I do this? And how do I retrieve a
connection?
 
 
Thanks
Oliver
 
 


Re: LDAP + DataSource

2004-01-23 Thread ian_d_stewart
LDAP, as the name implies, is a Directory Access Protocol.  As such, you
cannot use JDBC to establish connections.  However, java does provide an
analagous interface for accessing Naming and Directory Services (LDAP, DNS,
etc) known as the Java Naming and Directory Interface (JNDI).

A good starting point to learn more about JNDI is 'Developing a White Pages
Service with LDAP and JNDI' by Budi Kurniawan
(http://www.onjava.com/pub/a/onjava/2001/05/21/jndi.html)


HTH,
Ian



   

Oliver Thiel 

thiel.oliver@   To: [EMAIL PROTECTED]   
   
gmx.de  cc:   

 Subject: LDAP + DataSource

01/23/2004 

07:55 AM   

Please respond 

to Struts 

Users Mailing  

List  

   

   





Hi all,


Is it possible to set up a DataSource for LDAP?
If yes how can I do this? And how do I retrieve a
connection?


Thanks
Oliver








This transmission may contain information that is privileged, confidential and/or 
exempt from disclosure under applicable law. If you are not the intended recipient, 
you are hereby notified that any disclosure, copying, distribution, or use of the 
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. 
If you received this transmission in error, please immediately contact the sender and 
destroy the material in its entirety, whether in electronic or hard copy format. Thank 
you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LDAP + DataSource

2004-01-23 Thread konf
Hallo,
generally, it is right.
but, there exist jdbc driver for ldap (for example,
http://www.octetstring.com/products/jdbcldapdriver/). I do not use it, becouse I
am using the classical way (java ldap packages from novell), but I was view the
samples of jdbc way and I thing if you use it (jdbc), you can create datasource.

But as I wrote, I am using the classic way to access LDAP.

Best regards
Jiri

 LDAP, as the name implies, is a Directory Access Protocol.  As such, you
 cannot use JDBC to establish connections.  However, java does provide an
 analagous interface for accessing Naming and Directory Services (LDAP, DNS,
 etc) known as the Java Naming and Directory Interface (JNDI).
 
 A good starting point to learn more about JNDI is 'Developing a White Pages
 Service with LDAP and JNDI' by Budi Kurniawan
 (http://www.onjava.com/pub/a/onjava/2001/05/21/jndi.html)
 
 
 HTH,
 Ian
 
 
 
  
  
 Oliver Thiel   
  
 thiel.oliver@   To:
 [EMAIL PROTECTED]  
 gmx.de  cc: 
  
  Subject: LDAP + DataSource  
  
 01/23/2004   
  
 07:55 AM 
  
 Please respond   
  
 to Struts   
  
 Users Mailing
  
 List
  
  
  
  
  
 
 
 
 
 Hi all,
 
 
 Is it possible to set up a DataSource for LDAP?
 If yes how can I do this? And how do I retrieve a
 connection?
 
 
 Thanks
 Oliver
 
 
 
 
 
 
 
 
 This transmission may contain information that is privileged, confidential
 and/or exempt from disclosure under applicable law. If you are not the
 intended recipient, you are hereby notified that any disclosure, copying,
 distribution, or use of the information contained herein (including any
 reliance thereon) is STRICTLY PROHIBITED. If you received this transmission
 in error, please immediately contact the sender and destroy the material in
 its entirety, whether in electronic or hard copy format. Thank you.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: LDAP + DataSource

2004-01-23 Thread Oliver Thiel
THANKS Jiri that's what I was searching for.
THANKS Ian for the nice explanation on LDAP ;) OK, maybe may question
was not very precise - sorry!


But anyway thanks to both of you!
Oliver

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 23. Januar 2004 16:49
An: Struts Users Mailing List
Betreff: Re: LDAP + DataSource

Hallo,
generally, it is right.
but, there exist jdbc driver for ldap (for example,
http://www.octetstring.com/products/jdbcldapdriver/). I do not use it,
becouse I
am using the classical way (java ldap packages from novell), but I was
view the
samples of jdbc way and I thing if you use it (jdbc), you can create
datasource.

But as I wrote, I am using the classic way to access LDAP.

Best regards
Jiri

 LDAP, as the name implies, is a Directory Access Protocol.  As such,
you
 cannot use JDBC to establish connections.  However, java does provide
an
 analagous interface for accessing Naming and Directory Services (LDAP,
DNS,
 etc) known as the Java Naming and Directory Interface (JNDI).
 
 A good starting point to learn more about JNDI is 'Developing a White
Pages
 Service with LDAP and JNDI' by Budi Kurniawan
 (http://www.onjava.com/pub/a/onjava/2001/05/21/jndi.html)
 
 
 HTH,
 Ian
 
 
 


  
 Oliver Thiel

  
 thiel.oliver@   To:
 [EMAIL PROTECTED]  
 gmx.de  cc:

  
  Subject: LDAP +
DataSource  
  
 01/23/2004

  
 07:55 AM

  
 Please respond

  
 to Struts

  
 Users Mailing

  
 List

  


  


  
 
 
 
 
 Hi all,
 
 
 Is it possible to set up a DataSource for LDAP?
 If yes how can I do this? And how do I retrieve a
 connection?
 
 
 Thanks
 Oliver
 
 
 
 
 
 
 
 
 This transmission may contain information that is privileged,
confidential
 and/or exempt from disclosure under applicable law. If you are not the
 intended recipient, you are hereby notified that any disclosure,
copying,
 distribution, or use of the information contained herein (including
any
 reliance thereon) is STRICTLY PROHIBITED. If you received this
transmission
 in error, please immediately contact the sender and destroy the
material in
 its entirety, whether in electronic or hard copy format. Thank you.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem instantiating a datasource

2004-01-19 Thread Engbers, ir. J.B.O.M.
I am using Struts 1.1 and Tomcat 4.1.18 and MySQL 4.0.17. 
In \Tomcat\common\lib I have jdbc2_0-stdext.jar and as connector I use
mysql-connector-java-3.0.9-stable-bin.jar which is located in
JAVA_HOME\jre\lib\ext

The user username is granted all rights to a test-database and mysql test
- u username -p connects to this database without problems.
Struts-config.xml contains the following lines:
  data-sources
data-source key=test
 type=javax.sql.DataSource
  set-property property=autoCommit
value=true/
  set-property property=driverClass
value=com.mysql.jdbc.Driver/
  set-property property=maxCount
value=6/
  set-property property=minCount 
value=2/
  set-property property=user
value=username/
  set-property property=password
value=pasword/
  set-property property=url
value=jdbc:mysql://localhost:3306/test/
/data-source
  /data-sources

At the end of web.xml, I have added the following lines:
  resource-ref
res-ref-namejdbc/test/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref

When I reload the application, tomcat\logs\stderr.log contains the following
lines:
java.lang.InstantiationException: javax.sql.DataSource
at java.lang.Class.newInstance0(Class.java:293)
at java.lang.Class.newInstance(Class.java:261)
at
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:23
1) 
..

and when I try to run the application, the browser displays this message:
The requested service (Servlet action is currently unavailable) is not
currently available. 

When I remove the datasource, there are no problems.

How can I check why instantiating of the DataSource fails and where do I
make a mistake?

Ben

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Help : null DataSource

2004-01-18 Thread lixin chu
Hi,
I am unable to get a DataSource in my Action. Here is
my code snippet:

struts-config.xml
--
data-source
set-property
property=driverClass
value=com.mysql.jdbc.Driver/
  
set-property
property=maxCount
value=4/

set-property
property=minCount
value=2/

set-property
property=user
value=canal/

set-property
property=password
value=canal/

set-property
property=url
   
value=jdbc:mysql://localhost:3306/newapp/

/data-source

in my lib\ directory, I have

jdbc-2_0-stdext.jar
mysql-connector-java-3.0.9-stable-bin.jar

in my action.java
-
ServletContext ctx = servlet.getServletContext();
if (ctx == null)
   System.out.println (---can not initialize
context);
else System.out.println (---conetxt created);

dataSource =
(DataSource)ctx.lookup(jdbc:mysql://localhost:3306/newapp);
..

when I check the dataSource, it is null.
I am lost now

thanks !
li xin


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Datasource problem

2004-01-07 Thread cnd
Hi,

I must be missing something here but for the life of me I cannot see what
it is. I've search the mail archives and can't find anything the same,
also I checked 3 different books and it looks like I have everything
configured correctly, I also tried two diffent MySQL drivers.

I have added a datasource to my struts-config and when I run the application I
can see it initializes ok:

Jan 7, 2004 10:09:48 PM org.apache.struts.legacy.GenericDataSource
createConnection
INFO:createConnection()
Jan 7, 2004 10:09:49 PM org.apache.struts.legacy.GenericDataSource
createConnection
INFO:createConnection()

If I mess up the password I get an access denied error on the db when this
runs so that tells me I am getting a connection.

But when I try to access the datasource inside my action using the
following code:

DataSource dataSource = getDataSource(req);

dataSource returns null which is where I'm stumped.

Anyone get any idea what this might be? I'm using struts 1.1 and tried JDK
1.4 and 1.3.

Here's my struts-config:

data-sources
  data-source key=dataSource
set-property property=driverClass value=com.mysql.jdbc.Driver/
set-property property=url value=jdbc:mysql://127.0.0.1:3306/ash/
set-property property=user value=myusername /
set-property property=password value=mypassword /
set-property property=minCount value=2 /
set-property property=maxCount value=4 /
  /data-source
/data-sources


The exception is java.lang.NullPointerException which results from trying
to use the null dataSource.

There is one other compiler error I am getting when I build the project
which I still trying to track down:

Jan 7, 2004 10:09:48 PM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 19 column -1: Attribute value for path is
#REQUIRED.
org.xml.sax.SAXParseException: Attribute value for path is #REQUIRED.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3317)
at
org.apache.crimson.parser.Parser2.defaultAttributes(Parser2.java:1889)
at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1600)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at
org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1006)
at
org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)


Thanks for any advice.


Chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Datasource problem

2004-01-07 Thread Matthias Wessendorf
hi chris,

have you tried:

getDataSource(req,dataSource);


greetings



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 10:25 AM
To: [EMAIL PROTECTED]
Subject: Datasource problem


Hi,

I must be missing something here but for the life of me I cannot see
what it is. I've search the mail archives and can't find anything the
same, also I checked 3 different books and it looks like I have
everything configured correctly, I also tried two diffent MySQL drivers.

I have added a datasource to my struts-config and when I run the
application I can see it initializes ok:

Jan 7, 2004 10:09:48 PM org.apache.struts.legacy.GenericDataSource
createConnection
INFO:createConnection()
Jan 7, 2004 10:09:49 PM org.apache.struts.legacy.GenericDataSource
createConnection
INFO:createConnection()

If I mess up the password I get an access denied error on the db when
this runs so that tells me I am getting a connection.

But when I try to access the datasource inside my action using the
following code:

DataSource dataSource = getDataSource(req);

dataSource returns null which is where I'm stumped.

Anyone get any idea what this might be? I'm using struts 1.1 and tried
JDK 1.4 and 1.3.

Here's my struts-config:

data-sources
  data-source key=dataSource
set-property property=driverClass value=com.mysql.jdbc.Driver/
set-property property=url
value=jdbc:mysql://127.0.0.1:3306/ash/
set-property property=user value=myusername /
set-property property=password value=mypassword /
set-property property=minCount value=2 /
set-property property=maxCount value=4 /
  /data-source
/data-sources


The exception is java.lang.NullPointerException which results from
trying to use the null dataSource.

There is one other compiler error I am getting when I build the project
which I still trying to track down:

Jan 7, 2004 10:09:48 PM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 19 column -1: Attribute value for path is
#REQUIRED.
org.xml.sax.SAXParseException: Attribute value for path is #REQUIRED.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3317)
at
org.apache.crimson.parser.Parser2.defaultAttributes(Parser2.java:1889)
at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1600)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
at
org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at
org.apache.commons.digester.Digester.parse(Digester.java:1548)
at
org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServl
et.java:1006)
at
org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.ja
va:955)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:918)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:3279)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3421
)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)


Thanks for any advice.


Chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional

RE: Datasource problem

2004-01-07 Thread cnd
Thanks Mathias, just after I sent the email I got it working using the key
as you suggested.  I tried using the key earlier today and it didn't work,
probably I had some other problem which I accidentally fixed and now I've
confused myself.

Shouldn't it work without the key since I only have the one datasource
and all the docs I've seen don't require the key. My understanding is that
the key is only required when there is more than one datasource. No?

Thanks for your help.

Chris


On Wed, 7 Jan 2004, Matthias Wessendorf wrote:

 hi chris,

 have you tried:

 getDataSource(req,dataSource);


 greetings



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 10:25 AM
 To: [EMAIL PROTECTED]
 Subject: Datasource problem


 Hi,

 I must be missing something here but for the life of me I cannot see
 what it is. I've search the mail archives and can't find anything the
 same, also I checked 3 different books and it looks like I have
 everything configured correctly, I also tried two diffent MySQL drivers.

 I have added a datasource to my struts-config and when I run the
 application I can see it initializes ok:

 Jan 7, 2004 10:09:48 PM org.apache.struts.legacy.GenericDataSource
 createConnection
 INFO:createConnection()
 Jan 7, 2004 10:09:49 PM org.apache.struts.legacy.GenericDataSource
 createConnection
 INFO:createConnection()

 If I mess up the password I get an access denied error on the db when
 this runs so that tells me I am getting a connection.

 But when I try to access the datasource inside my action using the
 following code:

 DataSource dataSource = getDataSource(req);

 dataSource returns null which is where I'm stumped.

 Anyone get any idea what this might be? I'm using struts 1.1 and tried
 JDK 1.4 and 1.3.

 Here's my struts-config:

 data-sources
   data-source key=dataSource
 set-property property=driverClass value=com.mysql.jdbc.Driver/
 set-property property=url
 value=jdbc:mysql://127.0.0.1:3306/ash/
 set-property property=user value=myusername /
 set-property property=password value=mypassword /
 set-property property=minCount value=2 /
 set-property property=maxCount value=4 /
   /data-source
 /data-sources


 The exception is java.lang.NullPointerException which results from
 trying to use the null dataSource.

 There is one other compiler error I am getting when I build the project
 which I still trying to track down:

 Jan 7, 2004 10:09:48 PM org.apache.commons.digester.Digester error
 SEVERE: Parse Error at line 19 column -1: Attribute value for path is
 #REQUIRED.
 org.xml.sax.SAXParseException: Attribute value for path is #REQUIRED.
   at org.apache.crimson.parser.Parser2.error(Parser2.java:3317)
   at
 org.apache.crimson.parser.Parser2.defaultAttributes(Parser2.java:1889)
   at
 org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1600)
   at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
   at
 org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
   at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
   at
 org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
   at
 org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
   at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
   at
 org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
   at
 org.apache.commons.digester.Digester.parse(Digester.java:1548)
   at
 org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServl
 et.java:1006)
   at
 org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.ja
 va:955)
   at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
   at javax.servlet.GenericServlet.init(GenericServlet.java:256)
   at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
 a:918)
   at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
   at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
 ava:3279)
   at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3421
 )
   at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
   at
 org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
   at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
   at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
   at
 org.apache.catalina.core.StandardService.start(StandardService.java:388)
   at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
   at
 org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
   at
 org.apache.catalina.startup.Catalina.process(Catalina.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native

RE: Datasource problem

2004-01-07 Thread Matthias Wessendorf
hi Chris!

only one can be defined without a key 

it is stored under default:
Globals.DATA_SOURCE_KEY

and of cource
in struts 1.2 you must!!! specify a type

in 1.1 it is a legacy-class
GenericDataSource (by default)
this is to remove...

you must say then type=org.apache.commons.dbcp.BasicDataSource

for that you must
add two jars
-the DBCP-commons from http://jakarta.apache.org/commons/dbcp/
-the pool-jar from: http://jakarta.apache.org/commons/pool/

for more read:
http://jakarta.apache.org/struts/faqs/database.html

regards,



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 10:44 AM
To: Struts Users Mailing List
Subject: RE: Datasource problem


Thanks Mathias, just after I sent the email I got it working using the
key as you suggested.  I tried using the key earlier today and it didn't
work, probably I had some other problem which I accidentally fixed and
now I've confused myself.

Shouldn't it work without the key since I only have the one datasource
and all the docs I've seen don't require the key. My understanding is
that the key is only required when there is more than one datasource.
No?

Thanks for your help.

Chris


On Wed, 7 Jan 2004, Matthias Wessendorf wrote:

 hi chris,

 have you tried:

 getDataSource(req,dataSource);


 greetings



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 10:25 AM
 To: [EMAIL PROTECTED]
 Subject: Datasource problem


 Hi,

 I must be missing something here but for the life of me I cannot see 
 what it is. I've search the mail archives and can't find anything the 
 same, also I checked 3 different books and it looks like I have 
 everything configured correctly, I also tried two diffent MySQL 
 drivers.

 I have added a datasource to my struts-config and when I run the 
 application I can see it initializes ok:

 Jan 7, 2004 10:09:48 PM org.apache.struts.legacy.GenericDataSource
 createConnection
 INFO:createConnection()
 Jan 7, 2004 10:09:49 PM org.apache.struts.legacy.GenericDataSource
 createConnection
 INFO:createConnection()

 If I mess up the password I get an access denied error on the db when 
 this runs so that tells me I am getting a connection.

 But when I try to access the datasource inside my action using the 
 following code:

 DataSource dataSource = getDataSource(req);

 dataSource returns null which is where I'm stumped.

 Anyone get any idea what this might be? I'm using struts 1.1 and tried

 JDK 1.4 and 1.3.

 Here's my struts-config:

 data-sources
   data-source key=dataSource
 set-property property=driverClass
value=com.mysql.jdbc.Driver/
 set-property property=url 
 value=jdbc:mysql://127.0.0.1:3306/ash/
 set-property property=user value=myusername /
 set-property property=password value=mypassword /
 set-property property=minCount value=2 /
 set-property property=maxCount value=4 /
   /data-source
 /data-sources


 The exception is java.lang.NullPointerException which results from 
 trying to use the null dataSource.

 There is one other compiler error I am getting when I build the 
 project which I still trying to track down:

 Jan 7, 2004 10:09:48 PM org.apache.commons.digester.Digester error
 SEVERE: Parse Error at line 19 column -1: Attribute value for path 
 is #REQUIRED.
 org.xml.sax.SAXParseException: Attribute value for path is
#REQUIRED.
   at org.apache.crimson.parser.Parser2.error(Parser2.java:3317)
   at
 org.apache.crimson.parser.Parser2.defaultAttributes(Parser2.java:1889)
   at
 org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1600)
   at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
   at
 org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
   at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
   at
 org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
   at
 org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
   at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
   at
 org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
   at
 org.apache.commons.digester.Digester.parse(Digester.java:1548)
   at 
 org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionSer
 vl
 et.java:1006)
   at

org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.ja
 va:955)
   at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
   at javax.servlet.GenericServlet.init(GenericServlet.java:256)
   at

org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
 a:918)
   at

org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
   at

org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
 ava:3279)
   at

org.apache.catalina.core.StandardContext.start(StandardContext.java:3421

RE: Datasource problem

2004-01-07 Thread cnd
Hi Matthias,

Thanks for all the info.

As you said that only one can be defined without a key hence if I use
getDataSource(req);  then it should use the default datasource without
me having to specify the Globals.DATA_SOURCE_KEY as the second parameter.
So looking at my struts-config.xml there is only one datasource hence my
reading is that the second parameter is redundant. Also
Globals.DATA_SOURCE_KEY is showing as deprecated so I was avoiding using
it.

Looking at it further I see that part of my problem was that I am using
JBuilder X which adds a key by default, once that key is added
DATA_SOURCE_KEY doesn't work, so obviously the key is the
problem. Once I remove the key I can use the single parameter.

Thanks for your help!

Chris

On Wed, 7 Jan 2004, Matthias Wessendorf wrote:

 hi Chris!

 only one can be defined without a key

 it is stored under default:
 Globals.DATA_SOURCE_KEY

 and of cource
 in struts 1.2 you must!!! specify a type

 in 1.1 it is a legacy-class
 GenericDataSource (by default)
 this is to remove...A

 you must say then type=org.apache.commons.dbcp.BasicDataSource

 for that you must
 add two jars
 -the DBCP-commons from http://jakarta.apache.org/commons/dbcp/
 -the pool-jar from: http://jakarta.apache.org/commons/pool/

 for more read:
 http://jakarta.apache.org/struts/faqs/database.html

 regards,



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 10:44 AM
 To: Struts Users Mailing List
 Subject: RE: Datasource problem


 Thanks Mathias, just after I sent the email I got it working using the
 key as you suggested.  I tried using the key earlier today and it didn't
 work, probably I had some other problem which I accidentally fixed and
 now I've confused myself.

 Shouldn't it work without the key since I only have the one datasource
 and all the docs I've seen don't require the key. My understanding is
 that the key is only required when there is more than one datasource.
 No?

 Thanks for your help.

 Chris


 On Wed, 7 Jan 2004, Matthias Wessendorf wrote:

  hi chris,
 
  have you tried:
 
  getDataSource(req,dataSource);
 
 
  greetings
 
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 07, 2004 10:25 AM
  To: [EMAIL PROTECTED]
  Subject: Datasource problem
 
 
  Hi,
 
  I must be missing something here but for the life of me I cannot see
  what it is. I've search the mail archives and can't find anything the
  same, also I checked 3 different books and it looks like I have
  everything configured correctly, I also tried two diffent MySQL
  drivers.
 
  I have added a datasource to my struts-config and when I run the
  application I can see it initializes ok:
 
  Jan 7, 2004 10:09:48 PM org.apache.struts.legacy.GenericDataSource
  createConnection
  INFO:createConnection()
  Jan 7, 2004 10:09:49 PM org.apache.struts.legacy.GenericDataSource
  createConnection
  INFO:createConnection()
 
  If I mess up the password I get an access denied error on the db when
  this runs so that tells me I am getting a connection.
 
  But when I try to access the datasource inside my action using the
  following code:
 
  DataSource dataSource = getDataSource(req);
 
  dataSource returns null which is where I'm stumped.
 
  Anyone get any idea what this might be? I'm using struts 1.1 and tried

  JDK 1.4 and 1.3.
 
  Here's my struts-config:
 
  data-sources
data-source key=dataSource
  set-property property=driverClass
 value=com.mysql.jdbc.Driver/
  set-property property=url
  value=jdbc:mysql://127.0.0.1:3306/ash/
  set-property property=user value=myusername /
  set-property property=password value=mypassword /
  set-property property=minCount value=2 /
  set-property property=maxCount value=4 /
/data-source
  /data-sources
 
 
  The exception is java.lang.NullPointerException which results from
  trying to use the null dataSource.
 
  There is one other compiler error I am getting when I build the
  project which I still trying to track down:
 
  Jan 7, 2004 10:09:48 PM org.apache.commons.digester.Digester error
  SEVERE: Parse Error at line 19 column -1: Attribute value for path
  is #REQUIRED.
  org.xml.sax.SAXParseException: Attribute value for path is
 #REQUIRED.
  at org.apache.crimson.parser.Parser2.error(Parser2.java:3317)
  at
  org.apache.crimson.parser.Parser2.defaultAttributes(Parser2.java:1889)
  at
  org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1600)
  at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
  at
  org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
  at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
  at
  org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
  at
  org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
  at org.apache.crimson.parser.Parser2.parse(Parser2.java:333

Re: Oracle DataSource configuration

2004-01-01 Thread Dirk Verbeeck
The exception you see is an indication that the factory doesn't see 
the ResourceParams you have specified. Try to print out the url and 
driverClassName properties of BasicDataSource, you will see they are null.

You have an extra /ResourceParams tag there in your definition of 
the server.xml file. Is that just a copy/paster error?
Maybe you can post the whole context

You should also try without a resource-ref in web.xml.

By the way, questions about DBCP are best posted on commons-user 
mailing list. http://jakarta.apache.org/commons/dbcp/mail-lists.html

-- Dirk

Ed Dowgiallo wrote:
I'm running into the following exception when issuing a getConnection to 
an Oracle DataSource.
 
SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
 
It has the following definition in a Tomcat 4.1.29 server.xml file.
 

Resource name=Library auth=Container scope=Shareable 
type=javax.sql.DataSource/

/ResourceParams

ResourceParams name=Library

parameter

namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter

parameter

namedriverClassName/name

valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

nameurl/name

valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value

/parameter

parameter

nameusername/name

valueabc/value

/parameter

parameter

namepassword/name

valuexyz/value

/parameter

parameter

namemaxActive/name

value25/value

/parameter

parameter

namemaxIdle/name

value10/value

/parameter

parameter

namemaxWait/name

value-1/value

/parameter

/ResourceParams

I have setup the following resource-ref in the applications web.xml file.

  resource-ref
descriptionOracle DataSource/description
res-ref-nameLibrary/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref
The JDBC library is a class12.jar file in the Tomcat shared/lib directory.

Comments and suggestions are most welcome.

Thank you,

Ed



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Oracle DataSource configuration

2003-12-29 Thread Ed Dowgiallo



I'm running into the following exception when 
issuing a getConnection to an Oracle DataSource.

SQLException: Cannot create JDBC driver of class '' for connect URL 
'null'

It has the following definition in a Tomcat 4.1.29 
server.xml file.


Resource name="Library" auth="Container" scope="Shareable" 
type="javax.sql.DataSource"/
/ResourceParams
ResourceParams name="Library"
parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter 
parameter
namedriverClassName/name
valueoracle.jdbc.driver.OracleDriver/value
/parameter
parameter
nameurl/name
valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value
/parameter
parameter
nameusername/name
valueabc/value
/parameter
parameter
namepassword/name
valuexyz/value
/parameter
parameter
namemaxActive/name
value25/value
/parameter
parameter
namemaxIdle/name
value10/value
/parameter
parameter
namemaxWait/name
value-1/value
/parameter
/ResourceParams
I have setup the following resource-ref in the applications web.xml file.
 resource-ref 
descriptionOracle DataSource/description 
res-ref-nameLibrary/res-ref-name 
res-typejavax.sql.DataSource/res-type 
res-authContainer/res-auth 
/resource-ref
The JDBC libraryis aclass12.jar file in the 
Tomcat shared/lib directory.
Comments and suggestions are most welcome.
Thank you,
Ed
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Oracle DataSource configuration

2003-12-29 Thread Ben Anderson
not sure if this matters, but my oracle jar is in common/lib instead of 
shared/lib.  I'm not familiar with the differences/uses of common and 
shared, but that's how mine works.
-Ben


From: Ed Dowgiallo [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Oracle DataSource configuration
Date: Mon, 29 Dec 2003 11:12:11 -0500
I'm running into the following exception when issuing a getConnection to an 
Oracle DataSource.

SQLException: Cannot create JDBC driver of class '' for connect URL 'null'

It has the following definition in a Tomcat 4.1.29 server.xml file.

Resource name=Library auth=Container scope=Shareable 
type=javax.sql.DataSource/

/ResourceParams

ResourceParams name=Library

parameter

namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter

parameter

namedriverClassName/name

valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

nameurl/name

valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value

/parameter

parameter

nameusername/name

valueabc/value

/parameter

parameter

namepassword/name

valuexyz/value

/parameter

parameter

namemaxActive/name

value25/value

/parameter

parameter

namemaxIdle/name

value10/value

/parameter

parameter

namemaxWait/name

value-1/value

/parameter

/ResourceParams

I have setup the following resource-ref in the applications web.xml file.

  resource-ref
descriptionOracle DataSource/description
res-ref-nameLibrary/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref
The JDBC library is a class12.jar file in the Tomcat shared/lib directory.

Comments and suggestions are most welcome.

Thank you,

Ed
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Check your PC for viruses with the FREE McAfee online computer scan.  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Oracle DataSource configuration

2003-12-29 Thread Kris Schneider
The following:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

explains TC 4.1's class loaders. Personally, I also place JDBC drivers in
$CATALINA_HOME/common/lib. If they're in $CATALINA_HOME/shared/lib, then all web
apps can see them but catalina can't, IIRC.

Quoting Ben Anderson [EMAIL PROTECTED]:

 not sure if this matters, but my oracle jar is in common/lib instead of 
 shared/lib.  I'm not familiar with the differences/uses of common and 
 shared, but that's how mine works.
 -Ben
 
 
 From: Ed Dowgiallo [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Oracle DataSource configuration
 Date: Mon, 29 Dec 2003 11:12:11 -0500
 
 I'm running into the following exception when issuing a getConnection to an
 
 Oracle DataSource.
 
 SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
 
 It has the following definition in a Tomcat 4.1.29 server.xml file.
 
 Resource name=Library auth=Container scope=Shareable 
 type=javax.sql.DataSource/
 
 /ResourceParams
 
 ResourceParams name=Library
 
 parameter
 
 namefactory/name
 
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 
 /parameter
 
 parameter
 
 namedriverClassName/name
 
 valueoracle.jdbc.driver.OracleDriver/value
 
 /parameter
 
 parameter
 
 nameurl/name
 
 valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value
 
 /parameter
 
 parameter
 
 nameusername/name
 
 valueabc/value
 
 /parameter
 
 parameter
 
 namepassword/name
 
 valuexyz/value
 
 /parameter
 
 parameter
 
 namemaxActive/name
 
 value25/value
 
 /parameter
 
 parameter
 
 namemaxIdle/name
 
 value10/value
 
 /parameter
 
 parameter
 
 namemaxWait/name
 
 value-1/value
 
 /parameter
 
 /ResourceParams
 
 I have setup the following resource-ref in the applications web.xml file.
 
resource-ref
  descriptionOracle DataSource/description
  res-ref-nameLibrary/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref
 
 The JDBC library is a class12.jar file in the Tomcat shared/lib directory.
 
 Comments and suggestions are most welcome.
 
 Thank you,
 
 Ed

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Oracle DataSource configuration

2003-12-29 Thread Steve Muench
Ed,
 
The setup instructions for the BC4J/Struts Toy Store Demo at:
 
  http://otn.oracle.com/sample_code/products/jdev/bc4jtoystore/index.html
 
 
go over the specifics of setting up Oracle DataSource for Tomcat.
 
The direct URL to the 80-page whitepaper that explains the demo's implementation and 
setup is at:
 
  http://otn.oracle.com/sample_code/products/jdev/bc4jtoystore/readme.html
 
Hope this helps.
 

Steve Muench - Technical Evangelist, Product Mgr, Developer, Author
http://radio.weblogs.com/0118231/


 


  _  

From: Ed Dowgiallo [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 29, 2003 08:12
To: Struts Users Mailing List
Subject: Oracle DataSource configuration


I'm running into the following exception when issuing a getConnection to an Oracle 
DataSource.
 
SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
 
It has the following definition in a Tomcat 4.1.29 server.xml file.
 
Resource name=Library auth=Container scope=Shareable 
type=javax.sql.DataSource/

/ResourceParams

ResourceParams name=Library

parameter

namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter 

parameter

namedriverClassName/name

valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

nameurl/name

valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value

/parameter

parameter

nameusername/name

valueabc/value

/parameter

parameter

namepassword/name

valuexyz/value

/parameter

parameter

namemaxActive/name

value25/value

/parameter

parameter

namemaxIdle/name

value10/value

/parameter

parameter

namemaxWait/name

value-1/value

/parameter

/ResourceParams

I have setup the following resource-ref in the applications web.xml file.

  resource-ref
descriptionOracle DataSource/description
res-ref-nameLibrary/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref

The JDBC library is a class12.jar file in the Tomcat shared/lib directory.

Comments and suggestions are most welcome.

Thank you,

Ed



Re: Oracle DataSource configuration

2003-12-29 Thread Ed Dowgiallo
OK.

I have moved the Oracle JDBC library from shared/lib to common/lib.  Same
error message.  SQLException: Cannot create JDBC driver of class '' for
connect URL 'null'

Restarted Tomcat service.  Same error message.

Removed all the javax.sql... classes from classes12.jar and
classes12dms.jar.  Same error message.

Logged a few sanity checks.  All look OK.
Value of servlet init parameter data-source is Library
InitialContext is not null
Context for java:/comp/env is not null
dataSource is not null: [EMAIL PROTECTED]

Any other ideas?

Has anyone successfully configured oracle.jdbc.pool.OracleDataSourceFactory
or oracle.jdbc.pool.OracleConnectionPoolDataSource instead of or in addition
to org.apache.commons.dbcp.BasicDataSourceFactory and
oracle.jdbc.driver.OracleDriver?

Thank you,
Ed

- Original Message - 
From: Kris Schneider [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, December 29, 2003 12:13 PM
Subject: RE: Oracle DataSource configuration


 The following:

 http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

 explains TC 4.1's class loaders. Personally, I also place JDBC drivers in
 $CATALINA_HOME/common/lib. If they're in $CATALINA_HOME/shared/lib, then
all web
 apps can see them but catalina can't, IIRC.

 Quoting Ben Anderson [EMAIL PROTECTED]:

  not sure if this matters, but my oracle jar is in common/lib instead of
  shared/lib.  I'm not familiar with the differences/uses of common and
  shared, but that's how mine works.
  -Ben
 
 
  From: Ed Dowgiallo [EMAIL PROTECTED]
  Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Subject: Oracle DataSource configuration
  Date: Mon, 29 Dec 2003 11:12:11 -0500
  
  I'm running into the following exception when issuing a getConnection
to an
 
  Oracle DataSource.
  
  SQLException: Cannot create JDBC driver of class '' for connect URL
'null'
  
  It has the following definition in a Tomcat 4.1.29 server.xml file.
  
  Resource name=Library auth=Container scope=Shareable
  type=javax.sql.DataSource/
  
  /ResourceParams
  
  ResourceParams name=Library
  
  parameter
  
  namefactory/name
  
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  
  /parameter
  
  parameter
  
  namedriverClassName/name
  
  valueoracle.jdbc.driver.OracleDriver/value
  
  /parameter
  
  parameter
  
  nameurl/name
  
  valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value
  
  /parameter
  
  parameter
  
  nameusername/name
  
  valueabc/value
  
  /parameter
  
  parameter
  
  namepassword/name
  
  valuexyz/value
  
  /parameter
  
  parameter
  
  namemaxActive/name
  
  value25/value
  
  /parameter
  
  parameter
  
  namemaxIdle/name
  
  value10/value
  
  /parameter
  
  parameter
  
  namemaxWait/name
  
  value-1/value
  
  /parameter
  
  /ResourceParams
  
  I have setup the following resource-ref in the applications web.xml
file.
  
 resource-ref
   descriptionOracle DataSource/description
   res-ref-nameLibrary/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref
  
  The JDBC library is a class12.jar file in the Tomcat shared/lib
directory.
  
  Comments and suggestions are most welcome.
  
  Thank you,
  
  Ed

 -- 
 Kris Schneider mailto:[EMAIL PROTECTED]
 D.O.Tech   http://www.dotech.com/

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Oracle DataSource configuration

2003-12-29 Thread Kris Schneider
What you're thinking of as a connection pool, Oracle refers to as a connection
cache. Their pool/cache implementation is provided by
oracle.jdbc.pool.OracleConnectionCacheImpl. I don't recall if I've gotten that
to work with TC before. Have you read:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Quoting Ed Dowgiallo [EMAIL PROTECTED]:

 OK.
 
 I have moved the Oracle JDBC library from shared/lib to common/lib.  Same
 error message.  SQLException: Cannot create JDBC driver of class '' for
 connect URL 'null'
 
 Restarted Tomcat service.  Same error message.
 
 Removed all the javax.sql... classes from classes12.jar and
 classes12dms.jar.  Same error message.
 
 Logged a few sanity checks.  All look OK.
 Value of servlet init parameter data-source is Library
 InitialContext is not null
 Context for java:/comp/env is not null
 dataSource is not null: [EMAIL PROTECTED]
 
 Any other ideas?
 
 Has anyone successfully configured oracle.jdbc.pool.OracleDataSourceFactory
 or oracle.jdbc.pool.OracleConnectionPoolDataSource instead of or in
 addition
 to org.apache.commons.dbcp.BasicDataSourceFactory and
 oracle.jdbc.driver.OracleDriver?
 
 Thank you,
 Ed
 
 - Original Message - 
 From: Kris Schneider [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Monday, December 29, 2003 12:13 PM
 Subject: RE: Oracle DataSource configuration
 
 
  The following:
 
  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
 
  explains TC 4.1's class loaders. Personally, I also place JDBC drivers in
  $CATALINA_HOME/common/lib. If they're in $CATALINA_HOME/shared/lib, then
 all web
  apps can see them but catalina can't, IIRC.
 
  Quoting Ben Anderson [EMAIL PROTECTED]:
 
   not sure if this matters, but my oracle jar is in common/lib instead of
   shared/lib.  I'm not familiar with the differences/uses of common and
   shared, but that's how mine works.
   -Ben
  
  
   From: Ed Dowgiallo [EMAIL PROTECTED]
   Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
   To: Struts Users Mailing List [EMAIL PROTECTED]
   Subject: Oracle DataSource configuration
   Date: Mon, 29 Dec 2003 11:12:11 -0500
   
   I'm running into the following exception when issuing a getConnection
 to an
  
   Oracle DataSource.
   
   SQLException: Cannot create JDBC driver of class '' for connect URL
 'null'
   
   It has the following definition in a Tomcat 4.1.29 server.xml file.
   
   Resource name=Library auth=Container scope=Shareable
   type=javax.sql.DataSource/
   
   /ResourceParams
   
   ResourceParams name=Library
   
   parameter
   
   namefactory/name
   
   valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   
   /parameter
   
   parameter
   
   namedriverClassName/name
   
   valueoracle.jdbc.driver.OracleDriver/value
   
   /parameter
   
   parameter
   
   nameurl/name
   
   valuejdbc:oracle:thin:@192.168.0.202:1521:tpeds002/value
   
   /parameter
   
   parameter
   
   nameusername/name
   
   valueabc/value
   
   /parameter
   
   parameter
   
   namepassword/name
   
   valuexyz/value
   
   /parameter
   
   parameter
   
   namemaxActive/name
   
   value25/value
   
   /parameter
   
   parameter
   
   namemaxIdle/name
   
   value10/value
   
   /parameter
   
   parameter
   
   namemaxWait/name
   
   value-1/value
   
   /parameter
   
   /ResourceParams
   
   I have setup the following resource-ref in the applications web.xml
 file.
   
  resource-ref
descriptionOracle DataSource/description
res-ref-nameLibrary/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref
   
   The JDBC library is a class12.jar file in the Tomcat shared/lib
 directory.
   
   Comments and suggestions are most welcome.
   
   Thank you,
   
   Ed
 
  -- 
  Kris Schneider mailto:[EMAIL PROTECTED]
  D.O.Tech   http://www.dotech.com/

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How find DataSource?

2003-12-23 Thread Edgar P Dollin
It can be done, use poolman.  Easiest DB pool to get going, works well with
more DB than others.

http://sourceforge.net/projects/poolman

Edgar


 -Original Message-
 From: Vic Cekvenich [mailto:[EMAIL PROTECTED] 
 Sent: Monday, December 22, 2003 4:50 PM
 To: [EMAIL PROTECTED]
 Subject: Re: How find DataSource?
 
 
 
 
 e-denton Java Programmer wrote:
 
  
  Has anyone set up a connection pool using web.xml? Steps? Examples? 
  Tips?
 
 
 No one has, it can't be done. You can declare it in web.xml, 
 that's all. Read Rick Reumans tutorial on ibatis dao and 
 ibatis petstore 3 example 
 and do that, and you will be in a good place.
 
 It's sad, no books on this. All JDBC books talk about JDBC 1.0, not 
 about JDBC 3 pooleddatasource, or DAO.
 
  
  Vic, I might have two problems with keeping it in a static 
 block. 1. 
  My container can be passivated, so everything must be serializable.
 
 Passivation is not a good idea ever, so just ignore it. 
 Change the co-lo 
 or host if you have to.   It sure does not give scalability 
 to the host 
 or to app.
 
 hth,
 .V
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread e-denton Java Programmer
Merry Christmas,

Wow, I finally connected to my data source! Now, I want to put the code
somewhere it will be executed only once, and save the DataSource object
where Actions, beans, etc. can get at it. That way, I don't have to perform
the lookup all the time.

Any suggestions on where to put the one time setup code, and where to save
the DataSource object reference (in the application?).

Thanks again,

Will

- Original Message - 
From: Vic Cekvenich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 20, 2003 12:14 PM
Subject: Re: How find DataSource?


 See sample source code section here:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

 Ex:
 Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);

DataSource ds =
  (DataSource)ctx.lookup(
 java:comp/env/jdbc/TestDB);


 Of course what you do with the data source depends on your DAO
 implementataion (iBatis, Hibrenate, etc.)

 .V


 hylepc wrote:
  Hi,
 
  From a Data Acess Object (DAO), I need to access a DataSource (like
  getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
don't
  have access to the servlet variable.
 
  What is the proper way to get the DataSource from a DAO which is called
by
  an Action but doesn't extend Action?
 
  Thanks,
 
  Will


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How find DataSource?

2003-12-22 Thread Marco Mistroni
Hi,
How about a plugIn?

Regards
marco

-Original Message-
From: e-denton Java Programmer [mailto:[EMAIL PROTECTED] 
Sent: 22 December 2003 14:11
To: Struts Users Mailing List
Subject: Re: How find DataSource?

Merry Christmas,

Wow, I finally connected to my data source! Now, I want to put the code
somewhere it will be executed only once, and save the DataSource object
where Actions, beans, etc. can get at it. That way, I don't have to
perform
the lookup all the time.

Any suggestions on where to put the one time setup code, and where to
save
the DataSource object reference (in the application?).

Thanks again,

Will

- Original Message - 
From: Vic Cekvenich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 20, 2003 12:14 PM
Subject: Re: How find DataSource?


 See sample source code section here:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples
-howto.html

 Ex:
 Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);

DataSource ds =
  (DataSource)ctx.lookup(
 java:comp/env/jdbc/TestDB);


 Of course what you do with the data source depends on your DAO
 implementataion (iBatis, Hibrenate, etc.)

 .V


 hylepc wrote:
  Hi,
 
  From a Data Acess Object (DAO), I need to access a DataSource (like
  getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
don't
  have access to the servlet variable.
 
  What is the proper way to get the DataSource from a DAO which is
called
by
  an Action but doesn't extend Action?
 
  Thanks,
 
  Will


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread Vic Cekvenich
I put mine in a static block of the base DAO. (static as in once per 
class, and all DAO's extend my base DAO).

.V

e-denton Java Programmer wrote:

Merry Christmas,

Wow, I finally connected to my data source! Now, I want to put the code
somewhere it will be executed only once, and save the DataSource object
where Actions, beans, etc. can get at it. That way, I don't have to perform
the lookup all the time.
Any suggestions on where to put the one time setup code, and where to save
the DataSource object reference (in the application?).
Thanks again,

Will

- Original Message - 
From: Vic Cekvenich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 20, 2003 12:14 PM
Subject: Re: How find DataSource?



See sample source code section here:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Ex:
Context ctx = new InitialContext();
  if(ctx == null )
  throw new Exception(Boom - No Context);
  DataSource ds =
(DataSource)ctx.lookup(
   java:comp/env/jdbc/TestDB);
Of course what you do with the data source depends on your DAO
implementataion (iBatis, Hibrenate, etc.)
.V

hylepc wrote:

Hi,

From a Data Acess Object (DAO), I need to access a DataSource (like
getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
don't

have access to the servlet variable.

What is the proper way to get the DataSource from a DAO which is called
by

an Action but doesn't extend Action?

Thanks,

Will


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How find DataSource?

2003-12-22 Thread Martin Gainty
how about putting it into DynaActionForm::initialize which initialises the
beans anyhow..

-Martin

this way your connections are
- Original Message - 
From: Vic Cekvenich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 22, 2003 9:31 AM
Subject: Re: How find DataSource?


 I put mine in a static block of the base DAO. (static as in once per
 class, and all DAO's extend my base DAO).


 .V


 e-denton Java Programmer wrote:

  Merry Christmas,
 
  Wow, I finally connected to my data source! Now, I want to put the code
  somewhere it will be executed only once, and save the DataSource object
  where Actions, beans, etc. can get at it. That way, I don't have to
perform
  the lookup all the time.
 
  Any suggestions on where to put the one time setup code, and where to
save
  the DataSource object reference (in the application?).
 
  Thanks again,
 
  Will
 
  - Original Message - 
  From: Vic Cekvenich [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, December 20, 2003 12:14 PM
  Subject: Re: How find DataSource?
 
 
 
 See sample source code section here:
 
 
 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
 
 Ex:
 Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);
 
DataSource ds =
  (DataSource)ctx.lookup(
 java:comp/env/jdbc/TestDB);
 
 
 Of course what you do with the data source depends on your DAO
 implementataion (iBatis, Hibrenate, etc.)
 
 .V
 
 
 hylepc wrote:
 
 Hi,
 
 From a Data Acess Object (DAO), I need to access a DataSource (like
 getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
 
  don't
 
 have access to the servlet variable.
 
 What is the proper way to get the DataSource from a DAO which is called
 
  by
 
 an Action but doesn't extend Action?
 
 Thanks,
 
 Will
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread Vic Cekvenich
repost (news error?)

Martin Gainty wrote:

how about putting it into DynaActionForm::initialize which 
initialises the
beans anyhow..

-Martin



A DAO in a form or a bean hmmm. If that is what you want to do in 
an MVC framework.

I don't do data source in formbeans.

Take a peak at PetStore 3 on ibatis. (even Spring uses that as MVC 
example, but not w/ Struts)

.V




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How find DataSource?

2003-12-22 Thread e-denton Java Programmer
I neglected to mention that my servlet container can be passivated on my
virtual host. So, all objects must be serializable and I can't use static
variables.

- Original Message - 
From: Vic Cekvenich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 22, 2003 8:31 AM
Subject: Re: How find DataSource?


 I put mine in a static block of the base DAO. (static as in once per
 class, and all DAO's extend my base DAO).


 .V


 e-denton Java Programmer wrote:

  Merry Christmas,
 
  Wow, I finally connected to my data source! Now, I want to put the code
  somewhere it will be executed only once, and save the DataSource object
  where Actions, beans, etc. can get at it. That way, I don't have to
perform
  the lookup all the time.
 
  Any suggestions on where to put the one time setup code, and where to
save
  the DataSource object reference (in the application?).
 
  Thanks again,
 
  Will
 
  - Original Message - 
  From: Vic Cekvenich [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, December 20, 2003 12:14 PM
  Subject: Re: How find DataSource?
 
 
 
 See sample source code section here:
 
 
 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
 
 Ex:
 Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);
 
DataSource ds =
  (DataSource)ctx.lookup(
 java:comp/env/jdbc/TestDB);
 
 
 Of course what you do with the data source depends on your DAO
 implementataion (iBatis, Hibrenate, etc.)
 
 .V
 
 
 hylepc wrote:
 
 Hi,
 
 From a Data Acess Object (DAO), I need to access a DataSource (like
 getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
 
  don't
 
 have access to the servlet variable.
 
 What is the proper way to get the DataSource from a DAO which is called
 
  by
 
 an Action but doesn't extend Action?
 
 Thanks,
 
 Will
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread Craig R. McClanahan
Quoting e-denton Java Programmer [EMAIL PROTECTED]:

 Merry Christmas,
 
 Wow, I finally connected to my data source! Now, I want to put the code
 somewhere it will be executed only once, and save the DataSource object
 where Actions, beans, etc. can get at it. That way, I don't have to perform
 the lookup all the time.
 

That turns out not to be the recommended pattern, for at least two reasons:

* If your app server supports the ability to dynamically
  reconfigure DataSource objects while your app is running,
  the object retrieved via JNDI might change each time.

* If you retrieve it once and then put it someplace (such as
  in a servlet context attribute) then any code that wants to
  retrieve it will need a reference to the ServletContext object
  (and therefore be dependent on the servlet API).



 Any suggestions on where to put the one time setup code, and where to save
 the DataSource object reference (in the application?).
 

Consider setting up a utility class with a public static method called
getDataSource() that actually does the lookup every time.  Then you can call it
like:

  DataSource ds = MyUtils.getDataSource(jdbc/TestDB);

or, even go a step farther and have it return a connection for you ... that way
you're hiding how the connection pooling is being done as well, and just
operating at the SQL level.

 Thanks again,
 
 Will
 

Craig


 - Original Message - 
 From: Vic Cekvenich [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, December 20, 2003 12:14 PM
 Subject: Re: How find DataSource?
 
 
  See sample source code section here:
 

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
 
  Ex:
  Context ctx = new InitialContext();
 if(ctx == null )
 throw new Exception(Boom - No Context);
 
 DataSource ds =
   (DataSource)ctx.lookup(
  java:comp/env/jdbc/TestDB);
 
 
  Of course what you do with the data source depends on your DAO
  implementataion (iBatis, Hibrenate, etc.)
 
  .V
 
 
  hylepc wrote:
   Hi,
  
   From a Data Acess Object (DAO), I need to access a DataSource (like
   getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
 don't
   have access to the servlet variable.
  
   What is the proper way to get the DataSource from a DAO which is called
 by
   an Action but doesn't extend Action?
  
   Thanks,
  
   Will
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread Craig R. McClanahan
Quoting e-denton Java Programmer [EMAIL PROTECTED]:

 I neglected to mention that my servlet container can be passivated on my
 virtual host. So, all objects must be serializable and I can't use static
 variables.
 

Yet another reason to look it up every time rather than caching it.

Craig

 - Original Message - 
 From: Vic Cekvenich [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, December 22, 2003 8:31 AM
 Subject: Re: How find DataSource?
 
 
  I put mine in a static block of the base DAO. (static as in once per
  class, and all DAO's extend my base DAO).
 
 
  .V
 
 
  e-denton Java Programmer wrote:
 
   Merry Christmas,
  
   Wow, I finally connected to my data source! Now, I want to put the code
   somewhere it will be executed only once, and save the DataSource object
   where Actions, beans, etc. can get at it. That way, I don't have to
 perform
   the lookup all the time.
  
   Any suggestions on where to put the one time setup code, and where to
 save
   the DataSource object reference (in the application?).
  
   Thanks again,
  
   Will
  
   - Original Message - 
   From: Vic Cekvenich [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Saturday, December 20, 2003 12:14 PM
   Subject: Re: How find DataSource?
  
  
  
  See sample source code section here:
  
  
  

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
  
  Ex:
  Context ctx = new InitialContext();
 if(ctx == null )
 throw new Exception(Boom - No Context);
  
 DataSource ds =
   (DataSource)ctx.lookup(
  java:comp/env/jdbc/TestDB);
  
  
  Of course what you do with the data source depends on your DAO
  implementataion (iBatis, Hibrenate, etc.)
  
  .V
  
  
  hylepc wrote:
  
  Hi,
  
  From a Data Acess Object (DAO), I need to access a DataSource (like
  getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
  
   don't
  
  have access to the servlet variable.
  
  What is the proper way to get the DataSource from a DAO which is called
  
   by
  
  an Action but doesn't extend Action?
  
  Thanks,
  
  Will
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread e-denton Java Programmer
Wow, my personal saga of discovery continues... Apparently I have been
trying to set up connection pooling *both* in server.xml context *and* in
web.xml unnecessarily. Well, the server.xml works, but then I have the
problem of where to store the DataStore object and how my Data Access
Objects will access it.

Has anyone set up a connection pool using web.xml? Steps? Examples? Tips? I
can't even seem to change the driver without problems. And, web.xml doesn't
use JNDI, does it?

Has anyone used server.xml instead? Where did you keep the DataSource
Object? I looked into keeping it in the session, but then I have to pass
session to my DAOs--ick. (I am writing my own DAOs.)

Vic, I might have two problems with keeping it in a static block. 1. My
container can be passivated, so everything must be serializable. 2. I hope
to only look it up once for efficiency's sake.

Martin, I assume you mean to extend DynaActionForm and override initialize,
but that means tying myself to Struts. (Like I'm not already!) Ideally, I
shouldn't have to modify the framework.

Thanks,

Will

- Original Message - 
From: Martin Gainty [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, December 22, 2003 1:41 PM
Subject: Re: How find DataSource?


 how about putting it into DynaActionForm::initialize which initialises the
 beans anyhow..

 -Martin

 this way your connections are
 - Original Message - 
 From: Vic Cekvenich [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, December 22, 2003 9:31 AM
 Subject: Re: How find DataSource?


  I put mine in a static block of the base DAO. (static as in once per
  class, and all DAO's extend my base DAO).
 
 
  .V
 
 
  e-denton Java Programmer wrote:
 
   Merry Christmas,
  
   Wow, I finally connected to my data source! Now, I want to put the
code
   somewhere it will be executed only once, and save the DataSource
object
   where Actions, beans, etc. can get at it. That way, I don't have to
 perform
   the lookup all the time.
  
   Any suggestions on where to put the one time setup code, and where to
 save
   the DataSource object reference (in the application?).
  
   Thanks again,
  
   Will
  
   - Original Message - 
   From: Vic Cekvenich [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Saturday, December 20, 2003 12:14 PM
   Subject: Re: How find DataSource?
  
  
  
  See sample source code section here:
  
  
  

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
  
  Ex:
  Context ctx = new InitialContext();
 if(ctx == null )
 throw new Exception(Boom - No Context);
  
 DataSource ds =
   (DataSource)ctx.lookup(
  java:comp/env/jdbc/TestDB);
  
  
  Of course what you do with the data source depends on your DAO
  implementataion (iBatis, Hibrenate, etc.)
  
  .V
  
  
  hylepc wrote:
  
  Hi,
  
  From a Data Acess Object (DAO), I need to access a DataSource (like
  getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I
  
   don't
  
  have access to the servlet variable.
  
  What is the proper way to get the DataSource from a DAO which is
called
  
   by
  
  an Action but doesn't extend Action?
  
  Thanks,
  
  Will
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-22 Thread Vic Cekvenich


e-denton Java Programmer wrote:

Has anyone set up a connection pool using web.xml? Steps? Examples? Tips? 


No one has, it can't be done. You can declare it in web.xml, that's all.
Read Rick Reumans tutorial on ibatis dao and ibatis petstore 3 example 
and do that, and you will be in a good place.

It's sad, no books on this. All JDBC books talk about JDBC 1.0, not 
about JDBC 3 pooleddatasource, or DAO.

Vic, I might have two problems with keeping it in a static block. 1. My
container can be passivated, so everything must be serializable. 
Passivation is not a good idea ever, so just ignore it. Change the co-lo 
or host if you have to.   It sure does not give scalability to the host 
or to app.

hth,
.V


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How find DataSource?

2003-12-20 Thread hylepc
Hi,

From a Data Acess Object (DAO), I need to access a DataSource (like
getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I don't
have access to the servlet variable.

What is the proper way to get the DataSource from a DAO which is called by
an Action but doesn't extend Action?

Thanks,

Will


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How find DataSource?

2003-12-20 Thread Vic Cekvenich
See sample source code section here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
Ex:
Context ctx = new InitialContext();
  if(ctx == null )
  throw new Exception(Boom - No Context);
  DataSource ds =
(DataSource)ctx.lookup(
   java:comp/env/jdbc/TestDB);
Of course what you do with the data source depends on your DAO 
implementataion (iBatis, Hibrenate, etc.)

.V

hylepc wrote:
Hi,

From a Data Acess Object (DAO), I need to access a DataSource (like
getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I don't
have access to the servlet variable.
What is the proper way to get the DataSource from a DAO which is called by
an Action but doesn't extend Action?
Thanks,

Will


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: HELP: about to get datasource of struts and pass to logic beans...

2003-12-08 Thread Caroline Jen
 username;
   }
   public void setUsername( String username ) {
  this.username = username;
   }
   public String getUserrole() {
  return userrole;
   }
   public void setUserrole( String userrole ) {
  this.userrole = userrole;
   }
   public String getKeyValue() {
  return keyValue;
   }
   public void setKeyValue( String keyValue ) {
  this.keyValue = keyValue;
   }
}

Here is the DBConnection.java, which gets a connection
object from a connection pool (you have to configure
your server's connection pool):

package org.apache.artimus.ConnectionPool;

import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DBConnection 
{
   public static Connection getDBConnection() throws
SQLException
   {
  Connection conn = null;

  try
  {
 InitialContext ctx = new InitialContext();
 DataSource ds = ( DataSource ) ctx.lookup(
java:comp/env/jdbc/MySQLDB );

 try 
 {
conn = ds.getConnection();
 }
 catch( SQLException e )
 {  
System.out.println( Open connection
failure:  + e.getMessage() );
 }
  }
  catch( NamingException nEx )
  {
 nEx.printStackTrace();
  }
  return conn;
   }
}

Here is the exception handling class:

package org.apache.artimus.logon.exceptions;

/**
 * EditorDAOSysException is an exception that extends
the standard
 * RunTimeException Exception. This is thrown by the
DAOs of the article
 * component when there is some irrecoverable error
(like SQLException)
 */

public class EditorDAOSysException extends
RuntimeException {

/**
 * Constructor
 * @param stra string that explains what the
exception condition is
 */
public EditorDAOSysException (String str) {
super(str);
} 

/**
 * Default constructor. Takes no arguments
 */
public EditorDAOSysException () {
super();
}
}

-Caroline
--- Ricky [EMAIL PROTECTED] wrote:
 hi, there, 
 
 with my project i had several queries about get
 datasource in struts. i know how to get datasource
 in struts, just as in myAction, use getDataSource
 method and return DataSource object, and go on to
 get connection  
 
 i also know the logic beans between the
 Controller and Module, so i create a logic bean ,i
 don't know how to get datasourc of pass the
 datasource, in some tutorial , i got a way to solve
 this, create a method getDAO(HttpServletRequest
 request) and pass the request to the method to get
 DataSource, i was lost here, i dont' know what
 should i return in getDAO, should i return a
 DataSource object or others and in my logic bean i
 can use the datasource and also get connection ,
 statement and resultset object , there i have to
 close it after i finish my process what do you
 think of this i did ? in general, when i got a
 DataSource, i will got a connection from datasource
 and a PrepareStatement and also a ResultSet , when i
 finished my process, i can close all object i opened
 before in final method of try
 ...catch...experession.. now what should i do to
 return a proper object in getDAO method and in logic
 beans i can use the object to process logic
 business...
 
 i appologized for this ... i hope you can give me
 some suggestion or flow.. thanx!
 
 now here is my flow of struts framework to pass the
 datasource to the logic beans...  i hope you can
 reword if you have some good idea...of correct my
 mistake... :)
 
 myAction :
 
 myAction extends Action() {
   public ActionForward execute(ActionMapping
 mapping,
ActionForm form,
HttpServletRequest
 request,
HttpServletResponse
 response) {
 LogicBean bean = new LogicBean();
 Object objcet =
 bean.doMethod(getDAO(request), other param)
   }
   
   public DataSource getDAO(HttpServletRequest
 request) {
 DataSource ds = null;
 ds = getDataSource(request);
 return ds;
   }
 }
 
 and in my logic bean :
 
 class LogicBean {
   public Objct doMethod(DataSource ds, other
 param) {
 try {
   Connection conn = ds.getConnection();
   PrepareStatment stmt =
 conn.prepareStatment(SELECT ...);
   stmt.setInt(1,);
   ResultSet rs = stmt.executeQuery();
   
   return Object.;
 } catch (SQLException ex) {
   ex.printStactTrace();
 } final {
   try {
 rs.close();
 stmt.close();
 conn.close()
   } catch (Exception ex) {
 ex.printStactTrace();
   }
 }
 return null;
   }
 }
 
 should i pass the DataSource to my logic beans?
 otherwise what object should i pass

RE: HELP: about to get datasource of struts and pass to logic bea ns...

2003-12-08 Thread Edgar P Dollin
Don't spend the time to get DataSource working.  It is deprecated and will
be removed from struts in 1.2.  I use Poolman at sourceforge (I highly
reccomend it for non-j2ee projects).  Most others use the DataSource
supplied with the container.

Edgar

-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 4:29 PM
To: Struts Users Mailing List
Subject: Re: HELP: about to get datasource of struts and pass to logic
beans...


There are lots of classes involved.  I will give you
an example:

1. my LogonAction calls EditorService.java (business
delegate)
2. EditorService.java calls MySQLEditorDAO.java (data
access object implements EditorDAO.java, which is a
data access interface)
3. the MySQLEditorDAO.java returns EditorBean.java (a
Java bean with three properties)

Here is my LogonAction.java:

package org.apache.artimus.logon;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;

import org.apache.artimus.lang.Tokens;

public final class LogonAction extends Action {

public ActionForward execute(ActionMapping
mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws java.lang.Exception {

// Obtain username and password from web tier
String username = ((LogonForm)
form).getUsername();
String password = ((LogonForm)
form).getPassword();

EditorService service = new EditorService();
EditorBean editor = service.findEditorData(
username );

HttpSession session = request.getSession();
session.setAttribute( editor, editor );

// Log this event, if appropriate

if (servlet.getDebug() = Tokens.DEBUG) {
StringBuffer message =
new StringBuffer(LogonAction: User
');
message.append(username);
message.append(' logged on in session );
message.append(session.getId());
servlet.log(message.toString());
}

// Return success
return (mapping.findForward(Tokens.VALID));

}

} // End LogonAction

Here is the EditorService.java:

package org.apache.artimus.logon;

import org.apache.artimus.logon.dao.*;

public class EditorService 
{
   EditorDAO ed = new MySQLEditorDAO();
   public EditorBean findEditorData( String username )
   {
  return ed.findEditor( username );
   }
}

Here is the EditorDAO.java:

package org.apache.artimus.logon.dao;

import org.apache.artimus.logon.EditorBean;
import
org.apache.artimus.logon.exceptions.EditorDAOSysException;

public interface EditorDAO.java
{
public EditorBean findEditor( String username )
throws EditorDAOSysException;
}

Here is the MySQLEditorDAO.java:

package org.apache.artimus.logon.dao;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;

import org.apache.artimus.logon.EditorBean;
import
org.apache.artimus.logon.exceptions.EditorDAOSysException;
import org.apache.artimus.ConnectionPool.DBConnection;

public class MySQLEditorDAO implements EditorDAO
{
   // Here the return type is EditorBean
   public EditorBean findEditor( String username ) 
   throws EditorDAOSysException 
   {
  Connection conn = null;
  Statement stmt = null;
  ResultSet rs = null;

  try 
  {
 conn = DBConnection.getDBConnection();
 stmt = conn.createStatement();
 String query = SELECT user_role,
journal_category FROM members WHERE user_name = ' +
username + ';   
 rs = stmt.executeQuery( query );
 if (rs.next()) 
 {
return new EditorBean( username,
rs.getString( user_role ), rs.getString(
journal_category ) );
 }
 else
 {
System.out.println( invalid user name );
return null;
 }
  } 
  catch (SQLException se)
  {
 throw new
EditorDAOSysException(SQLException:  +
se.getMessage());
  }
  finally
  {
 if ( conn != null )
 {
try
{
   rs.close();
   rs = null;
   stmt.close();
   stmt = null;
   conn.close();
}
catch( SQLException sqlEx )
{
   System.out.println( Problem occurs
while closing  + sqlEx );
}
conn = null;
 }   
  }
   }
}

Here is the EditorBean.java:

package

Re: HELP: about to get datasource of struts and pass to logic bea ns...

2003-12-08 Thread Vic Cekvenich
Ah a small comment... The Struts DataSource should not be used, I agree;
 the J2EE container DataSource should be used; but it will not be 
removed for a while AFIAK.

(Deprecated just means it might be removed in some futre version. Just 
like hopefully bean, logic and html:link get deprecated in 2.0 in favor 
of JSTL. It's just a nudge from developers (of which I am not one) for 
you to start considering the better alternatives. I even think Java 
should deprecate Connection , ResultSet and java.util.Date  in favor of 
DataSource, RowSet and Calendar)
Poolman is very, very nice... I used it before 2001; when I switched to 
RowSet (before I started using a SQL based DAO). DAO is best thing to do 
now, and all the DB issues would disapper.

.V

Edgar P Dollin wrote:
Don't spend the time to get DataSource working.  It is deprecated and will
be removed from struts in 1.2.  I use Poolman at sourceforge (I highly
reccomend it for non-j2ee projects).  Most others use the DataSource
supplied with the container.
Edgar

-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 4:29 PM
To: Struts Users Mailing List
Subject: Re: HELP: about to get datasource of struts and pass to logic
beans...
There are lots of classes involved.  I will give you
an example:
1. my LogonAction calls EditorService.java (business
delegate)
2. EditorService.java calls MySQLEditorDAO.java (data
access object implements EditorDAO.java, which is a
data access interface)
3. the MySQLEditorDAO.java returns EditorBean.java (a
Java bean with three properties)
Here is my LogonAction.java:

package org.apache.artimus.logon;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.artimus.lang.Tokens;

public final class LogonAction extends Action {

public ActionForward execute(ActionMapping
mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws java.lang.Exception {

// Obtain username and password from web tier
String username = ((LogonForm)
form).getUsername();
String password = ((LogonForm)
form).getPassword();

EditorService service = new EditorService();
EditorBean editor = service.findEditorData(
username );

HttpSession session = request.getSession();
session.setAttribute( editor, editor );
// Log this event, if appropriate

if (servlet.getDebug() = Tokens.DEBUG) {
StringBuffer message =
new StringBuffer(LogonAction: User
');
message.append(username);
message.append(' logged on in session );
message.append(session.getId());
servlet.log(message.toString());
}
// Return success
return (mapping.findForward(Tokens.VALID));
}

} // End LogonAction

Here is the EditorService.java:

package org.apache.artimus.logon;

import org.apache.artimus.logon.dao.*;

public class EditorService 
{
   EditorDAO ed = new MySQLEditorDAO();
   public EditorBean findEditorData( String username )
   {
  return ed.findEditor( username );
   }
}

Here is the EditorDAO.java:

package org.apache.artimus.logon.dao;

import org.apache.artimus.logon.EditorBean;
import
org.apache.artimus.logon.exceptions.EditorDAOSysException;
public interface EditorDAO.java
{
public EditorBean findEditor( String username )
throws EditorDAOSysException;
}
Here is the MySQLEditorDAO.java:

package org.apache.artimus.logon.dao;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;
import org.apache.artimus.logon.EditorBean;
import
org.apache.artimus.logon.exceptions.EditorDAOSysException;
import org.apache.artimus.ConnectionPool.DBConnection;
public class MySQLEditorDAO implements EditorDAO
{
   // Here the return type is EditorBean
   public EditorBean findEditor( String username ) 
   throws EditorDAOSysException 
   {
  Connection conn = null;
  Statement stmt = null;
  ResultSet rs = null;

  try 
  {
 conn = DBConnection.getDBConnection();
 stmt = conn.createStatement();
 String query = SELECT user_role,
journal_category FROM members WHERE user_name = ' +
username + ';   
 rs = stmt.executeQuery( query );
 if (rs.next()) 
 {
return new EditorBean( username,
rs.getString( user_role ), rs.getString

Re: HELP: about to get datasource of struts and pass to logic beans...

2003-12-06 Thread Vic Cekvenich
Take a look at a very good db example app that uses Struts on iBatis.com
caled PetStore 3.

.V

Ricky wrote:
 hi, there, 
 
 with my project i had several queries about get datasource in struts. i know how 
 to get datasource in struts, just as in myAction, use getDataSource method and 
 return DataSource object, and go on to get connection  
 
 i also know the logic beans between the Controller and Module, so i create a 
 logic bean ,i don't know how to get datasourc of pass the datasource, in some 
 tutorial , i got a way to solve this, create a method getDAO(HttpServletRequest 
 request) and pass the request to the method to get DataSource, i was lost here, i 
 dont' know what should i return in getDAO, should i return a DataSource object or 
 others and in my logic bean i can use the datasource and also get connection , 
 statement and resultset object , there i have to close it after i finish my process 
 what do you think of this i did ? in general, when i got a DataSource, i will 
 got a connection from datasource and a PrepareStatement and also a ResultSet , when 
 i finished my process, i can close all object i opened before in final method of try 
 ...catch...experession.. now what should i do to return a proper object in getDAO 
 method and in logic beans i can use the object to process logic business...
 
 i appologized for this ... i hope you can give me some suggestion or flow.. 
 thanx!
 
 now here is my flow of struts framework to pass the datasource to the logic beans... 
  i hope you can reword if you have some good idea...of correct my mistake... :)
 
 myAction :
 
 myAction extends Action() {
   public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
 LogicBean bean = new LogicBean();
 Object objcet = bean.doMethod(getDAO(request), other param)
   }
   
   public DataSource getDAO(HttpServletRequest request) {
 DataSource ds = null;
 ds = getDataSource(request);
 return ds;
   }
 }
 
 and in my logic bean :
 
 class LogicBean {
   public Objct doMethod(DataSource ds, other param) {
 try {
   Connection conn = ds.getConnection();
   PrepareStatment stmt = conn.prepareStatment(SELECT ...);
   stmt.setInt(1,);
   ResultSet rs = stmt.executeQuery();
   
   return Object.;
 } catch (SQLException ex) {
   ex.printStactTrace();
 } final {
   try {
 rs.close();
 stmt.close();
 conn.close()
   } catch (Exception ex) {
 ex.printStactTrace();
   }
 }
 return null;
   }
 }
 
 should i pass the DataSource to my logic beans? otherwise what object should i 
 pass



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HELP: about to get datasource of struts and pass to logic beans...

2003-12-05 Thread Ricky
hi, there, 

with my project i had several queries about get datasource in struts. i know how 
to get datasource in struts, just as in myAction, use getDataSource method and return 
DataSource object, and go on to get connection  

i also know the logic beans between the Controller and Module, so i create a logic 
bean ,i don't know how to get datasourc of pass the datasource, in some tutorial , i 
got a way to solve this, create a method getDAO(HttpServletRequest request) and pass 
the request to the method to get DataSource, i was lost here, i dont' know what should 
i return in getDAO, should i return a DataSource object or others and in my logic bean 
i can use the datasource and also get connection , statement and resultset object , 
there i have to close it after i finish my process what do you think of this i did 
? in general, when i got a DataSource, i will got a connection from datasource and a 
PrepareStatement and also a ResultSet , when i finished my process, i can close all 
object i opened before in final method of try ...catch...experession.. now what should 
i do to return a proper object in getDAO method and in logic beans i can use the 
object to process logic business...

i appologized for this ... i hope you can give me some suggestion or flow.. thanx!

now here is my flow of struts framework to pass the datasource to the logic beans...  
i hope you can reword if you have some good idea...of correct my mistake... :)

myAction :

myAction extends Action() {
  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) {
LogicBean bean = new LogicBean();
Object objcet = bean.doMethod(getDAO(request), other param)
  }
  
  public DataSource getDAO(HttpServletRequest request) {
DataSource ds = null;
ds = getDataSource(request);
return ds;
  }
}

and in my logic bean :

class LogicBean {
  public Objct doMethod(DataSource ds, other param) {
try {
  Connection conn = ds.getConnection();
  PrepareStatment stmt = conn.prepareStatment(SELECT ...);
  stmt.setInt(1,);
  ResultSet rs = stmt.executeQuery();
  
  return Object.;
} catch (SQLException ex) {
  ex.printStactTrace();
} final {
  try {
rs.close();
stmt.close();
conn.close()
  } catch (Exception ex) {
ex.printStactTrace();
  }
}
return null;
  }
}

should i pass the DataSource to my logic beans? otherwise what object should i 
pass





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



sql server datasource - howto?

2003-12-02 Thread dario
i configured sql server datasource in struts-config

 data-sources
  data-source key=SqlGordon
   type=com.microsoft.jdbcx.sqlserver.SQLServerDataSource
   set-property property=ServerName
 value=Gordon/
   set-property property=DatabaseName
 value=lanaco/
   set-property property=User
 value=sa/
   set-property property=Password
 value=sa/
  /data-source
 /data-sources

but when i try to instantiate DataSource object in my action

ds = getDataSource(request);

struts complains that it can not find GenericDataSource. (legacy package is
not in the classpath)

do i need GenericDatasource at all? i thought i can live without it since
SQLServerDataSource implements DataSource interface.

thankyou!

dario




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: sql server datasource - howto?

2003-12-02 Thread Witt, Mike (OH35)
I'm not sure what problem you are experiencing, but I am pretty sure that it
is not recommended that you use the GenericDataSource.  I switched my last
project to use Jakarta's DBCP (http://jakarta.apache.org/commons/dbcp/) and
found it pretty easy to use.  This was a Tomcat implementation on MySQL, but
if it is helpful, I can send you a snippet from my server.xml which would be
applicable to how you would do your sql server.

Mike

-Original Message-
From: dario [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 8:56 AM
To: [EMAIL PROTECTED]
Subject: sql server datasource - howto?


i configured sql server datasource in struts-config

 data-sources
  data-source key=SqlGordon
   type=com.microsoft.jdbcx.sqlserver.SQLServerDataSource
   set-property property=ServerName
 value=Gordon/
   set-property property=DatabaseName
 value=lanaco/
   set-property property=User
 value=sa/
   set-property property=Password
 value=sa/
  /data-source
 /data-sources

but when i try to instantiate DataSource object in my action

ds = getDataSource(request);

struts complains that it can not find GenericDataSource. (legacy package is
not in the classpath)

do i need GenericDatasource at all? i thought i can live without it since
SQLServerDataSource implements DataSource interface.

thankyou!

dario




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setting DataSource

2003-11-03 Thread ZYD
Did you solved this problem? 
what's wrong with it? I didn't get load exceptions


- Original Message - 
From: Funicelli Aldo [EMAIL PROTECTED]
To: 'struts user' [EMAIL PROTECTED]
Sent: Monday, October 13, 2003 10:41 PM
Subject: setting DataSource


 Using struts 1.1 I'm able to set a DataSource correctly.
 In struts-config.xml I use:
 
 data-sources
   data-source
   set-property property= autoCommit value= false/
 set-property value=true property=autoCommit /
 set-property value=Alnitak Data Source property=description /
 set-property value=oracle.jdbc.driver.OracleDriver
 property=driverClass /
 set-property value=10 property=maxCount /
 set-property value=2 property=minCount /
 set-property value=GL_DYNAMO property=user /
 set-property value=GL_DYNAMO property=password /
 set-property value=jdbc:oracle:thin:@ALNITAK:1521:GL property=url
 /
   /data-source
 /data-sources
 
 With struts 1.1. el, I get a startup configuration error  (which blocks the
 application):
 
 StandardContext[/rr_lesson_3]: Servlet /rr_lesson_3 threw load() exception:
 javax.servlet.ServletException: Servlet.init() for servlet action threw
 exception javax.servlet.ServletException: Servlet.init() for servlet action
 threw exception
 
 Does anyone know why?
 Thanks
 Aldo Funicelli
 
 
 

Deprecation - DataSource

2003-10-27 Thread Mathieu Grimault
First hello everyone !!! This is my first answer and i'm learning struts now...

I'm using this method but it's deprecated...Did someone knows the right call ? thx.

DataSource dataSource = 
(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);



Re: Deprecation - DataSource

2003-10-27 Thread Mark Lowe
You can use the jndi datasource that you define in web.xml rather than  
struts.

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource- 
examples-howto.html

The struts datasource is deprecated generally. Ideally you have your db  
connection stuff in your model layer. If this means little to you, then  
just use the jndi datasource for the time being while you become more  
familiar with struts. I'm sure a few weeks down the line you'll see  
what the model - controller separation stuff is about, when your  
actions start getting longer than is ideal.

Hope this helps

Cheers Mark

On Monday, October 27, 2003, at 01:47 PM, Mathieu Grimault wrote:

First hello everyone !!! This is my first answer and i'm learning  
struts now...

I'm using this method but it's deprecated...Did someone knows the  
right call ? thx.

DataSource dataSource =  
(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE 
_KEY);



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Deprecation - DataSource

2003-10-27 Thread David Graham

--- Mathieu Grimault [EMAIL PROTECTED] wrote:
 First hello everyone !!! This is my first answer and i'm learning struts
 now...
 
 I'm using this method but it's deprecated...Did someone knows the right
 call ? thx.
 
 DataSource dataSource =

(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);

Ideally you configure your DataSource in the server's JNDI registry and
look it up from there.  A Tomcat HOWTO is available here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

David

 
 


__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Please Please Help! -- DataSource Error

2003-10-25 Thread Paul Idusogie
Thanks for pointing me in the right direction Craig. I've got it to work.

Sincerely,


Paul Idusogie


-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 1:59 PM
To: Struts Users Mailing List
Subject: Re: Please Please Help! -- DataSource Error


Paul Idusogie wrote:

Thanks for your support, I was able to redeem a copy of the
struts-legacy.jar.

I have the following questions however:

Does this datasource model still support connection pooling.?




Yes.

Now if this code is specified as legacy, are there better approaches to
retrieving database data without using ejbs.?




If your container supports it, I would recommend retrieving
javax.sql.DataSource instances from the JNDI resources configured by the
container.  For Tomcat, the docs are at:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html

Sincerely,


Paul Idusogie




Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Please Please Help! -- DataSource Error

2003-10-21 Thread Paul Idusogie
I have the following setup within my struts-config.xml file

data-sources
data-source key=myDB
type=org.apache.commons.dbcp.BasicDataSource 
set-property property=description value=my Database/
set-property property=url
value=jdbc:mysql://localhost:3306/myDB/
set-property property=driverClass
value=com.mysql.jdbc.Driver/
set-property property=maxCount value=5/
set-property property=minCount value=1/
set-property property=user value=root/
set-property property=password value=mypassword/
set-property property=maxActive value=10 /
set-property property=maxWait value=5000 /
set-property property=defaultAutoCommit value=false /
set-property property=defaultReadOnly value=false /
set-property property=validationQuery value=SELECT
COUNT(*) FROM userAttributes /
/data-source
/data-sources

but I get the following error when I restart tomcat.

- Root Cause -
java.lang.NoClassDefFoundError: org/apache/struts/legacy/GenericDataSource
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
ader.java:1680)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
a:968)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1410)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1289)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1084)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3421)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3609)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at
org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:273)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.BootstrapService.start(BootstrapService.java:245
)
at
org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:307)

2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading container
servlet default
2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:invoker]: Loading container
servlet invoker


Now there is a file GenericDataSource class located within the package
org/apache/struts/util/GenericDataSource in the struts.jar 

I cannot find the reference located at
org/apache/struts/legacy/GenericDataSource

I am using struts 1.1

Please help


Sincerely,


Paul Idusogie






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Please Please Help! -- DataSource Error

2003-10-21 Thread Barry Volpe
Do you have the struts-legacy.jar in your WEB-INF/lib directory?


- Original Message - 
From: Paul Idusogie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 10:44 AM
Subject: Please Please Help! -- DataSource Error


 I have the following setup within my struts-config.xml file

 data-sources
 data-source key=myDB
 type=org.apache.commons.dbcp.BasicDataSource 
 set-property property=description value=my Database/
 set-property property=url
 value=jdbc:mysql://localhost:3306/myDB/
 set-property property=driverClass
 value=com.mysql.jdbc.Driver/
 set-property property=maxCount value=5/
 set-property property=minCount value=1/
 set-property property=user value=root/
 set-property property=password value=mypassword/
 set-property property=maxActive value=10 /
 set-property property=maxWait value=5000 /
 set-property property=defaultAutoCommit value=false /
 set-property property=defaultReadOnly value=false /
 set-property property=validationQuery value=SELECT
 COUNT(*) FROM userAttributes /
 /data-source
 /data-sources

 but I get the following error when I restart tomcat.

 - Root Cause -
 java.lang.NoClassDefFoundError: org/apache/struts/legacy/GenericDataSource
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
 at
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
 at

org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
 ader.java:1680)
 at

org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
 a:968)
 at

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
 a:1410)
 at

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
 a:1289)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
 at

org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
 ava:1084)
 at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at

org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
 5)
 at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at

org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
 3421)
 at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3609)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at
 org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at

org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:273)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
 )
 at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
 .java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at

org.apache.catalina.startup.BootstrapService.start(BootstrapService.java:245
 )
 at

org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:307)

 2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading
container
 servlet default
 2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:invoker]: Loading
container
 servlet invoker


 Now there is a file GenericDataSource class located within the package
 org/apache/struts/util/GenericDataSource in the struts.jar

 I cannot find the reference located at
 org/apache/struts/legacy/GenericDataSource

 I am using struts 1.1

 Please help


 Sincerely,


 Paul Idusogie













 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Please Please Help! -- DataSource Error

2003-10-21 Thread Geeta Ramani
Paul:

This might occur if you have multiple copies (perhaps differnt versions?) of
struts.jar in your classpath.  Make sure you have one and only one struts-jar in
your WEB-INF/lib directory and that you compile against *that* jar.  (Remove all
other extaneous ones.)  Recompile your app (if necessary) and then restart
tomcat.  This may resolve your problem..

Geeta

Paul Idusogie wrote:

 I have the following setup within my struts-config.xml file

 data-sources
 data-source key=myDB
 type=org.apache.commons.dbcp.BasicDataSource 
 set-property property=description value=my Database/
 set-property property=url
 value=jdbc:mysql://localhost:3306/myDB/
 set-property property=driverClass
 value=com.mysql.jdbc.Driver/
 set-property property=maxCount value=5/
 set-property property=minCount value=1/
 set-property property=user value=root/
 set-property property=password value=mypassword/
 set-property property=maxActive value=10 /
 set-property property=maxWait value=5000 /
 set-property property=defaultAutoCommit value=false /
 set-property property=defaultReadOnly value=false /
 set-property property=validationQuery value=SELECT
 COUNT(*) FROM userAttributes /
 /data-source
 /data-sources

 but I get the following error when I restart tomcat.

 - Root Cause -
 java.lang.NoClassDefFoundError: org/apache/struts/legacy/GenericDataSource
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
 at
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
 at
 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
 ader.java:1680)
 at
 org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
 a:968)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
 a:1410)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
 a:1289)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
 at
 org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
 ava:1084)
 at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
 5)
 at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
 3421)
 at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3609)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at
 org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at
 org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:273)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
 )
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
 .java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
 org.apache.catalina.startup.BootstrapService.start(BootstrapService.java:245
 )
 at
 org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:307)

 2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading container
 servlet default
 2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:invoker]: Loading container
 servlet invoker

 Now there is a file GenericDataSource class located within the package
 org/apache/struts/util/GenericDataSource in the struts.jar

 I cannot find the reference located at
 org/apache/struts/legacy/GenericDataSource

 I am using struts 1.1

 Please help

 Sincerely,

 Paul Idusogie

   
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Please Please Help! -- DataSource Error

2003-10-21 Thread Rajat Pandit
Hi there, this errors looks familiar to me as a one time struts newbie,
you need to a file called struts-legacy.jar to help you. This is if ur
using the generic data source. I still havent been able to figure out
how to get org.apache.commons.dbcp.BasicDataSource to work fr me.
Any pointers 


-Original Message-
From: Paul Idusogie [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 21, 2003 10:45 AM
To: [EMAIL PROTECTED]
Subject: Please Please Help! -- DataSource Error
Importance: High


I have the following setup within my struts-config.xml file

data-sources
data-source key=myDB
type=org.apache.commons.dbcp.BasicDataSource 
set-property property=description value=my
Database/
set-property property=url
value=jdbc:mysql://localhost:3306/myDB/
set-property property=driverClass
value=com.mysql.jdbc.Driver/
set-property property=maxCount value=5/
set-property property=minCount value=1/
set-property property=user value=root/
set-property property=password value=mypassword/
set-property property=maxActive value=10 /
set-property property=maxWait value=5000 /
set-property property=defaultAutoCommit value=false
/
set-property property=defaultReadOnly value=false
/
set-property property=validationQuery value=SELECT
COUNT(*) FROM userAttributes /
/data-source
/data-sources

but I get the following error when I restart tomcat.

- Root Cause -
java.lang.NoClassDefFoundError:
org/apache/struts/legacy/GenericDataSource
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappCla
ssLo
ader.java:1680)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader
.jav
a:968)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
.jav
a:1410)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
.jav
a:1289)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
et.j
ava:1084)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:93
5)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:
3421)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3609
)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at
org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:2
73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.BootstrapService.start(BootstrapService.java
:245
)
at
org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:
307)

2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading
container servlet default 2003-10-21 11:12:41
StandardWrapper[/pentstarjsp:invoker]: Loading container servlet invoker


Now there is a file GenericDataSource class located within the package
org/apache/struts/util/GenericDataSource in the struts.jar 

I cannot find the reference located at
org/apache/struts/legacy/GenericDataSource

I am using struts 1.1

Please help


Sincerely,


Paul Idusogie








-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Please Please Help! -- DataSource Error

2003-10-21 Thread Barry Volpe
They way I got it working was including
the

struts-legacy.jar
commons-dbcp.jar
commons-pool.jar

and it works.

Barry



- Original Message - 
From: Rajat Pandit [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 11:07 AM
Subject: RE: Please Please Help! -- DataSource Error


 Hi there, this errors looks familiar to me as a one time struts newbie,
 you need to a file called struts-legacy.jar to help you. This is if ur
 using the generic data source. I still havent been able to figure out
 how to get org.apache.commons.dbcp.BasicDataSource to work fr me.
 Any pointers


 -Original Message-
 From: Paul Idusogie [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 10:45 AM
 To: [EMAIL PROTECTED]
 Subject: Please Please Help! -- DataSource Error
 Importance: High


 I have the following setup within my struts-config.xml file

 data-sources
 data-source key=myDB
 type=org.apache.commons.dbcp.BasicDataSource 
 set-property property=description value=my
 Database/
 set-property property=url
 value=jdbc:mysql://localhost:3306/myDB/
 set-property property=driverClass
 value=com.mysql.jdbc.Driver/
 set-property property=maxCount value=5/
 set-property property=minCount value=1/
 set-property property=user value=root/
 set-property property=password value=mypassword/
 set-property property=maxActive value=10 /
 set-property property=maxWait value=5000 /
 set-property property=defaultAutoCommit value=false
 /
 set-property property=defaultReadOnly value=false
 /
 set-property property=validationQuery value=SELECT
 COUNT(*) FROM userAttributes /
 /data-source
 /data-sources

 but I get the following error when I restart tomcat.

 - Root Cause -
 java.lang.NoClassDefFoundError:
 org/apache/struts/legacy/GenericDataSource
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
 at
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
 at
 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappCla
 ssLo
 ader.java:1680)
 at
 org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader
 .jav
 a:968)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
 .jav
 a:1410)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
 .jav
 a:1289)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
 at
 org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
 et.j
 ava:1084)
 at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
 a:93
 5)
 at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
 ava:
 3421)
 at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3609
 )
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at
 org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at
 org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:2
 73)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
 a:39
 )
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
 Impl
 .java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
 org.apache.catalina.startup.BootstrapService.start(BootstrapService.java
 :245
 )
 at
 org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:
 307)

 2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading
 container servlet default 2003-10-21 11:12:41
 StandardWrapper[/pentstarjsp:invoker]: Loading container servlet invoker


 Now there is a file GenericDataSource class located within the package
 org/apache/struts/util/GenericDataSource in the struts.jar

 I cannot find the reference located at
 org/apache/struts/legacy/GenericDataSource

 I am using struts 1.1

 Please help


 Sincerely,


 Paul Idusogie








 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Please Please Help! -- DataSource Error

2003-10-21 Thread Paul Idusogie
Where do I find the struts legacy package?

Sincerely,


Paul Idusogie




-Original Message-
From: Barry Volpe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 1:13 PM
To: Struts Users Mailing List
Subject: Re: Please Please Help! -- DataSource Error


They way I got it working was including
the

struts-legacy.jar
commons-dbcp.jar
commons-pool.jar

and it works.

Barry



- Original Message - 
From: Rajat Pandit [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 11:07 AM
Subject: RE: Please Please Help! -- DataSource Error


 Hi there, this errors looks familiar to me as a one time struts newbie,
 you need to a file called struts-legacy.jar to help you. This is if ur
 using the generic data source. I still havent been able to figure out
 how to get org.apache.commons.dbcp.BasicDataSource to work fr me.
 Any pointers


 -Original Message-
 From: Paul Idusogie [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 10:45 AM
 To: [EMAIL PROTECTED]
 Subject: Please Please Help! -- DataSource Error
 Importance: High


 I have the following setup within my struts-config.xml file

 data-sources
 data-source key=myDB
 type=org.apache.commons.dbcp.BasicDataSource 
 set-property property=description value=my
 Database/
 set-property property=url
 value=jdbc:mysql://localhost:3306/myDB/
 set-property property=driverClass
 value=com.mysql.jdbc.Driver/
 set-property property=maxCount value=5/
 set-property property=minCount value=1/
 set-property property=user value=root/
 set-property property=password value=mypassword/
 set-property property=maxActive value=10 /
 set-property property=maxWait value=5000 /
 set-property property=defaultAutoCommit value=false
 /
 set-property property=defaultReadOnly value=false
 /
 set-property property=validationQuery value=SELECT
 COUNT(*) FROM userAttributes /
 /data-source
 /data-sources

 but I get the following error when I restart tomcat.

 - Root Cause -
 java.lang.NoClassDefFoundError:
 org/apache/struts/legacy/GenericDataSource
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
 at
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
 at
 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappCla
 ssLo
 ader.java:1680)
 at
 org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader
 .jav
 a:968)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
 .jav
 a:1410)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
 .jav
 a:1289)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
 at
 org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
 et.j
 ava:1084)
 at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
 a:93
 5)
 at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
 ava:
 3421)
 at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3609
 )
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at
 org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at
 org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:2
 73)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
 a:39
 )
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
 Impl
 .java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
 org.apache.catalina.startup.BootstrapService.start(BootstrapService.java
 :245
 )
 at
 org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:
 307)

 2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading
 container servlet default 2003-10-21 11:12:41
 StandardWrapper[/pentstarjsp:invoker]: Loading container servlet invoker


 Now there is a file GenericDataSource class located within the package
 org/apache/struts/util/GenericDataSource in the struts.jar

 I cannot find the reference located at
 org/apache/struts/legacy/GenericDataSource

 I am using struts 1.1

 Please help


 Sincerely,


 Paul Idusogie








 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED

Re: Please Please Help! -- DataSource Error

2003-10-21 Thread Barry Volpe
In the struts 1.1 Final release

in the /lib directory

Barry


- Original Message - 
From: Paul Idusogie [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 11:17 AM
Subject: RE: Please Please Help! -- DataSource Error


 Where do I find the struts legacy package?

 Sincerely,


 Paul Idusogie




 -Original Message-
 From: Barry Volpe [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 1:13 PM
 To: Struts Users Mailing List
 Subject: Re: Please Please Help! -- DataSource Error


 They way I got it working was including
 the

 struts-legacy.jar
 commons-dbcp.jar
 commons-pool.jar

 and it works.

 Barry



 - Original Message - 
 From: Rajat Pandit [EMAIL PROTECTED]
 To: 'Struts Users Mailing List' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 11:07 AM
 Subject: RE: Please Please Help! -- DataSource Error


  Hi there, this errors looks familiar to me as a one time struts newbie,
  you need to a file called struts-legacy.jar to help you. This is if ur
  using the generic data source. I still havent been able to figure out
  how to get org.apache.commons.dbcp.BasicDataSource to work fr me.
  Any pointers
 
 
  -Original Message-
  From: Paul Idusogie [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, October 21, 2003 10:45 AM
  To: [EMAIL PROTECTED]
  Subject: Please Please Help! -- DataSource Error
  Importance: High
 
 
  I have the following setup within my struts-config.xml file
 
  data-sources
  data-source key=myDB
  type=org.apache.commons.dbcp.BasicDataSource 
  set-property property=description value=my
  Database/
  set-property property=url
  value=jdbc:mysql://localhost:3306/myDB/
  set-property property=driverClass
  value=com.mysql.jdbc.Driver/
  set-property property=maxCount value=5/
  set-property property=minCount value=1/
  set-property property=user value=root/
  set-property property=password value=mypassword/
  set-property property=maxActive value=10 /
  set-property property=maxWait value=5000 /
  set-property property=defaultAutoCommit value=false
  /
  set-property property=defaultReadOnly value=false
  /
  set-property property=validationQuery value=SELECT
  COUNT(*) FROM userAttributes /
  /data-source
  /data-sources
 
  but I get the following error when I restart tomcat.
 
  - Root Cause -
  java.lang.NoClassDefFoundError:
  org/apache/struts/legacy/GenericDataSource
  at java.lang.ClassLoader.defineClass0(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
  at
  java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
  at
  org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappCla
  ssLo
  ader.java:1680)
  at
  org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader
  .jav
  a:968)
  at
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
  .jav
  a:1410)
  at
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
  .jav
  a:1289)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
  at
  org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
  et.j
  ava:1084)
  at
  org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
  at javax.servlet.GenericServlet.init(GenericServlet.java:256)
  at
  org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
  a:93
  5)
  at
  org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
  at
  org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
  ava:
  3421)
  at
  org.apache.catalina.core.StandardContext.start(StandardContext.java:3609
  )
  at
  org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
  at
  org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
  at
  org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
  at
  org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
  at
  org.apache.catalina.core.StandardService.start(StandardService.java:497)
  at
  org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
  at
  org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:2
  73)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
  a:39
  )
  at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
  Impl
  .java:25)
  at java.lang.reflect.Method.invoke(Method.java:324)
  at
  org.apache.catalina.startup.BootstrapService.start(BootstrapService.java
  :245
  )
  at
  org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:
  307)
 
  2003-10-21 11:12:41 StandardWrapper[/pentstarjsp:default]: Loading
  container servlet default 2003-10-21 11:12:41
  StandardWrapper[/pentstarjsp:invoker]: Loading container servlet invoker
 
 
  Now there is a file GenericDataSource class located within

RE: Please Please Help! -- DataSource Error

2003-10-21 Thread Paul Idusogie
Thanks for your support, I was able to redeem a copy of the
struts-legacy.jar.

I have the following questions however:

Does this datasource model still support connection pooling.?

Now if this code is specified as legacy, are there better approaches to
retrieving database data without using ejbs.?


Sincerely,


Paul Idusogie


-Original Message-
From: Barry Volpe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 1:20 PM
To: Struts Users Mailing List
Subject: Re: Please Please Help! -- DataSource Error


In the struts 1.1 Final release

in the /lib directory

Barry


- Original Message -
From: Paul Idusogie [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 11:17 AM
Subject: RE: Please Please Help! -- DataSource Error


 Where do I find the struts legacy package?

 Sincerely,


 Paul Idusogie




 -Original Message-
 From: Barry Volpe [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 1:13 PM
 To: Struts Users Mailing List
 Subject: Re: Please Please Help! -- DataSource Error


 They way I got it working was including
 the

 struts-legacy.jar
 commons-dbcp.jar
 commons-pool.jar

 and it works.

 Barry



 - Original Message -
 From: Rajat Pandit [EMAIL PROTECTED]
 To: 'Struts Users Mailing List' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 11:07 AM
 Subject: RE: Please Please Help! -- DataSource Error


  Hi there, this errors looks familiar to me as a one time struts newbie,
  you need to a file called struts-legacy.jar to help you. This is if ur
  using the generic data source. I still havent been able to figure out
  how to get org.apache.commons.dbcp.BasicDataSource to work fr me.
  Any pointers
 
 
  -Original Message-
  From: Paul Idusogie [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, October 21, 2003 10:45 AM
  To: [EMAIL PROTECTED]
  Subject: Please Please Help! -- DataSource Error
  Importance: High
 
 
  I have the following setup within my struts-config.xml file
 
  data-sources
  data-source key=myDB
  type=org.apache.commons.dbcp.BasicDataSource 
  set-property property=description value=my
  Database/
  set-property property=url
  value=jdbc:mysql://localhost:3306/myDB/
  set-property property=driverClass
  value=com.mysql.jdbc.Driver/
  set-property property=maxCount value=5/
  set-property property=minCount value=1/
  set-property property=user value=root/
  set-property property=password value=mypassword/
  set-property property=maxActive value=10 /
  set-property property=maxWait value=5000 /
  set-property property=defaultAutoCommit value=false
  /
  set-property property=defaultReadOnly value=false
  /
  set-property property=validationQuery value=SELECT
  COUNT(*) FROM userAttributes /
  /data-source
  /data-sources
 
  but I get the following error when I restart tomcat.
 
  - Root Cause -
  java.lang.NoClassDefFoundError:
  org/apache/struts/legacy/GenericDataSource
  at java.lang.ClassLoader.defineClass0(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
  at
  java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
  at
  org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappCla
  ssLo
  ader.java:1680)
  at
  org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader
  .jav
  a:968)
  at
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
  .jav
  a:1410)
  at
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
  .jav
  a:1289)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
  at
  org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
  et.j
  ava:1084)
  at
  org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
  at javax.servlet.GenericServlet.init(GenericServlet.java:256)
  at
  org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
  a:93
  5)
  at
  org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
  at
  org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
  ava:
  3421)
  at
  org.apache.catalina.core.StandardContext.start(StandardContext.java:3609
  )
  at
  org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
  at
  org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
  at
  org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
  at
  org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
  at
  org.apache.catalina.core.StandardService.start(StandardService.java:497)
  at
  org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
  at
  org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:2
  73)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
  a:39
  )
  at
  sun.reflect.DelegatingMethodAccessorImpl.invoke

Re: Please Please Help! -- DataSource Error

2003-10-21 Thread Barry Volpe

Read this:


http://jakarta.apache.org/struts/faqs/database.html

Also wanted to mention that I'm not sure if you are going
to have problems if you are not using the struts.jar from release 1.1

The other item I had a problem with is:

set-property property=validationQuery value=SELECT
   COUNT(*) FROM userAttributes /

If this fails your datasource will not work.
If it does fail completely remove this statement.

Barry




- Original Message - 
From: Paul Idusogie [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 11:44 AM
Subject: RE: Please Please Help! -- DataSource Error


 Thanks for your support, I was able to redeem a copy of the
 struts-legacy.jar.

 I have the following questions however:

 Does this datasource model still support connection pooling.?

 Now if this code is specified as legacy, are there better approaches to
 retrieving database data without using ejbs.?


 Sincerely,


 Paul Idusogie


 -Original Message-
 From: Barry Volpe [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 1:20 PM
 To: Struts Users Mailing List
 Subject: Re: Please Please Help! -- DataSource Error


 In the struts 1.1 Final release

 in the /lib directory

 Barry


 - Original Message -
 From: Paul Idusogie [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Tuesday, October 21, 2003 11:17 AM
 Subject: RE: Please Please Help! -- DataSource Error


  Where do I find the struts legacy package?
 
  Sincerely,
 
 
  Paul Idusogie
 
 
 
 
  -Original Message-
  From: Barry Volpe [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, October 21, 2003 1:13 PM
  To: Struts Users Mailing List
  Subject: Re: Please Please Help! -- DataSource Error
 
 
  They way I got it working was including
  the
 
  struts-legacy.jar
  commons-dbcp.jar
  commons-pool.jar
 
  and it works.
 
  Barry
 
 
 
  - Original Message -
  From: Rajat Pandit [EMAIL PROTECTED]
  To: 'Struts Users Mailing List' [EMAIL PROTECTED];
  [EMAIL PROTECTED]
  Sent: Tuesday, October 21, 2003 11:07 AM
  Subject: RE: Please Please Help! -- DataSource Error
 
 
   Hi there, this errors looks familiar to me as a one time struts
newbie,
   you need to a file called struts-legacy.jar to help you. This is if ur
   using the generic data source. I still havent been able to figure out
   how to get org.apache.commons.dbcp.BasicDataSource to work fr me.
   Any pointers
  
  
   -Original Message-
   From: Paul Idusogie [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, October 21, 2003 10:45 AM
   To: [EMAIL PROTECTED]
   Subject: Please Please Help! -- DataSource Error
   Importance: High
  
  
   I have the following setup within my struts-config.xml file
  
   data-sources
   data-source key=myDB
   type=org.apache.commons.dbcp.BasicDataSource 
   set-property property=description value=my
   Database/
   set-property property=url
   value=jdbc:mysql://localhost:3306/myDB/
   set-property property=driverClass
   value=com.mysql.jdbc.Driver/
   set-property property=maxCount value=5/
   set-property property=minCount value=1/
   set-property property=user value=root/
   set-property property=password value=mypassword/
   set-property property=maxActive value=10 /
   set-property property=maxWait value=5000 /
   set-property property=defaultAutoCommit value=false
   /
   set-property property=defaultReadOnly value=false
   /
   set-property property=validationQuery value=SELECT
   COUNT(*) FROM userAttributes /
   /data-source
   /data-sources
  
   but I get the following error when I restart tomcat.
  
   - Root Cause -
   java.lang.NoClassDefFoundError:
   org/apache/struts/legacy/GenericDataSource
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
   at
  
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
   at
  
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappCla
   ssLo
   ader.java:1680)
   at
  
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader
   .jav
   a:968)
   at
  
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
   .jav
   a:1410)
   at
  
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
   .jav
   a:1289)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
   at
  
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
   et.j
   ava:1084)
   at
   org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
   at javax.servlet.GenericServlet.init(GenericServlet.java:256)
   at
  
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
   a:93
   5)
   at
  
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
   at
  
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
   ava:
   3421)
   at
  
org.apache.catalina.core.StandardContext.start(StandardContext.java

Re: Please Please Help! -- DataSource Error

2003-10-21 Thread Craig R. McClanahan
Paul Idusogie wrote:

Thanks for your support, I was able to redeem a copy of the
struts-legacy.jar.
I have the following questions however:

Does this datasource model still support connection pooling.?

 

Yes.

Now if this code is specified as legacy, are there better approaches to
retrieving database data without using ejbs.?
 

If your container supports it, I would recommend retrieving 
javax.sql.DataSource instances from the JNDI resources configured by the 
container.  For Tomcat, the docs are at:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Sincerely,

Paul Idusogie

 

Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: AW: AW: Looking up the Struts Datasource

2003-10-19 Thread Wolfgang Woger


Craig R. McClanahan wrote:

Philipp Rthl wrote:

That's not really what I would like to do.

public ActionForward
  execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response) throws Exception
{
   SomeBean  myBean = new SomeBean();
}
public class SomeBean()
{
  public SomeBean()
{
   //how do I get the Struts DS here - without passing it as an 
attribute?
}

}

Any hints?

 

Short answer -- you don't.

The Struts data source isn't magical -- it's an object like any other 
object, and in order for a method in some bean to talk to an instance, 
the method needs a reference to that object.  Typically, that means 
you need to pass it in as a method parameter, make it visible through 
some static getter or factory method, or make it visible in some 
global repository that is available to the bean instance.

Using JNDI-based data sources is an example of the third approach.  
Indeed, that is one of the main reasons that using JNDI data sources 
should be preferred to using the one provided by Struts -- your method 
inside SomeBean can ask for the data source whenever it needs to, 
without having to pass it around.  (There are other advantages as 
well, but this is the one most relevant to your concern here.)
So, when ever you neet a datasource, the method in SomeBean will have to 
search it in JNDI. Doesn't this pose a performance penalty?


phi

 

Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: AW: AW: Looking up the Struts Datasource

2003-10-19 Thread Craig R. McClanahan
Wolfgang Woger wrote:



Craig R. McClanahan wrote:

Philipp Rthl wrote:

That's not really what I would like to do.

public ActionForward
  execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response) throws Exception
{
   SomeBean  myBean = new SomeBean();
}
public class SomeBean()
{
  public SomeBean()
{
   //how do I get the Struts DS here - without passing it as an 
attribute?
}

}

Any hints?

 

Short answer -- you don't.

The Struts data source isn't magical -- it's an object like any other 
object, and in order for a method in some bean to talk to an 
instance, the method needs a reference to that object.  Typically, 
that means you need to pass it in as a method parameter, make it 
visible through some static getter or factory method, or make it 
visible in some global repository that is available to the bean 
instance.

Using JNDI-based data sources is an example of the third approach.  
Indeed, that is one of the main reasons that using JNDI data sources 
should be preferred to using the one provided by Struts -- your 
method inside SomeBean can ask for the data source whenever it needs 
to, without having to pass it around.  (There are other advantages as 
well, but this is the one most relevant to your concern here.)


So, when ever you neet a datasource, the method in SomeBean will have 
to search it in JNDI. Doesn't this pose a performance penalty?


The JNDI environment is a glorified HashMap, so it's not like this is 
particularly expensive.  Certainly no more expensive than modifying all 
your beans to pass along a DataSource or Connection parameter to any 
method that needs it.

Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Looking up the Struts Datasource

2003-10-17 Thread Philipp Röthl
Hi,

I've implemented a struts application that uses JavaBeans which perform the whole 
business logic. These beans access an Oracle DB. The datasource is passed from the 
action classes to the bean classes as a parameter.

Now I have to implement a WebService that does the same as the Struts Application. 
Therefore I use the same JavaBeans.

My problem now is: I have to pass the datasource to the Java Beans. I've read that I 
should be able to access the Struts Datasource via JNDI. But how?

Thanks for any help.

Philipp

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Looking up the Struts Datasource

2003-10-17 Thread Ben Anderson
It depends on the container as to how you put the datasource into the 
context.

If you're using Tomcat 4.1:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
Then to access the datasource:
   String dsName = java:comp/env/jdbc/myDS;
   ctx = new InitialContext();
   DataSource ds = (DataSource)ctx.lookup(dsName);


From: Philipp Röthl [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Looking up the Struts Datasource
Date: Fri, 17 Oct 2003 15:50:23 +0200
Hi,

I've implemented a struts application that uses JavaBeans which perform the 
whole business logic. These beans access an Oracle DB. The datasource is 
passed from the action classes to the bean classes as a parameter.

Now I have to implement a WebService that does the same as the Struts 
Application. Therefore I use the same JavaBeans.

My problem now is: I have to pass the datasource to the Java Beans. I've 
read that I should be able to access the Struts Datasource via JNDI. But 
how?

Thanks for any help.

Philipp

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Cheer a special someone with a fun Halloween eCard from American Greetings! 
Go to  http://www.msn.americangreetings.com/index_msn.pd?source=msne134

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


AW: Looking up the Struts Datasource

2003-10-17 Thread Philipp Rthl
Ben, thanks for your answer. But the DS I would like to get is the Struts DS. The one 
I defined in the struts-config.xml.
When I do the naming lookup as you described I get 
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
 
Philipp

-Ursprngliche Nachricht- 
Von: Ben Anderson [mailto:[EMAIL PROTECTED] 
Gesendet: Fr 17.10.2003 16:22 
An: [EMAIL PROTECTED] 
Cc: 
Betreff: Re: Looking up the Struts Datasource



It depends on the container as to how you put the datasource into the
context.

If you're using Tomcat 4.1:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Then to access the datasource:
String dsName = java:comp/env/jdbc/myDS;
ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(dsName);



From: Philipp Rthl [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Looking up the Struts Datasource
Date: Fri, 17 Oct 2003 15:50:23 +0200

Hi,

I've implemented a struts application that uses JavaBeans which perform the
whole business logic. These beans access an Oracle DB. The datasource is
passed from the action classes to the bean classes as a parameter.

Now I have to implement a WebService that does the same as the Struts
Application. Therefore I use the same JavaBeans.

My problem now is: I have to pass the datasource to the Java Beans. I've
read that I should be able to access the Struts Datasource via JNDI. But
how?

Thanks for any help.

Philipp

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
Cheer a special someone with a fun Halloween eCard from American Greetings!
Go to  http://www.msn.americangreetings.com/index_msn.pd?source=msne134


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: AW: Looking up the Struts Datasource

2003-10-17 Thread Ben Anderson
you've tried the configuration detailed in the struts faqs?
http://jakarta.apache.org/struts/faqs/database.html
public ActionForward
  execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response) throws Exception
{
javax.sql.DataSource dataSource;
java.sql.Connection myConnection;
try {
 dataSource = getDataSource(request);
 myConnection = dataSource.getConnection();
 // do what you wish with myConnection
} catch (SQLException sqle) {
   getServlet().log(Connection.process, sqle);
} finally {
   //enclose this in a finally block to make
   //sure the connection is closed
   try {
  myConnection.close();
   } catch (SQLException e) {
  getServlet().log(Connection.close, e);
   }
  }
}

From: Philipp Röthl [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: AW: Looking up the Struts Datasource
Date: Fri, 17 Oct 2003 20:01:39 +0200
Ben, thanks for your answer. But the DS I would like to get is the Struts 
DS. The one I defined in the struts-config.xml.
When I do the naming lookup as you described I get 
javax.naming.NameNotFoundException: Name jdbc is not bound in this 
Context

Philipp

-Ursprüngliche Nachricht-
Von: Ben Anderson [mailto:[EMAIL PROTECTED]
Gesendet: Fr 17.10.2003 16:22
An: [EMAIL PROTECTED]
Cc:
Betreff: Re: Looking up the Struts Datasource


It depends on the container as to how you put the datasource into the
context.
If you're using Tomcat 4.1:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
Then to access the datasource:
String dsName = java:comp/env/jdbc/myDS;
ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(dsName);


	From: Philipp Röthl [EMAIL PROTECTED]
	Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
	To: [EMAIL PROTECTED]
	Subject: Looking up the Struts Datasource
	Date: Fri, 17 Oct 2003 15:50:23 +0200
	
	Hi,
	
	I've implemented a struts application that uses JavaBeans which perform 
the
	whole business logic. These beans access an Oracle DB. The datasource is
	passed from the action classes to the bean classes as a parameter.
	
	Now I have to implement a WebService that does the same as the Struts
	Application. Therefore I use the same JavaBeans.
	
	My problem now is: I have to pass the datasource to the Java Beans. I've
	read that I should be able to access the Struts Datasource via JNDI. But
	how?
	
	Thanks for any help.
	
	Philipp
	
	-
	To unsubscribe, e-mail: [EMAIL PROTECTED]
	For additional commands, e-mail: [EMAIL PROTECTED]
	

	_
	Cheer a special someone with a fun Halloween eCard from American 
Greetings!
	Go to  http://www.msn.americangreetings.com/index_msn.pd?source=msne134

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Want to check if your PC is virus-infected?  Get a FREE computer virus scan 
online from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


AW: AW: Looking up the Struts Datasource

2003-10-17 Thread Philipp Rthl
That's not really what I would like to do.
 
public ActionForward
   execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) throws Exception
{
SomeBean  myBean = new SomeBean();
}
 
 
public class SomeBean()
{
 
   public SomeBean()
 {
//how do I get the Struts DS here - without passing it as an attribute?
}
 
}
 
Any hints?
 
phi

-Ursprngliche Nachricht- 
Von: Ben Anderson [mailto:[EMAIL PROTECTED] 
Gesendet: Fr 17.10.2003 20:57 
An: [EMAIL PROTECTED] 
Cc: 
Betreff: Re: AW: Looking up the Struts Datasource



you've tried the configuration detailed in the struts faqs?
http://jakarta.apache.org/struts/faqs/database.html

public ActionForward
   execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) throws Exception
{
javax.sql.DataSource dataSource;
java.sql.Connection myConnection;
try {
  dataSource = getDataSource(request);
  myConnection = dataSource.getConnection();
  // do what you wish with myConnection
} catch (SQLException sqle) {
getServlet().log(Connection.process, sqle);
} finally {
//enclose this in a finally block to make
//sure the connection is closed
try {
   myConnection.close();
} catch (SQLException e) {
   getServlet().log(Connection.close, e);
}
   }
}


From: Philipp Rthl [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: AW: Looking up the Struts Datasource
Date: Fri, 17 Oct 2003 20:01:39 +0200

Ben, thanks for your answer. But the DS I would like to get is the Struts
DS. The one I defined in the struts-config.xml.
When I do the naming lookup as you described I get
javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context

Philipp

   -Ursprngliche Nachricht-
   Von: Ben Anderson [mailto:[EMAIL PROTECTED]
   Gesendet: Fr 17.10.2003 16:22
   An: [EMAIL PROTECTED]
   Cc:
   Betreff: Re: Looking up the Struts Datasource



   It depends on the container as to how you put the datasource into the
   context.

   If you're using Tomcat 4.1:
   
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

   Then to access the datasource:
   String dsName = java:comp/env/jdbc/myDS;
   ctx = new InitialContext();
   DataSource ds = (DataSource)ctx.lookup(dsName);



   From: Philipp Rthl [EMAIL PROTECTED]
   Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: Looking up the Struts Datasource
   Date: Fri, 17 Oct 2003 15:50:23 +0200
   
   Hi,
   
   I've implemented a struts application that uses JavaBeans which 
perform
the
   whole business logic. These beans access an Oracle DB. The datasource 
is
   passed from the action classes to the bean classes as a parameter.
   
   Now I have to implement a WebService that does the same as the Struts
   Application. Therefore I use the same JavaBeans.
   
   My problem now is: I have to pass the datasource to the Java Beans. 
I've
   read that I should be able to access the Struts Datasource via JNDI. 
But
   how?
   
   Thanks for any help.
   
   Philipp
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   

   _
   Cheer a special someone with a fun Halloween eCard from American
Greetings!
   Go to  http://www.msn.americangreetings.com/index_msn.pd?source=msne134


   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED

Re: AW: AW: Looking up the Struts Datasource

2003-10-17 Thread Craig R. McClanahan
Philipp Rthl wrote:

That's not really what I would like to do.

public ActionForward
  execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response) throws Exception
{
   SomeBean  myBean = new SomeBean();
}
public class SomeBean()
{
  public SomeBean()
{
   //how do I get the Struts DS here - without passing it as an attribute?
}
}

Any hints?

 

Short answer -- you don't.

The Struts data source isn't magical -- it's an object like any other 
object, and in order for a method in some bean to talk to an instance, 
the method needs a reference to that object.  Typically, that means you 
need to pass it in as a method parameter, make it visible through some 
static getter or factory method, or make it visible in some global 
repository that is available to the bean instance.

Using JNDI-based data sources is an example of the third approach.  
Indeed, that is one of the main reasons that using JNDI data sources 
should be preferred to using the one provided by Struts -- your method 
inside SomeBean can ask for the data source whenever it needs to, 
without having to pass it around.  (There are other advantages as well, 
but this is the one most relevant to your concern here.)

phi

 

Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JNDI Datasource

2003-10-16 Thread virupaksha
Dear All,

I am facing following error, when i am trying to connect jndi data source. 

error is Cannot load JDBC driver class 'null'.

here i am using Mysql database, i have copied mysql driver jar files into 
struts application's lib folder , tomcat's common/lib and  shared/lib folder and Jndi 
datasource is configured in server.config,, 

can any one pls. help me to correct my mistake..

Regards,
viru



Re: JNDI Datasource

2003-10-16 Thread Kirk Wylie
This actually looks like a Tomcat problem, not a Struts problem, but if 
you post your server.xml file it might help debug the problem.

Kirk Wylie
M7 Corporation
virupaksha wrote:

Dear All,

I am facing following error, when i am trying to connect jndi data source.

error is Cannot load JDBC driver class 'null'.

here i am using Mysql database, i have copied mysql driver jar files into
struts application's lib folder , tomcat's common/lib and  shared/lib 
folder and Jndi datasource is configured in server.config,,

can any one pls. help me to correct my mistake..

Regards,
viru


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: JNDI Datasource

2003-10-16 Thread Welkin Fung
Kirk Wylie

You can copy the JDBC driver *.jar to
$TOMCAT_HOME/common/lib or make the CLASSPATH.

Welkin

--- Kirk Wylie [EMAIL PROTECTED] wrote:
 This actually looks like a Tomcat problem, not a
 Struts problem, but if 
 you post your server.xml file it might help debug
 the problem.
 
 Kirk Wylie
 M7 Corporation
 
 virupaksha wrote:
 
  Dear All,
  
  I am facing following error, when i am trying to
 connect jndi data source.
  
  error is Cannot load JDBC driver class 'null'.
  
  here i am using Mysql database, i have copied
 mysql driver jar files into
  struts application's lib folder , tomcat's
 common/lib and  shared/lib 
  folder and Jndi datasource is configured in
 server.config,,
  
  can any one pls. help me to correct my mistake..
  
  Regards,
  viru
  
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JNDI Datasource

2003-10-16 Thread virupaksha
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
  namemaxActive/name
  value100/value
/parameter
parameter
  namemaxWait/name
  value1/value
/parameter
parameter
  namepassword/name
  valuesuiwah/value
/parameter
parameter
  nameurl/name

valuejdbc:mysql://191.100.10.248:3306/db_slcs?autoReconnect=true/value
/parameter
parameter
  namedriverClassName/name
  valueorg.gjt.mm.mysql.Driver/value
/parameter
parameter
  namemaxIdle/name
  value30/value
/parameter
parameter
  nameusername/name
  valueadmin/value
/parameter
  /ResourceParams
  Resource name=test auth=Container
  type=javax.sql.DataSource/
ResourceParams name=test
  parameter
nameuser/name
valueadmin/value
  /parameter
  parameter
namepassword/name
valuesuiwah/value
  /parameter
 parameter
   namedriverClassName/name
valueorg.gjt.mm.mysql.Driver/value
  /parameter
 parameter
namedriverName/name
 valuejdbc:mysql://191.100.10.248:3306/db_slcs/value
   /parameter
 /ResourceParams
/Context
Context className=org.apache.catalina.core.StandardContext
cachingAllowed=true
charsetMapperClass=org.apache.catalina.util.CharsetMapper cookies=true
crossContext=true debug=0
docBase=D:\StrutsStudio\tomcat\webapps\FirstProject
mapperClass=org.apache.catalina.core.StandardContextMapper
path=/FirstProject privileged=false reloadable=true
swallowOutput=false useNaming=true
wrapperClass=org.apache.catalina.core.StandardWrapper
/Context
Context className=org.apache.catalina.core.StandardContext
cachingAllowed=true
charsetMapperClass=org.apache.catalina.util.CharsetMapper cookies=true
crossContext=true debug=0
docBase=D:\StrutsStudio\tomcat\webapps\TicTacToe
mapperClass=org.apache.catalina.core.StandardContextMapper
path=/TicTacToe privileged=false reloadable=true swallowOutput=false
useNaming=true wrapperClass=org.apache.catalina.core.StandardWrapper
/Context
Context className=org.apache.catalina.core.StandardContext
cachingAllowed=true
charsetMapperClass=org.apache.catalina.util.CharsetMapper cookies=true
crossContext=true debug=0 displayName=Tomcat Manager Application
docBase=../server/webapps/manager
mapperClass=org.apache.catalina.core.StandardContextMapper path=/manager
privileged=true reloadable=true swallowOutput=false useNaming=true
wrapperClass=org.apache.catalina.core.StandardWrapper
  ResourceLink global=UserDatabase name=users
type=org.apache.catalina.UserDatabase/
/Context
Context className=org.apache.catalina.core.StandardContext
cachingAllowed=true
charsetMapperClass=org.apache.catalina.util.CharsetMapper cookies=true
crossContext=true debug=0 displayName=Welcome to Tomcat
docBase=D:\StrutsStudio\tomcat\webapps\ROOT
mapperClass=org.apache.catalina.core.StandardContextMapper path=
privileged=false reloadable=true swallowOutput=false useNaming=true
wrapperClass=org.apache.catalina.core.StandardWrapper
/Context
DefaultContext
className=org.apache.catalina.core.StandardDefaultContext cookies=true
crossContext=true name=defaultContext reloadable=true
swallowOutput=false useNaming=true
wrapperClass=org.apache.catalina.core.StandardWrapper
/DefaultContext
Logger className=org.apache.catalina.logger.FileLogger debug=0
directory=logs prefix=localhost_log. suffix=.txt timestamp=true
verbosity=1/
  /Host
  Logger className=org.apache.catalina.logger.FileLogger debug=0
directory=logs prefix=catalina_log. suffix=.txt timestamp=true
verbosity=1/
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
debug=0 resourceName=UserDatabase validate=true/
/Engine
  /Service
/Server


-
- Original Message -
From: Kirk Wylie [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, October 17, 2003 2:31 AM
Subject: Re: JNDI Datasource


 This actually looks like a Tomcat problem, not a Struts problem, but if
 you post your server.xml file it might help debug the problem.

 Kirk Wylie
 M7 Corporation

 virupaksha wrote:

  Dear All,
 
  I am facing following error, when i am trying to connect jndi data
source.
 
  error is Cannot load JDBC driver class 'null'.
 
  here i am using Mysql database, i have copied mysql driver jar files
into
  struts application's lib folder , tomcat's common/lib and  shared/lib
  folder and Jndi datasource is configured in server.config,,
 
  can any one pls. help me to correct my mistake..
 
  Regards,
  viru

setting DataSource

2003-10-13 Thread Funicelli Aldo
Using struts 1.1 I'm able to set a DataSource correctly.
In struts-config.xml I use:

data-sources
  data-source
set-property property= autoCommit value= false/
set-property value=true property=autoCommit /
set-property value=Alnitak Data Source property=description /
set-property value=oracle.jdbc.driver.OracleDriver
property=driverClass /
set-property value=10 property=maxCount /
set-property value=2 property=minCount /
set-property value=GL_DYNAMO property=user /
set-property value=GL_DYNAMO property=password /
set-property value=jdbc:oracle:thin:@ALNITAK:1521:GL property=url
/
  /data-source
/data-sources

With struts 1.1. el, I get a startup configuration error  (which blocks the
application):

StandardContext[/rr_lesson_3]: Servlet /rr_lesson_3 threw load() exception:
javax.servlet.ServletException: Servlet.init() for servlet action threw
exception javax.servlet.ServletException: Servlet.init() for servlet action
threw exception

Does anyone know why?
Thanks
Aldo Funicelli




datasource connection problem.

2003-09-09 Thread Rajat Pandit
hello,
i am using mysql as a datasource in the app,everything
is working fine but when make changes in the class
files and reload the application the application
ceazes to work and i got the followng messages in my
log file. can some one help me figure out where am i
going wrong. am a newbie.
thanks in advance
rajat

-- SNIP --
[INFO] PropertyMessageResources - -Initializing,
config='resources.application',
 returnNull=true
[INFO] GenericDataSource - -   createConnection()
[ERROR] ActionServlet - -Initializing application data
source org.apache.struts.action.DATA_SOURCE
java.sql.SQLException: Unable to connect to any hosts
due to exception: java.net.BindException: Address in
use: no further informationjava.
sql.SQLException: Unable to connect to any hosts due
to exception: java.net.Bind
Exception: Address in use: no further information
at
com.mysql.jdbc.Connection.createNewIO(Connection.java:1622)
at
com.mysql.jdbc.Connection.init(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
at
org.apache.struts.legacy.GenericDataSource.createConnection(GenericDataSource.java:805)
at
org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:741)
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1085)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at
javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:2567)
at
org.apache.catalina.servlets.ManagerServlet.reload(ManagerServlet.java:740)
at
org.apache.catalina.servlets.HTMLManagerServlet.reload(HTMLManagerServlet.java:325)
at
org.apache.catalina.servlets.HTMLManagerServlet.doGet(HTMLManagerServlet.java:143)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
-- SNIP --


Yahoo! India Matrimony: Find your partner online.
Go to http://yahoo.shaadi.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: datasource connection problem.

2003-09-09 Thread alan
A BindException is caused when you try to grab a socket that is already
in use.  My guess is that you haven't stopped the previous application
before trying to start the new version.

alan 

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 08, 2003 11:33 PM
To: Struts Users Mailing List
Subject: datasource connection problem.

hello,
i am using mysql as a datasource in the app,everything
is working fine but when make changes in the class
files and reload the application the application
ceazes to work and i got the followng messages in my
log file. can some one help me figure out where am i
going wrong. am a newbie.
thanks in advance
rajat

-- SNIP --
[INFO] PropertyMessageResources - -Initializing,
config='resources.application',
 returnNull=true
[INFO] GenericDataSource - -   createConnection()
[ERROR] ActionServlet - -Initializing application data
source org.apache.struts.action.DATA_SOURCE
java.sql.SQLException: Unable to connect to any hosts
due to exception: java.net.BindException: Address in
use: no further informationjava.
sql.SQLException: Unable to connect to any hosts due
to exception: java.net.Bind
Exception: Address in use: no further information
at
com.mysql.jdbc.Connection.createNewIO(Connection.java:1622)
at
com.mysql.jdbc.Connection.init(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:34
6)
at
org.apache.struts.legacy.GenericDataSource.createConnection(GenericDataS
ource.java:805)
at
org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:7
41)
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServl
et.java:1085)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at
javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:934)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:3420)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:256
7)
at
org.apache.catalina.servlets.ManagerServlet.reload(ManagerServlet.java:7
40)
at
org.apache.catalina.servlets.HTMLManagerServlet.reload(HTMLManagerServle
t.java:325)
at
org.apache.catalina.servlets.HTMLManagerServlet.doGet(HTMLManagerServlet
.java:143)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
-- SNIP --


Yahoo! India Matrimony: Find your partner online.
Go to http://yahoo.shaadi.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: datasource connection problem.

2003-09-09 Thread Paul Thomas
On 09/09/2003 07:32 Rajat Pandit wrote:
hello,
i am using mysql as a datasource in the app,everything
is working fine but when make changes in the class
files and reload the application the application
ceazes to work and i got the followng messages in my
log file. can some one help me figure out where am i
going wrong. am a newbie.
thanks in advance
rajat
-- SNIP --
[INFO] PropertyMessageResources - -Initializing,
config='resources.application',
 returnNull=true
[INFO] GenericDataSource - -   createConnection()
[ERROR] ActionServlet - -Initializing application data
source org.apache.struts.action.DATA_SOURCE
java.sql.SQLException: Unable to connect to any hosts
due to exception: java.net.BindException: Address in
use: no further informationjava.
sql.SQLException: Unable to connect to any hosts due
to exception: java.net.Bind
Exception: Address in use: no further information
[snip]

Are you running on Windows by any chance? If so then there's a known 
problem which sounds very much like the one your experiencing. Happily, I 
don't use M$ junk but if you Google around for BindException and Windows 
you'll probably find it.

HTH

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: datasource connection problem.

2003-09-09 Thread Caroline Jen
Hi, in my opinion, you should pay attention to this
part of your log file:

Unable to connect to any hosts due to exception.

and 

java.net.BindExceptioncom.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346

It says that the jdbc driver is not registered.
--- Rajat Pandit [EMAIL PROTECTED] wrote:
 hello,
 i am using mysql as a datasource in the
 app,everything
 is working fine but when make changes in the class
 files and reload the application the application
 ceazes to work and i got the followng messages in my
 log file. can some one help me figure out where am i
 going wrong. am a newbie.
 thanks in advance
 rajat
 
 -- SNIP --
 [INFO] PropertyMessageResources - -Initializing,
 config='resources.application',
  returnNull=true
 [INFO] GenericDataSource - -   createConnection()
 [ERROR] ActionServlet - -Initializing application
 data
 source org.apache.struts.action.DATA_SOURCE
 java.sql.SQLException: Unable to connect to any
 hosts
 due to exception: java.net.BindException: Address in
 use: no further informationjava.
 sql.SQLException: Unable to connect to any hosts due
 to exception: java.net.Bind
 Exception: Address in use: no further information
 at

com.mysql.jdbc.Connection.createNewIO(Connection.java:1622)
 at

com.mysql.jdbc.Connection.init(Connection.java:491)
 at

com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
 at

org.apache.struts.legacy.GenericDataSource.createConnection(GenericDataSource.java:805)
 at

org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:741)
 at

org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1085)
 at

org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at

javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at

org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)
 at

org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
 at

org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420)
 at

org.apache.catalina.core.StandardContext.reload(StandardContext.java:2567)
 at

org.apache.catalina.servlets.ManagerServlet.reload(ManagerServlet.java:740)
 at

org.apache.catalina.servlets.HTMLManagerServlet.reload(HTMLManagerServlet.java:325)
 at

org.apache.catalina.servlets.HTMLManagerServlet.doGet(HTMLManagerServlet.java:143)
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
 at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
 at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
 -- SNIP --
 


 Yahoo! India Matrimony: Find your partner online.
 Go to http://yahoo.shaadi.com
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



R: [OT] JNDI datasource lookup to test classes

2003-08-23 Thread Leonardo Francalanci
 The most common solution to this problem is using a Factory Method to
 return the correct implementation of the interface.  Your classes should
 never know which implementation is in use because they will all ask the
 Factory Method for the object.  You just need to change the one line in
 the method to return a different object for testing.

Ok, you mean something like that:

Class ConnectionHandlerFactory
...

public IConnectonHandler getConnectonHandler()
{
if (test)
return new ConnectionHandlerTest();

else
return new ConnectionHandlerForTomcat();


}

but I think this has 2 problems:

1) in my production code I'll have code that is written just for testing
purpose
2) Before executing any test I have to set the test variable to true.


Or I did not understand?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: R: [OT] JNDI datasource lookup to test classes

2003-08-23 Thread James CE Johnson
 
  The most common solution to this problem is using a Factory Method to
  return the correct implementation of the interface.  Your classes should
  never know which implementation is in use because they will all ask the
  Factory Method for the object.  You just need to change the one line in
  the method to return a different object for testing.
 
 Ok, you mean something like that:
 
 Class ConnectionHandlerFactory
   ...
 
   public IConnectonHandler getConnectonHandler()
   {
   if (test)
   return new ConnectionHandlerTest();
 
   else
   return new ConnectionHandlerForTomcat();
 
 
   }
 
 but I think this has 2 problems:
 
 1) in my production code I'll have code that is written just for testing
 purpose
 2) Before executing any test I have to set the test variable to true.
 
 
 Or I did not understand?
 

That's the gist of it. We've solved it thusly:

if (Boolean.getBoolean(use.test.objects)) {
try {
return = (IConnectonHandler)
 Class.forName(
 path.to.ConnectionHandlerTest).newInstance();
} catch (Exception e) {
  log.fatal(Unable to create Test object., e);
  throw new RuntimeException(e);
}
} else {
return = new ConnectionHandlerForTomcat();
}

So when we're executing our tests we set the property
use.test.objects=true. It uses Class.forName() to create the object 
instance so that it doesn't have to know about the test object at
compile time or production runtime.

We also keep our testcase source in a separate, though parallel, tree in
the filesystem. That lets us easily build a production jarfile that
doesn't include any of the testcase classes.

(If you need to reach me please email directly as I don't always manage
to keep up with the mailing list.)

Later,
J


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: R: [OT] JNDI datasource lookup to test classes

2003-08-23 Thread James Harman
Alternatively,

If you are worried about test code in production, you could extend from 
ConnectionHandlerFactory with a TestConnectionHandlerFactor and override 
the getConnectionHandler() method to return the connectionHandler for 
testing. 

James

James CE Johnson wrote:

The most common solution to this problem is using a Factory Method to
return the correct implementation of the interface.  Your classes should
never know which implementation is in use because they will all ask the
Factory Method for the object.  You just need to change the one line in
the method to return a different object for testing.
 

Ok, you mean something like that:

Class ConnectionHandlerFactory
...
public IConnectonHandler getConnectonHandler()
{
if (test)
return new ConnectionHandlerTest();
else
return new ConnectionHandlerForTomcat();
	}

but I think this has 2 problems:

1) in my production code I'll have code that is written just for testing
purpose
2) Before executing any test I have to set the test variable to true.
Or I did not understand?

   

That's the gist of it. We've solved it thusly:

   if (Boolean.getBoolean(use.test.objects)) {
   try {
   return = (IConnectonHandler)
Class.forName(
path.to.ConnectionHandlerTest).newInstance();
   } catch (Exception e) {
 log.fatal(Unable to create Test object., e);
 throw new RuntimeException(e);
   }
   } else {
   return = new ConnectionHandlerForTomcat();
   }
So when we're executing our tests we set the property
use.test.objects=true. It uses Class.forName() to create the object 
instance so that it doesn't have to know about the test object at
compile time or production runtime.

We also keep our testcase source in a separate, though parallel, tree in
the filesystem. That lets us easily build a production jarfile that
doesn't include any of the testcase classes.
(If you need to reach me please email directly as I don't always manage
to keep up with the mailing list.)
Later,
J
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[OT] JNDI datasource lookup to test classes

2003-08-22 Thread Leonardo Francalanci
In my DB tier I use an interface to get the connection.
When used under Tomcat, the class that implements the connection gets
the connecton through JNDI.
I want to test these classes outside of Tomcat.
Is there a simple way to put objects in the Context,
I mean a simple way to emulate Tomcat behavior?
I read the JNDI tutorial, but is the worse thing I've ever read.

At this moment I created a class that implements my interface
and that open a simple connection to the db, but in this way I need
to set the right interface (JNDI/Simple) in each class a want to test.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] JNDI datasource lookup to test classes

2003-08-22 Thread Manolo Ramirez T.
Maybe this files can help you.

Regards.


Manolo Ramirez T.
Leonardo Francalanci wrote:
In my DB tier I use an interface to get the connection.
When used under Tomcat, the class that implements the connection gets
the connecton through JNDI.
I want to test these classes outside of Tomcat.
Is there a simple way to put objects in the Context,
I mean a simple way to emulate Tomcat behavior?
I read the JNDI tutorial, but is the worse thing I've ever read.
At this moment I created a class that implements my interface
and that open a simple connection to the db, but in this way I need
to set the right interface (JNDI/Simple) in each class a want to test.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


package com.handsoftware.utils;

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class DBjndi {

protected static DataSource ds;

public static void init(String name) throws NamingException{
Context ctx = new InitialContext();
init(name,ctx);
}

public static void init(String name,Context context) throws NamingException {
ds = (DataSource)context.lookup(name);
}

public static Connection getConnection() throws SQLException {
if(ds == null)
throw new IllegalStateException(DBjndi was not initialized);
return ds.getConnection();
}
}
package com.handsoftware.utils.test;

import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class MockContext extends InitialContext {

Hashtable data;

public MockContext() throws NamingException{
super();
data = new Hashtable();
}

public Object add2Context(String name,Object obj) {
return data.put(name,obj);
}

public Object lookup(String name) throws NamingException {
Object obj=data.get(name);
if(obj!=null)
return obj;

return super.lookup(name);
}
}
package com.handsoftware.utils.test;

import javax.sql.DataSource;
import java.sql.*;
import java.io.PrintWriter;

public class MockDataSource implements DataSource {

protected Driver m_driver;
protected String m_url;
protected String m_user;
protected String m_passwd;

public MockDataSource(String driverClass, String url, String user, String passwd) {
try {
m_driver = (Driver)Class.forName(driverClass).newInstance();
DriverManager.registerDriver(m_driver);
} catch (Exception e) {
e.printStackTrace();
}

m_url=url;
m_user=user;
m_passwd=passwd;
}

public Connection getConnection() throws SQLException {
return DriverManager.getConnection(m_url,m_user,m_passwd);
}

public Connection getConnection(String username,String password) throws 
SQLException {
return DriverManager.getConnection(m_url,username,password);
}

public PrintWriter getLogWriter() throws SQLException {
return null;
}

public void setLogWriter(PrintWriter out) throws SQLException {
}

public void setLoginTimeout(int seconds) throws SQLException {
}

public int getLoginTimeout() throws SQLException {
return 0;
}

}
package com.handsoftware.utils;

import junit.framework.TestCase;
import com.handsoftware.utils.test.MockContext;
import com.handsoftware.utils.test.MockDataSource;
import java.sql.*;
import javax.naming.NamingException;

public class TestDBjndi extends TestCase {

public TestDBjndi () {
super();
}

public void setUp() throws NamingException {
MockContext context = new MockContext();
String jndiName=java:comp/env/jdbc/PruebasDB;
context.add2Context(jndiName,new MockDataSource(org.postgresql.Driver

,jdbc:postgresql://localhost:5432/pruebas
,manolo,)
);

DBjndi.init(jndiName,context);
}

public void testConnection() {

try {
Connection con = DBjndi.getConnection();

//insercion
PreparedStatement st =
con.prepareStatement(insert into pruebas(id,nombre,apellido) 
values(?,?,?));
st.setInt(1,666);
st.setString(2,juan);
st.setString(3,perez);
st.execute();

//select
st = con.prepareStatement(select nombre,apellido from pruebas where 
id=?);
st.setInt(1,666);
ResultSet rset = st.executeQuery();
rset.next();
assertEquals(no funciona select:nombre,rset.getString(nombre),juan

Re: [OT] JNDI datasource lookup to test classes

2003-08-22 Thread David Graham
--- Leonardo Francalanci [EMAIL PROTECTED] wrote:
 In my DB tier I use an interface to get the connection.
 When used under Tomcat, the class that implements the connection gets
 the connecton through JNDI.
 I want to test these classes outside of Tomcat.
 Is there a simple way to put objects in the Context,
 I mean a simple way to emulate Tomcat behavior?
 I read the JNDI tutorial, but is the worse thing I've ever read.
 
 At this moment I created a class that implements my interface
 and that open a simple connection to the db, but in this way I need
 to set the right interface (JNDI/Simple) in each class a want to test.

The most common solution to this problem is using a Factory Method to
return the correct implementation of the interface.  Your classes should
never know which implementation is in use because they will all ask the
Factory Method for the object.  You just need to change the one line in
the method to return a different object for testing.

David


 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] JNDI datasource lookup to test classes

2003-08-22 Thread Adam Hardy
On 08/22/2003 04:43 PM Leonardo Francalanci wrote:
I read the JNDI tutorial, but is the worse thing I've ever read.
You've obviously never read any of my poetry.

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: retrieving DataSource in struts

2003-08-14 Thread David Graham

--- [EMAIL PROTECTED] wrote:
 hi all,
   i have configured a datasource in struts-config.xml, which is
 successfully loaded.
 now my problem is that i want to write a  component (which has
 application-context scope) which wraps
 the DataSource, so that individual action classes don't have to deal
 with PreparedStatement etc...
 so, this component needs to be initialized with the DataSource
 
 my initiali idea whas to write a plugin for instantiating this
 component.
 But the only method that i can see for retreiving the configured
 datasource is servlet.getDataSource(request), and in the
 plugin initialization method there is no request.
 
 does this method exist  servlet.getDataSource() ?
 
 otherwise,does anyone have any alternative solutions?

Struts stores your DataSources in the ServletContext under the
Globals.DATA_SOURCE_KEY attribute (you can change this name in the
data-source element.  You can retrieve them just like any other object
you store in the ServletContext.

David

 
 regards
   marco
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



retrieving DataSource in struts

2003-08-14 Thread Marco.Mistroni
hi all,
i have configured a datasource in struts-config.xml, which is successfully 
loaded.
now my problem is that i want to write a  component (which has application-context 
scope) which wraps
the DataSource, so that individual action classes don't have to deal with 
PreparedStatement etc...
so, this component needs to be initialized with the DataSource

my initiali idea whas to write a plugin for instantiating this component.
But the only method that i can see for retreiving the configured datasource is 
servlet.getDataSource(request), and in the
plugin initialization method there is no request.

does this method exist  servlet.getDataSource() ?

otherwise,does anyone have any alternative solutions?

regards
marco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Best way to retrieve data from a datasource

2003-08-14 Thread Mehta, Chirag (IT)
Following on to a earlier question, what is the reccomended way of
retrieving a ResultSet and passing it to be viewed on a JSP page? I have
seen it done using ProcessBeans, Array Lists, ResultLists, Collection
and it all seems a bit confusing. In my app, the user enters a SQL query
so I have no idea the structure of the data that will be returned.
 
Thanks in advance
 
Chirag
 
 
 


--
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive 
confidentiality or privilege, and use is prohibited.

Re: retrieving DataSource in struts

2003-08-14 Thread Ted Husted
Before rolling your own, you might want to take a look at some of the 
ORM projects, like OJB http://db.apache.org/ojb/ and Hibernate 
http://hibernate.bluemars.net/, or a DAO framework, like ibatis 
http://ibatis.com/.

These sorts of things are always more work than they seem at first.

-Ted.

[EMAIL PROTECTED] wrote:

hi all,
i have configured a datasource in struts-config.xml, which is successfully 
loaded.
now my problem is that i want to write a  component (which has application-context 
scope) which wraps
the DataSource, so that individual action classes don't have to deal with 
PreparedStatement etc...
so, this component needs to be initialized with the DataSource
my initiali idea whas to write a plugin for instantiating this component.
But the only method that i can see for retreiving the configured datasource is 
servlet.getDataSource(request), and in the
plugin initialization method there is no request.
does this method exist  servlet.getDataSource() ?

otherwise,does anyone have any alternative solutions?

regards
marco


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


how to access my datasource from a securityfilter realm?

2003-07-21 Thread Michael Muller
I found a reference to the SecurityFilter project on this mailing list. 
 I just hooked it up, and it seems to work pretty well.

I do have a question, though.  Is there any way for the realm to use 
same datasource as struts?  I'm not passed anything useful.  Is there 
something static somewhere that I can access?

I could pass the connection information in as parameters to the realm, 
but then I've got the same config information in two places and I'm not 
using whatever nifty pooling is provided by struts' datasource.

Thanks,

  -- Mike



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: using Struts datasource from a normal servlet

2003-07-17 Thread Richard Raquepo
i got it.

here's what i did:

import org.apache.struts.Globals;
.
 HttpServlet servlet = (HttpServlet)
getServletContext().getAttribute(Globals.ACTION_SERVLET_KEY);
MyService service = new MyService();
service.setServlet(servlet);

viola... it worked!

-richard

- Original Message -
From: Richard Raquepo [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, July 18, 2003 11:43 AM
Subject: using Struts datasource from a normal servlet


 i have a service class that i can use in my actions by passing the servlet
 variable to it
 MyService service = new MyService(servlet);
 or
 MyService service = new MyService()
 service.setServlet(servlet);

 this works fine on my action classes. My question is
 how can i use this service in a normal servlet.

 public class MyServlet extends HttpServlet{
 
 }

 how can i pass the servlet variable and how to get it so i can use my
 service in a normal servlet. Please help me
 thanks.

 -richard



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: using struts datasource from a servlet

2003-07-01 Thread Erik Price


Richard Raquepo wrote:
Another option would be to configure the DS in struts but register it with
a

singleton (Service Locator) that can retrieve the datasource in your data
access classes.


maybe you can give me some link about this? tutorials maybe? any code maybe?
:p
As you wish:

http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html

Erik

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


using struts datasource from a servlet

2003-06-30 Thread Richard Raquepo
can i call/use the a struts datasource in my servlet.

the thing is, i have a struts app. then i created a servlet to do some specific thing. 
now my question is,
can i use the datasource defined in my struts config file in my servlet. if so, how? 
example code will
be very much appreciated.

thanks.

-richard

  1   2   3   4   >