Does CoyoteConnector's connectionLinger option work?

2005-02-08 Thread Rodrigo Ruiz
Hi all,
I am having problems with the configuration of a Tomcat 4.1.27 server on 
a Windows XP box.

Although I use the following connector configuration in my server.xml file:
Connector className='org.apache.coyote.tomcat4.CoyoteConnector'
  acceptCount='10'
  connectionLinger='-1'
  connectionTimeout='5000'
  debug='0'
  enableLookups='false'
  maxProcessors='20'
  minProcessors='5'
  port='8080'
  tcpNoDelay='true'
  useURIValidationHack='false'/
I am getting lots of TIME_WAIT sockets in my computer. The client app is 
located in a remote machine, and since I disabled the SO_LINGER option 
on it, I stopped to get TIME_WAITs in the client side.

Setting the connectionLinger attribute to -1 should have made accept 
sockets to close inmediately without passing by this state (at least, 
that is the behaviour I am getting in the client side).

Is there something wrong in my statements, or I have found a bug?
Thanks in advance,
Rodrigo Ruiz

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 07/02/2005
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Is it possible to setup a custom ServerSocketFactory?

2005-02-08 Thread Rodrigo Ruiz
Hi all,

I am using Tomcat 4.1.27, on a Windows XP SP2 host.

I have tried to implement a custom ServerSocketFactory, and configured
my CoyoteConnector to use it as its factory in the server.xml file.
But, although an instance is created on startup, it seems no call is
made to any of its createSocket() methods.

Is there anything special that must be done for the connector to use
my factory? It seems that CoyoteConnector is creating the ServerSocket
by itself, or at least, without asking the specified factory.

Thanks in advance,
Rodrigo Ruiz

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



Re: How can I display number of requests over the past n seconds?

2004-08-04 Thread Rodrigo Ruiz
Mmmm, I think people is answering more than one question ;-)
If you need to be strict with respect to the timings, that is, you need 
exactly the number of requests in the past five seconds counting from 
the moment your request is done, you will need the solution proposed by 
Tim. Just remember to synchronize the access to the list, to prevent 
ConcurrentModification exceptions while you iterate over the list to get 
the counter values :-)

If the time buckets idea works well for you, both Yoav and Justin 
proposals are good. I just prefer Yoav one because I guess the cost 
associated to the hash function, even if it is simple, is greater than 
the associated to a thread that is sleeping most of the time (I mean, in 
processing time terms).

I think Yoav idea could be implemented like this (with a variation on my 
own ;-):

public class Historic extends Thread {
 private static final int NUM_COUNTERS = 6;
 private static final int INTERVAL = 5000;
 private int[] counters = new int[NUM_COUNTERS];
 private int pos = 0;
 public Historic() {
   super();
   this.setDaemon(true);
 }
 public void run() {
   try {
 while (true) {
   sleep(INTERVAL);
   synchronized (this) {
 pos = (pos + 1) % NUM_COUNTERS;
 counters[pos] = 0;
   }
 }
   }catch (InterruptedException e) {
   }
 }
 public synchronized void addRequest() {
   counters[pos] += 1;
 }
 public int[] getCounters() {
   int[] copy;
   int posCopy;
   synchronized (this) {
 System.arraycopy(counters, 0, copy, 0, NUM_COUNTERS);
 posCopy = pos;
   }
   int[] values = new int[NUM_COUNTERS];
   int count = 0;
   int index = posCopy;
   for (int i = 0; i  NUM_COUNTERS; i++) {
 count += copy[index];
 values[i] = count;
 index = (index == 0 ? NUM_COUNTERS : index) - 1;
   }
   return values;
 }
}
Just instantiate the class and start it in your Filter initialization, 
and call addRequest() on each received request. The getCounters() gives 
you the number of requests in each time slice. Ah, and remember to 
interrupt it on Filter finalization :-)

There is no guaranty that the pos variable will be changed exactly 
each five seconds, as the sleep() method is not accurate by design. In a 
highly loaded server with only one CPU, the time slicing will become 
worse. If you detect the thread scheduling is too much biased, you can 
raise its priority.

If this is not enough, you will have to calculate the cursor position in 
each request, implementing the hashtable proposed by Justin:

public class Historic {
 private static final int NUM_COUNTERS = 6;
 private static final int INTERVAL = 5000;
 private int[] counters = new int[NUM_COUNTERS];
 private int pos = 0;
 private long ts = System.currentTimeMillis();
 public Historic() {
 }
 public synchronized void addRequest() {
   adjust();
   counters[pos] += 1;
 }
 public int[] getCounters() {
   int[] copy;
   int posCopy;
   synchronized (this) {
 adjust();
 System.arraycopy(counters, 0, copy, 0, NUM_COUNTERS);
 posCopy = pos;
   }
   int[] values = new int[NUM_COUNTERS];
   int count = 0;
   int index = posCopy;
   for (int i = 0; i  NUM_COUNTERS; i++) {
 count += copy[index];
 values[i] = count;
 index = (index == 0 ? NUM_COUNTERS : index) - 1;
   }
   return values;
 }
 private void adjust() {
   long now = System.currentTimeMillis();
   while (now - ts = INTERVAL) {
 pos = (pos + 1) % NUM_COUNTERS;
 counters[pos] = 0;
 ts += INTERVAL;
   }
 }
}
HTH,
Rodrigo Ruiz
I need to display on a .jsp page the number of requests for Tomcat in the past 5 / 10 / 15/ 30 / 45 / 60 seconds.  I've already implement a Filter will count the total number of requests.  I did this with a static int, which is incremented everytime a request comes in.  But what should I do so that I can show number of request over past time intervals?  Since the present time is always changing, the past n seconds is constantly changing also.  
Thanks in advance,
Tom

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 


Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.727 / Virus Database: 482 - Release Date: 28/07/2004
 


--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.733 / Virus Database: 487 - Release Date: 02/08/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: detecting the shutdown of tomcat in a servlet

2004-07-28 Thread Rodrigo Ruiz
There is more than one way :-)
- From within a servlet, add a shutdown hook with 
Runtime.getRuntim().addShutdownHook()
- Create a ServletContextListener, and implement the clean stop of your 
daemon in the listener contextDestroyed() method
- Create an initialization servlet, and implement the clean stop in its 
destroy() method

and probably a few more if you use specific Tomcat classes.
I would not use the first option unless really necessary, as it seems to 
me a too much low level solution.
My favourite is the second option, as this is what 
ServletContextListeners are for. You could start and stop the thread 
from this listener.

The second and third options will perform the thread stop when the 
context or the container are shut down. This includes a context stop 
from the admin webapp. Whether this is good or bad for your purposes 
depends on the actions you need to perform. I suppose you do not want 
your thread to keep running if you stop the webapp, because restarting 
the webapp would lead to have two daemon threads :-)

HTH,
Rodrigo Ruiz
STOCKHOLM, Raymond wrote:
In my tomcat 4.1.30n, I have a webapp in which a deamon Thread (started automatically) 
is scheduled to send automatic mails every morning.

I would like to make a clean stop of my deamon when tomcat shutdowns.
How can I detect that tomcat is shuting down ?
Raymond Stockholm
Aubay Luxembourg
51, Rue de Strasbourg
L-2561 LUXEMBOURG
Tel : +352 29 92 50 31
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 


--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.727 / Virus Database: 482 - Release Date: 27/07/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Problem with proper shutdown of tomcat

2004-07-28 Thread Rodrigo Ruiz
Maybe you have some non-daemon threads running. This would prevent the 
JVM from exiting. I would do the following:

- Once the java process is frozen, ask it a thread stack dump (I do 
not remember well, but I think in Linux you must send the process a QUIT 
signal)
- In the trace you should see all threads still alive. Check if any of 
them is yours. Such a thread could be the problem source.
- Sometimes converting the thread in a daemon is enough. Other times you 
need to ensure a clean stop, in which case you could implement it 
through a ServletContextListener.

HTH,
Rodrigo Ruiz
dejw wrote:
Hi,
I have tomcat 4.1.30 installed on linux red hat 9 with java version 
1.4.1_03. Sometimes when I shutdown tomcat by using shutdown script it 
remains java process in memory which I have to kill manually. Only 
then I can start up tomcat again. What can be the reason of this? I'm 
using GridSphere portal framework with gridportlets whithin the 
tomcat, maybe some bad written portlets or servlets are able to freeze 
java process of tomcat?

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


--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.727 / Virus Database: 482 - Release Date: 27/07/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to limit time for Connector threads?

2004-05-07 Thread Rodrigo Ruiz
rlipi wrote:

I am going to try Antonio's proposal. Also I would like to try some
profiling tool. But it will take a lot of time to find and repair
something, I think.
 

If you are dealing with a programming error like an infinite loop or a 
deadlock, you may have better luck using a debugger, rather than a 
profiling tool :-)

Most of the popular IDEs (JBuilder, Eclipse, Idea, etc) can do remote 
debugging, so you just need to start your server (or a copy of it) in 
debug mode and connect to it from the IDE.

In case you do not have any IDE, my recommendation is Eclipse, as it is 
free and needs no complicated installation.
In case you do not know how to use remote debugging, I am pretty sure 
you can search through the archives in this list, or do some googling ;-)

Hope it helps you,
Rodrigo Ruiz
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.678 / Virus Database: 440 - Release Date: 06/05/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: specifying location of confg file

2004-05-07 Thread Rodrigo Ruiz
The standard way to specify configuration data in J2EE is through 
JNDI. With this, I am not telling you to drop your config file, but 
specify its path there ;-)
In Tomcat, the JNDI tree is specified in the server.xml descriptor. You 
will find good documentation on this topic on the tomcat web pages

Rodrigo Ruiz

Milt Epstein wrote:

On Thu, 6 May 2004, Arora, Avinash wrote:

 

Hi,
 How can we specify the location of config file, so that we don't
have to hardcode it in our code. Thanks.
   

You can specify the location in the config file.

Oh wait, never mind.

Other alternatives are specifying it as init-param's (either servlet
or context) in web.xml.  Still somewhat hard-coded, but not as bad as
putting it in the servlet code itself.  A bit of a bootstrapping issue
here.
Also, I think I saw something here recently about being to specify
certain init-param's in server.xml, not sure of the details, maybe
that's a possibility.
Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 



--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.678 / Virus Database: 440 - Release Date: 06/05/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: What is accepted way to read/write files in Tomcat ?

2004-04-15 Thread Rodrigo Ruiz
Some thoughts on this matter :-)

If I am not wrong, the servlet specification states that the directory 
pointed by javax.servlet.context.tempdir can be cleaned on restart (it 
is left to the container implementation). I think Tomcat does not do 
such a cleaning, but other containers (or even future Tomcat versions) 
are perfectly allowed to do so :-S

So, sticking to the specification, I guess the only way left to define 
such a location is specifying it through JNDI.
This means that any webapp needing (for example) to work as file server 
are unnecessary difficult to implement. Having to implement a custom 
servlet that does the same as the default one, but accessing another 
directory out of the context, sounds to me like reinventing the wheel :-D

Having war deployments this lack of functionality, it has always seemed 
strange to me that the specification only considers mandatory this type 
of deployment.

Rodrigo Ruiz

Mike Curwen wrote:

Is it legitimate depends on who you talk to. ;)

Purists (I don't mean that negatively) would remind you that the only
'guaranteed' filepath available is the javax.servlet.context.tempdir .
And getRealPath() would blow up on  you, if you were running your webapp
from a WAR file.  

However, if *you* know that your app will only ever be used unpacked,
then fully document this requirement, and go ahead and use
getRealPath().


 

-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 15, 2004 12:28 AM
To: Tomcat Users List
Subject: What is accepted way to read/write files in Tomcat ?

Hi all,
 What is the best way to read and write file(the file 
locations are inside
context) in a servlet container. I was able to read file using
getResourceAsStream() but writing using 
URLConnection().getOutputStream() failed and throws  protocol 
doesn't support output - UnknownServiceException. Is it 
legitimate to use the getRealPath() to get the context root 
and write the file ?

Antony Paul

-
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]


 



--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.658 / Virus Database: 421 - Release Date: 09/04/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How to enable cipher suites in Tomcat

2004-03-29 Thread Rodrigo Ruiz
Hi all, is there any way to enable a specific cipher suite for SSL 
connections in Tomcat?

The current project I am working in requires data encryption, but not 
server authentication, so enabling an anonymous cipher suite would fit 
my requirements without needing to create a certificate.

Thanks in advance,
Rodrigo Ruiz
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.642 / Virus Database: 410 - Release Date: 24/03/2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Réf. : RE: How to know when Tomcat has completed startup?

2004-02-17 Thread Rodrigo Ruiz
AFAIK, the ServletContextListener initialization event is fired before 
Tomcat starts listening to external requests, so they won't work for you.
SessionListeners will be executed on a request basis, as their first 
execution will be fired on the first request asking for a session to be 
created. Depending on your requirements this could be good enough... or 
not. You decide ;-)

If I had undestood well, you want to invoke some JSP from within your 
own web-app during initialization, to do some data pre-generation.

Does your JSP performs all operations, or does it delegates in another 
class?
In my opinion:
 a) If your JSP (or Action if you use struts) is performing the 
operation itself, I would refactor the code and create a Helper class 
containing the necessary logic.
 b) If your logic is in a sepparate class, you could probably call its 
methods directly from a ServletContextListener, without needing to 
perform a JSP invocation. From a ServletContextListener you do not have 
access to a ServletResponse or ServletRequest, as there is no request in 
process, but you have access to the ServletContext, and many times it 
provides enough information for data preparing tasks.

HTH,
Rodrigo Ruiz
[EMAIL PROTECTED] wrote:

if your application is a struts one, you can do that with
struts plugin mechanism.
___
NATEXIS ASSET MANAGEMENT
Meissa SAKHO
01 58 19 45 71. . . . . . . . . . . . (84571)
[EMAIL PROTECTED]


Peter Guyatt [EMAIL PROTECTED]
16/02/2004 14:26
Veuillez répondre à Tomcat Users List


   Pour :  Tomcat Users List [EMAIL PROTECTED]
   cc :
   Objet : RE: How to know when Tomcat has completed startup?

What about using a session listener.

Why not call your method in the constructor for the SessionListsner

Pete

-Original Message-
From: James Neville [mailto:[EMAIL PROTECTED]
Sent: 16 February 2004 12:38
To: [EMAIL PROTECTED]
Subject: How to know when Tomcat has completed startup?
Hi all,

I'm trying to get a certain method within my startup class to *only*

execute after Tomcat startup has fully completed.

I understand I can implement a LifecycleListener, but there only seems

to be before/after start/stop events.
(i'm not sure that Lifecycle.AFTER_START_EVENT refers to 'startup is
complete', or 'startup event was requested')

In short, as part of my Startup procedure, we pre-generate(if rqd) a

fornightly clandar of 'events' from some JSPs on the same Tomcat instance.
The problem is mainly that we also use Apache/JK2, so a HTTP 500 error
is generated (the Apache connection can be made, but Tomcat is not yet

available), unless we can defer until Tomcat has started.
I could, of course, defer the event for a few minutes, but that doesn't
strike me as much of a graceful approach.

I'm assuming this is probably pretty simple?
Any pointers would be much appreciated. (not google.com, been all
morning in there! :) )

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]




L'integrite de ce message n'etant pas assuree sur internet, Natexis
Banques Populaires ne peut etre tenu responsable de
son contenu. Toute utilisation ou diffusion non autorisee est
interdite. Si vous n'etes pas destinataire de ce message, merci de le
detruire et d'avertir l'expediteur.
The integrity of this message cannot be guaranteed
on the Internet. Natexis Banques Populaires can not therefore be
considered responsible for the contents.Any unauthorized use or dissemination is 
prohibited.
If you are not the intended recipient of this message, then please delete it and
notify the sender.
 



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


Re: How to know when Tomcat has completed startup?

2004-02-17 Thread Rodrigo Ruiz
If I had undestood well, you want to invoke a servlet from within your 
own web-app during initialization, to do some data pre-generation.

What about isolating the logic of your event management in a helper 
class? This way you could call its methods from within your 
ServletContextListener without needing to wait for the servlets being 
able to respond. Just add your helper instance to the context as an 
attribute in the ServletContextListener, to be sure you use the same 
instance from within your timer servlet, or make it a singleton :-)

HTH,
Rodrigo Ruiz
James Neville wrote:

Jose,

James, do you need the servlets to be already initialized???


Yes, and they are all defined in web.xml.
The timer servlet that processes the calendars is the last to load.
Another thing to consider is that the connector between Tomcat and 
Apache is also set up. Because Tomcat and Apache may be completly set 
up, but the connector takes a little longer (at lest in my case) 
therefore you may get a HTTP Error.
 

This is what causes me HTTP 500 errors.
The servlets are in fact all instantiated, but they are just not 
available on port 80 until JK2 has completed whatever it does on startup.

The best thing I can think of is start the timer in a thread, and 
defer the thread from processing the action for a nominal duration 
(1/2 mins?).
Still seems like a dirty way of doing it though.

Maybe I should talk to the JK2 developers.

Thanks

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]


How to get a thread stack dump programmatically

2004-02-03 Thread Rodrigo Ruiz
Hi all, is there any way to get a stack trace of a given thread?

I want to obtain a full thread stack dump from a JSP, just like the one 
obtained via kill -QUIT, but I do not find any method in the Thread 
class that could be used to get this information.

I seem to recall that some code was posted some time ago in this list, 
but I have not found it in the archives. Any ideas?

PS: What I really want to do is a tool for detecting deadlocks via 
thread dump analysis :-)

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


Re: How to get a thread stack dump programmatically

2004-02-03 Thread Rodrigo Ruiz
My problem is I want a full stack dump, so I need to obtain stack traces 
from all threads, even those out of my control. Specifically, I would 
like to obtain a stack thread from all Tomcat worker threads, and if 
they are in a deadlock state, I cannot print their stack trace from 
within them ;-)

I know it is technically possible, because there are some commercial 
libraries that do it. For example, BEA systems seems to have an 
implementation, as from their javadocs:

http://edocs.bea.com/wljrockit/docs142/jmapi/javadoc/Management%20API/com/bea/jvm/ThreadSystem.html

But I do not know if that implementation is only for their JRockit 
virtual machine, or they use JNI to access internal JVM data, or if 
there is something else involved.

I am implementing a rather complex server, and detecting / reporting a 
deadlock condition would be a great advantage in the development process.

Anyway, thanks for your comments :-)

Thomas Kellerer wrote:

Rodrigo Ruiz schrieb:

Hi all, is there any way to get a stack trace of a given thread?

I want to obtain a full thread stack dump from a JSP, just like the 
one obtained via kill -QUIT, but I do not find any method in the 
Thread class that could be used to get this information.

I seem to recall that some code was posted some time ago in this 
list, but I have not found it in the archives. Any ideas?

PS: What I really want to do is a tool for detecting deadlocks via 
thread dump analysis :-)


Create an exception within that thread, and write it's stack dump via 
a StringWriter into a String

Thomas

-
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 to get a thread stack dump programmatically

2004-02-03 Thread Rodrigo Ruiz
Thanks Yoav, do you remember some keyword I could use to find that code 
in the archives? I have searched with no luck :-(

I have this code section:

List list = getAllThreads();
for (Iterator it = list.iterator(); it.hasNext(); ) {
 Thread t = (Thread)it.next();
 String strace = getStackTrace(t);
}
I know how to get a list of all threads in the system, but I do not know 
how to obtain a stack dump from a thread being passed as a parameter. 
The only method that seems related to this task is Thread.dumpStack(), 
but it is intended to be called from within the thread, so it will not 
work for me.

Thanks again,
Rodrigo Ruiz
Shapira, Yoav wrote:

Howdy,
It's not hard.  I've posted code in the past that will list and give you
access to all the threads in the system.  Then you can crawl this list
and use the exception-oriented approach.  But keep in mind this is all
transient snapshots.
Yoav Shapira
Millennium ChemInformatics
 

-Original Message-
From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 5:04 AM
To: Tomcat Users List
Subject: How to get a thread stack dump programmatically
Hi all, is there any way to get a stack trace of a given thread?

I want to obtain a full thread stack dump from a JSP, just like the one
obtained via kill -QUIT, but I do not find any method in the Thread
class that could be used to get this information.
I seem to recall that some code was posted some time ago in this list,
but I have not found it in the archives. Any ideas?
PS: What I really want to do is a tool for detecting deadlocks via
thread dump analysis :-)
-
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]


 



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


Re: rtexprvalue ignored? - fixed

2003-12-19 Thread Rodrigo Ruiz
Hi, just a tip for portability:

WebSphere JSP parser will complain when you use an expression containing 
the same string delimiter used for the attribute. This means that

attr=%= aaa %

will produce a compiler error. To avoid this, simply use a different 
quotation marks for the attribute itself, as in:

attr='%= aaa %'

I personally consider this a bug in WebSphere, but in the meanwhile the 
change does not hurt :-)

Hope it helps,
Rodrigo Ruiz
Josh G wrote:

At 11:47 AM 19/12/2003, you wrote:

This is what i was telling you before, the attribute has to be either a
expression or a constant, not both. so add the _off.gif part to the
tmp variable before you put it in the tags attribute.
like this:
% String temp = sectionNames[i] + _off.gif; %
image:local file=%= temp  % /
thats what i've done before to fix the problem.

dave


Ah, gotcha... Now I see. I misread it, and thought you meant that my 
problem was within the %= %, not in the tag attribute. Cheers mate.

If it helps you any, I also got

image:local file=%= tmp + off.gif % /

to work, since I'm doing a lot of these lines and assigning tmp to 
sectionNames[i] above the block.

(sent this back to the list so it turns up in the archive, sorry if 
this pisses anyone off).

Again, thanks, have a beer on me.

-Josh



 He likes to run, And then the thing with the.. person..
   ... Oh boy, that monkey is going to pay.
   [ Josh 'G' McDonald ]  --  [ Pirion Systems, Brisbane]

[ 07 3257 0490 ]  --  [ 0415 784 825 ]  --  [ http://www.gfunk007.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: Maximum page size before JasperException

2003-12-17 Thread Rodrigo Ruiz
Hi Peter, I am not sure of which are the current limitations of the JVM 
in method code and constants pool sizes, but with such a huge JSP you 
could be reaching them. Remember that your JSP will be converted into a 
servlet, and that most of the JSP code will be generated inside a single 
method (called somewhat similar to _jspService, so the larger your JSP 
is, the larger the generated servlet will be. You can probably find the 
exact numbers in the Java Virtual Machine Specification.

A way of  alleviating this is through configuration of the Jasper 
servlet, that is, the servlet that compiles JSPs. You will find its 
configuration in the tomcat/conf/web.xml file. One of the attributes you 
can configure there will tell the compiler to put all the static content 
of your JSP in a static plain text file, so it will not be part of the 
servlet class, reducing its size.

Hope it helps you,
Rodrigo Ruiz
Peter Guyatt wrote:

Hi There,

The JSP page had it as a JavaScript variable (long story!!).

I am more curious to find out what the maximum size is due to an academic
curiosity
Thanks

Pete

-Original Message-
From: Kwok Peng Tuck [mailto:[EMAIL PROTECTED]
Sent: 17 December 2003 11:21
To: Tomcat Users List
Subject: Re: Maximum page size before JasperException
Hmm maybe you can just write out the file to the response body in a
servlet ?  Or do you need to do something in the jsp ?
Peter Guyatt wrote:

 

Hi there,

	Its an XML file

Pete

-Original Message-
From: Kwok Peng Tuck [mailto:[EMAIL PROTECTED]
Sent: 17 December 2003 11:12
To: Tomcat Users List
Subject: Re: Maximum page size before JasperException
What are you displaying in a JSP page that takes up 4 megs ?

Peter Guyatt wrote:



   

Hi There,

Can anyone possibly tell me what the maximum page size allowed when
compiling/presenting JSP page.
The question arises when I try and display a 4meg file.

If there is a limit is there any way to increase the maximum allowed size?

Thanks

Pete

-
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]
-
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: new JVM feature, just an idea

2003-12-15 Thread Rodrigo Ruiz
Just an idea, a jar archive can contain a list of jar dependencies in 
its META-INF/manifest.mf file. You could create such a jar
in a fixed location in your system, and set your CLASSPATH point to it.

An example of such a manifest could be:

Manifest-Version: 1.0
Created-By: myself
Class-Path: d:\usr\local\jakarta\apache-ant-1.5.4\lib\xmltask.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\xml-apis.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\xercesImpl.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\optional.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\ant.jar
d:\arquiv~1\j2sdk1.4.1_01\commapi\comm.jar
d:\usr\local\skinlf-1.2.4\lib\skinregion.jar;
...
This way, including this jar in your classpath will be equivalent to 
include all its dependencies :-)

Another think that could help would be to create a d:\jars directory, 
and place a copy of all your jars into it. This way, the CLASSPATH 
variable will be shorter (and BTW, your ant scripts too ;-)

Hope this helps,
Rodrigo Ruiz
Edson Alves Pereira wrote:

That´s right, but even using a GUI IDE like JBuilder or Netbeans
this problem can occours, because in a low level these tools make a command
like to compile, to build a webbapp or to create a jar file.
 

--
De: Shapira, Yoav[SMTP:[EMAIL PROTECTED]
Responder:  Tomcat Users List
Enviada:sexta-feira, 12 de dezembro de 2003 15:18
Para:   Tomcat Users List
Assunto:RE: new JVM feature, just an idea
Howdy,

   

	And Yoav, you did say that in almost 10 years no one complains about
it, but as i know there are many people facing this issue all over
 

internet
   

also. My neibour here has a windows 2000, he will make some tests with
 

its
   

command line.
 

I misunderstood your problem when I said no one else has it.  What you
describe is a common issue.  It used to be more common before people used
Ant and IDEs, when they did more stuff on the command line.  I just
haven't compiled anything in a DOS window for ages, so I forgot ;)
Yoav Shapira

   

--
De: Shapira, Yoav[SMTP:[EMAIL PROTECTED]
Responder:  Tomcat Users List
Enviada:sexta-feira, 12 de dezembro de 2003 14:41
Para:   Tomcat Users List
Assunto:RE: new JVM feature, just an idea
Howdy,
I see -- thanks for the example.
You do realize Ant adds a lot of these jars for you automatically to
   

the
   

classpath, right?  You don't need to add anything in ANT_HOME/lib, as
that's automatically included.  Furthermore, if you're using JDK 1.4 or
later, you can remove a bunch of other jars from the path as they're
included in the JDK, e.g. JAXP, Crimson, JDBC 2.0 extensions.  Finally,
you have a number of duplicates, e.g. the XML APIs, repeated a number
   

of
   

times in the path.

Yoav Shapira
Millennium ChemInformatics
   

-Original Message-
From: Edson Alves Pereira [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 1:35 PM
To: 'Tomcat Users List'
Subject: RE: new JVM feature, just an idea
	This mainly it happen with ant, here a snapshot of it:

D:\home\edsonset
LOCALCLASSPATH=d:\usr\local\jakarta\apache-ant-1.5.4\lib\xmlta
sk.jar;d:\usr\local\jakarta\apache-ant-1.5.4\lib\xml-
apis.jar;d:\usr\local\j
akar
 

ta\apache-ant-1.5.4\lib\xercesImpl.jar;d:\usr\local\jakarta\apache-ant-
 

1.5.4
\lib
\optional.jar;d:\usr\local\jakarta\apache-ant-
1.5.4\lib\ant.jar;d:\arquiv~1\
j2sd
k1.4.1_01\commapi\comm.jar;d:\usr\local\skinlf-
1.2.4\lib\skinregion.jar;d:\u
sr\l
ocal\skinlf-1.2.4\lib\skinlf.jar;d:\usr\local\ecs-1.4.1\lib\xerces-
1.2.2.jar
;d:\
usr\local\ecs-1.4.1\lib\jakarta-regexp-1.2.jar;d:\usr\local\ecs-
 

1.4.1\ecs
 

-
   

1.
4.1.
 

jar;d:\usr\local\java_cup\java_cup.jar;d:\usr\local\hsqldb_v.1.61\lib\hs
   

q
   

ld
   

b
.jar
;d:\usr\local\junit3.7\junit.jar;d:\usr\local\jakarta\apache-ant-
1.5.4\lib\x
mlta
sk.jar;d:\usr\local\jakarta\apache-ant-1.5.4\lib\xml-
apis.jar;d:\usr\local\j
akar
 

ta\apache-ant-1.5.4\lib\xercesImpl.jar;d:\usr\local\jakarta\apache-ant-
 

1.5.4
\lib
\optional.jar;d:\usr\local\jakarta\apache-ant-
1.5.4\lib\ant.jar;d:\desenv\os
ctrl
 

_lib\classes;d:\desenv\osctrl\classes;d:\desenv\pannet\src\servlets\ifin
   

a
   

nc
   

e
\cla
 

sses;d:\desenv\pannet\src\servlets\intranet\classes;d:\desenv\pannet\src
   

\
   

se
   

r
vlet
 

s\panfinance\classes;d:\desenv\pannet\src\servlets\base\classes;d:\desen
   

v
   

\p
   

a
nnet
\java-lib\jasper-runtime.jar;d:\desenv\pannet\java-lib\jasper-
compiler.jar;d
:\de
senv\pannet\java-lib\jdbc2_0-stdext.jar;d:\desenv\pannet\java-
lib\tinySQL.ja
r;d:
\desenv\pannet\java-lib\servlet.jar;d:\desenv\pannet\java-
lib\ojdbc14.jar;d:
\des
env\pannet\java-lib\shell_term.jar;d:\desenv\pannet\java-
lib\crimson.jar;d:\
dese
nv\pannet\java-lib\jconcept.zip;d:\desenv\pannet\java-
lib\com.zip;d:\desenv\
pann
et\java-lib\acme.zip;d:\desenv\pannet\java-
lib\xBaseJ.jar;d

Re: new JVM feature, just an idea

2003-12-15 Thread Rodrigo Ruiz
It is a feature of the JAR specification.  You can find the online 
document at

http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html

It is in the Main Attributes section. The feature is also present in 
JDK 1.4.1 (and I think in 1.3.1 too, but I have not tested this)  :-)

Regards,
Rodrigo Ruiz
Derek Mahar wrote:

Is the Class-Path keyword actually available in META-INF/minfest.mf or
is this a feature that you like the JVM to support?
Derek

-Original Message-
From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED] 
Sent: December 15, 2003 3:50 AM
To: Tomcat Users List
Subject: Re: new JVM feature, just an idea

Just an idea, a jar archive can contain a list of jar dependencies in 
its META-INF/manifest.mf file. You could create such a jar
in a fixed location in your system, and set your CLASSPATH point to it.

An example of such a manifest could be:

Manifest-Version: 1.0
Created-By: myself
Class-Path: d:\usr\local\jakarta\apache-ant-1.5.4\lib\xmltask.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\xml-apis.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\xercesImpl.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\optional.jar
d:\usr\local\jakarta\apache-ant-1.5.4\lib\ant.jar
d:\arquiv~1\j2sdk1.4.1_01\commapi\comm.jar
d:\usr\local\skinlf-1.2.4\lib\skinregion.jar;
...
This way, including this jar in your classpath will be equivalent to 
include all its dependencies :-)

Another think that could help would be to create a d:\jars directory, 
and place a copy of all your jars into it. This way, the CLASSPATH 
variable will be shorter (and BTW, your ant scripts too ;-)

Hope this helps,
Rodrigo Ruiz
 



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


Re: Image Viewing

2003-12-12 Thread Rodrigo Ruiz
Kiran, if condifentiality is your main concern, I will suppose you are 
using some kind of authentication mechanism in your webapp.

If you are using container authentication, just add the image directory 
to your security restriction, and only authenticated users will have 
access to the images.
If your authentication scheme is different, but you can access the 
credentials data from the request, you could implement a filter that 
denies access to non-authenticated requests, and map the filter to the 
images directory. You will find more information on both subjects in the 
Servlet Specification :-)

Hope this helps you,
Rodrigo Ruiz
Kiran Patel wrote:

I am using jsp and tomcat 4.1 for my web application.  My application is viewing image which is in the webapps/image folder.  This image can also be viewed from the internet by just typing the url.  I want to block this since these are the confidential images.  Does anybody know how to do that.  Thanks in advance.

Kiran Patel
 



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


Re: JSP doubt

2003-12-10 Thread Rodrigo Ruiz
Mmmm, I have never tried this, but you could try something like:

!-- your web.xml file --
?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
!ENTITY precompiled SYSTEM web-fragment.xml
web-app
...
 precompiled;
...
/webapp
With this syntax, the parser should replace precompiled; by the 
contents of the web-fragment.xml file. I do not know if the parser will 
accept it, but in case it does, you should put precompiled; between 
the last servlet and the first servlet-mapping declarations in your 
web.xml file.

HTH,
Rodrigo Ruiz
Edson Alves Pereira wrote:

	Is there a tag to import these new xml file in my web.xml?

 

--
De: Rodrigo Ruiz[SMTP:[EMAIL PROTECTED]
Responder:  Tomcat Users List
Enviada:terça-feira, 9 de dezembro de 2003 14:14
Para:   Tomcat Users List
Assunto:Re: JSP doubt
Edson Alves Pereira wrote:

   

	Hello folks, i made a war file and i compiled my JSP pages and
create a jar file with then. My question is, do i still need to put
 

inside
   

my webapp ( in my case war file, but is the same ) all JSP files anyway?
Because tomcat complain about them.
Regards,
Edson


 

Hi Edson, when you compile your JSPs, you are creating a set of servlet 
classes.

Tomcat needs a mapping between the servlet classes and the paths they 
will serve, so you need to explicitly tell Tomcat to use your index_jsp 
servlet class when it receives a request for index.jsp. If you do not 
include this mapping, Tomcat will search for the jsp file, and complain 
when it does not found it.

If you do JSP precompilation through the JspC ant task, I think there is 
an option to tell it to create a web.xml fragment containing the extra 
tags you need to include in your web.xml file.

Regards,
Rodrigo Ruiz
-
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]


jasper2 ant task does not report JSP error descriptions

2003-12-10 Thread Rodrigo Ruiz
Hi all,

I am trying to use the jasper2 task that comes with Tomcat. In 4.1.12 
version, when I had an error, it reported something similar to:

An error occurred at line: 15 in the jsp file: /NewUser.jsp

Generated servlet error:
   [javac] Compiling 1 source file
C:\project\genjsp\index_jsp.java:53: illegal start of expression
  }
  ^
But with 4.1.27, it changed and now it just reports:

 [jasper2] Compile failed; see the compiler error output for details.
 [jasper2] at 
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:844)
 [jasper2] at 
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
 ...

But no compiler error output is generated anywhere :_(

Can this be fixed? Maybe the taskdef example that comes in the javadoc 
comments of the class (org.apache.jasper.JspC) is not totally correct? 
Last time I checked the ant jspc task, it didn't compile the generated 
servlets, so it was unable to tell which JSP line contained the error.

Thanks in advance,
Rodrigo Ruiz
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: JSP doubt

2003-12-10 Thread Rodrigo Ruiz
Sorry, I was somewhat asleep when I wrote the previous message ;-)

The correct syntax to include an entity in your web.xml is:

!-- your web.xml file --
?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
  PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
  http://java.sun.com/dtd/web-app_2_3.dtd; [
 !ENTITY precompiled SYSTEM web-fragment.xml
]
web-app
...
precompiled;
...
/webapp
Regards,
Rodrigo Ruiz
Edson Alves Pereira wrote:

	Is there a tag to import these new xml file in my web.xml?

 

--
De: Rodrigo Ruiz[SMTP:[EMAIL PROTECTED]
Responder:  Tomcat Users List
Enviada:terça-feira, 9 de dezembro de 2003 14:14
Para:   Tomcat Users List
Assunto:Re: JSP doubt
Edson Alves Pereira wrote:

   

	Hello folks, i made a war file and i compiled my JSP pages and
create a jar file with then. My question is, do i still need to put
 

inside
   

my webapp ( in my case war file, but is the same ) all JSP files anyway?
Because tomcat complain about them.
Regards,
Edson


 

Hi Edson, when you compile your JSPs, you are creating a set of servlet 
classes.

Tomcat needs a mapping between the servlet classes and the paths they 
will serve, so you need to explicitly tell Tomcat to use your index_jsp 
servlet class when it receives a request for index.jsp. If you do not 
include this mapping, Tomcat will search for the jsp file, and complain 
when it does not found it.

If you do JSP precompilation through the JspC ant task, I think there is 
an option to tell it to create a web.xml fragment containing the extra 
tags you need to include in your web.xml file.

Regards,
Rodrigo Ruiz
-
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 to prevent direct access to login.jsp

2003-12-09 Thread Rodrigo Ruiz
I think there is another option that noone has mentioned yet :-P

When the login.jsp page is presented as part of the login process, there 
will be some standard request attributes containing the original 
requested page (I don't remember the names now, but you can find them in 
the servlet spec). They are used by the servlet container to redirect to 
the correct page once your login data is validated, and will be not 
present if you point to the page directly from the browser. You can 
check for the existence of these attributes, and if they are not present 
redirect to your webapp homepage. This way, the correct login steps will 
be followed.

HTH,
Rodrigo Ruiz
Adam Hardy wrote:

On 12/08/2003 11:59 PM Chaikin, Yaakov Y (US SSA) wrote:

I realized that my user can mess himself by bookmarking the login page
he is asked to log in. The login.jsp appears in the URL address in the
browser...
Does anyone know how to avoid this? How do I block that URL for the user
and not for the server?


Hi Yaakov,
I think the best way to deal with this situation is to configure 
tomcat to catch the error status 403 or whatever it is and then serve 
up an error page with a calm, logical explanation of why they 
shouldn't do that.

Or upgrade to tomcat 5.

Adam

-
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: JSP doubt

2003-12-09 Thread Rodrigo Ruiz
Edson Alves Pereira wrote:

Hello folks, i made a war file and i compiled my JSP pages and
create a jar file with then. My question is, do i still need to put inside
my webapp ( in my case war file, but is the same ) all JSP files anyway?
Because tomcat complain about them.
Regards,
Edson
 

Hi Edson, when you compile your JSPs, you are creating a set of servlet 
classes.

Tomcat needs a mapping between the servlet classes and the paths they 
will serve, so you need to explicitly tell Tomcat to use your index_jsp 
servlet class when it receives a request for index.jsp. If you do not 
include this mapping, Tomcat will search for the jsp file, and complain 
when it does not found it.

If you do JSP precompilation through the JspC ant task, I think there is 
an option to tell it to create a web.xml fragment containing the extra 
tags you need to include in your web.xml file.

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


Re: Tomcat's ThreadPool and InheritableThreadLocal variables

2003-12-05 Thread Rodrigo Ruiz
AFAIK, Java does not provide any way to clear ThreadLocal variable 
values related to a given thread. As it is a language-level limitation, 
Tomcat can do nothing to resolve it. I tend to think that this is also a 
valid reason to consider not necessary to document it ;-)

Cheers,
Rodrigo Ruiz
In some ways,you are right.But,looking at it this way.

When it's said that each request is processed in a *new* thread,it is
reasonable to expect that thread-specific language constructs will be
handled.In this case,a new thread would mean new copies of ThreadLocal and
InheritableThreadLocal variables.
If this new thread is created in a customized manner(in this case,alloted
from a ThreadPool),I would say that the behaviour of the new Thread should
be modelled on the language defined lines.
It would be good if this is atleast documented somewhere. :)
 



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


Re: Tomcat 4.x non .jsp suffix for includes?

2003-12-04 Thread Rodrigo Ruiz
In fact, I think you could reuse the default jsp servlet, and simply add

servlet-mapping
   servlet-namejsp/servlet-name
   url-pattern*.jnc/url-pattern
/servlet-mapping
to your webapp WEB-INF/web.xml, or $CATALINA_HOME/conf/web.xm, whichever 
you preferl

What I am not sure about is whether the JSP servlet has its name fixed 
in the JSP specification, or it is left to the container implementation. 
Perhaps someone here can enlight this :-)

Cheers,
Rodrigo Ruiz
Richard Bondi wrote:

Thanks to Chris and and Tim Funk for pointing me in the right 
direction. For the archives, I found that adding the following two 
lines to %catalina_home%/conf/web.xml did the trick:

servlet
servlet-namejnc/servlet-name

servlet-classorg.apache.jasper.servlet.JspServlet/servlet-class
init-param
param-namelogVerbosityLevel/param-name
param-valueWARNING/param-value
/init-param
load-on-startup3/load-on-startup
/servlet

servlet-mapping
servlet-namejnc/servlet-name
url-pattern*.jnc/url-pattern
/servlet-mapping
Best,
Richard Bondi
At 06:14 PM 12/3/2003 -0500, you wrote:

Richard,

Does anyone know how to configure tomcat to compile .jnc files in 
this circumstance?
Is there a standard convention for naming jsp include files?


Yeah, .jsp :)

Seriously, though. Check out CATALINA_HOME/conf/web.xml for how they 
configure the .jsp file trnaslator/compiler. You could modify the 
that web.xml file to include the same type of things for .jsp files, 
or you could modify the deployment descriptor for your application.

Unfortunately, modifying your deployment descriptor will make your 
application non-portable. But, you are already making your .jsp files 
called something else, anyway, so you'll have to do some sort of 
re-configuration for every app server you indend to use.

-chris

-
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: Restarting tomcat from web page

2003-12-04 Thread Rodrigo Ruiz
The only way to restart a Windows service is through native code. You 
could use JNDI, or Runtime.exec() to run a net stop  net start 
script, or a perl script, or a vbs one... there are many options here :-)

Apart from protecting the page, I would also implement a first step with 
a countdown, so you can abort the restart operation if you want :-P

Regards,
Rodrigo Ruiz
Tim Funk wrote:

I have heard of this done by using a second webserver with perl 
installed and then using Perl Win32 calls from webserver A to 
webserver B to restart the server.

You could always run the other webserver on a high protected port so 
you don't need a second box.

-Tim

Altug B. Altintas wrote:

Hi
How can i restart Tomcat which is running as service, from a web page
1 - calling bat file ? (not working)
2 - calling http://localhost:8080/manager/html/start?path=/engine  
(asking
password)
 


-
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: OutOfMemoryError

2003-12-03 Thread Rodrigo Ruiz
Christopher Schultz wrote:

So, moving on, what usually happens is that a low memory condition 
triggers a GC (usually a full GC). When the GC runs, it needs some 
memory to work with. If it cannot allocate memory for itself, it will 
die with an OOM. If the heap hasn't increased, yet, then the GC cannot 
allocate more objects on the heap to do it's thing. That can explain 
why you get an OOM when you are way under the heap size in the 
output of ps.


Hi Christopher, I have a doubt with respect to your explanation. Is 
there any difference between an OOM thrown within the GC thread, and any 
other OOM?

I mean, if an OOM is thrown within the GC, and it dies, the JVM looses 
its GC, so no memory can be deallocated, and the only way is to shutdown 
the JVM. But what happens if the OOM is thrown in any other thread? Is 
the JVM state preserved in this case?

As said in another post, generally speaking, an OOM leaves the JVM in a 
bad state. But, can this state be detected by checking the state of any 
of the JVM threads? I guess the GC should run in a thread I could get a 
reference from. If I check this reference liveness, could I determine if 
the OOM has affected the GC?

I have developed some web services that can return an important amount 
of data.  Under high load, the server memory requirements can become 
huge, so I added a loop into the catalina script to restart my tomcat 
instance automatically, and added a filter that catches OOMs and forces 
a JVM shutdown, after writing some logs asking for more memory. I was 
wondering if I could reduce the shutdown condition to only the cases 
when the GC has died.

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


Re: org.apache.catalina.valves.RemoteHostValve

2003-11-27 Thread Rodrigo Ruiz
Instead of denying access, try to allow it. I think the valve should 
accept this syntax:

Valve className=... allow=localhost,127.0.0.1,other IPs/

If you only deny access from other intranet computers, you are allowing 
access from internet

HTH,
Rodrigo Ruiz
Drinkwater, GJ (Glen) wrote:

Hi 

I have tried to put 

Valve className=org.apache.catalina.valves.RemoteHostValve
deny=*.subnet.ac.uk/ in my context but it keeps on throwing an exception 

Catalina.start: java.lang.IllegalArgumentException: Syntax error in request
filter pattern *.subnet.ac.uk
Can wild cards be used in this context?

Does anybosy know how to only allow the localhost to access the server
/context???
Glen

-
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: Using authenticated URLs

2003-11-26 Thread Rodrigo Ruiz
Hi all,

I am trying to implement a downloading web service that will act as an
internet front-end for an intranet server. I want my service to return a
file as an attachment. For this, I have a method like this (simplified 
code):

 public DataHandler download(String path) throws AxisFault {
   String authInfo = getUserName() + : + getPassword();
   String sUrl = http://; + authInfo + @ + getServerHost() + :
   + getServerPort() + /files/ + path;
   try {
 URL url = new URL(sUrl);
 return new DataHandler(url);
   }
   catch (MalformedURLException e) {
 throw new AxisFault(Invalid path, e);
   }
 }
In order for Axis to send the URL contents as an attachment, I need to 
return a javax.activation.DataHandler instance. This object does not 
have any method to set authentication info.

The intranet server requires Basic authentication credentials, that is
why I add user / password to the URL. The problem is that it does not
work. The code fails with:
java.io.IOException: Server returned HTTP response code: 401 for URL: ...

I have made some tests, and finally, I have found that when I try to use
url.openStream() for a URL with user / password data, no Authentication
header is sent to the server. Surfing the JDK source code, I can see
there are BasicAuthentication and DigestAuthentication classes in the
sun.net.www.protocol.http package. I guess they should do what I need,
but I am trying to figure out how to activate their functionality.
Currently, I am creating a custom sun.net.www.protocol.http.Handler
subclass that extracts the getUserInfo() data from the URL and adds the
Basic Authentication header to the created URLConnection. It works, but
I do not like to have Sun classes dependencies in my code, and it will
fail if I try to connect to a server requiring Digest authentication.
Does anybody have some experience in this subject?
I wonder if there is something missing in my code. Perhaps a call
to activate the authentication mechanism, or something similar?
Thanks in advance,
Rodrigo Ruiz


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


Re: hot deploy

2003-11-21 Thread Rodrigo Ruiz
Leonardo Kenji Shikida wrote:

is there an easy way to deploy a web application over another existent
one without stopping tomcat and without killing the current sessions?
 

Hi Leonardo,
You can redeploy a webapp through the admin or manager applications. I 
have not tested myself, but I think that if you configure a persistent 
session manager (you can find more info on this in the configuration 
reference), active sessions should be stored before the webapp shutdown, 
and reloaded upong restarting it.

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


Re: [OT] Synchronising database access

2003-11-21 Thread Rodrigo Ruiz
If you implement your database access as a static synchronized method, 
only one instance of the class will be able to execute it at the same time.
If you put all your database stuff in the same class, this schema should 
be enough. If only one servlet does database access, then you can put 
these methods on the servlet, but if you have more than one servlet 
doing this stuff, you should place your code in a separated class.

Apart from this, take into account that this will be a, generally 
speaking, very weak solution. In a general scenario, other applications 
(or webapps) could be accessing your database. In those cases, the only 
safe solution are database transactions :-)

HTH,
Rodrigo Ruiz
Antony Paul wrote:

thanks for the reply
synchrosing servlet code dont work ?
Antony Paul

- Original Message -
From: Peter Guyatt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, November 21, 2003 5:28 PM
Subject: RE: [OT] Synchronising database access
 

Hi There,

Use a singleton class to manage the database transactions.

Then implement a owner mechanism. E.g.

class DbTxMgr {

String owner = null;

public synchronized boolean lockMgr (String threadId) {
if (owner == null) {
owner = threadId;
return true;
} else {
if (owner.equals(threadId)) {
return true
}
return false;
}
}
public synchronized void releaseMgr (String threadId) {
if (owner != null) {
if (owner.equals(threadId)) {
owner = null;
}
}
}
public synchronized boolean insert (String statement, String threadId) {
if (owner == null) {
owner = threadId;
}
if (owner.equals(threadId)) {
file://do the transaction
}
}
}
your code

class tester {
file://name of your thread
Thread t = new Thread(testerThread)
...
if (lockMgr(t.getName())) {
file://do database code
}
lockMgr.releaseLock(t.getName());
}

This way olny the owner of the lock can perform transactions and all other
threads must wait for the lock to be released
Thanks

Pete

-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED]
Sent: 21 November 2003 11:51
To: Tomcat Users List
Subject: [OT] Synchronising database access
Hi,
   I want to synchronise all database access. There are lots of
   

situations
 

where first first a select query is performed to get the results and then
insert/update data. I dont want to implement row level locking or
   

optimistic
 

locking. I just want to synchronise the whole process. Only after a thread
completes the entire process other threads can execute the code. How to do
it. Do I have to synchronise on Connection or on this or implement
SingleThreadModel. I also want to know how much extra time a synchronised
block requires than an unsynchronised block.
Antony Paul.

-
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: Is this a bug???

2003-11-20 Thread Rodrigo Ruiz
Do you have any other tomcat installed on the machine? I sometimes 
forget to set the correct value to my CATALINA_HOME / CATALINA_BASE 
environment variables ;-P

Regards,
Rodrigo Ruiz
Gabriel Jenik wrote:

Chris...

Thanks for answering...

Maybe that's the problem... I don't know...I am just stattring on this...

The strange thing is that I've just installed it... I haven't made any
modifications to anything... just installed the tomcat...
Could it be something with the configuration on my PC??? Do you think I
should report it as a Bug??
Thanks

Gabriel
- Original Message -
From: Christopher Schultz [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 7:53 PM
Subject: Re: Is this a bug???
 

Gabriel,
   

Hi...

I've read all the stuff about repoting bugs, but I still don't want
to report this, cause I don't know if this is a bug or not...It is
too hard to know... isn't it?
Here is the deal... I have clean installation. Every first time,
after startup, I try to get to the tomcat administration, I get
this error... Then I just reload the page and everithing works
great I've tried to stop the tomcat administration application
and then re-start it... and I still get the error on the first
attempt to surf to the application..
what's this???
 


   

org.apache.jasper.JasperException: Malformed \u encoding.
 

  at

   

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
 

It looks like you have a JSP that you've run through native2ascii (or
used your own escape codes), and one of them is bogus. Look in your JSPs
for the string \u and see if any of those references are broken.
-chris

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



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.542 / Virus Database: 336 - Release Date: 18/11/03


-
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: Can Tomcat run on JRE only?

2003-11-20 Thread Rodrigo Ruiz
Thierry Thelliez wrote:

My understanding is that the full JDK is needed for compiling JSPs. What if
the JSPs are already compiled? Can on deploy a JSP site without the full
JDK, only the JRE? Can I deploy the site without the JSP files themselves?
With a copy of the work directory?
 

AFAIK, the full JDK is needed only for compiling the servlets generated 
from your JSPs. If you only have servlets or precompiled JSPs, the JRE 
should be enough.
I think you can even compile JSPs with only the JRE if you provide a 
javac replacement, as jikes

If you recompile JSPs, remember to add the extra servlet declarations in 
your web.xml deployment descriptor. If you do not do so, they will not work.

HTH,
Rodrigo Ruiz


Thanks,

Thierry

 



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


Re: Tomcat OpenJMS Design Pattern?

2003-11-19 Thread Rodrigo Ruiz
You could check this article

http://www.onjava.com/pub/a/onjava/2001/12/12/openjms.html

HTH,
Rodrigo Ruiz
Gavin, Rick wrote:
Hi All,
 Just wondering if any could post a working design pattern for using
openJMS or another open 
JMS engine with tomcat, preferably a model using asynchronous queue message
handling.  I 
figured someone around here has done it and I would rather use a tried and
true model.  

Looking for some basics about best intregration method, and or for dealing
with async message
Handling.
I currently have openJMS setup using persistent Database storage, using JNDI
content lookup to
Get the JMS connection factory, is this better looked up once and bound to
servlet context as an 
Application scope variable, etc, etc?

Thanks for you any help,

Rick

 



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


Re: Tomcat Settings advice on long-running process.

2003-11-12 Thread Rodrigo Ruiz
Elankath, Tarun (Cognizant) wrote:

Hi list,

We have a long running process (all in java, not external) that is initiated from struts action class, (does a lot of file I/O, etc)

The browser apparently timesout after about 20 minutes or whereabouts, and then suddenly the process do stops bang in the middle as soon as this happens. This is quite puzzling as one expects the process to continue even if the browser timed out.
 

If you do not write anything to the servlet output, perhaps Tomcat is 
assuming some kind of connection timeout or it is somehow detecting that 
the remote browser has broken the connection. I guess you cannot change 
this behaviour.

I do know the correct solution is to make it run in the background and give constant updates to the user, however, we just need to make it work ASAP with the correct approach. We'll migrate to the background process  progress page approach soon enough.
 

That's correct. IMHO you should move to this approach ASAP. Otherwise, 
you could encounter migration problems and bugs, due to some differences 
in how to make thing work. Remember your thread will have to notify 
state changes to a listener, or publish state data for your structs 
action to be able to get it. You should take this into account right 
now, even before migration :-)

Any pointers/comments on browser (Internet Explorer), server (Tomcat) settings and Struts settings to handle long-running activities in the web-request cycle would be greatly appreciated. I did scout the web, but apart from the connectionTimeout setting in the connector element of tomcat, I didn't find anything much. I don't think increasing session-timeout would be of any help here.
 

If you have access to the servlet output from your process, you could 
write something to it from time to time. If, for example, you write 
html right at the beggining of your servlet process, you can write 
dummy comments like !-- --. If you put these statements in the right 
point, you could keep the connection alive until the process finishes. 
If you do this, remember to do an out.flush() after the writing.

I once did something similar. I wrote an html page with two divs 
simulating a progress bar. My process started just before writing the 
/html tag. During the process I was sending a javascript code that was 
updating the inner div width according to the current state of the process.

This worked for me, but it made my process code far more complex than 
necessary... and than maintainable :-P

Finally, I dropped that code and replaced it by a background thread 
approach.

Hope this helps you,
Rodrigo Ruiz
Any pointers on how to avoid the 'freeze' would also be much appreciated. 

Thank you,
Tarun
 



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

 



-
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: encoding problems with XML

2003-11-10 Thread Rodrigo Ruiz
Special characters can be written using a escape syntax. This syntax 
is something like XXX;. where XXX is a numerical code in decimal 
format (or in hexadecimal if you precede it by a numeral (#) sign.

Depending on the character encoding being used in your XML file, the 
code will vary for non ASCII characters. You can find conversion tables 
in the web via google. Just search for character table and your 
encoding charset name.

For the ampersand, the sequence would be #38;

HTH,
Rodrigo Ruiz
Edson Alves Pereira wrote:

Hello folks, i´m trying to write some special characters in a XML
file, like:
company Doubs  Noble/company
But i don´t known the right encoding to [  ] be validate properly,
any idea?
Regards,
Edson


 



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


Re: static variables and context

2003-11-07 Thread Rodrigo Ruiz
If your class is present only in the WEB-INF/lib directory of your 
webapps, there will be separated singletons for each one.
If you put the jar in $CATALINA_HOME/common/lib or 
$CATALINA_HOME/shared/lib, the class loader will take the class from 
there, so there will be only one shared instance for all your webapps.

Magne Skjeret wrote:

Hi

I just need someone to confirm my belives.

I have a jar file added to my WEB-INF/lib
I create a singleton of one of my classes.
In another context I have the same jar file, so it is duplicated. And 
I create a singleton of the same class there.

I thought that each context had its own classloader so that a 
singleton was private for each context. But now I have doubts.

Can anyone shed some light on this.

Magne

-
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: Access static content ...

2003-11-07 Thread Rodrigo Ruiz
The problem is the /resources entry. If you map it to the default 
servlet, the directory name itself will not be part of the path, but a 
root for the actual one, so the default servlet will understand you 
want to get the path following resources, and it is . I guess the 
same will happen with the contents of the directory.

It seems that the default servlet cannot be configured to serve files 
from an alternative directory.

You could try one of the following:
 - Create your own servlet for resources requests. Perhaps you could 
subclass DefaultServlet, or use it in any other way.
 - Implement a Filter that redirects any request not to resources to 
your own servlet, and let the default configuration to work for the 
resources directory.



Samuel Le Berrigaud wrote:

Thanks for your help,

I'll do it another way I think and I'll probably come back on that 
problem later on.

SaM

Tim Funk wrote:

Then there is either
- a bug in tomcat
- a config error (most likely) but don't know what could be the culprit
I never heard of this before. Seems quite odd.

-Tim

Samuel Le Berrigaud wrote:

Yes

Tim Funk wrote:

[Need more coffee]

Does that mean that http://myserver/context/resources is serving a 
dir listing of the contents from http://myserver/context ?
(instead of /context/resources)

-Tim




-
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: specifying web app classpath in server xml?

2003-11-07 Thread Rodrigo Ruiz
In server.xml you can specify an alternative class loader for your 
context webapp (see configuration reference on the tomcat docs). You 
will have to dig into the Tomcat code, but you may create a subclass of 
the default class (or use it as a template), and add some mechanisms to 
include extra directories at the same level as WEB-INF/lib. You could, 
for example, make it use a system property, or  add xml properties for 
configuring it from server.xml

A bit advanced, and very non-standard, but it may work for your 
development environment :-)

Curtis Leach wrote:

I haven't tried this to see if it works, but you can always edit the
catalina.sh or setclasspath.sh files.  It's where CLASSPATH is reset during
the Tomcat startup.  (Or .bat for windows)
Curtis

-Original Message-
From: Anton Modaresi [mailto:[EMAIL PROTECTED]
Sent: Friday, November 07, 2003 9:31 AM
To: 'Tomcat Users List'
Subject: RE: specifying web app classpath in server xml?
My point was exactly I would rather like an extra classspath in the webapp
context declaration so I could skip the work of building a jar for one
project and copy it (or somehow link it) to the other project's web-inf/lib.
When I change in both projects I'd rather tell tomcat to just look a little
extra. So you say the classpath fixed? Am I the only one who want to use
tomcat in this way? how do I suggest this to developers, write to the other
mailing list?
regards, artin

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: den 6 november 2003 15:11
To: Tomcat Users List
Subject: RE: specifying web app classpath in server xml?


Howdy,
Can you symlink your WEB-INF/lib/otherProject.jar to the other's
project's build directory?
You can't declare classpaths in server.xml.  The classpath hierarchy is
fixed.
Yoav Shapira
Millennium ChemInformatics
 

-Original Message-
From: Anton Modaresi [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 06, 2003 5:29 AM
To: [EMAIL PROTECTED]
Subject: specifying web app classpath in server xml?
Hi,
I would like to specify additional classpaths for a web app
beside the WEB-INF/lib WEB-INF/classes and common/lib directories.
My reason is I have a project using code from another project.
In a production environment you would jar the classes from the
used project and put it in the WEb-INF/lib of the other
but in development, where both projects may be updated all the time,
I'd prefer to skip the extra overhead of either jaring all files,
or recompile the classes a second time to the WEB-INF/classes of
the taget project..
So I am wondering, is there a way, I can say in my server.xml,
hey please go and check in this additional classpath too for this
particular web app. is this possible?
(Im using tomcat 5.0.7)
   



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]
-
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: response.sendRedirect()

2003-11-07 Thread Rodrigo Ruiz
You should only loose your session if session cookies support is 
disabled, and
 - the redirected URL has not been rewritten to add the session id, or
 - you redirect to another context / server

in the second case the passed session id will be invalid, or ignored, 
depending on the case.

Sometimes I have lost my session because I was not calling the 
getSession() in my servlet. This led my servlet engine to not properly 
set the response cookies.

Hope it helps you,
Rodrigo Ruiz
Duncan wrote:

Is it normal to loose your session when using the
response.sendRedirect() command?
If so is there a way to redirect without loosing the session?

Cheers, Duncan.
Decker Telecom Ltd
-
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: Tomcat crash

2003-11-07 Thread Rodrigo Ruiz
Start your tomcat instance with catalina run instead of startup. 
This will make your tomcat run in the same console you invoke it from, 
and will let you its output when it stops :-)

[EMAIL PROTECTED] wrote:

That's a good Idea but the console window close when tomcat crash so nothing 
can be read. 
Can I redirect the console output to a file ?

Scrive Ben Souther [EMAIL PROTECTED]:

 

There is no stack trace in the console window when the server crashes?

Try putting a 'System.out.println(page/servlet name);' at the top of all

of your pages. Then you can see which page was the last one hit before the 
server crashed. 



On Friday 07 November 2003 11:06 am, [EMAIL PROTECTED] wrote:
   

Thanks for your ideas.

I can see the console window but because the crash happens casually I
 

can't
   

see everytime the server screen and also reproduce the circumstances
because I can't understand which are.
The server crash only with my own app. and I don't have System.exit

For the same reason I can't understand which code create the problem.

Thanks again

Scrive Ben Souther [EMAIL PROTECTED]:
 

There is no console window, even when you start Tomcat with the
catalina.bat
file?

Can you reproduce the circumstances that caused it to crash?  Does it
crash when you are hitting the exaple apps or only when you are hitting
your own app?  If it's your own app, or a third party app, can you post
the code to the JSP/Servlet that was being hit when the server crashes? 
Do you have any

calls to System.exit(0) in your code?

On Friday 07 November 2003 10:48 am, [EMAIL PROTECTED] wrote:
   

Unfortunately when tomcat crash I can't see the console window so
 

I
   

don't have any message useful to start the debugging...

Scrive Anton Modaresi [EMAIL PROTECTED]:
 

do you get an exception in the console window? If the tomcat window
vanishes, you can try starting with the catalina batch file instead
of the startup batch file.
regards, anton

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: den 7 november 2003 16:34
To: [EMAIL PROTECTED]
Subject: Tomcat crash


Hello, I'm new to Tomcat and Apache so I'm wasting a lot of time
trying to understand why Tomcat sometimes shutdown by itself or
better it crash This
happen without messages in the log file .
can someone have some experience in that solved the problem ?

Thanks to all.

   

-
   

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]
 

--
Ben Souther
F.W. Davison  Company, Inc.


-
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]
 

--
Ben Souther
F.W. Davison  Company, Inc.


-
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: Which is the winner----Singleton Class or Base Servlet????

2003-11-06 Thread Rodrigo Ruiz
I totally agree with Justin. One object instantiation does not take more 
than a few milliseconds. This is not a performance issue. Object 
instantiation becomes an issue only when a great number of objects are 
constantly being created. This is the case of, for example, JDBC 
connections or sockets in your server (that is why pooling is the best 
strategy for them), but not of a singleton.

As for your performance tunning, it seems to me that you have taken good 
decissions: using oracle connection pooling, and using a native server 
for your video clips.

Maybe you could switch from IIS to Apache. Independently of religious 
ideas, Apache has a very good performance, many experts recommend it 
over IIS due to important security bugs in IIS, and it can run on other 
platforms, so you could install the server on a Linux box. I do not want 
to begin an OS war discussion, just pointing that you could reduce 
costs, as Linux is free ;-)

Regards,
Rodrigo Ruiz
Justin Ruthenbeck wrote:

At 05:07 PM 11/5/2003, you wrote:

In addition to what others have said, why don't you ask your highly
knowledgeable friend for proof of what he's claiming?
Anyway his answer to this question is,-- using base servlet does not
create a separate object instance as it is done when using a singleton
class.That way u use one object less from JVM point of view.However this
answer did not solve my quest.


Really?  That's the reason?  Ignore it.

Choosing to implement something in a base class or in a singleton is a 
decision based on your app's architecture -- choose whichever is more 
clear and/or more maintainable for you.  There may be performance 
issues involved, but that would have to be discussed with specific 
examples ... in any case, this is not one of them.

justin

-
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: Installing jakarta on linux RH9

2003-11-05 Thread Rodrigo Ruiz
Looking at the Red Hat 9 Release Notes, it seems that only JDKs prior to 
1.4.1 fail. You are using 1.4.2, so you are not supposed to need the 
LD_ASSUME_KERNEL setting ;-)

The problem comes from a new implementation of the POSIX Thread Native 
Library. This new version corrects some deviances from the POSIX 
standard, so applications that rely on these differences will fail.

Regards,
Rodrigo
Christopher Schultz wrote:

All,

The newest version (4.1.29) should be fine.  If I recall, however, 
there
was a problem with Sun's Java Virtual Machine, and RH9, which used an
incompatible threading library.  


No, on RH 9, all VMs will actually need the LD_ASSUME_KERNEL env 
variable (look in the archives for the details on the problems and 
the workaround).


Is this accurate? I use RH9 with kernel 2.4.20/i686, JDK 1.4.2-b28 
without any LD_ASSUME_KERNEL setting (that I know of).

Is this for a specific kernel version or architecture?

-chris

-
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: Which is the winner----Singleton Class or Base Servlet????

2003-11-05 Thread Rodrigo Ruiz
Both techniques have their advantaes and disadvantages. A singleton
class usually has problems when reloading the context. Using a Servlet
Base for JSPs makes you container version dependent (As the minimum
implementation required can change among jasper versions).

Anyway, the performance improvements you can achieve selecting between
these two options are probably minimal. Depending on your webapp DB
load, you could obtain a greater performance boost using a connection
pool. Look at the JNDI DataSource HOW-TO for more info about this :-)

Hope this help,
Rodrigo Ruiz

kgsat wrote:

Dear experts,

It may not be appropriate to ask this doubt here.Though i am aware of it , i
chose to ask here thinking that experts would forgive me.

Now the doubt is...

In a web application, what is the performance difference of using singleton
class and a base servlet to do the database related operations such as
loading the driver, obtaining the dbURL and obtaining the connection
instance for further db operations.
I use a singleton class for my db requirements in jsps and servlets and also
in other beans.
One of my friends suggests that using base servlet to do the same work is
more efficient.
Can any one throw some more light on this topic.i want to improve the
performance of my web application.
Any white papers or pointing URLs are given astounding welcome.
thanks and regards
sat

  




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



Re: Tomcat doesn't start

2003-11-05 Thread Rodrigo Ruiz
It seems you have any non UTF-8 character in your server.xml. Check your 
file and search for accented or any other non ASCII characters.

You can also set the encoding of your xml file including the following 
statement at the beginning:

?xml  version=1.0 encoding=ISO-8859-1?

Changing ISO-8859-1 by the one you need. By default, if not included, 
the parser will suppose the encoding is UTF-8.

HTH,
Rodrigo Ruiz
Didier Wiroth wrote:

Hi,
I've created a custom server.xml when I try to start tomcat, tomcat fails
with this output:
Catalina.start: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte
UTF-8 sequence.
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
   at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source)
   at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
   at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
   at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown
Source)
   at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown
Source)
   at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
   at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
   at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.apache.commons.digester.Digester.parse(Digester.java:1548)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
   at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
   at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
   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.Bootstrap.main(Bootstrap.java:203)
What does that mean?
Thanks
-
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: Which is the winner----Singleton Class or Base Servlet????

2003-11-05 Thread Rodrigo Ruiz
JNDI adds a little performance penalty (extra overhead), and provides 
you more independency from the database layer. If that independency is 
not much important for you, your current configuration will probably 
suit better ;-)

Apart from this, if your app serves video content, a careful tunning of 
your servlet output buffer size, and number of concurrent client 
connections will probably be the best point to optimize. Just curiosity, 
where do you store the video clips? file system, oracle or somewhere else?

kgsat wrote:

Hi Rodrigo Ruiz
Thanks for your response.I have been using oracle conneciton pooling
features in my singleton db class for the faster connectivity with the
database from my application.
Should i go for a JNDIDatasource model for the better db access or the
current one will serve the needs.My application is a video download
application   meant for the members of the site.
U have any thing to suggest with respect to database access ?
regards
sat
- Original Message - 
From: Rodrigo Ruiz [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, November 05, 2003 6:23 PM
Subject: Re: Which is the winnerSingleton Class or Base Servlet

 

Both techniques have their advantaes and disadvantages. A singleton
class usually has problems when reloading the context. Using a Servlet
Base for JSPs makes you container version dependent (As the minimum
implementation required can change among jasper versions).
Anyway, the performance improvements you can achieve selecting between
these two options are probably minimal. Depending on your webapp DB
load, you could obtain a greater performance boost using a connection
pool. Look at the JNDI DataSource HOW-TO for more info about this :-)
Hope this help,
Rodrigo Ruiz
kgsat wrote:

   

Dear experts,

It may not be appropriate to ask this doubt here.Though i am aware of it
 

, i
 

chose to ask here thinking that experts would forgive me.

Now the doubt is...

In a web application, what is the performance difference of using
 

singleton
 

class and a base servlet to do the database related operations such as
loading the driver, obtaining the dbURL and obtaining the connection
instance for further db operations.
I use a singleton class for my db requirements in jsps and servlets and
 

also
 

in other beans.
One of my friends suggests that using base servlet to do the same work is
more efficient.
Can any one throw some more light on this topic.i want to improve the
performance of my web application.
Any white papers or pointing URLs are given astounding welcome.
thanks and regards
sat


 

-
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]


JSP verification

2003-11-05 Thread Rodrigo Ruiz
Hi all,

As part of my compilation script I usually precompile all my webapp 
JSPs, to catch all compilation errors.  My ant script is something like:

 target name=compileJsp
   mkdir dir=${jsp.gendir}/
   jspc destdir=${jsp.gendir} verbose=9 srcdir=web
 webapp basedir=web/
 classpath refid=project.classpath /
   /jspc
   javac srcdir=${jsp.gendir} destdir=${jsp.gendir} debug=on
 classpath refid=project.classpath /
   /javac
 /target
This works fine, but compilation errors show line numbers in the 
generated servlets, not in the JSPs (it's logic, as I am compiling the 
generated servlets). I have seen that Tomcat is able to tell me which 
JSP line is incorrect in error pages, so I guess there is a smarter way 
to do this precompilation. Is there any way through ant tasks, or 
through direct java invocation to get it?

Thanks in advance,
Rodrigo Ruiz
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: xhtml and Internet Explorer

2003-11-04 Thread Rodrigo Ruiz
Well, not necessarily unreadable, just different ;-)

I usually play with the tag delimiters to allow some readability. For 
example, my JSPs usually begin with something like:

[EMAIL PROTECTED] contentType=...
   import=...
   import=...
   errorPage=...
%%!
 // class code

%%

 // service code

%!DOCTYPE ... 
...
And if I need to place two directives with no spaces in between, I write

jsp:useBean 
   id=data scope=request class=my.Data
/jsp:getProperty
   name=data property=aField
/
   

It is not as clean as a directive per line, but at least it doesn't hurt too much :-P

Regards,
Rodrigo
Marius Scurtescu wrote:

Hi,

Yes, I totally agree that this issue should be brought
up with the JSP specification. I will look into that.
Even if the suggestion is accepted it will be quite
a while until a specification will deal with this
issue and then even longer until there is going to
be a Tomcat implementation supporting it. We are
talking years I guess :-(
For what I know the specification is not saying
anything about this issue and if Tomcat is implementing
it right now it will not go against the spec.
Keeping strictly with the JSP directives (the issue
can be extended to the JSP tags as well, but it
gets more complicated) common sense is enough, I
hope, to realize that whenever you add a directive
you really don't want an empty line in your output.
These empty lines are annoying at best (every time
you check the source of a page generated by JSP you
first see an empty page - quite stupid), and breaking
your app at worst (like in the case of IE).
The absolute best proof that there is a problem
here that needs fixing is the fact that developers
make their code unreadable just as a work around.
Cheers,
Marius
Rodrigo Ruiz wrote:

Marius, I think such a feature request should not be addressed to 
Tomcat, but to the JSP specification itself. Remember that Tomcat is 
being used as the reference implementation of servlet/JSP 
technologies, and so it should stick to the specification.

Basically, as I see it, your request means a special treatment for a 
subset of directives in a few specific cases. I think it would imply 
that tags could be marked as not generating any output, so when in a 
single JSP line there were only such marked tags and leading / 
trailing spaces among them, the line itself could be omited from the 
output. Such a change should be made from the specification.

Regards,
Rodrigo
Marius Scurtescu wrote:

JSP is a templating language which is using a meta
language: the JSP constructs.
The new line is in the JSP indeed, but is it part
of the meta language or part of the literal output?
I would argue that these new lines are part of the
meta language and that they should not be output.
You put them there so the meta language you use is
readable.
See how FreeMarker, another templating language,
is dealing with this issue:
http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping 

You are not asking the directive to scan anything,
the page compiler could consider white space and newlines
after a directive as part of that directive.
Marius

Adam Hardy wrote:

On 10/30/2003 10:08 PM Marius Scurtescu wrote:

I will consider implementing a filter to remove
the empty lines before the html tag.





-
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: Opinions

2003-11-03 Thread Rodrigo Ruiz
Jejeje, people (in general) should buy better monitors. It looks like 
they skip more than one line when reading on-line docs ;-)

Shapira, Yoav wrote:

Howdy,

 

feature natively. Jakarta Commons' deamon  is a unix-only solution (I
imagine it uses JNI). So its's possible, but not portable. Still an
advanced language...
-Vincent.
   

Aarrggh, Monday morning and I'm already annoyed.  Where did you get the
idea commons-daemon is unix only?  It works on unix and win32 platforms.
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]


 



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


Re: xhtml and Internet Explorer

2003-10-31 Thread Rodrigo Ruiz
Marius, I think such a feature request should not be addressed to 
Tomcat, but to the JSP specification itself. Remember that Tomcat is 
being used as the reference implementation of servlet/JSP technologies, 
and so it should stick to the specification.

Basically, as I see it, your request means a special treatment for a 
subset of directives in a few specific cases. I think it would imply 
that tags could be marked as not generating any output, so when in a 
single JSP line there were only such marked tags and leading / trailing 
spaces among them, the line itself could be omited from the output. Such 
a change should be made from the specification.

Regards,
Rodrigo
Marius Scurtescu wrote:

JSP is a templating language which is using a meta
language: the JSP constructs.
The new line is in the JSP indeed, but is it part
of the meta language or part of the literal output?
I would argue that these new lines are part of the
meta language and that they should not be output.
You put them there so the meta language you use is
readable.
See how FreeMarker, another templating language,
is dealing with this issue:
http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping 

You are not asking the directive to scan anything,
the page compiler could consider white space and newlines
after a directive as part of that directive.
Marius

Adam Hardy wrote:

On 10/30/2003 10:08 PM Marius Scurtescu wrote:

I will consider implementing a filter to remove
the empty lines before the html tag.



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


Re: Use of return statement in servlet.

2003-10-31 Thread Rodrigo Ruiz
Anthony, putting a return in a servlet code will not create any state 
problem for the servlet itself. You could have problems if you have 
opened resources that need finalization or closing before returning, for 
example DB connections, or opened streams others than the servlet input 
and ouput ones, but that depends on the code, and it is independent from 
the servlet engine.

Of course, if you do not redirect to anywhere, or display nothing, what 
you will get in the browser is a neat clean blank page ;-)

I am not sure at all, but I think JSPs could be different, depending on 
the compiler implementation. I think Jasper generated code does not have 
problems with return statements, but I check it with every new release I 
download, just in the case ;-)

What I do is to create a simplest JSP:

!-- JSP beginning --
Hello World
!-- JSP end --
And compile it. Then, looking at the generated servlet code, I check 
that no resource-freeing operations are done after writing Hello Worl 
to the output stream. The moment this happens, the moment I will have a 
lot of problems :-P

Hope it helps you,
Rodrigo
Antony Paul wrote:

Thanks for the reply
I want the browser to point to the query page if user did not provide enough
data or an error happens like database connection is not available. I want
user to re enter data or wait for some time .  So I dont want to use
requestDispatcher.forward()  method or redirect to an error page. I want
to know is there any problems in using the return statement in servlets/jsp.
Antony Paul

- Original Message -
From: Nikola Milutinovic [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, October 31, 2003 12:00 PM
Subject: Re: Use of return statement in servlet.
 

Antony Paul wrote:
   

Hi,
 If any one feel it off topic mark it as off topic.
 I want to exit from a servlet if no database connection is available.
 

For
 

this can I use a return statement in the beginning of a servlet. Will it
cause any state problems. I dont like putting the code in an if block.
 

There
 

will be lots of if blocks.
 

A servlet is a web application component. It is invoked when a web client
   

makes
 

a request. The client expects SOMETHING as a response from the server and,
   

thus,
 

from the servlet.

So, quitting with no response is not a good practice. What you should do
   

is
 

display an error page. There are several ways you can do it,
requestDispatcher.forward() or throw an exception and have custom error
   

pages
 

ready.

Nix.

-
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: Opinions

2003-10-31 Thread Rodrigo Ruiz
Also, depending on the amout of static content in your webapps, having 
an Apache as the front-end can perform better than a standalone tomcat. 
But this depends on numbers you have to get by yourself. Experimenting 
uses to be the best way ;-)

Rodrigo

Vincent Aumont wrote:

François,


Oh, and last but not least, I didn't find a privilege separation 
method in tomcat (like in apache or ssh or postfix, or...). Perhaps 
am I wrong, but, if you want tomcat to run in unpriviledge 
environment, you have to make it bind to a public port (say 8080). I 
use iptables to redirect connections from 80 to 8080:
 

No, you're right.  You can make Apache listen on port 80 while running 
as root because it'll change the process' ownership when it opens a 
new connection. There is no portable way of doing this in Java; 
therefore, you have to run Tomcat as root if you want to make it 
listen on port 80. Of course, that's a major security hole.
I always front-end TC with Apache and use mod_proxy to achieve what 
you're doing with iptables.

-Vincent.

-
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: where should i store a attribute

2003-10-31 Thread Rodrigo Ruiz
Edson Alves Pereira wrote:

	Hello folks, i´m trying to store a database connection in a session
attribute or request attribute, but i must choose a name that just one
thread per time would knowns. Any idea?
 

If you put the attribute in your request, the name does not matter: only 
forwarded or included servlets / JSPs will have access to the object, 
even if the same name is always used.
If you want each request to use a different instance of an object, 
request attributes are the correct place. Session attributes are best 
fitted for instances that must be shared among multiple requests from 
the same user (well, exactly from the same user session ;-).

Anyway, consider also to execute your DB queries internally and put as 
attribute the results instead of the connection. It is usually better :-)

Regards,
Edson
 



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


Re: Virtual Files

2003-10-31 Thread Rodrigo Ruiz
Try to create a servlet-mapping in your web.xml that directs all 
requests in a directory to your servlet / JSP. For example, if you put:

servlet-mapping
 servlet-nameVirtualFileServlet/servlet-name
 url-pattern/vfiles/*/url-pattern
/servlet-mapping
All URLs beginning with [context]/vfiles will be redirected to the 
VirtualFileServlet.  Consult the servlet specification for details on 
the pattern matching algorithm, to know which mappings will be overriden 
by this declaration :-)

HTH,
Rodrigo
Duncan wrote:

Don't know if this is possible with tomcat but;

I need people to be able to request virtual files in a directory of a
web application.
As in:  A user would request a file (which doesn't exist). This would
call a jsp page which would return output based on the name of the file
requested, but the user would still see the filename as the one which
they originally requested.
I thought that perhaps changing the 404 error page to my jsp file may
work, but is it possible to set the 404 error page for just one
directory? I would prefer a differant method if there is one.
Thanks for any help anyone can give.

Duncan Smith
Decker Telecom Ltd


-
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: Virtual Files

2003-10-31 Thread Rodrigo Ruiz
Well, if you don't precompile JSPs,there is another way to map a JSP:

servlet
 servlet-nameMyServlet/servlet-name
 jsp-file/MyPage.jsp/jsp-file
/servlet


jakarta wrote:

You can set up mappings to jsp pages

   servlet
   servlet-nameorg.apache.jps.MyPage_jsp/servlet-name
   servlet-classorg.apache.jps.MyPage_jsp/servlet-class
   /servlet
   servlet-mapping
   servlet-nameorg.apache.jps.MyPage_jsp/servlet-name
   url-pattern/some/dir/you/would/like/to/use/*/url-pattern
   /servlet-mapping
Any page called from /some/dir/you/would/like/to/use/ 
Ie /some/dir/you/would/like/to/use/itworks.jsp

Would go to the MyPage.jsp 

 

-Original Message-
From: Duncan [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 31, 2003 11:02 AM
To: Tomcat Users List
Subject: Virtual Files

Don't know if this is possible with tomcat but;

I need people to be able to request virtual files in a 
directory of a web application.

As in:  A user would request a file (which doesn't exist). 
This would call a jsp page which would return output based on 
the name of the file requested, but the user would still see 
the filename as the one which they originally requested.

I thought that perhaps changing the 404 error page to my jsp 
file may work, but is it possible to set the 404 error page 
for just one directory? I would prefer a differant method if 
there is one.

Thanks for any help anyone can give.

Duncan Smith
Decker Telecom Ltd


-
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: Session vs. Application Replication

2003-10-30 Thread Rodrigo Ruiz
I agree with this inquiry. I think replication of application context
attributes is conceptually as necessary as session replication. I usually
store things like connection information to back-end servers, counters and
other stuff that I need to share among all sessions. If I need to
dinamically modify any of these data, I would like it to be modified in all
cluster nodes.

Regards,
Rodrigo Ruiz

- Original Message -
From: Karthik Duddala [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, October 29, 2003 9:23 PM
Subject: RE: Session vs. Application Replication







 So, is there a way I could do application context replication?

 Karthik Duddala
 Developer - Web Team
 Commerce Technologies
 Ph. 518-886-0700 x. 3881




  Mike Curwen
  [EMAIL PROTECTED]
To
'Tomcat Users List'
  10/29/2003 02:59  [EMAIL PROTECTED]
  PM cc

Subject
  Please respond to RE: Session vs. Application
Tomcat Users   Replication
List
  [EMAIL PROTECTED]
   rta.apache.org







 Looking at the bottom of this page:
 http://www.javagroups.com/javagroupsnew/docs/success.html

 I'd say Filip liked it for Session replication.


  -Original Message-
  From: Karthik Duddala [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 29, 2003 1:56 PM
  To: Tomcat Users List
  Subject: RE: Session vs. Application Replication
 
 
 
 
 
 
 
  Could we use JGroups to replicate application context? Any thoughts ??
 
  thanks
 
  Karthik Duddala
  Developer - Web Team
  Commerce Technologies
  Ph. 518-886-0700 x. 3881
 
 
 
 
 
   Shapira, Yoav
 
   [EMAIL PROTECTED]
 
   .com
To
 Tomcat Users List
 
   10/29/2003 12:28
  [EMAIL PROTECTED]
   PM
cc
 
 
 
   Subject
   Please respond to RE: Session vs.
  Application
 Tomcat Users   Replication
 
 List
 
   [EMAIL PROTECTED]
 
rta.apache.org
 
 
 
 
 
 
 
 
 
 
 
 
  Howdy,
 
  Let's say we have a preferences object in each of the jvms running on
  each
  of the application instances and on one instance we update a
  preference
  (this is a java package that we are using to store user and system
  preferences called java.util.prefs which is a singleton in the JVM,
  part of
 
  Oh, JDK 1.4 preferences are not a trivial example.  The
  backing store could be different from one JVM to another in
  the cluster.
 
  But in general, when we have something that could change at the
  application
  level (and not at the user's session level) we need to find a way to
  communicate that to every other instance
 
  To toss out another approach: you could have a
  PropertyChangedEvent sent to a JMS topic.  All your apps will
  be listening for messages in this topic, and each one can
  handle the PropertyChangedEvent as it needs.
 
  I'm glad you started giving more concrete examples of what
  you're looking for.  Just saying I need application
  replication is confusing at best: it's hard to help with that ;)
 
  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]
 
 
 
 
  -
  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: JSP generated HTML code squashed in one line

2003-10-29 Thread Rodrigo Ruiz
Check your pages do have DOS-style EOLs.

If you have javascript code like:

fuction a() {
  // comment
  ...
}

and IE is merging all in a single line, the closing bracket will become part
of the comment, so the interpreter will fail to find it.

You could check if this is the problem by editing a failing JSP, and
changing all line comments by /* */ (or removing them at all :-)

This problem is common when you pack a war in Unix and put it into a Tomcat
installed under Windows, but this is the first time I hear about it in an
only-windows environment. Why are there differences between XP and 2K, I
cannot say :-(

I have never test it, but I guess there is another workaround if the problem
is the EOL style of your JSPs. In your tomcat, you can modify your
conf/web.xml, and set the mappedfile init parameter of the jsp servlet to
true. This should force jasper to generate JSPs that do a println for each
JSP line, instead of merging multiple static lines into a single print. This
way, the standard EOL sequences will be sent to your browser.

Another approach, if you develop in Unix is to force the correct EOLs before
packaging, for example, through ant task fixCRLF.

Hope this helps you,
Rodrigo Ruiz

- Original Message -
From: Baer Peter Christoph Alexander [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Kokemueller Detlef [EMAIL PROTECTED]; Al-Khwlani
Khaled [EMAIL PROTECTED]
Sent: Tuesday, October 28, 2003 6:15 PM
Subject: JSP generated HTML code squashed in one line


 Hi,

 we have a problem here that looks pretty strange to us. We have
extensively
 searched the mail archive and we googled a lot, but found no suitable
 information. Should we nevertheless ask something obvious, please forgive
 us.

 Here is the problem:
 Tomcat 4.0.6 LE generates HTML pages with a lot of the code compressed
into
 a single line, when running on *some* machines under Windows XP. That is,
 the first line of the generated HTML is very long. This appears to confuse
 MSIE: We see lots of runtime exceptions regarding missing closing braces
 (}).
 On another machine, running Windows 2000, an apparently identical
 installation works just fine. No such runtime errors.

 We found another difference in the work directory tree. The filenames of
the
 servlets on the Win XP machines start with _0002 and contain this string a
 number of times each. On the Win2k computer we have just jspname$jsp.java
as
 the name of the generated servlet.

 We don't know, if the two phenomena are connected, and we are absolutely
 clueless what the differences are caused by.

 If anyone of could give us a hint of how to make the Win XP installations
 work as properly as the Win2k instance, your help will be greatly
 appreciated!

 Our environments are: Windows 2000 (works fine) and Windows XP (sucks),
 J2SDK 1.4.2_01 from Sun and Tomcat 4.0.6 LE.

 Many thanks in advance!

 Regards

 Peter Bär

 -
 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]



Needed more support for catalina.base in Bootstrap

2003-10-28 Thread Rodrigo Ruiz
Hi all,
Recently I have been trying to install and configure an OGSA server
(www.globus.org) deployed over a Tomcat container. The problem I have is
that it requires a lot of Tomcat customization: additional connectors in the
server.conf, additional jars in the common/lib, common/endorsed and
server/lib directories, conf/web.xml modifications, and so.

In order to keep track of these changes, I decided to use a shared Tomcat
installation, and do all the dirty business in a separated Tomcat instance,
pointing CATALINA_BASE to it. Doing this I noticed that there was no place
for putting my common/lib and server/lib jars.

Digging in the source code, I found that CATALINA_BASE is not used at all
when building the common and catalina class loaders.

I think such a feature would be interesting not only for me, but for anyone
who wants (or needs) to use custom valves, realms, etc, and so I have
attached a patch to make it possible.

The patch makes Tomcat to detect if catalina.base is defined to a value
different from catalina.home, and if so, it adds the same directories to the
class paths of the internal classloaders. Using this patch, I can create a
common/lib and a server/lib on my separated Tomcat instance, and they are
added to the correct classpath on startup.

This is my first patch for Tomcat, so any comments or suggestions will be
welcome :-)





GRIDSYSTEMSRodrigo Ruiz Aguayo
Parc Bit - Son EspanyolR  D
07120 Palma de Mallorca[EMAIL PROTECTED]
Baleares - España  Tel:+34-971435085
www.gridsystems.comFax:+34-971435082

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

Re: Needed more support for catalina.base in Bootstrap

2003-10-28 Thread Rodrigo Ruiz
Thanks for your responses, I will follow your suggestions :-)

- Original Message -
From: Shapira, Yoav [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, October 28, 2003 3:16 PM
Subject: RE: Needed more support for catalina.base in Bootstrap



 Howdy,
 What Steve said is right on target.  Your patch is not likely to make it
 into the tomcat code base ;)

 A couple of other pointers, however:
 - Patches are always welcome -- so thanks for contributing ;)
 - Don't attach them to messages: open a bugzilla enhancement request and
 attach your patch, or better yet, a diff file from current sources to
 your patch, in the bugzilla issue.
 - You may wish to discuss the need for and intent of your patch on the
 dev list before writing the patch itself.
 - If you intend to contribute more, which I hope is the case, please
 read the guidelines for getting involved with jakarta:
 http://jakarta.apache.org/site/getinvolved.html

 Yoav Shapira
 Millennium ChemInformatics


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 28, 2003 7:19 AM
 To: Tomcat Users List
 Subject: Re: Needed more support for catalina.base in Bootstrap
 
  From: Rodrigo Ruiz [EMAIL PROTECTED]
 
  Recently I have been trying to install and configure an OGSA server
  (www.globus.org) deployed over a Tomcat container. The problem I have
 is
  that it requires a lot of Tomcat customization: additional connectors
 in
 the
  server.conf, additional jars in the common/lib, common/endorsed and
  server/lib directories, conf/web.xml modifications, and so.
 
  In order to keep track of these changes, I decided to use a shared
 Tomcat
  installation, and do all the dirty business in a separated Tomcat
 instance,
  pointing CATALINA_BASE to it. Doing this I noticed that there was no
 place
  for putting my common/lib and server/lib jars.
 
 This sounds backwards.  When using separate CATALINA_HOME and
 CATALINA_BASE locations,
 
 CATALINA_HOME -
 
   the central location.  Classes used by tomcat (server and common
   respositories) are taken from this location.  You'll also use the bin
   directory for this location.
 
 CATALINA_BASE -
 
   the lightweight installations.  These contain web applications,
   their own logs, own configuration files, and make use of their own
   shared class repositories.  If you think about it, this makes
   sense: separate CATALINA_BASEs can have different web applications,
   so the set of web application library depencies can vary from one
   CATALINA_BASE to the next.
 
 
  Digging in the source code, I found that CATALINA_BASE is not used at
 all
  when building the common and catalina class loaders.
 
 That's correct.  CATALINA_BASE uses the shared class loader, and
 CATALINA_HOME uses common and server.
 
 --
 Steve
 
 -
 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]




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



Re: Forking high loaded servlet

2003-07-07 Thread Rodrigo Ruiz
Depending on the kind of request you are trying to accelerate, you could
also do some caching in the response.
Depending on what the servlet is intended to do, the strategies to apply can
vary a lot.
A description of the servlet execution would allow people to help you better
:)

Regards,
Rodrigo Ruiz

- Original Message -
From: Peter Lin [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, July 04, 2003 5:31 PM
Subject: Re: Forking high loaded servlet



 I haven't followed this thread too closely, but what kind of concurrent
requests you looking at?  i ask this because the number of concurrent
threads in most cases is the result of hardware limitations.

 if you want to double the concurrent requests, get more cpu and multiple
gigabit ethernet cards.  trying to do it with servlet tricks (aside from
server.xml configuration) won't do much in the long run.

 peter


 Sergio Juan [EMAIL PROTECTED] wrote:

 - Original Message -
 From: Diego Castillo
 To:
 Sent: Friday, July 04, 2003 3:05 PM
 Subject: Forking high loaded servlet


  Hi all,
 
  I have a servlet that receives a heavy load. I would like to process
  multiple requests in parallel in order to increase throughput.
 
  Tomcat creates one single instance of the servlet. This is right
  according to servlet specification paragraph 3.2, but it does not suit
  my needs.
 
  I have tried extending SingleThreadModel and Tomcat does create multiple
  instances, but I get the exact same throughput.

 Tomcat automatically creates one thread per request. If your servlet does
 not have synchronization issues, it will be the same creating an object
per
 thread that using the same object (in fact a little heavier in the first
 case, because of the overhead of creating objects).
 
  I have also tried launching a new thread for handling HttpServletRequest
   HttpServletResponse, but as soon as the servlet exits service(), the
  response output stream gets closed by Tomcat.
 
 Same here.. you are launching a Thread inside of an already independent
 Thread.

  Is there any spec compliant strategy to increase the number of requests
  per second that a servlet can handle?
 
 In configuration you can set the processors number, but I think it is not
 the issue. If the problem is that you got a bottleneck in your host (CPU
or
 disk at nearly 100%) you should consider load balancing between multiple
 servers in different machines or using common programming performance
tricks
 (but I think you have already done that).

 Regards.

  Thanks in advance,
 
 
  Diego
 
 
  -
  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]



 -
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!


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



Re: does the getRequestDispatcher().forward() method return control?

2003-04-04 Thread Rodrigo Ruiz
AFAIK, the only way in java to get what you ask for, is to raise an
Exception at the end of the forward() method.
Even doing so, you could wrap the forward() call in a try / catch block,
avoiding whatever mechanism the servlet engine
could use to get the desired behaviour.

Thespecification says that no ouput must be commited from the calling
servlet *before* the
forward() call, but says nothing about conditions after the call (Servlet
2.3 Spec. SRV 8.4).

If normal control flow should be broken after the call, I think the Java
Team would be in great problems ;-)

 Hi,

 I think this is a bug as per the servlet specification.Just check with
some
 other servlet engine. I will forward this error to tomcat developer list.
I
 was tested with Tomcat3.2.2.

 Velmurugan P.
 Java Team.

  Hi,
 
  if in a servlet, I have some code like:
 
  getServletConfig().getRequestDispatcher(/my/page.jsp).forward(request,
  response)
 
  Is it supposed to return control to the servlet afterwards?
 
  From what I find on the net, it isn't, but when I try to print
something
  to System.out after the forward call, that works...
 
  So did I misread on the www, or is this some bug in my webserver?
 
  I'm using JBoss/Tomcat btw...
 
  Thanks,
 
  Hans
 


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



Re: Programmatic login

2002-11-29 Thread Rodrigo Ruiz
I think the same Bill implements with a Valve could be implemented with a
Filter with an HttpRequestWrapper for setting the principal. Am I right?

- Original Message -
From: Bill Barker [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, November 17, 2002 8:53 AM
Subject: Re: Programmatic login


 The following is a bare-bones implemetation.  Posted under the standard
 Apache Licence.

 import java.io.*;
 import java.security.Principal;
 import javax.servlet.*;
 import javax.servlet.http.*;
 import org.apache.catalina.*;

 public class MyValve implements Valve {
 public MyValve() {}

 public void invoke(Request request, Response response, ValveContext
 context)
  throws IOException, ServletException {
  HttpSession session = ((HttpServletRequest)request.getRequest())
 .getSession(false);
  if(session != null) {
 Principal user =
 (Principal)session.getAttribute(my.login.principal);
 if(user != null) {
 ((HttpRequest)request).setUserPrincipal(user);
 }
  }
  context.invokeNext(request, response);
   }
 }


 Zsolt Koppany [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 it sounds very interesting. Could you provide some implementation details
 (source code)?

 Zsolt

 On Saturday 16 November 2002 08:26, Bill Barker wrote:
  setUserPrincipal





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




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




Re: How to add a servlet to a new Webapp

2002-11-28 Thread Rodrigo Ruiz
If you copied the examples web.xml, then you must have a lot of references
to servlet classes and filters not present in your new webapp. This can make
the context not to be created, because of exceptions raised during context
initialization. Try to delete all unused entries before starting the server
:-)

Hope it helps

- Original Message -
From: Curley, Thomas [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, November 28, 2002 2:37 PM
Subject: RE: How to add a servlet to a new Webapp


 Jim - its in both webapps under classes - com.wrox.projsp.ch03.TestServlet

 -Original Message-
 From: Collins, Jim [mailto:[EMAIL PROTECTED]]
 Sent: 28 November 2002 13:35
 To: 'Tomcat Users List'
 Subject: RE: How to add a servlet to a new Webapp


 You mention in your first post that the servlet works if you create the
 package structure in WEB-INF/classes. Is the servlet no longer in this
 directory?

  -Original Message-
  From: Curley, Thomas [mailto:[EMAIL PROTECTED]]
  Sent: 28 November 2002 13:29
  To: Tomcat Users List
  Subject: RE: How to add a servlet to a new Webapp
 
 
  Correct ! - I origionally copied the examples web.xml
 
  -Original Message-
  From: Collins, Jim [mailto:[EMAIL PROTECTED]]
  Sent: 28 November 2002 13:28
  To: 'Tomcat Users List'
  Subject: RE: How to add a servlet to a new Webapp
 
 
  Thomas has got a mapping to the invoker servlet in the web.xml file he
  posted so it should not be a problem.
 
   -Original Message-
   From: mech [mailto:[EMAIL PROTECTED]]
   Sent: 28 November 2002 13:25
   To: 'Tomcat Users List'
   Subject: RE: How to add a servlet to a new Webapp
  
  
   This problem is new with 4.1.12. For security reasons the invoker
   servlet had been disabled in the global /conf/web.xml file.
   This invoker servlet usually loads user servlets that are not mapped
   correctly as far as i understand. This is done by using a default
   mapping /servlet/*.
   In productive systems this should not be done, instead
  correct mapping
   is required.
  
   In the /examples webapp the invoker servlet had been enabled
   again with
   the local web.xml.
   That's why it's working in examples and not in study.
  Because in your
   study web.xml you won't have it enabled manually and thus
  the default
   from /conf/web.xml ist used where this feature is disabled.
  
   Thus the mapping /servlet/... to servlets is just Tomcat
  specifically
   done via the invoker servlet which is now (4.1.12+) disabled
   by default.
   But actually you should not need /servlet/ at all, if your
  mapping is
   correct.
  
   Try
   http://localhost:8080/study/com.wrox.projsp.ch03.Testservlet or make
   a shorter mapping to /study/Testservlet in your web.xml
  
   mech
  
-Original Message-
From: Curley, Thomas [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 28. November 2002 14:06
To: Tomcat Users List
Subject: RE: How to add a servlet to a new Webapp
   
   
Well I also tried
   
  http://localhost:8080/study/servlet/com.wrox.projsp.ch03.TestServlet
   
but the same whereas
http://localhost:8080/examples/servlet/com.wrox.projsp.ch03.Te
stServlet works
   
   
??
   
Thomas
   
   
-Original Message-
From: Collins, Jim [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 13:04
To: 'Tomcat Users List'
Subject: RE: How to add a servlet to a new Webapp
   
   
I believe that servlet has been disabled by default in 4.1.12
for security reasons. That is probably why you can't use:
http://localhost:8080/study/servlet/TestServlet
   
Jim
   
 -Original Message-
 From: Curley, Thomas [mailto:[EMAIL PROTECTED]]
 Sent: 28 November 2002 12:58
 To: [EMAIL PROTECTED]
 Subject: How to add a servlet to a new Webapp


 Hi All,

 Using Tomcat 4.1.12 on Win 2K

 I am getting a 404 error when I try to create a new webapp
 and add a very basic servlet.  The servlet works if I create
 the package structure within the examples WEB-INF/classes.
 Here are the steps:

 1. created webapps/study
 2. created
 .../study/WEB-INF/classes/com/wrox/projsp/ch03/TestServlet.jav
 a and compiled [ok]
 3. added the following line to server.xml after the
 examples /Context

 Context path=/study docBase=study
debug=0 
 /Context
 4. just copied the examples web.xml to study/WEB-INF and
 added the following lines


 servlet
   servlet-name
   TestServlet
   /servlet-name
   servlet-class
   com.wrox.projsp.ch03.TestServlet
   /servlet-class
 /servlet

 servlet-mapping
 servlet-nameTestServlet/servlet-name
 url-pattern/TestServlet/url-pattern
 /servlet-mapping


 5. restart tomcat


 RESULT - The requested resource 

Re: How to add a servlet to a new Webapp

2002-11-28 Thread Rodrigo Ruiz
Thomas,

filters are classes that preprocess / postprocess servlet requests. Defining
a filter, you are instructing the server to pass the requests to a specified
filter, instead of directly passing it to the servlet. Filter is responsible
of redirecting the request to the servlet between pre and postprocess.

If you remove from your web.xml all filter, and filter-mapping tags, the
webapp should still work properly.

As some pointed in previous messages, the invoker servlet was disabled in
Tomcat 4.1.12. This was done because of a security hole that allowed  a
hacker to obtain the source code of your JSPs through direct invocation to
this servlet.

The invoker servlet is the one used for serving requests of the style
/servlet/MyServlet. This means that having the invoker servlet disabled
you cannot access your servlet with such a URL.

But you have an entry in your web.xml that makes the last point irrelevant:

servlet
  servlet-nameTestServlet/servlet-name
  servlet-classcom.wrox.projsp.ch03.TestServlet/servlet-class
/servlet
servlet-mapping
  servlet-nameTestServlet/servlet-name
  url-pattern/TestServlet/url-pattern
/servlet-mapping

With these lines you are specifying that you can access your servlet
directly with a URL with the form:

http://yourserver/study/TestServlet

Without the /servlet/ part. URLs with /servlet/ are useful for accesing
servlets that don't have an associated mapping, but in your case, as you
explicitly mapped it to /TestServlet, you can use this mapping.



- Original Message -
From: Curley, Thomas [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, November 28, 2002 3:14 PM
Subject: RE: How to add a servlet to a new Webapp


Hi,

this is now working thanks to you all.

Attached is the web.xml. As Rodrigo stated I pruned it down and it turns out
that at a min I need the 'Servlet Mapped Filter', the invoker mapping.

If anyone can explain the web.xml file in plain lang / what filters do and
how to get rid of the invoker then please do


Thomas






-Original Message-
From: Curley, Thomas
Sent: 28 November 2002 13:48
To: Tomcat Users List
Subject: RE: How to add a servlet to a new Webapp


thanks - will try

-Original Message-
From: Ruiz [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 13:46
To: Tomcat Users List
Subject: Re: How to add a servlet to a new Webapp


If you copied the examples web.xml, then you must have a lot of references
to servlet classes and filters not present in your new webapp. This can make
the context not to be created, because of exceptions raised during context
initialization. Try to delete all unused entries before starting the server
:-)

Hope it helps

- Original Message -
From: Curley, Thomas [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, November 28, 2002 2:37 PM
Subject: RE: How to add a servlet to a new Webapp


 Jim - its in both webapps under classes - com.wrox.projsp.ch03.TestServlet

 -Original Message-
 From: Collins, Jim [mailto:[EMAIL PROTECTED]]
 Sent: 28 November 2002 13:35
 To: 'Tomcat Users List'
 Subject: RE: How to add a servlet to a new Webapp


 You mention in your first post that the servlet works if you create the
 package structure in WEB-INF/classes. Is the servlet no longer in this
 directory?

  -Original Message-
  From: Curley, Thomas [mailto:[EMAIL PROTECTED]]
  Sent: 28 November 2002 13:29
  To: Tomcat Users List
  Subject: RE: How to add a servlet to a new Webapp
 
 
  Correct ! - I origionally copied the examples web.xml
 
  -Original Message-
  From: Collins, Jim [mailto:[EMAIL PROTECTED]]
  Sent: 28 November 2002 13:28
  To: 'Tomcat Users List'
  Subject: RE: How to add a servlet to a new Webapp
 
 
  Thomas has got a mapping to the invoker servlet in the web.xml file he
  posted so it should not be a problem.
 
   -Original Message-
   From: mech [mailto:[EMAIL PROTECTED]]
   Sent: 28 November 2002 13:25
   To: 'Tomcat Users List'
   Subject: RE: How to add a servlet to a new Webapp
  
  
   This problem is new with 4.1.12. For security reasons the invoker
   servlet had been disabled in the global /conf/web.xml file.
   This invoker servlet usually loads user servlets that are not mapped
   correctly as far as i understand. This is done by using a default
   mapping /servlet/*.
   In productive systems this should not be done, instead
  correct mapping
   is required.
  
   In the /examples webapp the invoker servlet had been enabled
   again with
   the local web.xml.
   That's why it's working in examples and not in study.
  Because in your
   study web.xml you won't have it enabled manually and thus
  the default
   from /conf/web.xml ist used where this feature is disabled.
  
   Thus the mapping /servlet/... to servlets is just Tomcat
  specifically
   done via the invoker servlet which is now (4.1.12+) disabled
   by default.
   But actually you should not need /servlet/ at all, if your
  mapping is
 

Re: bug in tomcat converting xml using xslt?

2002-11-28 Thread Rodrigo Ruiz
Dionisio,
Your transformamaquinas bean is internally calling response.getWriter().
This interfere with the JSP, as it calls the same method internally to
create the out variable.

If you use this code inside a servlet you should have no problem.

For using the bean in a JSP, you should use out, instead of the
getWriter() return value. If transformamaquinas is yours (it seems so, by
the package name ;-), you should try to add an alternative method in which
you pass out too, instead of only the request. This way you will have no
problems with JSPs.

I suppose you pass the request to be able to call other request methods. If
you don't use it, you could also replace the parameter, instead of adding a
new one.


- Original Message -
From: Dionisio Ruiz de Zarate [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 28, 2002 4:16 PM
Subject: bug in tomcat converting xml using xslt?


 Hello from the

http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/work/Stylizer.java
 i have load one classe and i have transform it (i attach the classe).
 this class run welss on RESIN , this class transform one XML using one
XSLT
 tempalte and produces HTML.
 for using i make this:
 jsp:useBean id=transformamaquinas scope=page
 class=utils.formateo.Transformacion /

 and where i whant to show the XML transform i writte this:
 %
 //esta String (kk) hay el resultado de una consulta a una bd que me lo
mete
 en formato xml, bien fomado y validado.
 String kk = maquinas.selectTodasMaquinas(0, 0, 1,0);
 //la xslt
 String xslStyleSheet = application.getRealPath(HomeMaquinas.xslt);
 //la transformacion
transformamaquinas.Transforma(kk, xslStyleSheet, response);
%


 this in resin works well but in tomcat 4.1.12 show the bellow error. Can
you
 help me? thanks

 ERROR:

 2002-11-28 00:10:52 StandardWrapper[:invoker]: Loading container servlet
 invoker
 2002-11-28 00:10:52 HostConfig[pruebas.irudia.com]: Deploying
configuration
 descriptor xml.xml
 2002-11-28 00:11:20 StandardWrapperValve[jsp]: Servlet.service() for
servlet
 jsp threw exception
 org.apache.jasper.JasperException: getWriter() has already been called for
 this response
  at

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
 48)
  at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at

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

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

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
 va:260)
  at

org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
 eNext(StandardPipeline.java:643)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
 va:191)
  at

org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
 eNext(StandardPipeline.java:643)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at
 org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
  at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
 )
  at

org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
 eNext(StandardPipeline.java:643)
  at

org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
 java:170)
  at

org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
 eNext(StandardPipeline.java:641)
  at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
 )
  at

org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
 eNext(StandardPipeline.java:641)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
 :174)
  at

org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
 eNext(StandardPipeline.java:643)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
  at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:256)
  at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:361)
  at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:563)
  at


Re: Tomcat NT Service Runtime.exec()

2002-11-25 Thread Rodrigo Ruiz
At least, doing so you should be able to test you are doing things well. We
have developed a service (an internal project, not Tomcat related), and it's
able to execute any program, including shells.

Check the security policy used by your Tomcat service. Perhaps you are not
allowed to call the Runtime.exec() method.


- Original Message -
From: Jacob Kjome [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, November 25, 2002 5:29 PM
Subject: Re: Tomcat NT Service  Runtime.exec()



For each NT service, there is an option called Allow service to interact
with desktop under Properties / Log On.  Check that option and what you
ask for should work just fine.



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




Re: How does servlets know it is a page refresh?

2002-11-21 Thread Rodrigo Ruiz
Take a look at this example chapter from the book Core J2EE Patterns:

http://vig.pearsoned.com/samplechapter/0130648841.pdf

On page 10 of the pdf (43 on the book :-), it speaks about this subject, and
a good strategy to address it

Hope it helps,
Rodrigo


 I have some servlets serving html pages from the servlet engine.
 suppose the user click the refresh button of the browser. How
 does the servlet know that the user wants a refresh of the page?

 My servlet needs to know if it is a refresh since if it processes the
 same request twice in a row, it may produce  unexpected results
 by the issuing the same comand twice.



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




Retrieving SSL client certificates from the Request

2002-11-21 Thread Rodrigo Ruiz
Hi all,

Can I retrieve the SSL client certificate from an incoming request and use
it in another one?

Let me explain the background:

We have implemented a server that only accepts SOAP requests. The purpose of
this server is to act as a job dispatcher for a cluster of N machines. The
jobs to execute are defined by the users, so we designed it to have a public
API (accesed via SOAP calls), with which we can define jobs, upload
executable files and resources and control execution in the cluster.
Currently, it uses basic authentication for all connections, but we are
planning to pass to a two-way SSL authentication model in a short time.

Users access this server through different front-ends, ones more specialized
than others. Some of them are themselves web applications.

We want our front-end to capture the client certificate from a request, and
use it to authenticate itself in its calls to our SOAP server. We need this
capability, because each user can have different permissions, and we don't
want all connections through the front-end to be made with a common
certificate. Also, we want to avoid the need to register the clients in
our front-end, as it should act as a simple proxy to our soap service.

Is this possible from a servlet? We are now using Tomcat 3.3.1, and
migrating to 4.1.12 for client certificate authentication support.

Any help would be appreciated

--
GRIDSYSTEMSRodrigo Ruiz Aguayo
Parc Bit - Son EspanyolAnalista Programador
07120 Palma de Mallorca[EMAIL PROTECTED]
Baleares - España  Tel:+34-971435085
www.gridsystems.comFax:+34-971435082


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




Re: 2ND TRY: Developing ASP applications with tomcat

2002-11-20 Thread Rodrigo Ruiz
Giovanni,

If you cannot change the third party library behaviour, then you will have
to put that jar into each webapp.
Anyway, you can put any other library in shared/lib if it does not need to
load resources.

Also, take into account that depending on the way forum.jar was implemented,
it could be impossible to use it in a multi-context environment (for
example, singleton patterns could lead to extrange behaviours in which one
context interfere with others)

The rule of thumb is that no class in shared/lib will be able to see any
class from your webapps. Well, unless you
use Thread.getCurrentThread().getContextClassLoader() to load the class,
of course.

For example, if you write code that does not need to access any class from
your webapp (including forum.jar), you should be able to put it in
shared/lib.

If you use getContextClassLoader().loadClass(), you will have to deal with
the reflection api. This make things harder to program and also a bit
slower.

If there is any other way, sorry, but I haven't heard about it

Hope it helps


- Original Message -
From: Turner, John [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Wednesday, November 20, 2002 3:07 PM
Subject: RE: 2ND TRY: Developing ASP applications with tomcat



 You can share a JAR across Contexts.

 From the ClassLoader HOWTO
 http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

 Shared - This class loader is the place to put classes and resources that
 you wish to share across ALL web applications (unless Tomcat internal
 classes also need access, in which case you should put them in the Common
 class loader instead).

 John


  -Original Message-
  From: Giovanni Cuccu [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, November 20, 2002 8:38 AM
  To: Tomcat Users List
  Subject: RE: 2ND TRY: Developing ASP applications with tomcat
 
 
  At 07:47 20/11/2002 -0500, you wrote:
  John, thanks for the response
 
  My advice would be use a separate tomcat instance for every
  customer, for
  one very simple reason:  if the forums for customer A hang
  for whatever
  reason, you would be able to restart their Tomcat instance,
  and only their
  Tomcat instance.  In your scenario, customers B, C, and D
  would also be
  restarted, losing their sessions and anything in progress.
  If customer B
  happens to be making a big change to a database at the time,
  they would be
  screwed.
 
  yes it's true, but if I use different contexts I can reload
  each context
  with no problem.
  I agree about issues on consumption of shared resource such
  as memory,
  file/socket descriptor.
 
 
  Yes, from an academic standpoint it makes sense to try and
  use the same JAR
  file for every customer or site, but in practice that isn't
  always the best
  way to go if the big picture is considered.  Since customers
  in an ASP
  scenario pay for disk space, the cost to you for having
  multiple JAR files
  is zero.  In addition, you may run into situations in the
  future where
  customer A pays for a version upgrade of some software
  (requiring a new JAR
  file) but customer B does not.  How would you handle that if
  they shared the
  same JAR?
  
  John
 
  I agree with you, but consider a lot of little customers with
  low traffic
  (in the example 50 message forum/DAY) I believe using a jvm
  for each of
  these could be a waste of resources. About the question of
  version update
  an ASP application can have updates included in the annual
  fee, and for
  reducing internal costs all customers should have the same
  software version
  (I believe this is recommended if you want make ASP model profitable).
 
  What it's still unclear to me is if: is it possible to share
  the same jar
  between contexts (with the restrictions of the classpath I
  explained before
  (I think the answer is  negative but I'd like to have a
  confirm on this))?
 
  thanks in advance
   Giovanni
 
 
-Original Message-
From: Giovanni Cuccu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 3:16 AM
To: Tomcat Users List
Subject: Re: 2ND TRY: Developing ASP applications with tomcat
   
   
At 23:59 19/11/2002 -0800, you wrote:
thanks for the response, but the load occurs in library that
I cannot modify.
my problem is how to share some classes including servlets
and deploying
only the jsp part.
For example consider a forum application
the logic, including servlets is in a jar (i.e forum.jar) and
the jsp in
each context.
If I have multiple customers can I create multiple contexts
on the same
instance or should I startup a different
tomcat instance for each customer?
   
the problem I'm facing is that a class put in the shared lib
cannot load
via classpath a resource file under WEB-INF. returning to
  the forum
example, if the class in the jar try to load a property file
for reading
the configuration it fails 

Re: 2ND TRY: Developing ASP applications with tomcat

2002-11-20 Thread Rodrigo Ruiz
I find the next article clear to understand:

http://otn.oracle.com/oramag/oracle/02-sep/o52oc4j.html

It presents a perspective of the class loading problems that can arise in a
J2EE application. You can skip all the Oracle specific part, if you want. It
makes some mentions to the uses of getContextClassLoader().

For Reflection API, you could start by

http://java.sun.com/docs/books/tutorial/reflect/

and

http://developer.java.sun.com/developer/technicalArticles/ALT/Reflection/

You can use reflection API, for example, to:
- Instantiate an object from the context classloader. For example, objects
from your forum.jar library :-)
- Invoke methods of an object created inside a webapp (get the classloader,
obtain the correct Class, get the Method object and use it)
- Access values of object fields, similar to method invocation case.
- Get resources from the calling context (via the
getContextClassLoader().getResourceAsStream() method)


- Original Message -
From: Giovanni Cuccu [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, November 20, 2002 4:08 PM
Subject: Re: 2ND TRY: Developing ASP applications with tomcat


 At 15:39 20/11/2002 +0100, you wrote:
 .
 
 The rule of thumb is that no class in shared/lib will be able to see any
 class from your webapps. Well, unless you
 use Thread.getCurrentThread().getContextClassLoader() to load the
class,
 of course.
 If you use getContextClassLoader().loadClass(), you will have to deal
with
 the reflection api. This make things harder to program and also a bit
 slower.
 Rodrigo,
 can you give more details about this (articles on the web, code
snippets,etc)?
 Thanks in advance,
  Giovanni



 Giovanni Cuccu
 Sw [EMAIL PROTECTED]
 Dianoema S.p.A.
 Via de' Carracci 93 40131 Bologna
 Tel: 051-4193911
 e-mail:[EMAIL PROTECTED]
 




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




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




Re: Coyote Connector won't listen on port 8004, only 8009 (Tomcat 4.1.12)

2002-11-19 Thread Rodrigo Ruiz
Brandom, I experienced this problem yesterday. It was a problem with my
CATALINA_HOME variable.

I was starting a Tomcat in directory A, but CATALINA_HOME was pointing to
directory B, and my CATALINA_BASE was undefined. The result: tomcat was
being started up with the B configuration.

Perhaps you are in the same case :_)

- Original Message -
From: Brandon Cruz [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, November 19, 2002 5:29 PM
Subject: RE: Coyote Connector won't listen on port 8004, only 8009 (Tomcat
4.1.12)


 Connector className=org.apache.coyote.tomcat4.CoyoteConnector
port=8004 minProcessors=5 maxProcessors=75
enableLookups=true redirectPort=8443
acceptCount=10 debug=0 connectionTimeout=2
useURIValidationHack=false

 protocolHandlerClassName=org.apache.jk.server.JkCoyoteHandler/

 Even with the above configuration, this connector tries to start up on
port
 8009.  Anyone know why?



 Brandon


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



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




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




Re: Java q: round to n decimal points?

2002-11-14 Thread Rodrigo Ruiz

- Original Message -
From: Josh G [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 7:53 AM
Subject: Java q: round to n decimal points?


 Is there a nice easy way to round a double to n decimal points? I couldn't
 see anything in Math,Double,String, or NumberFormat...

if you want a double result, you can do the following:

double round(double value, int numDecimals) {
  double factor = 1.0;

  // This calculation could be improved for high numDecimal values
  while (numDecimals--  0) factor *= 10.0;

  return Math.round(value * factor) / factor;
}

if you just need it for presentation, it could be enough to have a String
representation:

String getRounded(double value, int numDecimals) {
  String template = 0.000;

  if (numDecimals  0) numDecimals = 0;
  String mask = template.substring(0, 2 + numDecimals);
  java.text.DecimalFormat df = new java.text.DecimalFormat(mask);
  return df.format(value);
}

Hope it helps :-)

PS: The code is not necessarily bug-free or optimal ;-)


 -Josh
 --
 And can you tell me doctor why I still can't get to sleep?
 And why the channel 7 chopper chills me to my feet?
 And what's this rash that comes and goes, can you tell me what it means?
 God help me, I was only 19



 --
 To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org




--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: how many tomcat in a machine?

2002-11-14 Thread Rodrigo Ruiz
It all depends on the workload they must support.

In my single CPU (800MHz / 256Mb / IDE HD), I usually have two or three
Tomcats for development, but
that's because the workload in my machine is very low (only one client, me
:-)

In production, you should test how performance degrades when you add another
Tomcat server. Without benchmarking it's imposible to know the answer to
your question, as it all depends on your applications,
and the use you make of them.

Anyway, a single tomcat instance can be configured to serve multiple web
applications from different ports, or
virtual hosts if you prefer. And it will need less resources than multiple
ones. You could consider it as an option.

Hope it helps

Rodrigo

- Original Message -
From: Jose Antonio Martinez [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 9:49 AM
Subject: how many tomcat in a machine?


 how many tomcat server do you think can i put in a big
 machine like this? :

Memory: 2G
 2*CPU: PIII 1100 Mhz (aprox)
  Disk: scasi raid




 ___
 Yahoo! Messenger
 Nueva versión: Webcam, voz, y mucho más ¡Gratis!
 Descárgalo ya desde http://messenger.yahoo.es

 --
 To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org




--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: Standalone Tomcat : suppress directory listing in web.xml

2002-11-06 Thread Rodrigo Ruiz
Marc, in the message title you say you want to suppress directory listings,
but in the content, you
speak about preventing access to some directories. These are two completely
different things.

Almost all responses you are receiving are directed to the first issue, that
is, preventing Tomcat from presenting
its own directory page when you use a URLs like http://server/dir/.

I can only add that the $CATALINA_HOME/conf/web.xml is just a web.xml
template. You can override most
configurations in that file, by copying the part you are interested in into
your local web.xml, and making any
modification there. Particularly, you can redefine the default servlet, and
configure it as you want. So you don't
need access to the global web.xml file :-)

If we pass to the second issue, I see 3 options:
1. If you want to allow access to some directories only to certain logged in
users, you can setup security constraints in your web.xml, as Craigh pointed
before.
2. If you use those directories only for internal use of your servlets/jsps,
you could move them inside the WEB-INF directory. This way nobody will have
access to them from the web.
3. If you don't want to change directory locations (because there's too much
code to change, for example), you could use security constraints, and allow
access only to an inexistent role.

You said that you cannot change conf/web.xml. I suppose you plan to deploy
your webapp into a tomcat from a third person (client, ISP, or something).
If this is the case, be sure you have some control or knowledge about the
realm used by your webapp. If you cannot control the roles in the realm, the
third option can be insecure, as you will not control if a specified role
exists or will exist in the future.

Hope it helps!


- Original Message -
From: Marc Mendez [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 9:12 AM
Subject: Re: Standalone Tomcat : suppress directory listing in web.xml



 - Original Message -
 From: Craig R. McClanahan [EMAIL PROTECTED]

  You can suppress directory indexes in the $CATALINA_HOME/conf/web.xml
  file.  See the listings init parameter for the default servlet.
 

 Read my previous post.

 
  You have complete control over which requests your filter applies to,
  because you are defining a filter-mapping for it.  In particular, if
you
  use a URL pattern of /* in your filter mapping, then *all* requests
for
  your webapp will go through the filter.
 

 Ok, I'll check


 --
 To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org




--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Test

2002-11-06 Thread Rodrigo Ruiz
Please, ignore this mail. I'm just testing my messages arrive to this list

--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: Standalone Tomcat : suppress directory listing in web.xml

2002-11-06 Thread Rodrigo Ruiz
Marc, in the message title you say you want to suppress directory listings,
but in the content, you speak about preventing access to some directories.
These are two completely different things.

Almost all responses you are receiving are directed to the first issue, that
is, preventing Tomcat from presenting its own directory page when you
use a URLs like http://server/dir/.

I can only add that the $CATALINA_HOME/conf/web.xml is just a web.xml
template. You can override most configurations in that file, by copying the
part you are interested in into your local web.xml, and making any
modification there. Particularly, you can redefine the default servlet, and
configure it as you want. So you don't need access to the global web.xml
file :-)

If we pass to the second issue, I see 3 options:
1. If you want to allow access to some directories only to certain logged in
users, you can setup security constraints in your web.xml, as Craigh pointed
before.
2. If you use those directories only for internal use of your servlets/jsps,
you could move them inside the WEB-INF directory. This way nobody will have
access to them from the web.
3. If you don't want to change directory locations (because there's too much
code to change, for example), you could use security constraints, and allow
access only to an inexistent role.

You said that you cannot change conf/web.xml. I suppose you plan to deploy
your webapp into a tomcat from a third person (client, ISP, or something).
If this is the case, be sure you have some control or knowledge about the
realm used by your webapp. If you cannot control the roles in the realm, the
third option can be insecure, as you will not control if a specified role
exists or will exist in the future.

Hope it helps!


--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: Authentication per-container level

2002-11-05 Thread Rodrigo Ruiz
 Hello,

 Is it possible to configure Tomcat, that it must check an authentication
 for all the webapps hosted
 within the container ?
 I mean tell Tomcat to send an authentication popup when someone goes to
 the http://localhost:8080/.
 whithout configure each webapp hosted in.

You can modify the conf/web.xml file, and add security constraints. This
will cause all web-apps to follow these restrictions.
This file is used by Tomcat as a template for all web.xml files, so any
modification there will be equivalent to a
modification in all deployed webapps.

Also, you may want to activate the once-login support (I'm not sure about
how to do this right now).


 Iris

Hope it helps,
Rodrigo


--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: Security RISK !

2002-10-29 Thread Rodrigo Ruiz
I think the idea of letting Apache directly access to the files into the
webapp is interesting. This way there is no need to replicate the static
content for Apache, and Apache will be faster serving all static content
than Tomcat .

But, at least in my experience, static files tend to be localized. Probably,
a better approach would be to configure Apache to access some subdirectories
into the webapp, such as /images and /js directories if they exist. If you
mantain dynamic files separated from static ones, this task will be even
easier. This way, you can let Apache serve your static content without
compromising security, and without replicating files.

- Original Message -
From: Tim Funk [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, October 24, 2002 12:08 PM
Subject: Re: Security RISK !


 401/404 - Forbidden vs not found doesn't matter as long as the intruder
 is forbidden. Relying on confusing the user is a nice technique to
 preventing intruders since it may waste more of their time and make them
 more likely to give up. But that may make others more determined to try
 to break in.

 Depending on how apache is configured, the intruder will be able to view
 the HTTP response header and seeing you may be running mod_jk/mod_webapp
 or whatever. The intruder can also see if you are running jhtml,jsp, or
 /servlet/ - it will be easy to deduce you are using some servlet engine.
 Some servlet engines also set a session cookie per webapp. It would be
 easy to deduce that jsessionid cookie for /myfooapp indicates that
 /myfooapp is a webapp and it has a WEB-INF. So I will first ask for:
 http://bar/myfooapp/WEB-INF/web.xml. And hope I have a novice config and
 next ask for: http://bar/myfooapp/WEB-INF/ to see if I can get a
 directory listing. Then the fun really begins.

 Personally - I like my way better since I run multiple webapps on our
 servers. That way I don't have to explicitly protect each WEB-INF.
 (Which could get forgotten while installing a new webapp)


 Veniamin Fichin wrote:
  Tim Funk wrote:
 
  You'll want to protect your WEB-INF directory as well as any
  properties files. You can do that by using by the following in your
  httpd.conf: (This should be the syntax)
 
  Files ~ \.properties$
  Order allow,deny
  Deny from all
  Satisfy All
  /Files
 
  Directory ~ /WEB-INF/
  Order allow,deny
  Deny from all
  Satisfy All
  /Directory
 
 
  Recently I did something else. Say, I have a webapp named mine in
  Tomcat, and have this line in httpd.conf:
 
  Alias  /mine /var/www/tomcat/webapps/mine/web
 
  I've made the web direcroty following recommendations described in
  section Source Organization of Tomcat docs
  (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/source.html).
  So, instead of denying any access to WEB-INF directory, I wrote:
 
  Alias /mine/WEB-INF /something_that_does_not_exists
 
  And, when I access http://localhost/mine/WEB-INF , I get 404 Not found
   error instead of 403 Forbidden . I think you will be more confusive for
  the intruder if he'll be told that WEB-INF don't even exists there.
  Or is this less secure to do that?
 
 
 


 --
 To unsubscribe, e-mail:
mailto:tomcat-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
mailto:tomcat-user-help;jakarta.apache.org




--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Environment variables in server.xml

2002-10-15 Thread Rodrigo Ruiz

Does Tomcat 4 still support environment variables into its server.xml file?

We would like our tomcat instances to automatically choose their HTTP port
from an environment variable.
It worked in Tomcat 3.3, doing something like:

TOMCAT_OPTS=-Dhttp.port=$HTTP_PORT

and using ${http.port} in our shared server.xml file.

Is it still possible to do this?

Thanks in advance

--
GRIDSYSTEMSRodrigo Ruiz Aguayo
Parc Bit - Son EspanyolAnalista Programador
07120 Palma de Mallorca[EMAIL PROTECTED]
Baleares - España  Tel:+34-971435085
www.gridsystems.comFax:+34-971435082


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




How to limit the number of connections per user?

2002-10-11 Thread Rodrigo Ruiz

Hi, is there any way to do this?

I would like to be able to limit the number of connections per user for
production environment.

--
GRIDSYSTEMSRodrigo Ruiz Aguayo
Parc Bit - Son EspanyolAnalista Programador
07120 Palma de Mallorca[EMAIL PROTECTED]
Baleares - España  Tel:+34-971435085
www.gridsystems.comFax:+34-971435082


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




Error in servlet: Out of memory in PUT method

2002-10-07 Thread Rodrigo Ruiz

Hi all,

I am working with Tomcat 3.3.1. I have implemented a servlet that processes
PUT requests, in order
to upload files to my server.

I am doing some workload tests, and when I try to upload a file over
70Mbytes (aprox.), the server
response shows an Out Of Memory Error.

My servlet gets some headers for authorization, and after that, it gets the
request input stream and starts
to write the file.

I have written some strings at the beginning and at the end of my servlet.
If I upload a small file, all goes
Ok. If I try to upload a big one, it raises the exception without even
executing the System.out.println().

It seems like Tomcat trying to get all request before passing control to the
servlet.

Is it a consequence of the way Tomcat 3.3.1 serves requests? (I know PUT
messages are not HTTP 1.0, but 1.1).

Upgrading to Tomcat 4 could solve this problem?

Thanks in advance

--
GRIDSYSTEMSRodrigo Ruiz Aguayo
Parc Bit - Son EspanyolAnalista Programador
07120 Palma de Mallorca[EMAIL PROTECTED]
Baleares - España  Tel:+34-971435085
www.gridsystems.comFax:+34-971435082


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




Re: Setting thread prority in Tomcat

2002-09-13 Thread Rodrigo Ruiz

See inlines :)

- Original Message -
From: Tim Funk [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, September 12, 2002 7:15 PM
Subject: Re: Setting thread prority in Tomcat


 Nope. A servlet may run in any thread. The servlet itself may adjust its
 priority (if allowed by the security manager). But you would need to
 remember to also lower it since the next request (to maybe a normal
 servlet) to run in that thread would also run at that priority.


A way to do this could be with a Filter. Just set the priority to the
desired level before service is called, and return it to its original value
after servlet process.

 Personally - unless who are running a high load site and the servlet is
 cpu intensive and long running - I don't think you'll notice a
difference.


I'm not sure, but I suppose a change in servlet thread priorities could have
an important impact on performance. If the thread has higher priority than
the thread receiving requests, a CPU intensive servlet will slow the rest of
the server. Just be careful :-)


 Takumi Fujiwara wrote:
  Hi,
 
  Could someone please tell me if it is possible to
  adjust the priority of servlet serving thread based on
  which servlet it is serving?
 
  For example, I have 2 servlets in my Web Application.
  All threads serving Servlet 1 will have higher prority
  than Servlet 2.
 
  Can I config that in TomCat?
 
  Thanks for any help.
  Sam
 
  __
  Do you Yahoo!?
  Yahoo! News - Today's headlines
  http://news.yahoo.com
 
  --
  To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
mailto:[EMAIL PROTECTED]
 
 
 


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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.386 / Virus Database: 218 - Release Date: 10/09/2002


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




Re: RE: RE: Problems with class loader

2002-09-06 Thread Rodrigo Ruiz

Just an idea:

I would create a subclass of Hashtable, rewriting serialization code so it won't call 
Hashtable code. I mean something like this:

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeInt(this.size());
  for (Enumeration keys = this.keys(); keys.hasMoreElements(); ) {
Object key = keys.nextElement();
Object value = this.get(key);

out.writeObject(key);
out.writeObject(value);
  }
}

and the opposite for the readObject method.

This way, there is no object creation out of your webapp, while keeping the Hashtable 
interface (just take care in hashtable creation and deserialization code. The rest 
remains the same)

It seems to me that copying JRE libs into the webapp will cause a very big memory 
overhead, as *ALL* core classes will be loaded twice in the JVM.

Hope it helps :)

Rodrigo

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 9:15 AM
Subject: RE: RE: RE: Problems with class loader


 Hi Charlie,
 
 thanks for your mail.  After some heavy thinking (gee, this topic lasted
 longer than expected! :-) ), we came to the following conclusion:
 
 We will copy the HashTable.class to the application library.  We believe
 this is the best we can do because
 
 (1) we maintain the concept of storing all classes, libraries and
 information as close as possible to the application itself,
 (2) even if HashTable.class changes between different JDKs, we have to
 watch only this happen (i.e., the change of the JDK).  Now, this will
 happen, say, once every other year ;-)
 (3) the other alternatives we were discussing are not applicable because
 the expose too much code to too many classloaders.
 
 The good thing is: we can be somewhat sure that the only class other than
 our own classes is HashMap.class.  Also, if necessary, we can copy the JRE
 libs to the application.
 
 I think this concludes this discussion.  Thanks a lot for the discussion we
 had.  I enjoyed it very much!
 
 Jürgen
 



Re: Processor Availability

2002-08-30 Thread Rodrigo Ruiz

Sending a QUIT signal works in Unix (Linux and Solaris), but Ctrl-D doesn't
do anything in Windows 2000. Anybody knows something about it?

Jeff, what kind of processing are you doing in your JSP/servlets? You could
be experiencing deadlock problems. It's just an idea :-)

Best regards,
Rodrigo Ruiz

- Original Message -
From: Glenn Nielsen [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 2:20 AM
Subject: Re: Processor Availability


 A good way to debug these types of problems is to tell the JVM to do a
 Thread stack dump.  By reviewing the stack for each processor you can
 get an idea of what may be causing a problem.  On unix you send the
 JMV a -QUIT signal.  On Windows I think you use CTRL-D in the console
 for Tomcat.

 Another thing to check is whether long JVM garbage collection (GC) times
 are causing requests to stack up.  While the JVM is doing GC handling of
 requests by Tomcat freezes.

 To get GC data add the arg -verbose:gc to your JVM startup options.

 Regards,

 Glenn

 Marinko, Jeff wrote:
  Thanks for the reply, Craig.  I pretty much figured that was how it
worked,
  but I was hoping for some kind of time out mechanism.  Somehow, someway,
I
  am able to lock up all 200 processors I defined for my Connector in TC
  (4.0.4, Java 1.4, Win2K).  I'm guessing it is the machine that is at
fault
  (very low powered), and that since each request potentially opens a
  connection to another machine, that may be the cause of the locking.
 
  Thanks!
 
  -Original Message-
  From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, August 27, 2002 4:19 PM
  To: Tomcat Users List
  Subject: Re: Processor Availability
 
 
 
 
  On Tue, 27 Aug 2002, Marinko, Jeff wrote:
 
 
 Date: Tue, 27 Aug 2002 13:45:05 -0700
 From: Marinko, Jeff [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: Processor Availability
 
 Greetings!
 
 Tomcat uses processors to service requests, as processors free up, they
 
  then
 
 move on and process other requests.
 
 
  Each processor also possesses a thread, so you can think of the set of
  available processors as a thread pool.
 
 
  My question is this:  Is there any way
 to lock up all the processors?
 
 
  Sure ... if you send n+1 simultaneous requests when you've only got
n
  available processors, you're going to run out (assuming that each
request
  takes enough time for all of them to get submitted before the first ones
  start completing.
 
  Such things happen occasionally when you get spkies of request activity,
  but it's usually a transient condition.  The analog in plain old web
sites
  is when a site gets Slashdotted :-).
 
 
  Is there a maximum time before a processor
 becomes available again, assuming it is taking to long to process a
 
  request?
 
  The amount of time your app takes to process a request is totally up to
  your app.  There's nothing Tomcat can do if you decide to execute a
  database query that takes 5 minutes because you're selecting through a
  million rows without using an index.
 
  The time it takes Tomcat to return the processor to the pool when a
  request is completed is as small as we can make it (a few milliseconds
on
  a typical configuration).  There's no motivation (or code in Tomcat) for
  keeping a processor unavailable any longer than it has to be.
 
  Besides processors, there might be contention for available threads
and/or
  TCP/IP socket resources in your operating system.  There are also VERY
  wide variations in the maximum number of threads a particular OS+JVM
  combination can support -- the Volano Report http://www.volano.com
makes
  interesting reading in this regard.
 
 
 Any way to check how many processors are active/in use?
 
 
 
  There's nothing built in, but it would be straightforward to create a
  Valve that was stuck on the Engine (so it could see all requests to all
  webapps).  Because this Valve will be executed by multiple threads at
the
  same time, maintaining a simple counter that is incremented at the start
  of a request and decremented at the end would give you an active count.
 
  For the requests being processed by a particular webapp, you could do
the
  same thing (and portably to boot) using a Filter mapped to /*.
 
 
 Jeff
 
 
 
  Craig
 
 
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]
 
 
 
  --
  To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
mailto:[EMAIL PROTECTED]




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




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




Re: Processor Availability

2002-08-30 Thread Rodrigo Ruiz

Thank you very much!

- Original Message -
From: Randall R Schulz [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, August 30, 2002 6:02 PM
Subject: Re: Processor Availability


 Rodrigo,

 CTRL-D doesn't send a signal on any OS I've ever worked with, including
 Windows.

 Use CTRL-BREAK. You'll get a nice, verbose thread dump. Make sure you've
 configured your console window for at least a few hundred lines of
 scroll-back, because the dump comes very fast. On my system with a newly
 launched Tomcat 4.0.4-LE, there were almost 240 lines after the
CTRL-BREAK.

 Randall Schulz
 Mountain View, CA USA


 At 05:20 2002-08-30, you wrote:
 Sending a QUIT signal works in Unix (Linux and Solaris), but Ctrl-D
doesn't
 do anything in Windows 2000. Anybody knows something about it?
 
 Jeff, what kind of processing are you doing in your JSP/servlets? You
could
 be experiencing deadlock problems. It's just an idea :-)
 
 Best regards,
 Rodrigo Ruiz


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




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




Re: shared classes for engine, service or global context

2002-08-29 Thread Rodrigo Ruiz

I am using Tomcat 3.3.1, and facing the same problem.

We are developing a custom Realm, and need to access some classes from
within a management web-app.

If I put my jar in lib/container, the realm starts with no error. If I put
it in /lib/common, it does not.

Is there any way in Tomcat 3.3.1 to achieve this?

PS: You can check this behaviour simply moving tomcat_modules.jar from
lib/container to any other lib directory.

Thanks in advance,
Rodrigo Ruiz


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




Re: Client Certificates on Tomcat 3.3.1

2002-08-21 Thread Rodrigo Ruiz

Ok, a step forward

After some changes in my certificates, I have a client that successfully
sends its certificates to the server.

From the browser, it doesn't connect at all (no certificate pop ups, and no
connection stablished)

Explorer requests now raise the following exception in Tomcat:

Thread-17, WRITE:  SSL v3.0 Handshake, length = 2825
Thread-17, READ:  SSL v3.0 Alert, length = 2
Thread-17, RECV SSLv3 ALERT:  warning, no_certificate
SSL -- handshake alert:  no_certificate
Thread-17, SEND SSL v3.0 ALERT:  fatal, description = handshake_failure
Thread-17, WRITE:  SSL v3.0 Alert, length = 2
PoolTcpEndpoint: Handshake failed
javax.net.ssl.SSLException: javax.net.ssl.SSLProtocolException: handshake
alert:  no_certificate
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:61)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
...

But my java client does the handshake correctly. I am using the same
certificates in both cases, any idea about the problem with Explorer?

The java client is working with BASIC authorization level. It still doesn't
work with CLIENT-CERT.

- Original Message -
From: Tathagat (London) [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 6:02 PM
Subject: RE: Client Certificates on Tomcat 3.3.1


 1 thing is still unclear to me. DO YOU SEE THE CERTIFICATE POP UP WHEN YOU
 CONNECT TO THE SERVER?

 If not you have to include your client side certificate store into your
 $JAVA_HOME\jre\lib\security\cacerts keystore. using keytool -import with
 -trustcacerts option

 I use.

 keytool -import -alias drkw_root -file InvestmentBankCA_root.pem
 -trustcacerts -keystore cacerts -v

 Tell me if you see the certificates already pop up when you connect to the
 website, then I will try to find if anything else is going wrong.

 cheers
 Tathagat

 -Original Message-
 From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 20, 2002 17:54
 To: Tomcat Users List
 Subject: Re: Client Certificates on Tomcat 3.3.1


 Tathagat, at this moment I am generating my own self-signed server and
 client certificates :-P

 I have no .pem files, as I don't rely on any third provider. The keystore
I
 am using in my server has the following entries:

 thawtepersonalfreemailca, Fri Feb 12 21:12:16 CET 1999, trustedCertEntry,
 thawtepersonalbasicca, Fri Feb 12 21:11:01 CET 1999, trustedCertEntry,
 verisignclass3ca, Mon Jun 29 19:05:51 CEST 1998, trustedCertEntry,
 thawtepersonalpremiumca, Fri Feb 12 21:13:21 CET 1999, trustedCertEntry,
 thawteserverca, Fri Feb 12 21:14:33 CET 1999, trustedCertEntry,
 verisignclass4ca, Mon Jun 29 19:06:57 CEST 1998, trustedCertEntry,
 verisignserverca, Mon Jun 29 19:07:34 CEST 1998, trustedCertEntry,
 verisignclass1ca, Mon Jun 29 19:06:17 CEST 1998, trustedCertEntry,
 thawtepremiumserverca, Fri Feb 12 21:15:26 CET 1999, trustedCertEntry,
 verisignclass2ca, Mon Jun 29 19:06:39 CEST 1998, trustedCertEntry,
 tomcat-sv, Tue Aug 20 16:39:06 CEST 2002, keyEntry,

 The last entry is my own server certificate.

 From this point, using the KeyMan tool, I do this:

 1. Create an empty keystore
 2. Import the server certificate as a CA certificate into this new
keystore
 3. Create a new key pair
 4. Create a .csr file
 5. From the server keystore, create a certificate for this .csr (it
creates
 a .cer file with a X509 certificate chain)
 6. Create a PKCS #12 token
 7. Import the .cer created at point 5
 8. Save the token (as a .pfx file)

 Once I have this file, I import the server certificate in the trusted CA
 provider store (I can do this directly from the pop-up window that shows
the
 browser on server connection).

 Finally, I import the .pfx file into Explorer.

 Is it enough importing the server certificate, or do I have to generate a
 .pem file for my server certificate? If so, which tool should I have to
use?

 Now it seems to connect to the server, but it still receives an HTTP 401
 error message.

 My web-app has activated the CLIENT-CERT authentication scheme. If I relax
 this to BASIC, all seems to work fine. The browser shows the user/password
 dialog box, and I am in :-)

 Could it be a problem related to the realm? How do you specified the list
of
 valid users? In CLIENT-CERT mode, you don't have user/password info.

 Thanks a lot!

 - Original Message -
 From: Tathagat (London) [EMAIL PROTECTED]
 To: 'Tomcat Users List' [EMAIL PROTECTED]
 Sent: Tuesday, August 20, 2002 5:14 PM
 Subject: RE: Client Certificates on Tomcat 3.3.1


  ok,
  what you have to do is put the certificate provider into your java's
  security file.
 
  keytool -import blah blah (options)
 
  what you have

CLIENT-CERT Authorization in Tomcat 3.3.1

2002-08-21 Thread Rodrigo Ruiz

I want to configure a webapp to use CLIENT-CERT authorization.

How do I specify which client certificates are allowed to access my webapp?

Thanks in advance

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




Client Certificates on Tomcat 3.3.1

2002-08-20 Thread Rodrigo Ruiz

Hi all,

I'm trying to setup a secure connection between Tomcat 3.3.1 and a java soap
client.

My soap service simply prints out some request data, and also the content of

request.getAttribute(javax.servlet.request.X509Certificate)

Following some example code I found on Internet (I'm not sure this code
should function)

I have followed the instructions in the xml.apache.org FAQ, and generated
all certificates with keytool.

Firstly, I configured tomcat with clientAuth set to false, and used a basic
authentication scheme in my web-app. It worked fine. When connecting through
my client, the service prints the next info:

Authorization: BASIC
Remote User: tomcat
Secured: true
Principal: tomcat
No client certificate is available

If I set clientAuth to true, it still works, but it keeps showing the No
client certificate available message.

The big problem comes when I configure my web-app to use CLIENT-CERT
authorization scheme.
It simply returns a 401 error code.

Any one can help me, please??

Thanks in advance,
Rodrigo Ruiz Aguayo

PS: Following is the bat file I'm using to generate the keystores:

del server.keystore
del client.keystore

copy %JAVA_HOME%\jre\lib\security\cacerts .\server.keystore
copy %JAVA_HOME%\jre\lib\security\cacerts .\client.keystore

REM Change default passwords
keytool -storepasswd -keystore server.keystore -storepass changeit -new
123456
keytool -storepasswd -keystore client.keystore -storepass changeit -new
123456

REM Create server.keystore
keytool -genkey -alias tomcat-sv -dname
CN=neyade,OU=InnerGrid,O=GridSystems,L=Palma,S=Baleares,C=ES -keyalg
RSA -keypass 123456 -storepass 123456 -keystore server.keystore
keytool -export -alias tomcat-sv -storepass 123456 -file
server.cer -keystore server.keystore

REM Import server certificate as a trusted CA in the client keystore
keytool -import -v -trustcacerts -alias tomcat -file server.cer -keystore
client.keystore -keypass 123456 -storepass 123456

REM Create client keystore
keytool -genkey -alias rruiz -dname
CN=rruiz,OU=InnerGrid,O=GridSystems,L=Palma,S=Baleares,C=ES -keyalg
RSA -keypass 123456 -storepass 123456 -keystore client.keystore
keytool -export -alias rruiz -storepass 123456 -file rruiz.cer -keystore
client.keystore

keytool -import -v -trustcacerts -alias tomcat -file rruiz.cer -keystore
server.keystore -keypass 123456 -storepass 123456


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




Re: Client Certificates on Tomcat 3.3.1

2002-08-20 Thread Rodrigo Ruiz


- Original Message -
From: Tathagat (London) [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 3:22 PM
Subject: RE: Client Certificates on Tomcat 3.3.1


 okay, I have faced so many problems on this.. and finally could do it!
 Please answer the following questions.

 First question: The certificates that you are using on your machine (as
 client), where do you get them from?

I create them with KeyMan from IBM. I have tried to create a X509 Chain,
signed with my server key,
and also a .PFX file with the same characteristics. None seemed to work.
In fact, when I import the certificates into Explorer, it places them into
the Medium CA Providers Tab, and not in the Personal repository. Is it ok?


 Second: When you connect the server (https://localhost:8443) or whatever),
 does your certificate pops up?

The browser only pops up the server certificate, not the client one.
It looks like it does not send my client certificate at all.


 cheers
 Tathagat

 -Original Message-
 From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 20, 2002 11:42
 To: [EMAIL PROTECTED]
 Subject: Client Certificates on Tomcat 3.3.1


 Hi all,

 I'm trying to setup a secure connection between Tomcat 3.3.1 and a java
soap
 client.

 My soap service simply prints out some request data, and also the content
of

 request.getAttribute(javax.servlet.request.X509Certificate)

 Following some example code I found on Internet (I'm not sure this code
 should function)

 I have followed the instructions in the xml.apache.org FAQ, and generated
 all certificates with keytool.

 Firstly, I configured tomcat with clientAuth set to false, and used a
basic
 authentication scheme in my web-app. It worked fine. When connecting
through
 my client, the service prints the next info:

 Authorization: BASIC
 Remote User: tomcat
 Secured: true
 Principal: tomcat
 No client certificate is available

 If I set clientAuth to true, it still works, but it keeps showing the No
 client certificate available message.

 The big problem comes when I configure my web-app to use CLIENT-CERT
 authorization scheme.
 It simply returns a 401 error code.

 Any one can help me, please??

 Thanks in advance,
 Rodrigo Ruiz Aguayo

 PS: Following is the bat file I'm using to generate the keystores:

 del server.keystore
 del client.keystore

 copy %JAVA_HOME%\jre\lib\security\cacerts .\server.keystore
 copy %JAVA_HOME%\jre\lib\security\cacerts .\client.keystore

 REM Change default passwords
 keytool -storepasswd -keystore server.keystore -storepass changeit -new
 123456
 keytool -storepasswd -keystore client.keystore -storepass changeit -new
 123456

 REM Create server.keystore
 keytool -genkey -alias tomcat-sv -dname
 CN=neyade,OU=InnerGrid,O=GridSystems,L=Palma,S=Baleares,C=ES -keyalg
 RSA -keypass 123456 -storepass 123456 -keystore server.keystore
 keytool -export -alias tomcat-sv -storepass 123456 -file
 server.cer -keystore server.keystore

 REM Import server certificate as a trusted CA in the client keystore
 keytool -import -v -trustcacerts -alias tomcat -file server.cer -keystore
 client.keystore -keypass 123456 -storepass 123456

 REM Create client keystore
 keytool -genkey -alias rruiz -dname
 CN=rruiz,OU=InnerGrid,O=GridSystems,L=Palma,S=Baleares,C=ES -keyalg
 RSA -keypass 123456 -storepass 123456 -keystore client.keystore
 keytool -export -alias rruiz -storepass 123456 -file rruiz.cer -keystore
 client.keystore

 keytool -import -v -trustcacerts -alias tomcat -file rruiz.cer -keystore
 server.keystore -keypass 123456 -storepass 123456


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


 --
 If you have received this e-mail in error or wish to read our e-mail
 disclaimer statement and monitoring policy, please refer to
 http://www.drkw.com/disc/email/ or contact the sender.
 --


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




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




Re: Client Certificates on Tomcat 3.3.1

2002-08-20 Thread Rodrigo Ruiz

Tathagat, at this moment I am generating my own self-signed server and
client certificates :-P

I have no .pem files, as I don't rely on any third provider. The keystore I
am using in my server has the following entries:

thawtepersonalfreemailca, Fri Feb 12 21:12:16 CET 1999, trustedCertEntry,
thawtepersonalbasicca, Fri Feb 12 21:11:01 CET 1999, trustedCertEntry,
verisignclass3ca, Mon Jun 29 19:05:51 CEST 1998, trustedCertEntry,
thawtepersonalpremiumca, Fri Feb 12 21:13:21 CET 1999, trustedCertEntry,
thawteserverca, Fri Feb 12 21:14:33 CET 1999, trustedCertEntry,
verisignclass4ca, Mon Jun 29 19:06:57 CEST 1998, trustedCertEntry,
verisignserverca, Mon Jun 29 19:07:34 CEST 1998, trustedCertEntry,
verisignclass1ca, Mon Jun 29 19:06:17 CEST 1998, trustedCertEntry,
thawtepremiumserverca, Fri Feb 12 21:15:26 CET 1999, trustedCertEntry,
verisignclass2ca, Mon Jun 29 19:06:39 CEST 1998, trustedCertEntry,
tomcat-sv, Tue Aug 20 16:39:06 CEST 2002, keyEntry,

The last entry is my own server certificate.

From this point, using the KeyMan tool, I do this:

1. Create an empty keystore
2. Import the server certificate as a CA certificate into this new keystore
3. Create a new key pair
4. Create a .csr file
5. From the server keystore, create a certificate for this .csr (it creates
a .cer file with a X509 certificate chain)
6. Create a PKCS #12 token
7. Import the .cer created at point 5
8. Save the token (as a .pfx file)

Once I have this file, I import the server certificate in the trusted CA
provider store (I can do this directly from the pop-up window that shows the
browser on server connection).

Finally, I import the .pfx file into Explorer.

Is it enough importing the server certificate, or do I have to generate a
.pem file for my server certificate? If so, which tool should I have to use?

Now it seems to connect to the server, but it still receives an HTTP 401
error message.

My web-app has activated the CLIENT-CERT authentication scheme. If I relax
this to BASIC, all seems to work fine. The browser shows the user/password
dialog box, and I am in :-)

Could it be a problem related to the realm? How do you specified the list of
valid users? In CLIENT-CERT mode, you don't have user/password info.

Thanks a lot!

- Original Message -
From: Tathagat (London) [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 5:14 PM
Subject: RE: Client Certificates on Tomcat 3.3.1


 ok,
 what you have to do is put the certificate provider into your java's
 security file.

 keytool -import blah blah (options)

 what you have to import are .PEM files which you get from the
certificate
 providers. Then IE will popup your certificates. Please read keytool
 documentation on sun site and most things will be clear of my mail.

 cheers
 Tathagat



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




Re: How to change the package definition from org.apache.jsp to something else ?

2002-08-20 Thread Rodrigo Ruiz

What about using

 %@ page extends=your.package %

at the beginning of your JSP?

Related to JBuilder:
1. which version of JBuilder are you using?
2. Are you doing remote debugging, or executing Tomcat from within JBuilder?


- Original Message -
From: Eric Gilbertson [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 5:53 PM
Subject: Re: How to change the package definition from org.apache.jsp to
something else ?


 Rob,

 As noted in a previous response, the package name and location of the
 servlet class
 files is server specific and not directly controllable by the user. You
can
 work around
 this by statically compiling your servlets using jspc (use the -p switch
to
 control
 the package name that is used) and packing the resulting class files into
a
 .war file.
 This scheme is also server specific, so you want might to consider
 portability impacts
 before using it.

 HTH,

 Eric Gilbertson

 At 12:50 AM 8/20/2002 -0400, you wrote:
 Hi,
 I have noticed that the default package structure in my servlet source
 files (compiled from JSPs) is org.apache.jsp.
 But the .java and .class files are generated in /work/localhost/_/
 directory.  How can i
 
 1. Force my compiled .java and .class file to go in /work/org/apache/jsp
?
 or
 2. Make .java files to include the right package in .java files (which is
 /work/locahost/_/)?
 
 thanks
 Rob



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




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