RE: I've officially decided that JSTL is one of the worst things to ever happen to mankind

2004-07-04 Thread Tom K
Ivan, tell us how you really feel  :-)
 
Not to be a smart As_  but Ive felt the same way about changes, for the
better?  not always, but it progresses to the next point where there is
an improvement. For example, remember the old client/server
technology? It sounded good at first until everyone discovered that
maintaining Fat clients was a total nightmare. Now we use java and the
client is a browser, is it better? Yea, probably, but it could be
simpler if all browsers worked the same. Use the technology that fits
your needs.
 
Tom K.
 
 
 
-Original Message-
From: Ivan Jouikov [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 04, 2004 1:04 AM
To: 'Tomcat Users List'
Subject: I've officially decided that JSTL is one of the worst things to
ever happen to mankind
 
After getting convinced to try JSTL, I learned the following things:
 
1.   JSTL and EL are inefficient.  Tests on similar pages clearly
showed that.  (compare - ${name} with %=name%, run in a loop 1
times, youll see the difference)
2.   JSTL is cumbersome  someone told me once that the reason they
use JSTL is because their designers are scared of %=% code, but they
have no problem throwing around XML statements.  Well, whats my advice
to him: hire new designers, and fire your high school students.  On one
hand, yeah ${parameter.name} is very nice relatively to
%=request.getParameter(name)%.  But after playing around with JSTLs
ull see what I mean.  Also, when your designers screwes up with the
logical structure of your web-site cuz he thought he could just throw
around tags, youll think twice.  Which brings me to the next point
3.   XML is for data flow, not for logic.  Whoever the hell thought
of tags like c:if and c:choose should be murdered in the worst way
possible.  With JSTLs exporting and importing variables, and all the
logical statements and loops, the whole idea of XML gets destroyed.
4.   EL encourages sloppy syntax.  It doesnt even have data types
(well it has on the bottom level, but not on the surface).  Remember
JavaScript?  Did you know that at first, it was supposed to be
server-side scripting language?  You know the reason it didnt make it
(one of the major ones)?  Because of its sloppy syntax and the amount of
errors it caused.  Why bring it back?
5.   Server-side content and client-side content should be
separated.  When everything looks like HTML (in some way), its hard to
tell what actually gets processed, and what gets sent to the client as
static (if you have all-nighters, youll understand).
6.   JSTL is time-consuming.  The whole idea of JSTL was to speed up
the process.  Not only is it less efficient than embedding code the
normal way, but it also takes you forever to make something new with it.
Dont believe me?  Just try it.
7.   The only reason JSTL was made is so that guys at Apache could
write some stupid book explaining its hella complicated syntax, and
charge people $50 for it.  See, its just like the C++ story.  Why was
C++ invented?  To give programmers jobs.  No other reason whatsoever, C
does whatever C++ does just as good, and better.  So I am not sure if
JSTL is a step to having advanced developers who get paid more because
they took time to learn retarded JSTL syntax and EL, or is it just
Apaches developers way of making money (and I am surre Oreilly and
the bros are thankful too).
 
Point of this message:  DO NOT USE JSTL OR EL.  Youll regret it.  I
did.
 
 
   _  


Best Regards,

Ivan V. Jouikov
(206) 228-6670
HYPERLINK http://www.ablogic.net/;
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07.06.2004


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


RE: how to check if a String is empty?

2004-06-24 Thread Tom K
Every once in a while you see this question pop-up and the same thing
happens...you get a whole bunch of answers. Remember that a String is
an Object and not a primitive e.g. int, long etc. So in that regard if
it is not an int but an Integer what would you use to test for an empty
String. Think about it. 
Tom Kochanowicz


-Original Message-
From: Frank Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 12:27 PM
To: [EMAIL PROTECTED]
Subject: Re: how to check if a String is empty?

Depends I guess :)  I personally find the use of a magic number to be
more 
complex.  To my eyes, it's clearer to see an empty string.  The
intention is 
more clear.

Kind of a silly debate I suppose because neither is exactly rocket
science 
;)


From: Robert F. Hall [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: how to check if a String is empty?
Date: Thu, 24 Jun 2004 10:22:06 -0700

Howdy,

if (test == null || test.trim().length() == 0 ) { }  is simpler.

/Robert

Frank Zammetti wrote:

I've always done

if (test == null || test.trim().equalsIgnoreCase()) { }

(I'm anal about always using equalsIgnoreCase unless I know for sure
that 
case sensitivity is required).  No need to do anything more complex
than 
that in my experience. Always do the simplest thing that will work.

Frank


From: Robert Bateman [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: how to check if a String is empty?
Date: Fri, 18 Jun 2004 12:58:30 -0400

Wouldn't   test.trim().length() be a better test?  length() after trm

would
tell you if non white-space was left.

Bob


On Thursday 24 June 2004 12:30 pm, Peter Guyatt wrote:
  Hi There,
 
  You could do the check test.length()  0
 
  Pete
 
  -Original Message-
  From: Carl Olivier [mailto:[EMAIL PROTECTED]
  Sent: 24 June 2004 17:18
  To: 'Tomcat Users List'
  Subject: RE: how to check if a String is empty?
 
 
  There is a trim() funtion in java.lang.String
 
  ?
 
  -Original Message-
  From: Marten Lehmann [mailto:[EMAIL PROTECTED]
  Sent: 24 June 2004 06:20 PM
  To: 'Tomcat Users List'
  Subject: how to check if a String is empty?
 
 
  Hello,
 
  maybe this is not the perfect group for my question, but as my
problem
  appears at the development of JSPs and tomcat is concerned with
that, 
I
  hope you can answer it.
 
  I often see the condition
 
  String test = req.getParameter(test);
 
  if (test == null) {
  /* string is empty */
  } else {
  /* string contains something */
  }
 
  But if test contains just blanks and other whitespaces, it's not
null,
  but doesn't contain usable data anyhow. How can I check if a
string
  contains whitespaces only? I though of something like
 
  if (test == null || test.trim().equals()) {
  }
 
  but there's no trim()-function, right? How do you solve this
problem?
  With whitespaces I mean blanks, tabs and newlines.
 
  Regards
  Marten
 


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


_
Make the most of your family vacation with tips from the MSN Family
Travel 
Guide! http://dollar.msn.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]


_
FREE pop-up blocking with the new MSN Toolbar  get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



log4j:WARN No appenders could be found

2004-06-17 Thread Tom K
I am using Tomcat 5.0.19 and I get the log4j:WARN No appenders could be
found error on startup. I have a log4j-1.2.8.jar file in my apps /lib
director. Should the log4j.properties file be in the same directory?
 
TIA 
 
Tom K.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


RE: How can I access a file located in WEB-INF

2004-06-16 Thread Tom K
File dir = new File(directoryName);

String[] children = dir.list();
if (children == null) {
// Either dir does not exist or is not a directory
} else {
for (int i=0; ichildren.length; i++) {
// Get filename of file or directory
String filename = children[i];
}
}

Tom Kochanowicz

-Original Message-
From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 16, 2004 2:15 AM
To: Tomcat Users List
Subject: How can I access a file located in WEB-INF

Hi,

I need to access a file located in the directory WEB-INF of my web
application.
In fact, in WEB-INF/conf.
How can I open this file in one of my servlet ?

Any advise is welcome.

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: How can I access a file located in WEB-INF

2004-06-16 Thread Tom K
I suppose you could use a getRelativePath()

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 16, 2004 2:15 PM
To: Tomcat Users List
Subject: RE: How can I access a file located in WEB-INF


Hi,
Just remember getRealPath returns null in a packed WAR file.  Better
approaches are in the tomcat FAQ.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Frank Zammetti [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 16, 2004 3:14 PM
To: [EMAIL PROTECTED]
Subject: RE: How can I access a file located in WEB-INF

Further, you will probably want to be able to construct the path to
/WEB-
INF
at runtime rather than hardcoding paths... You can do that as follows:

String fullPath = getServletContext().getRealPath(path);

where path is a context-relative path (can include a filename if you
want).

For instance, I use this in a Struts plug-in to initialize a custom
connection pool.  The value I use for path is /WEB-
INF/ConnPoolConfig.xml.
  The above gives you the full system path to the file (in my case,
C:\tomcat\webapps\toa\WEB-INF on my development machine), so you can
easily
open it then.

If you just use the above to get the path to a path (i.e., you want the
fully-qualified path to WEB-INF in the current webapp, but not a
specific
file), you will need to append a file separator character at the end
before
appending a filename.

Frank

From: Tom K [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Subject: RE: How can I access a file located in WEB-INF
Date: Wed, 16 Jun 2004 13:52:42 -0500

File dir = new File(directoryName);

 String[] children = dir.list();
 if (children == null) {
 // Either dir does not exist or is not a directory
 } else {
 for (int i=0; ichildren.length; i++) {
 // Get filename of file or directory
 String filename = children[i];
 }
 }

Tom Kochanowicz

-Original Message-
From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 16, 2004 2:15 AM
To: Tomcat Users List
Subject: How can I access a file located in WEB-INF

Hi,

I need to access a file located in the directory WEB-INF of my web
application.
In fact, in WEB-INF/conf.
How can I open this file in one of my servlet ?

Any advise is welcome.

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004



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


_
MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months
FREE!
http://join.msn.click-url.com/go/onm00200361ave/direct/01/


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




This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender.  Thank you.


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: Execute servlet at an interval.

2004-06-11 Thread Tom K
Try Quartz http://www.quartzscheduler.org/quartz/

Tom Kochanowicz


-Original Message-
From: Gabi [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 11, 2004 2:03 AM
To: [EMAIL PROTECTED]
Subject: Execute servlet at an interval.

Hello, I'm going to migrate a Resin to Tomcat application, I'm beggining
with Tomcat, I'm very interested reading Tomcat feature, etc...
But I can't find a similar feature to Resin run-at parameter in the
configuration files for the servlets, wich is used to execute at regular
intervals a servlet.
¿Can I do the same without changing the application?
¿How?
Thanks in advance.


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: unable to connect to mysql db on localhost

2004-06-08 Thread Tom K
Are you using the latest connectorJ version? If so change
org.gjt.mm.mysql.Driver to com.mysql.jdbc.Driver


Tom Kochanowicz

-Original Message-
From: ilasno [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 08, 2004 9:34 PM
To: [EMAIL PROTECTED]
Subject: unable to connect to mysql db on localhost

hello,

i'm running tomcat 5.0.16 on debian linux with webmin, which provides 
mysql.  i've created a test database, and set up a user with what i 
think are the proper permissions.  here's the datasource resource from 
the server.xml that's nested within a context:

Resource name=jdbc/dbName auth=Container 
type=javax.sql.DataSource /

  ResourceParams name=jdbc/dbName

parameter
namefactory/name
 
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter

parameter
namemaxActive/name
value100/value
  /parameter

parameter
namemaxIdle/name
value30/value
  /parameter

parameter
namemaxWait/name
value1/value
  /parameter

parameter
nameusername/name
valuexx/value
  /parameter

parameter
namepassword/name
valuexx/value
  /parameter

parameter
namedriverClassName/name
valueorg.gjt.mm.mysql.Driver/value
  /parameter

parameter
nameurl/name
 
valuejdbc:mysql://localhost/dbName?autoReconnect=true/value
  /parameter

parameter
nameremoveAbandoned/name
valuetrue/value
  /parameter

parameter
namelogAbandoned/name
valuetrue/value
  /parameter
 
  /ResourceParams

but when i try to access, i get this exception, taken from the logs for 
that context:

2004-06-08 19:18:24 AbandonedObjectPool is used 
([EMAIL PROTECTED])
   LogAbandoned: true
   RemoveAbandoned: true
   RemoveAbandonedTimeout: 300
org.apache.commons.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory, cause:
java.sql.SQLException: Cannot connect to MySQL server on localhost:3306.

Is there a MySQL server running on the machine/port you are trying to 
connect to? (java.net.ConnectException)
at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)

incidentally (or maybe not), i have other datasources configured pretty 
much identically that work fine for another context that are connecting 
to remote mysql servers.

any suggestions?

thanks for your time.

-- 
ilasno


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: Problem in inserting word document into database as a blob object under tomcat server

2004-06-07 Thread Tom K
I see you are using an Oracle database.
String text;
while(re.next(){ 
dbBlob = (oracle.sql.BLOB)rs.getBlob(1)
}
text = dbBlob.getSubString(1,((intdbBlob.length()));

Why not use a CLOB if it's text.
Now you are my wife.

Tom K.



-Original Message-
From: Thangamani, Elanjchezhiyan (Cognizant)
[mailto:[EMAIL PROTECTED] 
Sent: Monday, June 07, 2004 11:11 PM
To: [EMAIL PROTECTED]
Subject: Problem in inserting word document into database as a blob
object under tomcat server


 Hi,
 I am inserting word document into database as a blob. It is inserting
successfully but we try to download it is not downloading. The insertion
itself having some problem



 //code listed below


 StringBuffer query = new StringBuffer(Insert into
PMS_Documents(DOCUMENTID, DOCUMENT_NAME, DOCUMENT_TYPE_ID,
DOCUMENT_DESCRIPTION, DOCUMENT_CTYPE,CREATED_BY,
CREATED_DATE,DOCUMENT_BLOB) values();
 pmskey =getSequence(Document.nextval);
 query.append(pmskey);
 query.append(,');
 query.append(form.getDocumentName());
 query.append(',);
 query.append(Integer.parseInt(getLookUPId(document,
form.getDocumentType(;
 query.append(,');
 query.append(form.getDocumentDescription().trim());
 query.append(',');
 query.append(form.getDocumentBlob().getContentType());
 query.append(',');
 query.append(form.getDocumentCreatedBy());
 query.append(',sysdate,EMPTY_BLOB()));
 query.toString();
 .
 conn = getConnection();
 conn.setAutoCommit(false);
 stat = conn.createStatement();
 stat.execute(query);
 stat.execute(commit);
 String SQL_GET_BY_PK =select document_blob from PMS_Documents where
documentId=+ pmskey + for update nowait ;
 rs = stat.executeQuery(SQL_GET_BY_PK);
 rs.next();
 ResourceBundle resBun = ResourceBundle.getBundle(pms);
 String server = resBun.getString(server);
 if (server.equals(tomcat)) {
 dbBlob = (oracle.sql.BLOB)rs.getBlob(1); //problem occurs here only

 }
 else {
 weblogic.jdbc.rmi.SerialOracleBlob cast1 =
(weblogic.jdbc.rmi.SerialOracleBlob)rs.getBlob(1);
 weblogic.jdbc.rmi.internal.OracleTBlobImpl cast2 =
(weblogic.jdbc.rmi.internal.OracleTBlobImpl)cast1.getTheRealBlob();
 dbBlob = (oracle.sql.BLOB)cast2.getTheRealBlob();
 }
 inStream = new
BufferedInputStream(form.getDocumentBlob().getInputStream());
 //createDocument(inStream);
 outStream = dbBlob.getBinaryOutputStream();
 while((len = inStream.read()) != -1) {
 outStream.write(len);
 fileSize += len;
 }
 if(inStream != null) {
 inStream.close();
 inStream = null;
 }
 if(outStream != null) {
 outStream.close();
 outStream = null;
 }


 I am getting problem in tomcat only . weblogic it is working fine.


 Thanks in Advance
 Elan
 



This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy all copies of the original message.

Any unauthorised review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on
this e-mail is strictly

prohibited and may be unlawful.

  Visit us at http://www.cognizant.com

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: tomcat book

2004-05-21 Thread Tom K
I don't own it, but you can look on http://amazon.com for  Professional
Apache Tomcat 5

Tom Kochanowicz

-Original Message-
From: wsedio [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 21, 2004 4:38 AM
To: Tomcat Users List
Subject: tomcat book

Hi all,
what is the best Tomcat book around?

It would be great if it also covers Tomcat 5 ...

Thanks.

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: Database backups initiated from Tomcat

2004-05-19 Thread Tom K
What operating system are you using? It is possible to call System (and
database) commands within java to execute the mysqldump script. For
example for basically any operating system you can execute a
Runtime.getRuntime().exec(String cmdline)

Tom Kochanowicz


-Original Message-
From: Frank Burns [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 19, 2004 8:05 AM
To: Tomcat Users List
Subject: Database backups initiated from Tomcat

Hi,

I have an urgent requirement where I have to initiate a database backup
(of
three mySQL tables) prior to performing an upload and update of the
database.

The preferred method of backing up is to use the mysqldump script.

Can anyone:

1) tell me whether this is possible -- i.e., running the mysqldump
script
from a servlet

2) give me any clues/details on the best way to do this?

Thanks,

Frank.


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: Database backups initiated from Tomcat

2004-05-19 Thread Tom K
I'm not sure either, but you could try it in a sync block and see if it
works and let us know ;-) I use mySQL, and this is an issue I will
tangle with too...so let the list know what works for you. 
You might also want to look at some scheduling software like
quartz http://www.opensymphony.com/quartz/ you can set it up to schedule
jobs at any time, recurring and likewise.

Tom Kochanowicz


-Original Message-
From: Ben Souther [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 19, 2004 9:28 AM
To: Tomcat Users List
Subject: Re: Database backups initiated from Tomcat

I'm not sure if getRuntime().exec(String cmdline) is synchronous or not.
Also I don't know if mySql makes any provisions for locking a table
during a 
dump.

Those are the questions I would want answered before going ahead. 


On Wednesday 19 May 2004 10:15 am, Frank Burns wrote:
 So you think running Runtime.getRuntime().exec(String cmdline) from
within
 a Servlet is viable?


 Can you think of any potential issues with using this solution?


 I'm just trying fathom, as quickly as possible, whether there are any
show
 stoppers in taking this route.

-- 
Ben Souther


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: Database backups initiated from Tomcat

2004-05-19 Thread Tom K
But ?? can't you do something like this


public static final void openFileAndExecuteAssociatedApplication(String 
fullPathAndFileName){ 
try { 
Process p = Runtime.getRuntime().exec(cmd /c start 
+fullPathAndFileName); 
p.waitFor(); 
} catch (Throwable ex) { 
ex.printStackTrace(); 
} 
}

I do agree that some of this Runtime stuff is dangerous. I'm just trying
to help, but I don't want to waste time, so this is my last post
regarding this topic. If anyone has a proven solution please share and
leave the corrections to God!

Tom Kochanowicz

-Original Message-
From: Ben Souther [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 19, 2004 3:37 PM
To: Tomcat Users List
Subject: Re: Database backups initiated from Tomcat

On Wednesday 19 May 2004 04:22 pm, Tom K wrote:
 I'm not sure either, but you could try it in a sync block and see if
it
 works and let us know ;-)

Yoav Shapira answered that.  (getRuntime().exec is non-blocking)
Read his reply for the details.




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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004
 


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



RE: Can servlet generate a Web page first, then continue to run ?

2004-05-05 Thread Tom K
Stan,

I have done something similar in a servlet by reposting to the
same servlet. The way I did this is by out-putting a hidden value in the
submission, then using a getParameter to retrieve this value on the next
submit. The first page was the user submitting some data, which when
submitted brought up a proof-read-page. If everything was OK they would
hit the submit button again (so the same page was actually generated
twice. The servlet would know to go to the correct processing part of
the servlet because of the hidden parameter would direct it to that part
of the servlet that did the processing.
For example, I hid a value called action with a value of
step2. In my servlet I had code that... if(action.equals(step2)){
..do something ...}+
So how might this apply to your problem? I'm not sure :-( but it
might spark an idea.

Tom Kochanowicz




-Original Message-
From: lixiaoquan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 05, 2004 5:02 AM
To: [EMAIL PROTECTED]
Subject: Can servlet generate a Web page first, then continue to run ?

hi,

I want to show a page immediately after the visiters' Form Submitting
,then do some logical processing at backgroud(this will assume a long
time, so it may bother the visitor).  I surpose to do these in one
servlet.

How can I do this?

Thanks
 
stan

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



Problem closing connection w/pagination

2004-05-04 Thread Tom K
I have a fairly simple tomcat 5.19 app, that queries a db, stores the
results in a bean, and forwards the request to a result jsp. 
 
I use pagination with a pooled connection. I get my my datasource
connection in the bean. If I try to close my connection after the first
query and try to page back or forward I lose my connection.
 
If I dont close the connection, everything works fine until I run out
of pooled connections!
 
ANY IDEAS?
 
 
TIA
 
Tom K.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


Hypersonic/Tomcat-5/ WinXP config

2004-04-21 Thread Tom K
Does anyone have a simple examples of configuring the Hypersonic SQL
Database working with Tomcat-5.19 ?
 
I have looked at all the Documentation and set up the classpath
variables but still seem to get the error message:
java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver
 
 
Thanks in advance,
 
Tom K.
 
 
 
I have the hsqldb.jar file in my applications \lib directory and have
the server.xml 
Context set up as follows:
  Context docBase=C:\\jakarta-tomcat-5.0.19\\webapps\\cheers
path=/cheers
  Resource name=jdbc/cheerdb
type=javax.sql.DataSource/
  ResourceParams name=jdbc/cheerdb
parameter
  namemaxWait/name
  value5000/value
/parameter
parameter
  namemaxActive/name
  value4/value
/parameter
parameter
  namepassword/name
  value/value
/parameter
parameter
  nameurl/name
 
valuejdbc:hsqldb:hsql://localhost/value
/parameter
parameter
  namedriverClassName/name
  valueorg.hsqldb.jdbcDriver/value
/parameter
parameter
  namemaxIdle/name
  value2/value
/parameter
parameter
  nameusername/name
  valuesa/value
/parameter
  /ResourceParams
/Context
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: Hypersonic/Tomcat-5/ WinXP config

2004-04-21 Thread Tom K
Thanks Peter, I not longer get the java.lang.ClassNotFoundException:
org.hsqldb.jdbcDriver I don't get 'any' exception :-( 

I suspect it is something in my server.xml file? Any idea/example.


TIA

Tom K.

Server.xml

!-- Example Server Configuration File --
!-- Note that component elements are nested corresponding to their
 parent-child relationships with each other --

!-- A Server is a singleton element that represents the entire JVM,
 which may contain one or more Service instances.  The Server
 listens for a shutdown command on the indicated port.

 Note:  A Server is not itself a Container, so you may not
 define subcomponents such as Valves or Loggers at this level.
 --

Server port=8005 shutdown=SHUTDOWN debug=0


  !-- Comment these entries out to disable JMX MBeans support --
  !-- You may also configure custom components (e.g. Valves/Realms) by 
   including your own mbean-descriptor file(s), and setting the 
   descriptors attribute to point to a ';' seperated list of paths
   (in the ClassLoader sense) of files to add to the default list.
   e.g. descriptors=/com/myfirm/mypackage/mbean-descriptor.xml
  --
  Listener
className=org.apache.catalina.mbeans.ServerLifecycleListener
debug=0/
  Listener
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener
debug=0/

  !-- Global JNDI resources --
  GlobalNamingResources

!-- Test entry for demonstration purposes --
Environment name=simpleValue type=java.lang.Integer
value=30/

!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users --
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
   description=User database that can be updated and saved
/Resource
ResourceParams name=UserDatabase
  parameter
namefactory/name
 
valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
  /parameter
  parameter
namepathname/name
valueconf/tomcat-users.xml/value
  /parameter
/ResourceParams

  /GlobalNamingResources

  !-- A Service is a collection of one or more Connectors that
share
   a single Container (and therefore the web applications visible
   within that Container).  Normally, that Container is an Engine,
   but this is not required.

   Note:  A Service is not itself a Container, so you may not
   define subcomponents such as Valves or Loggers at this level.
   --

  !-- Define the Tomcat Stand-Alone Service --
  Service name=Catalina

!-- A Connector represents an endpoint by which requests are
received
 and responses are returned.  Each Connector passes requests on
to the
 associated Container (normally an Engine) for processing.

 By default, a non-SSL HTTP/1.1 Connector is established on port
8080.
 You can also enable an SSL HTTP/1.1 Connector on port 8443 by
 following the instructions below and uncommenting the second
Connector
 entry.  SSL support requires the following steps (see the SSL
Config
 HOWTO in the Tomcat 5 documentation bundle for more detailed
 instructions):
 * If your JDK version 1.3 or prior, download and install JSSE
1.0.2 or
   later, and put the JAR files into $JAVA_HOME/jre/lib/ext.
 * Execute:
 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
(Windows)
 $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
(Unix)
   with a password value of changeit for both the certificate
and
   the keystore itself.

 By default, DNS lookups are enabled when a web application
calls
 request.getRemoteHost().  This can have an adverse impact on
 performance, so you can disable it by setting the
 enableLookups attribute to false.  When DNS lookups are
disabled,
 request.getRemoteHost() will return the String version of the
 IP address of the remote client.
--

!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 --
Connector port=80
   maxThreads=150 minSpareThreads=25
maxSpareThreads=75
   enableLookups=false redirectPort=8443
acceptCount=100
   debug=0 connectionTimeout=2 
   disableUploadTimeout=true /
!-- Note : To disable connection timeouts, set connectionTimeout
value
 to 0 --

!-- Note : To use gzip compression you could set the following
properties :

   compression=on 
   compressionMinSize=2048 
   noCompressionUserAgents=gozilla, traviata 
   compressableMimeType=text/html,text/xml
--

!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 --
!--
Connector port=8443 
   maxThreads=150 minSpareThreads=25
maxSpareThreads=75
   enableLookups=false

RE: [OT] Pager Tag Library v2.0 usage w/Tomcat 5

2004-04-18 Thread Tom K
Thanks Eric, but would the example give me the back, forward buttons and
in-between the jump to pages, for example, it looks like this: 
 1 2 3 4 5 6  
I have the back and forward buttons working but getting the jump to a
certain number page will not work.

Tom K.


-Original Message-
From: Eric Noel [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 18, 2004 7:13 PM
To: Tomcat Users List
Subject: Re: [OT] Pager Tag Library v2.0 usage w/Tomcat 5

On 4/17/2004 10:05 AM, Tom K wrote:

 I have pagination working with Tomcat 5 through a bean. I like the
 flexible features that Pager Tag Library v2.0 has and would like to
 implement it in my jsp. I know I have everything configured correctly
 because I can get the paging to display but not more to the next or
 previous page.
  
 Does anyone have an example code I can see. I just dont understand
the
 examples well enough on their web site HYPERLINK

http://jsptags.com/tags/navigation/pager/index.jsphttp://jsptags.com/t
 ags/navigation/pager/index.jsp
  
  
  
  
 TIA
  
 Tom K.
%@ taglib prefix=pg uri=http://jsptags.com/tags/navigation/pager; %
%-- rs/datasource here --%

c:if test=${rs.rowCount  0}
 pg:pager maxIndexPages=10
 maxPageItems=15
 export=pagerPageNumber=pageNumber 
 c:forEach var=row items=${rs.rows} varStatus=lineInfo
 pg:item
 c:out value='${row.field1}'/
 /pg:item
 /c:forEach
 pg:index
pg:first
a href=%= pageUrl %first/anbsp;
/pg:first

pg:prev
   a href=%= pageUrl %prev/anbsp;
/pg:prev

pg:pages
   a href=%= pageUrl %%= pageNumber %/anbsp;
/pg:pages

pg:next
   a href=%= pageUrl %next/anbsp;
/pg:next

pg:last
   a href=%= pageUrl %last/a
/pg:last
   /pg:index
   /pg:pager
/c:if


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Relative directory addressing to parent directory

2004-04-17 Thread Tom K
John, relative paths are always a headache (until you do some
book-learning :-)). What I do is, right after my HTML tag I put in a
line like this:
HTML
BASE
href='%=request.getScheme()+://+request.getServerName()+:+request.g
etServerPort()+request.getContextPath()+/ %'

What the line above does is gives you the full path as your base
reference.

You can put 'kind-of' the same line in your regular html pages by using
just the relative paths. Some may argue with the approach I use; if you
include footers` and headers though and use the line right after your
HTML tag your relative path will always be the same.

Tom Kochanowicz




-Original Message-
From: John B. Moore [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 14, 2004 6:27 PM
To: Tomcat Users List
Subject: Relative directory addressing to parent directory

Can't seem to get this to work

Example:   Under  Tomcat/webapps I want an images directory that any 
of the web applications in that directory can access in their pages. 

  In static HTML (under Apache) I would use..

   ../images/myimage.jpg

   and it would work just fine.. (the ../ would cause it to backup 
one folder to the parent and access the images directory directly under 
webapps)

   I can seem to get this to work within a JSP page in Tomcat (4.1.29)

  As a test I created an HTML inwhich this works under Apache. Then 
changed it to a .jsp to run under Tomcat with the target image in 
/webapps/images/ and the app under /webapps/testapp.

   Suggestions as to what I am missing...???

John..

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



[OT] Pager Tag Library v2.0 usage w/Tomcat 5

2004-04-16 Thread Tom K
I have pagination working with Tomcat 5 through a bean. I like the
flexible features that Pager Tag Library v2.0 has and would like to
implement it in my jsp. I know I have everything configured correctly
because I can get the paging to display but not more to the next or
previous page.
 
Does anyone have an example code I can see. I just dont understand the
examples well enough on their web site HYPERLINK
http://jsptags.com/tags/navigation/pager/index.jsphttp://jsptags.com/t
ags/navigation/pager/index.jsp
 
 
 
 
TIA
 
Tom K.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: problem with url - extra / appended before action

2004-04-02 Thread Tom K
Hi Chris,

Frames are very inconsistent on different browser, so most
developers try to avoid them. With that said, some times you have to
tune you path to work with the classpath.

First of all see where your path is pointing to by use a few commands
e.g.

String path = request.getContextPath();
System.out.println(The path in SearchResultsPage is  + path);
String basePath =
request.getScheme()+://+request.getServerName()+:+request.getServerP
ort()+path+/;

If you are using a jsp, simply enclose the above code in % %

Now that you know your path info, the next thing to do is determine if
you can make it all work together by tuning your path info.

For example, when viewing your source code html out put, look at the
path, sometime, you need to ad a ../myPath to go back a directory!

Now other times (I dont know exactly what your working with, so excuse
my ignorance) you may have to have a base path set up so all you
relative path information can be base on that. For example you may
need to ad code such as this:

BASE
HREF=%=request.getScheme()+://+request.getServerName()+:+request.ge
tServerPort()+path+/ %

which gives you a base path to work off of.


Any ways...good luck,


Tom Kochanowicz





-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 02, 2004 10:56 AM
To: [EMAIL PROTECTED]
Subject: problem with url - extra / appended before action

Hello,

 

I have an application that uses frames.  The problem that I am
experiencing
is that when I go to a page that loads a new frameset all of my links
and
buttons work correctly - that is they produce the correct url:
www.companyname.com/action.do?parameter1=blah .  Now when I click one of
these links it populates a new page in the frameset, but the links are
all
messed up.  They all include an extra /  before the action name:
www.companyname.com//action.do?parameter=blah
http://www.companyname.com/action.do?parameter=blah  .  This extra /
is
also found in the base href=./ element for these pages.

 

This problem only occurs when I deploy the application (tomcat
standalone no
apache involved) onto a linux box.  The problem does not occur when I
test
things on my windows box using eclipse and the tomcat sysdeo plugin.

 

Any idea what is going on here?   

 

Thanks,

 

c.


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Problem with Tomcat 5.0.19 and JSTL

2004-04-01 Thread Tom K
The key to getting Tomcat 5 to work with JSP 2.0 and expression language
is to copy the standard.jar and the jstl.jar (that already exists in
Tomcat5s examples/lib directory)  into the lib directory you are using
for your app. You DO NOT have to edit the web.xml file at all but the
web-app tag must be replaced with this:
web-app xmlns=http://java.sun.com/xml/ns/j2ee;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  
  xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
 web-app_2_4.xsd version=2.4
Then in your jsp page you are going to use you will have these lines at
the top of your page:
%-- These two taglib DIRECTIVES define the 
  two tag libraries used on this page--%
   %@ taglib prefix=c 
  uri=http://java.sun.com/jstl/core_rt; %
   %@ taglib prefix=sql 
  uri=http://java.sun.com/jstl/sql_rt; %
Should work then!


Sincerely,

Tom Kochanowicz


-Original Message-
From: Knight, Digby [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 01, 2004 2:09 AM
To: '[EMAIL PROTECTED]'
Subject: Problem with Tomcat 5.0.19 and JSTL

Hi,

I've just installed Netbeans 3.6RC1 which has Tomcat 5.0.19 bundled, and
it
seems to have a problem with JSTL (error below).

I've searched the Web for info, and the only thing I found (2 results in
Google) was a suggestion to upgrade Xerces and Xalan, which I've done at
the
server and webapp level, but it doesn't seem to have made any
difference. I
haven't installed 5.0.19 as a standalone yet, so I don't know if
Netbeans
has introduced the problem, but this seems like the best place to start
looking.

Pages without JSTL work fine, and the error appears when declaring the
taglib (with or without the actual tags on the page).

System: WinXP, no Apache

org.apache.jasper.JasperException: h3Validation error messages from
TagLibraryValidator for c/h3pnull: java.lang.IllegalStateException:
can't declare any more prefixes in this context/p
at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand
ler.
java:94)
at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java
:404
)
at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java
:112
)
trunc

Any thoughts?

TIA Digby


-
*
Confidentiality Note: The information contained in this 
message, and any attachments, may contain confidential 
and/or privileged material. It is intended solely for the 
person(s) or entity to which it is addressed. Any review, 
retransmission, dissemination, or taking of any action in 
reliance upon this information by persons or entities other 
than the intended recipient(s) is prohibited. If you received
this in error, please contact the sender and delete the 
material from any computer.
*


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: redirecting uploaded files in tomcat5

2004-04-01 Thread Tom K
Kay,

What you need to do is copy or move the directories (on the same
machine) e.g.

/**
 * Copies all files under srcDir to dstDir, if dstDir does not exist, it
* will be created.
*/

public void copyDirectory(File srcDir, File dstDir) throws
IOException {
if (srcDir.isDirectory()) {
if (!dstDir.exists()) {
dstDir.mkdir();
}

String[] children = srcDir.list();
for (int i=0; ichildren.length; i++) {
copyDirectory(new File(srcDir, children[i]),
 new File(dstDir, children[i]));
}
} else {
copy(srcDir, dstDir);
}
}

// Copies src file to dst file.
// If the dst file does not exist, it is created
void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);

// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf))  0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}


Now if you have to copy a file to another computer, take a look at using
an ftp client and redirecting it (using a 'put') to another computer.
You may even look at using a native method via jni for doing your file
transfer. Have a look here:
http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html



Regards,

Tom Kochanowicz
Janitor II
Nebraska Psychiatric Hospital








-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 01, 2004 3:24 PM
To: Tomcat Users List
Subject: redirecting uploaded files in tomcat5

Hi,

After I get files uploaded into the webapp folder of Tomcat5, how can I 
redirect them to be located/copied/moved OUTSIDE of the Tomcat folders?
(and 
possibly send them to other machines)

Thanks,
Kay




This mail sent through www.mywaterloo.ca

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



Two JSTL Questions

2004-03-31 Thread Tom K
1) I am trying to get jakartas taglib to work. Is there a standard way
to locate the *.tld files and jar files on tomcat. For example, would
this be a correct structure assuming I am using it for a single package
and not for every app under the webapps directory?
 
myWebApp/WEB-INF/lib-- my jar files go here?
 
myWebApp/WEB-INF/tld-- my taglibs go here?
 
Map the taglib in my web.xml file
 
2) What is the difference between the JSTL I download from apache and
the JSTL package used in SUNs jsdk download (which includes their
server). I noted that SUNs jstl page is named appserv-jstl.jar OR is it
the same?
 
TIA
 
Tom K.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: Tomcat5 - MySql5.0.0a - apache2.0 - XP - JNDI connection problems

2004-03-31 Thread Tom K
Are you using jstl tags to connect to your database? Looking at your
error, I noted the path http://java.sun.com/jsp/jstl/sql You are using
the preview version of mySQL (Version 5), has connectorJ been tested
with it...I don't know, I'm just asking. 

Tom K.




-Original Message-
From: The Gman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 31, 2004 10:16 PM
To: [EMAIL PROTECTED]
Subject: Tomcat5 - MySql5.0.0a - apache2.0 - XP - JNDI connection
problems

I am following:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples
-howto.html

I am running windows XP - have apache 2.0.48 and Tomcat 5.0.19 up and
running with j2sdk1.4.2_04. I am also running MySql5.0.0a

Under $CATALINA_HOME/comon/lib
  mysql-connector-java-3.0.11-stable-bin
  commons-collections.3.0.jar
  commons-dbcp-1.1.jar
  commons-pool-1.1.jar

When I run the test code - test.jsp I get the following error:

Exception report:
org.apache.jasper.JasperException: The absolute uri:
http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or
the
jar files deployed with this application

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand
ler.java:94)

org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java
:404)

org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java
:154)

org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLib
raryInfoImpl.java:359)

org.apache.jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.
java:190)

org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:458)

org.apache.jasper.compiler.Parser.parseDirective(Parser.java:523)

org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)

org.apache.jasper.compiler.ParserController.doParse(ParserController.jav
a:258)

org.apache.jasper.compiler.ParserController.parse(ParserController.java:
139)

org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.ja
va:553)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:291)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

What is wrong with my configuration?

Step 2. server.xml configuration says /Context tag of the examples
context and the /Host
My server.xml doesn't have Context tags should there be one?

Step 3. web.xml configuration - Do I make/add these changes to the
web.xml
under $CATALINA\ROOT\WEB-INF or under a subdirectory called /DBTest/??

Step 4. test code says deploy your web app into $CATALINA_HOME/webapps
either as a warfile called DBTest.war orinto a subdirectory called
DBTest.
So, I created a directory called DBTest and just put the test.jsp file
into
that directory - doesn't that qualify as deploying??

Thanks for any help to fix my configuration.

Tim

_
MSN Toolbar provides one-click access to Hotmail from any Web page 
FREE 
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Connection is Closed

2004-03-29 Thread Tom K
In your server.xml file if you are using connection pooling you can put
a line in like this:
valuejdbc:mysql://localhost:3306/Classifieds?autoReconnect=true/value




  -- 
- parameter
  nameurl/name 
 
valuejdbc:mysql://localhost:3306/Classifieds?autoReconnect=true/value
 
  /parameter
  /ResourceParams
  /Context
  /Host
  /Engine
  /Service
  /Server

Hope that does the trick.

Tom Kochanowicz



-Original Message-
From: Rob Wichterman [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 29, 2004 7:36 AM
To: 'Tomcat Users List'
Subject: Connection is Closed

I keep receiving a Connection is Closed error in my tomcat
localhost_log.
After receiving this error I have to restart tomcat to reconnect to
oracle.
Is there any type of auto reconnect parameter?

 

Thanks,


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



jsp:include page question.

2004-03-27 Thread Tom K
I ran across this post comparing Tomcat 4 to Tomcat 5 pertaining to a
jsp:include statement, and was wondering if anyone else has the same
problem?
HYPERLINK
http://www.mail-archive.com/[EMAIL PROTECTED]/msg120161.ht
mlhttp://www.mail-archive.com/[EMAIL PROTECTED]/msg120161.
html
 
I have a jsp:include that looks like this but passes params to a
servlet. I cant get it to work with Tomcat 5, did the specs change or
am I missing something?
 
 
jsp:include page=./myServlet
  jsp:param name=type value=blob /
  jsp:param name=id value=%=SearchFormBean.getUniqueDateId()%
/
  jsp:param name=description value=someThing /
/jsp:include
 
 
Can you include a servlet with e.g. jsp:incude page=./myServlet  in a
jsp
 
TIA,
 
Tom K.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: Fake 'alias' for sales rep pages

2004-03-27 Thread Tom K
Well...you might try using something like a response.redirect() to
another url. You might need to set some type of flag in a database
corresponding with there login id which would redirect them to a unique
URL. Just some ideas.

Sincerely,

Tom K.

-Original Message-
From: Bryan K. Cantwell [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 27, 2004 6:45 PM
To: Tomcat Users List
Subject: Fake 'alias' for sales rep pages

I have created a templated 'Personal' web page (jsp) that dynamically
becomes the personal page of each of our sales reps in the copmpany.
What I
need to know is how I can make the URL unique for each rep's page
without
actually creating a directory or alias for each and every one of them.
For
instance I am John Doe, sales rep,  I want my personal URL to be
http://www.domain.com/johndoe/. Any help?


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Question on debuggin JNDI/prepared statement in a bean

2004-03-26 Thread Tom K
Harry,

Yes the ClassifiedAd and UniqueDateId are two parameters taken
from an html form, the values of ClassifiedAd and UniqueDateId are used
in a prepared statement for substitution of ? and ? the results are then
forwarded to a results jsp, which used the getXXX() to retrieve the
values from the bean.
I have this code working in another form as a Servlet using JNDI
and prepared statements. In the servlet the JNDI connection is made in
the init(blah, blah) and calls the super.init(config) which I
super.init(config) is implicit from reading the Tomcat docs.
The bottom line on this, is how do you set up a JNDI connection
in a bean, use a prepared statement (in a bean), retrieve a resultset
and forward the result for the results jsp to retrieve the value from
the bean.

Finally, I apologize to those who feel this is off topic. I have similar
code working in Resin but for the life of me, I can't get it working
with Tomcat 5  :-(   I searched all the archives and can't find a good
example for doing this.

TIA Tom K.



   


-Original Message-
From: Harry Mantheakis [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 2:29 AM
To: Tomcat Users List
Subject: Re: Question on debuggin JNDI/prepared statement in a bean

Hello

 pstmt.setString(1,ClassifiedAd);
 pstmt.setString(2,UniqueDateId);

Are those two parameters - 'ClassifiedAd' and 'UniqueDateId' -
variables?
They should be, and if so, where do you declare and initialise them?
They do
not appear in the method you posted.

Harry


 I am frustrated trying to debug a prepared statement within a bean;
what
 am I doing wrong?; ANY clues appreciated
 It is not throwing any exceptions yet I methodically went over the
code;
 granted this is the first time I used beans versus servlets.
 
 Can anyone point me to a good example (JNDI, JSP, JavaBean, Resultset)
 
 Code within bean:
 
 private void prepareStatement(){
   try{
  
   Context env = (Context) new
 InitialContext().lookup(java:comp/env);
   pool = (DataSource) env.lookup(jdbc/myDB);
 
   if (pool == null)
   throw new NamingException(`jdbc/ myDB ' is an
 unknown DataSource);
  
  
 
 //dbConnection = null;
 dbConnection = pool.getConnection();
  
 
 String SQLCmd =
 select * from AdInfoView where Classification = ?
  
  + and UniqueDateId  ? order by UniqueDateId
 desc;
  
 pstmt = dbConnection.prepareStatement(SQLCmd);
 // TEST Exception thrown here.
 //pstmt.setString(1,searchWord);
 pstmt.setString(1,ClassifiedAd);
 pstmt.setString(2,UniqueDateId);
 
   }catch(Exception e){
 System.err.println(Problem preparing statement  +
 e.getMessage() + e.getCause());
   } 
 }
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 
 


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Question on debuggin JNDI/prepared statement in a bean

2004-03-26 Thread Tom K
Not exactly...it is not the same! I have it working with a connection
pool, mySQL and JNDI. To keep my reply short it goes like this within
the bean:
getDBConnection();  // get
the connection
prepareStatement(); // prepare the
statement
rs = pstmt.executeQuery();  // execute the
query
and of course after that I get my parameters. In a servlet you have an
init() statement that executes only once which you get your db
connection in, also you need to call super.init(config), where you don't
have to do this in a bean, because it is implicit.

(By the way, if someone wants an example, I will post it, but you'll
then be my wife.)

Next challenge is I have a blob that I set and get, but when I get the
blob on my results page, it comes up with something like this  @1eb2473
which I assume is an address. Anyone know what know how to get, what's
in the address. Maybe open a stream?

TIA

Tom K.



-Original Message-
From: Harry Mantheakis [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 10:43 AM
To: Tomcat Users List
Subject: Re: Question on debuggin JNDI/prepared statement in a bean

Hi Tom

 how do you set up a JNDI connection
 in a bean?

Exactly the same way as you would anywhere else, so if you have some
code
working in a servlet, copy it.

To be precise, it is a database connection, acquired from a DataSource,
which is itself acquired via a JNDI lookup. The fact that your code is
in a
bean makes no difference.


 how do you... use a prepared statement (in a bean)


Same as anywhere else.


 how do you... retrieve a resultset, and
 forward the result


Again, same as anywhere else.

BTW - you should not be passing about references to JDBC objects that
are
tethered (so to speak) to database connections - it is bad practice, and
likely to cause connection (and memory) leaks.

The best thing to do with database connections is, grab your data, store
it
in some collection object, and then make damn sure you close the db
connection - usually within a 'finally' block which is guaranteed to
execute, even when exceptions occur.

Having stored the data you need in a collection object, you can pass
that
about as much as you like.

That has not really answered your original question, but unless you
provide
us with all your relevant code we probably cannot solve the problem.

Since you got it working before, I would be inclined to start again,
making
sure that you copy the same JNDI/connection procedures in your 'bean' as
in
the servlet that works.

The fact that your 'bean' is not throwing any exceptions suggests, to
me,
that there is a bug (logic error) in your code. Starting over might sort
that out.

Sprinkle about a few (temporary) 'System.out.println' statements to see
where your code gets to. Not cool, but they do the job sometimes!

If you are using an IDE - like Eclipse - you can run in debug mode, so
it's
easy to see what is happening - though may be not with JSPs.

Good luck.

Harry


 Harry,
 
 Yes the ClassifiedAd and UniqueDateId are two parameters taken
 from an html form, the values of ClassifiedAd and UniqueDateId are
used
 in a prepared statement for substitution of ? and ? the results are
then
 forwarded to a results jsp, which used the getXXX() to retrieve the
 values from the bean.
 I have this code working in another form as a Servlet using JNDI
 and prepared statements. In the servlet the JNDI connection is made in
 the init(blah, blah) and calls the super.init(config) which I
 super.init(config) is implicit from reading the Tomcat docs.
 The bottom line on this, is how do you set up a JNDI connection
 in a bean, use a prepared statement (in a bean), retrieve a resultset
 and forward the result for the results jsp to retrieve the value from
 the bean.
 
 Finally, I apologize to those who feel this is off topic. I have
similar
 code working in Resin but for the life of me, I can't get it working
 with Tomcat 5  :-(   I searched all the archives and can't find a good
 example for doing this.
 
 TIA Tom K.


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Connection Pool

2004-03-25 Thread Tom K
Armalai,

This is some of the parameters I noted you didn't have, BUT,
they are from the Tomcat 5, so check the docs. Just by looking at the
verbiage of the tags, they look like they might be helpful.

Tom Kochanowicz



!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit.
--
parameter
namemaxIdle/name
value30/value
/parameter

!-- Maximum time to wait for a dB
connection to become available
 in ms, in this example 10 seconds. An
Exception is thrown if
 this timeout is exceeded.  Set to -1 to
wait indefinitely.
--
parameter
namemaxWait/name
value1/value
/parameter

!-- To configure a DBCP DataSource so
that abandoned dB connections
 are removed and recycled 
--
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter




-Original Message-
From: armalai [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 7:53 AM
To: Tomcat Users List
Subject: Connection Pool

Environement: Tomcat4.x ,Windows 2000 , Oracle9i

I'm using 75 concurrent users to hit my application using Jmeter.
After 5 hours i'm getting this below error. 

ERROR: Cannot get a connection, pool exhausted

1.Can you please give me an idea to tune up my settings?
2.This is something sue to server's unavailable state?



this is my data base connection setting.

  Resource name=jdbc/CONTROLLER scope=Shareable
type=javax.sql.DataSource/
  ResourceParams name=jdbc/CONTROLLER
parameter
  namedriverClassName/name
  valueoracle.jdbc.OracleDriver/value
/parameter
parameter
  nameurl/name
  valuejdbc:oracle:oci:@CURACC_DEV/value
/parameter
parameter
  nameusername/name
  valuesysadm/value
/parameter
parameter
  namepassword/name
  valuesysadmawbs/value
/parameter
parameter
  namemaxActive/name
  value20/value
/parameter
parameter
  namemaxWait/name
  value1/value
/parameter
parameter
  namemaxIdle/name
  value10/value
/parameter
  /ResourceParams


Thanks.,
MALAI

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



Question on debuggin JNDI/prepared statement in a bean

2004-03-25 Thread Tom K
I am frustrated trying to debug a prepared statement within a bean; what
am I doing wrong?; ANY clues appreciated
It is not throwing any exceptions yet I methodically went over the code;
granted this is the first time I used beans versus servlets.
 
Can anyone point me to a good example (JNDI, JSP, JavaBean, Resultset) 
 
Code within bean:
 
private void prepareStatement(){
try{
  
Context env = (Context) new
InitialContext().lookup(java:comp/env);
pool = (DataSource) env.lookup(jdbc/myDB);
 
if (pool == null)
throw new NamingException(`jdbc/ myDB ' is an
unknown DataSource);


  
  //dbConnection = null;
  dbConnection = pool.getConnection();

 
  String SQLCmd =
  select * from AdInfoView where Classification = ?
 
   + and UniqueDateId  ? order by UniqueDateId
desc;

  pstmt = dbConnection.prepareStatement(SQLCmd);
// TEST Exception thrown here.
//pstmt.setString(1,searchWord);
  pstmt.setString(1,ClassifiedAd);
  pstmt.setString(2,UniqueDateId);  
  
}catch(Exception e){
  System.err.println(Problem preparing statement  +
e.getMessage() + e.getCause());
} 
  }

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


Database connection going from servlet to a bean

2004-03-22 Thread Tom K
I am going from a html--servlet--output to a jsp--javabean--jsp
configuration.
 
In my servlet I connect via JNDI like this:
public void init(ServletConfig config) throws ServletException{
super.init(config);
  try{
  Context env = (Context) new
InitialContext().lookup(java:comp/env);
  pool = (DataSource) env.lookup(jdbc/app1);
 
  if (pool == null)
throw new ServletException(`jdbc/app1' is an unknown
DataSource);
  }catch (NamingException e) {
throw new ServletException(e);
  }
 
How would I connect using a JSP? Or would this be done in the javabean?
 
TIA
 
Tom K.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: Database connection going from servlet to a bean

2004-03-22 Thread Tom K
Mike thanks for the feedback, but is this the practical solution? For
example, I am using a connection pool, the init is only done once, the
bean does the processing, after the processing it done (that is the
beans set their properties) the results are forwarded to another jsp
for viewing, so where do I release my connection back into the pool?

TIA

Tom K.




-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 22, 2004 1:31 PM
To: 'Tomcat Users List'
Subject: RE: Database connection going from servlet to a bean

There is a jspInit() method in a JSP that you can 'override' by doing:

%!

public void jspInit() {


}

%

So the answer for 'how' is; the same way


 -Original Message-
 From: Tom K [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 22, 2004 12:58 PM
 To: [EMAIL PROTECTED]
 Subject: Database connection going from servlet to a bean
 
 
 I am going from a html--servlet--output to a 
 jsp--javabean--jsp configuration.
  
 In my servlet I connect via JNDI like this:
 public void init(ServletConfig config) throws ServletException{
 super.init(config);
   try{
   Context env = (Context) new 
 InitialContext().lookup(java:comp/env);
   pool = (DataSource) env.lookup(jdbc/app1);
  
   if (pool == null)
 throw new ServletException(`jdbc/app1' is an 
 unknown DataSource);
   }catch (NamingException e) {
 throw new ServletException(e);
   }
  
 How would I connect using a JSP? Or would this be done in the 
 javabean?
  
 TIA
  
 Tom K.
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
  
 


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Database connection going from servlet to a bean

2004-03-22 Thread Tom K
Thanks, I will search the archives, ...you gave my an idea, it seems to
me I could use the following code in my bean and call the getMatches()
and forward the results to a ResultsPage.jsp. 

TIA Tom K.


 try{
  Context env = (Context) new
InitialContext().lookup(java:comp/env);
  pool = (DataSource) env.lookup(jdbc/myApp);

  if (pool == null)
throw new ServletException(`jdbc/myApp' is an unknown
DataSource);
  }catch (NamingException e) {
throw new ServletException(e);
  }

public int getMatches(){
try {

/** Run prepared statement */
dbConnection = pool.getConnection();
PreparedStatement pstmt = 

dbConnection.prepareStatement(Display_Statement_AdInfoView);

pstmt.setString(1,uniqueDateId);
pstmt.setString(2,titlePage
pstmt.setString(3,color);
pstmt.setString(4,banner);
pstmt.setBlob(5,myAppSays01);
pstmt.setString(6,phone);
pstmt.setString(7,email);
pstmt.setString(8,webSite);

rs = pstmt.executeQuery();
rs.last();
rowCount = rs.getRow();
dbConnection.close();





-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 22, 2004 1:42 PM
To: Tomcat Users List
Subject: RE: Database connection going from servlet to a bean


Hi,

Mike thanks for the feedback, but is this the practical solution? For
example, I am using a connection pool, the init is only done once, the
bean does the processing, after the processing it done (that is the
beans set their properties) the results are forwarded to another jsp
for viewing, so where do I release my connection back into the pool?

Your question is a good argument for having the bean retrieve the
connection, do its processing, and release the connection.  The results
you're forwarding can't be a java.sql.ResultSet, as that keeps the
connection open, but some other object containing the processed results.

Hand-in-hand with this approach goes the practice of getting a handle to
your connection pool in a ServletContextListener.  The listener can make
a getConnectionPool() or getConnection() method available for use by
your beans.  This approach has several advantages over the servlet init
(or jspInit for a JSP) design, all of which have been discussed in the
past on this list so if you're interested you can search the archives.

Yoav Shapira



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender.  Thank you.


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Why can't tomcat find my bean classes?

2004-03-21 Thread Tom K
Tomcat like your bean in a package. 

-Original Message-
From: Roy Smith [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 20, 2004 4:31 PM
To: [EMAIL PROTECTED]@jakarta.apache.org
Cc: Roy Smith
Subject: Why can't tomcat find my bean classes? 

I'm running jakarta-tomcat-5.0.18 on OSX.

I've got a trivial little JSP file:

jsp:useBean id=doubler class=DoublerBean scope=page
jsp:setProperty name=doubler property=in value=wugga/
/jsp:useBean
html
body
It looks like quot;jsp:getProperty name=doubler
property=out/quot;
/body
/html

and my DoublerBean.java file is pretty simple too:

public class DoublerBean
{
  private String phrase;

  public DoublerBean ()
  {
  // empty
  }

  public void setIn (String phrase)
  {
  this.phrase = phrase;
  }

  public String getOut ()
  {
  return (phrase + ,  + phrase);
  }
}

When I run ant, I get a build/WEB-INF/classes/DoublerBean.class file,
but my jsp application can't seem to find the DoublerBean class.  When
I reload my app through the manager and run it, I get:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 1 in the jsp file: /foo.jsp

Generated servlet error:
  [javac] Compiling 1 source file

/usr/local/jakarta-tomcat-5.0.18/work/Catalina/localhost/SquawkLog/org/
apache/jsp/foo_jsp.java:40: cannot resolve symbol
symbol  : class DoublerBean
location: class org.apache.jsp.foo_jsp
DoublerBean doubler = null;
^

and a few more similar errors complaining that it can't resolve
DoublerBean.  Other JSP pages I wrote were able to find their required
classes in the same location.  What's different about finding bean
classes?


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



Image proccessing deployment problem, Give me some Idea's where to look.

2004-03-20 Thread Tom K
This is a weird problem, so please excuse me if this is not Tomcat
related because Im not sure where the problem is.
 
Dev. Environment: Tomcat 5.0; IDE: MyEclipse, WinXP
 
Problem: Using Jmagik (ImageMagic) to process image files. Tomcat works
fine when I start Tomcat from the startup.bat and processes images
correctly. But, when I start and deploy to Tomcat within MyEclipse it
cant find the jmagic.jar file even though I have jmagic.jar in all the
library paths.
 
Any clues?
 
TIA
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: WARNING: Duplicate name in Manifest: Class-Path

2004-03-19 Thread Tom K
Thanks Larry!

Tom Kochanowicz

-Original Message-
From: Larry Isaacs [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 19, 2004 7:29 AM
To: Tomcat Users List
Subject: RE: WARNING: Duplicate name in Manifest: Class-Path

In case it helps, the struts.jar from 1.1-b3, and I assume
earlier, had a MANIFEST.MF file that had multiple
Class-Path lines, which would lead to this symptom.
The 1.1 release version of struts.jar had this corrected.
I don't know about the Struts 1.1 release candidates.
You might check your struts.jar to see what it has.
AFAIK, it isn't a problem that requires fixing beyond the
annoyance.

Cheers,
Larry

 -Original Message-
 From: Adam Hardy [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 19, 2004 5:18 AM
 To: Tomcat Users List
 Subject: Re: WARNING: Duplicate name in Manifest: Class-Path
 
 
 On 03/19/2004 06:35 AM Tom K wrote:
  Any clues where I would look to determine where this message?
  Start from ... only happens during sart up of my application.
   
   
   
  Mar 18, 2004 11:33:48 PM java.util.jar.Attributes read
  WARNING: Duplicate name in Manifest: Class-Path
 
 Sounds like somebody is complaining that you have an invalid 
 MANIFEST.MF 
 entry in one of your jars/wars/ears.
 
 Are you making a manifest entry yourself?
 
 Adam
 
 -- 
 struts 1.1 + tomcat 5.0.16 + java 1.4.2
 Linux 2.4.20 Debian
 
 
 -
 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]


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



Tomcat 5 Startup Warning question

2004-03-18 Thread Tom K
Does anyone know what is causing me to get this message?
 
Note: it prints the message 6 times before starting up!
 
WARNING: Duplicate name in Manifest: Class-Path
Mar 17, 2004 12:01:40 PM java.util.jar.Attributes read
 
TIA
 
Tom K.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


WARNING: Duplicate name in Manifest: Class-Path

2004-03-18 Thread Tom K
Any clues where I would look to determine where this message?
Start from  only happens during sart up of my application.
 
 
 
Mar 18, 2004 11:33:48 PM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
 
 
TIA
 
Tom K
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


RE: JDBC problems with MySQL

2004-03-17 Thread Tom K
I am new to this list as of today, so I don't know if anyone has already
answered your question. Tomcat will not connect to mysql unless you have
a password and of course rights to the database. Here is an example.

Use these mySQL commands

mysql -u root  (This command gives your root privledges).

CONNECT YourDatabase
GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED] IDENTIFIED BY
Yourpassword WITH GRANT OPTION;

You must have a password for Tomcat to work with mySQL

Note: the above user should be removed once testing is complete!


/* Next, put something like this in your server.xml file: */

- Context path=/classified docBase=classified debug=5
reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
prefix=localhost_Classifieds_log. suffix=.txt timestamp=true / 
  Resource name=jdbc/Classifieds auth=Container
type=javax.sql.DataSource / 
- ResourceParams name=jdbc/Classifieds
- parameter
  namefactory/name 
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value 
  /parameter
- !-- 
 Maximum number of dB connections in pool. Make sure you
 configure your mysqld max_connections
large enough to handle
 all of your db connections. Set to 0
for no limit.


  -- 
- parameter
  namemaxActive/name 
  value100/value 
  /parameter
- !-- 
 Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit.


  -- 
- parameter
  namemaxIdle/name 
  value30/value 
  /parameter
- !-- 
 Maximum time to wait for a dB connection to become available
 in ms, in this example 10 seconds. An
Exception is thrown if
 this timeout is exceeded.  Set to -1 to
wait indefinitely.


  -- 
- parameter
  namemaxWait/name 
  value1/value 
  /parameter
- !-- 
 To configure a DBCP DataSource so that abandoned dB connections
 are removed and recycled 


  -- 
- parameter
  nameremoveAbandoned/name 
  valuetrue/value 
  /parameter
- !--  MySQL dB username and password for dB connections  
  -- 
- parameter
  nameusername/name 
  valuetkoc/value 
  /parameter
- parameter
  namepassword/name 
  valuetrustno1/value 
  /parameter
- !--  Class name for mm.mysql JDBC driver 
  -- 
- parameter
  namedriverClassName/name 
  valuecom.mysql.jdbc.Driver/value 
  /parameter
- !-- 
 The JDBC connection url for connecting to your MySQL dB.
 The autoReconnect=true argument to the
url makes sure that the
 mm.mysql JDBC Driver will automatically
reconnect if mysqld closed the
 connection.  mysqld by default closes
idle connections after 8 hours.


  -- 
- parameter
  nameurl/name 
 
valuejdbc:mysql://localhost:3306/Classifieds?autoReconnect=true/value
 
  /parameter
  /ResourceParams
  /Context
/* NOTE THAT Classifieds would be my JNDI datasource  see the servlet
code below*/


IF CONNECTING VIA A SERVLET PUT THIS CODE BEFORE doPost/doGet

public void init(ServletConfig config) throws ServletException{
super.init(config);
  try{
  System.out.println(init() DeleteDBServlet: Start Loading
Database Driver);
  Context env = (Context) new
InitialContext().lookup(java:comp/env);
  pool = (DataSource) env.lookup(jdbc/Classifieds);

  if (pool == null)
throw new ServletException(`jdbc/Classifieds' is an unknown
DataSource);
  }catch (NamingException e) {
throw new ServletException(e);
  }
  }




I hope this helps,

Tom Kochanowicz






















-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 16, 2004 12:01 PM
To: 'Tomcat Users List'
Subject: RE: JDBC problems with MySQL
Importance: High

Dear Steve,

I posted this problem around 3 months back and I am daily reading the
forum, hoping that one day somebody will give a solution.
I will deeply appreciate you if u share the solution with me if u r able
to find.

Good Luck 

Best Regards
Abhay Kumar


-Original Message-
From: Steve Gums [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 16, 2004 11:57 AM
To: [EMAIL PROTECTED]
Subject: JDBC problems with MySQL


Users

I know there has been a bazillion messages about this.  I
searched the archives and couldn't find anything to solve my extremely
annoying issue.  It has to be something really simple but I just can't
find it.

 

My System:

Solaris 9

Tomcat 5.0.19

MySQL 4.0.18

Connector J 3.0.11

 

I have the connector J jar in the /usr/local/tomcat/common/lib dir.

I have basically copied the HOW-TO located at.