Re: Image Viewing

2003-12-12 Thread Erik Wright
How does an image get displayed in a page?

1. The browser receives an HTML page with an IMG tag in it. The IMG tag 
contains a src attr (an HTTP URL).
2. The browser makes another request, for the URL of the image.
3. The server returns the image, which is displayed.

Clearly, if you want an image to be displayed within a web page, the 
image must be available on your server. There is no difference between 
the browser making a request for an URL and the user typing that URL 
into the address bar directly. Maybe you can look at the referer field, 
but of course that can be hoaxed so if you are really trying to keep 
this secure that is not a solution.

If you really want to only provide content to specific users, you must 
provide some sort of access control mechanism. The same mechanism should 
apply to images you wish to protect.

This is all related to the fundamental workings of HTTP.

HTTP is an integral part of how the web works - anyone thinking of 
designing a website (especially using scripting languages, servlets, or 
anyone trying to provide any type of security) should understand at 
least the fundamentals of HTTP.

-Erik

Christopher Schultz wrote:

All,

It would be http://yourserver/yourservlet?param=paramValue";
alt="something">


This still doesn't answer the "original" interpreted question. I don't 
think it's possible to display an image on a page and prevent users 
from browsing to it directly from their browser.

The only thing I can think of is to check the REFERER header to see if 
it came from the page on which you want to display it. That's also not 
foolproof...

-chris

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




--
http://www.spectacle.ca/
The Online Source for Live Music in Montreal
.::514.286.1699::.


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


Re: Confusing - Compression 5.0.16 - Filter or connector???

2003-12-09 Thread Erik Wright
You will be compressing images?! :(

Remember that most image formats - gif, jpeg, png, etc, are already 
compressed. In most cases compressing them again will only gain you 2-3% 
improvement if anything at all. So you will be spending time compressing 
for nothing.

Notice that the "compressableMimeType" attribute that you copied below 
does not include "image/jpeg". That is because whoever configured this 
example file rightly excluded compression of objects that would not 
benefit at all.

If you are expecting compression to make up for a web site that is 
graphic heavy, you will be sorely disappointed. If, however, you have a 
website with significant amounts of text (i.e., large database result 
sets) then you will probably benefit.

-Erik

Ron Andersen wrote:

I am only using one platform and I need the best performance, since I will be compressing images. Therefore, if I use the connector compression, shall I turn the filter compression off(in web.xml). Also, does the connector(in server.xml) support the following attributes??

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

Remy Maucherat <[EMAIL PROTECTED]> wrote:
Shapira, Yoav wrote:
 

Howdy,
Yup, it would be attempted twice (if the request matches both the filter
and the connector, which is the default setup). Personally I prefer the
filter, as it's more portable and not tomcat-specific.
   

I prefer the connector, since it's faster and more powerful (you get the 
regexp based exception list Henri added, etc) :)
If we (ever) get a gz impl that isn't an output stream and could work on 
"straight" byte arrays, we'd also be able to do the compression without 
facade objects at all, which would have the best performance.

 



--
http://www.spectacle.ca/
The Online Source for Live Music in Montreal
.::514.286.1699::.


Re: [off-topic] jakarta, java, indonesia

2003-11-21 Thread Erik Wright
Jakarta is a major city on the island of Java... in addition to being 
capital of indonesia.

The city of Jakarta was built on the island of Java. This is the kind of 
complex thinking that brought us product names like javabeans, kaffe, 
hotjava, espresso, etc...

Who said geeks weren't creative?

-e

Yansheng Lin wrote:

Oh yeah, 'not coincidentally' they say.  I wonder why they name their conference
room 'jakarta' in the first place anyways.  I don't name my bedroom 'Tokyo
Garden'... 

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 21, 2003 12:04 PM
To: Tomcat Users List
Subject: RE: [off-topic] jakarta, java, indonesia



Howdy,
Actually, Jakarta "was the name of the Sun conference room in which the
majority of the meetings leading up to the agreement took place; not
coincidentally, it's also the name of Indonesia's capital.)".  The
meetings and agreement above were between Sun and Apache to come up with
an open-source reference implementation of the Servlet and JSP APIs.
See http://www.javaworld.com/javaworld/jw-06-1999/jw-06-sunapache.html

Yoav Shapira
Millennium ChemInformatics
 

-Original Message-
From: Yansheng Lin [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2003 1:32 PM
To: 'Tomcat Users List'
Subject: [off-topic] jakarta, java, indonesia
Sorry,

What's the connection between this place and the name of jakarta we
   

use?
 

The creator of the jakarta project was born there?

Thanks!



-Original Message-
From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2003 1:39 AM
To: Tomcat Users List
Subject: Re: "hot" deploy
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]
-
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]


 



--
http://www.spectacle.ca/
The Online Source for Live Music in Montreal
.::514.286.1699::.


Re: apache + tomcat + ssl + mod_rewrite

2003-11-10 Thread Erik Wright
If you really believe your mod_rewrite rule is properly configured to 
"send *ALL* traffic to the same URL  but via https" then:

I would double/triple check the access.log files to see if the request 
is actually getting served from the port 80 server.

If I visit www.foo.com and then change the address to www.bar.com and 
then click 'reload' in IE, it reloads www.foo.com. So I suspect that 
what you are seeing is that the browser is not doing what you expect it 
to do.

Next, I would run a packet sniffer (install ethereal, it's pretty easy) 
and actually check out the request being sent by your browser to port 
80. That should give you a better idea what the problem is.

I mean, if you haven't configured your port 80 apache to talk to Tomcat, 
then the page you are seeing in your browser can't be arriving from port 
80... simple as that, no?

- Erik

Andrew Davis wrote:

I have a test server setup with Apache 1.3.27, Tomcat 4.1.27, and 
mod_jk2. Its all running on RH Linux ES 2.1.

Apache is setup on ports 80 & 443. The port 80 config has only the 
basics defined, then has a mod_rewrite rule to send *ALL* traffic to 
the same URL but via https. It also has mod_jk2 setup to forward all 
.jsp & .do requests to tomcat. Tomcat is listening on ports 8080 and 
8009.

All seems to work fine, but there's a hole. If I go to http://qa-wap1, 
I am properly redirected to https://qa-wap1. As I login, follow links, 
etc., I stay on the secure URL. However, if get into a secure URL... 
say https://qa-wap1/submitProfile.jsp and change the URL in my browser 
to http://qa-wap1:80/submitProfile.jsp and refresh the browser, the 
entire page (content and images, both) reloads and looks perfect. The 
obvious problem is that I just circumvented the secure URL concept. 
There's a hole somewhere that I haven't been able to plug. This occurs 
with multiple browsers.

Interestingly, I have an almost identical setup using Apache 1.3.26 
and Resin via mod_caucho. The mod_rewrite rule is the same, but if I 
try to substitute the URL as mentioned above, it immediately puts me 
back on the secure URL as it should.

The relevant portions of the config files are below. I'm hoping 
someone can help me get byond this.

Relevant portion of httpd.conf:


ServerName qa-wap1
ServerAlias qa-wap1.my.domain.com
ServerAdmin [EMAIL PROTECTED]
ErrorLog /var/log/httpd/qa-wap1_error_log
TransferLog /var/log/httpd/qa-wap1_access_log
CustomLog /var/log/httpd/qa-wap1_referer_log referer
CustomLog /var/log/httpd/qa-wap1_agent_log agent
#
RewriteEngine on
RewriteLogLevel 0
RewriteRule ^(.*) https://qa-wap1$1 [R=301]


ServerName qa-wap1
ServerAlias qa-wap1.my.domain.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /usr/tomcat/webapps/Genvault
ErrorLog /var/log/httpd/qa-wap1_ssl_error_log
TransferLog /var/log/httpd/qa-wap1_ssl_access_log
CustomLog /var/log/httpd/qa-wap1_ssl_referer_log referer
CustomLog /var/log/httpd/qa-wap1_ssl_agent_log agent
DirectoryIndex index.htm
# SSL Options
SSLEngine on
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/httpd/certs/qa-wap1.crt
SSLCertificateKeyFile /etc/httpd/certs/qa-wap1.key
# End SSL Options

# Load mod_jk2
LoadModule jk2_module modules/mod_jk2.so
AddModule mod_jk2.c
Relevant portion of workers2.properties

#[logger.apache13]
#level=DEBUG
[shm]
file=/var/log/httpd/shm.file
size=1048576
[workerEnv:]
info=Global server options
timing=1
debug=0
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket.localhost:8009
# Uri mapping

[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/*.do]
worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
[uri:/services/*]
worker=ajp13:localhost:8009
I'm not including my server.xml as I don't think its necessary, but I 
can if it will help. Most interestingly, I decided to circumvent the 
problem by setting a different DocumentRoot for the port 80 vhost, and 
having only a single index.html in the folder and have it do an 
immediate refresh to the secure URL (https://qa-wap1), plus I removed 
the rewrite rules. I would think that in doing this, if I change the 
URL to http://qa-wap1:80/submitProfile.jsp that I should get a 404 
error. Unfortunately, I got the same results as above... the page 
loaded perfectly on the non-secure URL, except for the images.

And since I know someone will ask, when I change the URL 
(https://qa-wap1/submitProfile.jsp) to 
http://qa-wap1:80/submitProfile.jsp and refresh the browser, yes, the 
lock icon goes away. So its not a client caching issue.



--
http://www.spectacle.ca/
The Online Source for Live Music in Montreal
.::514.286.1699::.


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


Re: Severe notification ...

2003-11-04 Thread Erik Wright
From java.sun.com:

To get a full thread dump of a running Java application, send a 
|SIGQUIT| signal to the JVM process. This can be done from command line 
as |kill -QUIT .

I think if you're running the jvm in a console you can do something like 
CTRL-\ or something... Also, there is some option to catalina.sh 
(environment variable or something) that will make it write out the JVM 
pid to a file... see the script for more info.

-Erik
|
Mufaddal Khumri wrote:
Hi,

I am facing this problem in 4.1.18. I havent tried to upgrade yet, but 
would like to know if there is a way in Tomcat to get a dump of my 
tomcat threads and see where the bottleneck is. How do I do this ? Is 
there a facility in tomcat that would allow me to dump its threads and 
allow me to see where the threads are waiting and not moving on ? Is 
there a good utility i can use ?

Thanks.

On Tuesday, November 4, 2003, at 02:45  PM, Erik Wright wrote:

Hi,

I have had this problem exactly, and have been told that it is a bug 
in 4.1.24 to 4.1.27 that has been fixed in 4.1.29. Essentially, when 
working at or near the maximum connections (as defined in the 
Connector config in server.xml) some threads get permanently 
deadlocked or something. I didn't investigate much more than that.

I created my own workaround which is really a hack not worth sharing 
here. Perhaps when I have time I will upgrade to 4.1.29 and see if 
that fixes the problem.

If you do upgrade, please post your results to the list!

Erik

Mufaddal Khumri wrote:

I have my webapp up and running and am stress testing it. After a 
while I get this:

"Nov 4, 2003 1:50:12 PM org.apache.tomcat.util.threads.ThreadPool 
logFull
SEVERE: All threads are busy, waiting. Please increase maxThreads or 
check the servlet status75 75"

I have no idea why all threads would be busy and waiting.

I could raise the value of maxThreads, but that would just delay the 
error from being reported. I need to get a dump of my tomcat threads 
and see where the bottleneck is. How do I do this ? Is there a 
facility in tomcat that would allow me to dump its threads and allow 
me to see where the threads are waiting and not moving on ? Is there 
a good utility i can use ?

Thanks.




--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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




--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


Re: Severe notification ...

2003-11-04 Thread Erik Wright
Hi,

I have had this problem exactly, and have been told that it is a bug in 
4.1.24 to 4.1.27 that has been fixed in 4.1.29. Essentially, when 
working at or near the maximum connections (as defined in the Connector 
config in server.xml) some threads get permanently deadlocked or 
something. I didn't investigate much more than that.

I created my own workaround which is really a hack not worth sharing 
here. Perhaps when I have time I will upgrade to 4.1.29 and see if that 
fixes the problem.

If you do upgrade, please post your results to the list!

Erik

Mufaddal Khumri wrote:

I have my webapp up and running and am stress testing it. After a 
while I get this:

"Nov 4, 2003 1:50:12 PM org.apache.tomcat.util.threads.ThreadPool logFull
SEVERE: All threads are busy, waiting. Please increase maxThreads or 
check the servlet status75 75"

I have no idea why all threads would be busy and waiting.

I could raise the value of maxThreads, but that would just delay the 
error from being reported. I need to get a dump of my tomcat threads 
and see where the bottleneck is. How do I do this ? Is there a 
facility in tomcat that would allow me to dump its threads and allow 
me to see where the threads are waiting and not moving on ? Is there a 
good utility i can use ?

Thanks.


--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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


Re: HOW CAN I USE THREADS IN TOMCAT

2003-11-01 Thread Erik Wright
A servlet is just a Java class. You can do anything you can do with the 
java language, including start threads. The following starts a thread 
that runs some task every 10 minutes. The thread is started in the 
servlet init method. I choose to set the thread to daemon mode, meaning 
that when the main thread of execution shuts down the mailer thread will 
automatically be killed. Otherwise you need to be sure to keep track of 
it and be sure to signal it to shutdown in your Servlet.destroy method.

public class MyServlet extends HttpServlet
{
   private static class MailerThread extends Thread
   {
  public void run ()
  {
 while (true)
 {
 // do something
synchronized (this)
{
   wait (10*60*1000);
}
 }
  }
   }
   // the servlet init method
   public void init ()
   {
  MailerThread thread = new MailerThread ();
  thread.setDaemon (true);
  thread.start ();
   }
   // ... doGet, etc. ...
}
-Erik

Eric C wrote:

Use cron under unix and/or a java app that would use Javamail classes.
Of course you can do it inside a servlet.
- Original Message -
From: "Prince" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Saturday, November 01, 2003 8:51 AM
Subject: HOW CAN I USE THREADS IN TOMCAT
 

Hi,
I need to send a mail automatically at 10 minutes interval. how can i do
this? how can i activate threads in tomcat?
regards
Prince
- Original Message -
From: "Bill Barker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 01, 2003 1:00 PM
Subject: Re: Opinions
   

The recent port of the 3.3 variable-substitution to Tomcat 5 may very
 

well
 

solve your problems here :).  The ports are supposed to move to
commons-digester, so should be available in 4.1.30 as well.
"Francois JEANMOUGIN" <[EMAIL PROTECTED]> wrote in
message
 

news:[EMAIL PROTECTED]
 

 

Hu! It's in early developments or is it suitable for production ?
 

It's ready for production.  People are already using it in production
with tomcat 5.  Of course, I'm biased ;)
   

Well, there is that beta flag in front of tomcat5 that tell me that your
opinion is more than biased :). Of course, I saw a mail telling that the
beta flag is related to specification instability (not code), anyway...
 

It's a Developer, rather than Sysadmin, option.  Chances are you won't
need to worry about it as you'll use commons-daemon with tomcat, which
already does the required jsvc invocation for you.
   

Well, that does not help that much. I hope that there will be a
configuration scheme that'll let easily define user/group/port and so on
 

for
   

the connectors. Just waiting for a sysadmin point of view :).

Thanks,

François.



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


 



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


Re: Tomcat + JK2 ==> Host (sous domaines) dynamiques ?

2003-10-31 Thread Erik Wright
Essayez

[uri:*.monsite.com]

i.e., sans pas ("path" en anglais)

Aux documentations, on trouve:

If the uri name doesn't have a slash then it is considered as a
virtual host directive.
ou, si le nom d'URI n'a pas une '/', c'est consideré comme directive d'hôte virtuel.

Mais, la tienne a une '/', peut-etre c'est pour ce que ça ne marche pas.

Bonne chance!

- Erik

GL wrote:

Bonjour

Ma config : apache + tomcat + jk2

J ai mon site www.monsite.com qui est dirigé vers ma webapp.

J aimerai créer dynamiquement des hosts style user1.monsite.com ,
user2.monsite.com, etc ...
Je gère mon dns, *.monsite.com est dirigé vers la bonne IP, celle du serveur
Apache :) Donc si je ping user1.monsite.com tout est ok.
Dans apache, j ai un virtual host www.monsite.com avec un alias
*.monsite.com , aucun souci
Dans tomcat :



*.monsite.com



Le souci se situe au niveau de JK2 / Tomcat :

Pour le moment j ai :
[uri:www.monsite.com/*]
   worker=ajp13:localhost:8019
==> OK, www.monsite.com marche bien

Mais si je met :

[uri:*.monsite.com/*]
   worker=ajp13:localhost:8019
==> quands j essaie d aller sur user1.monsite.com , cela ne fonctionne pas
!!!
Je sais que tout ca est compliqué, mais quelqu un a t il déjà eu ce souci ?
Ou quelqu un a t il eu le même besoin que moi et comment le solutionner ?
Merci





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


 



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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


Re: generate images on the fly

2003-10-31 Thread Erik Wright
Of course, there is always java.awt.

In order to write the images out, you need to use javax.imageio, which 
is included in recent JDKs and can write to a variety of formats.

I use this combination to accept image uploads, determine their size, 
store them in a database, and then serve them back at any resolution. 
I.E, the url for the image may specify the size the image should be 
scaled to. The system looks in a disk cache to find if the file has 
already been generated, and if not, generates it using the JDK.

The JDK can read gifs but not write them, which is inconvenient but not 
the end of the world. In my case, I do use transparent images, but I 
work around this problem by accepting transparent gifs, and then (at 
request time) accepting a parameter for the background color onto which 
the gif will be drawn (in my case the bg is always solid). I then draw 
the gif onto a java.awt.Graphics that has been filled in with that 
color, and render the final scaled product as a JPG.

I suspect I could make my life a lot easier by using PNGs but I haven't 
gotten around to it yet...

-Erik

Thorsten Möller wrote:

Hi,

slightly off topic but does anybody know an Java open source framework or
class library which makes it possible to generate images (gif, jpg, png) on
the fly on server side and send them to the client (or store them on the web
app context)?
Thanks,
Thorsten
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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


Re: Opinions

2003-10-31 Thread Erik Wright
Francois,

can you tell me more about this:

"Tomcat 4.1.27 bug when running at the MaxConnector limit"

I am certainly experiencing this problem and really banging my head against it. Is there documentation about this bug? What is your workaround? I was planning to make the MaxConnector limit really high and implement my own bounded semaphore within doGet.

Thanks! I'm so happy to know I'm not crazy! The bug really exists! ;)

-Erik

Francois JEANMOUGIN wrote:

 

-Message d'origine-
De : Robert Charbonneau [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 31 octobre 2003 06:17
À : Tomcat Users Mailing List
Objet : Opinions
Does anyone have an opinion of Tomcat running in a very high traffic
environment, let's say, 100K - 500K unique visits/day?
I'm also wondering about the possibility of running a Tomcat server
standalone
as opposed to using mod_jk.so with Apache to mount webapps with.
Would this
be more stable, and is there any loss to me if I *don't* use Apache?
   

I have several tomcat standalone applications with more than one connection per second. It works well. I had to be carefull with:

o JITC bug in IBM 1.4.1 Jvm on hyperthreaded machines (SIG11)
o Silly name lookup at IBM Jvm startup (it needs to know the name for all the 
interfaces up on the machine or it SIG11. Even if your tomcat has nothing to do with 
the interfaces, event if you need administrative unnamed (DNS, Hosts) interfaces). 
This does not happen with Sun Jvm.
o Memory leaks (in java servlets or Jvm or both)
o Tomcat 4.1.27 bug when running at the MaxConnector limit (workaroundable)
Those applications are wap and web applications, mainly. Total traffic is about 30Mb/s (up to 40) all day. I am in the process of migrating to a LinuxVirtualServer architecture for load balancing and failover. It works well.

I have to say that tomcat is not so easy to share between nodes. I had to do at least one modification to catalina.sh (introducing a CATALINA_LOGS). The CATALINA_BASE is shared netween nodes (via NFS) and I need one catalina.out for each node. So...

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:

If you have only one tomcat running on the server, you can use:
/sbin/iptables -t nat -A PREROUTING -i lo -p tcp --dport 80 -j REDIRECT --to-ports 8080
For more than one (one IP for one tomcat is required), you have to deal with DNAT:
/sbin/iptables -t nat -A PREROUTING -d 1.2.3.4 -p tcp -m tcp --dport 80 -j DNAT 
--to-destination 1.2.3.4:8080
This way, you don't have to put any port number in URLs.

Ho. I just see that it is all linux related... I don't have any experience in Windows. Sorry.

In fact, with a minimal of Unix/Linux sysadmin knowledge, tomcat become spretty scalable.

François.

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


 



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


Re: instanceof drives me nuts!

2003-10-31 Thread Erik Wright
This is definitely due to the class being loaded twice in two different 
classloaders.

An object's type is in fact not only its class name, but a combination 
of its class name and the class loader from which the class was loaded. 
Note that class loaders can be heirarchical, but if classloader A 
delegates the loading of a class to classloader B, the class is 
considered loaded from classloader B.

Now, the classloader chosen when you refer to a class by name is the 
class loader of the current class. So in

class Bar
{
   public void someFunction (Object obj)
   {
  if (obj instanceof FooClass)
  {
 ...
  }
   }
}
we are comparing obj.getClass () to Bar.class.getClassLoader 
().loadClass ("FooClass").

If obj was an instance of "FooClass" instantiated using the class 
definition from a different classloader, then this won't work.

The reason for this kind of behavior is that you can load two different 
versions of the same class for example (or two completely different 
classes of the same name) within two different classloaders without them 
conflicting. Also, static variables are specific only to the actual 
class instance, therefore if the same class has been loaded in two 
different classloaders, each one will have its own instances of static 
members.

That's why, for example, two different web apps can be loaded into 
tomcat with different versions of the same library and not conflict.

Now you understand why it's evil to keep your jars in two places.

Cheers,

Erik

Shapira, Yoav wrote:

Howdy,

 

As I didn't build the project, I am not so familiar with it and I
   

couldn't
 

avoid to put some of the classes in several places (server, common,
shared, WEB-INF of my apps).
   

Don't do this, as it can lead to unpredictable classloading errors.
Keep everything you can in WEB-INF/lib, the rest in common/lib, but no
jar should be in both places.  And you probably don't need to put
anything at all of yours in the server classloader directories.
 

Callback callback = getTheCallBackObject();

if(callback instanceof ApplicationCallback) {
  ((ApplicationCallback) callback).doSomething();
}
When I debug this part, the expression 'callback instanceof
ApplicationCallback' is true, nevertheless if I step once, the code in
   

the
 

if block is not executed !!!
   

If the doSomething is not executed, how do you know if clause evaluates
to true?  From the debugger I suppose?
You can also try the other way around,
callback.getClass().isAssignableFrom(ApplicationCallback.class), to see
what would happen.
 

Has anybody experienced this kind of weird behaviour?
   

Strange.  I think I've had that happen once or twice, but I can't recall
the solution ;(  

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]


 



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


Re: Windows freeze...

2003-10-28 Thread Erik Wright
I run my production server on Linux so I've never bothered to try, but a 
quick google search shows:

http://www.mattkelli.com/tech/tomcat/ntservice.htm

and

http://web.bvu.edu/staff/david/tcservcfg/

-e

Leo Larraquy wrote:

I`ve never done that, that`s the a fine way to avoid the problem,  could you
tell me how to do it?
 

It's a problem with Windows and has nothing to do with Tomcat. More
specifically, it's a problem with the DOS terminal program. The reason
it doesn't happen on linux is because linux has better terminal
emulators than windows.
Anyway, why run a production server in a console? Shouldn't you have it
installed as a service?
Erik

--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.
   



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


Re: Windows freeze...

2003-10-28 Thread Erik Wright
Leo Larraquy wrote:

Excuse me about not beeing happy with your response, I understand that your
not the person who made Tomcat, but I really can`t understand why Linux
doesn`t have these problem and Windows does.
 

It's a problem with Windows and has nothing to do with Tomcat. More 
specifically, it's a problem with the DOS terminal program. The reason 
it doesn't happen on linux is because linux has better terminal 
emulators than windows.

Anyway, why run a production server in a console? Shouldn't you have it 
installed as a service?

Erik

--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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


problems with JK2... does max_connections do anything?!

2003-10-25 Thread Erik Wright
Hi,

I have found what appears to be a serious problem in JK2. Am I doing 
something wrong?

I'm tracking down a problem wherein some requests get lost. At first I 
saw this when doing a large number of requests, but I was able to narrow 
the problem down to a situation that avoids memory issues.

First: Tomcat 4.1.27, Apache 1.3.28, mod_jk2 2.02

I configured Tomcat's JK connector to have a min and max of 3 
processors. There is an accept count of 0. What I expect to see now is 
that up to 3 requests may be served at a time, and anymore will be denied.

Instead, I can serve up to 2 simultaneous requests. On the third 
request, I see the following in catalina.out:

Oct 24, 2003 7:05:25 PM org.apache.tomcat.util.threads.ThreadPool logFull
SEVERE: All threads are busy, waiting. Please increase maxThreads or 
check the servlet status3 3

That third request never returns to the client.

Now, if I do more requests, I see hit and miss results. If I do 10 
simultaneous requests, I'll see two of them succeed, and the rest never 
return.

Meanwhile, I am looking at the JK2 /status/ worker. On the scoreboard, I 
see (after my first two requests) 2 slots. As I keep making requests, I 
see the slots increase gradually. By the time I've made 84 requests 
there are 71 slots, but only 24 requests have succeeded.

I've even tried setting the max_connections paramater on my worker to 2, 
expecting that might do something... no effect.

I'm planning to dive into the jakarta-tomcat-connectors source code in 
order to determine what the problem is here, but I feel as though I must 
be doing something wrong this is too serious a problem and must 
affect other people besides me... any ideas?

Thanks,

Erik

--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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


Re: Content length

2003-10-24 Thread Erik Wright
Which connector are you using?

I'm just theorizing here, but if it is a JK/JK2 AJP connector you may 
find that the reason it is cutting off the extra space is to avoid 
breaking the AJP protocol...

Another option for you might be to put a proxy somewhere between client 
and server that can just add in the extra two bytes. That would avoid 
having to mess around with tomcat/apache entirely, which would make 
upgrading/swapping servers easier, for example.

Cheers,

Erik

William Bondy wrote:

Unfortunately no, it looks like the only solution is change the connector
used with Tomcat, though I really wan't to avoid that...
-Original Message-
From: Jeff Jackson [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2003 05:08 PM
To: Tomcat Users List
Subject: Re: Content length
Can the client handle chunked encoding?  Then you don't need to set
content-length at all.
Jeff Jackson

On Fri, 24 Oct 2003, William Bondy wrote:

 

I have a client browser that acts a bit in a non-standard fashion, for
   

http
 

responses with content-length set (keep-alive) it expects the
   

content-length
 

worth of data PLUS an extra \r\n that is not counted in the content length
header sent.
When I set the HttpServletResponse contentLength header to value X and
   

then
 

write X+2 bytes to the stream, only X bytes get written. I assume the the
underlying control is only sending what the header is set to. Is there
anyway to get around this, ie. set the content length header to X and X+2
bytes?
 Thanks!

   



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



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


Re: Un-authorized page 403

2003-10-22 Thread Erik Wright
Look closer, it's listed in the error message you provided.

Cheers,

-erik

Thai Nguyen wrote:

Thanks so much Shapira,

The element I added in is .
This element does not exist in the element's list from the error message.
I guess my question now is how do I add that element.
Thanks,

Thai Nguyen
 

Howdy,

   

SEVERE: Parse Error at line 72 column 11: The content of element type
"web-app" must match
"(icon?,display-name?,description?,distributable?,context-
param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,sess
 

ion-
   

config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-e
 

nv-
   

ref*,resource-ref*,security-constraint*,login-config?,security-role*,en
 

v-
   

entry*,ejb-ref*,ejb-local-ref*)".

The error only occurs once (when restart tomcat) but it's still an
 

error.
   

Anyone know how to fix this error?
 

Not only is it still an error, but a very significant error at that.
That's why it's a SEVERE-level message ;)
You need to edit your web.xml so that its elements are in the order
specified in the error message above.  If you think your web.xml is
correct, validate it with a tool like XMLSpy or simply post it (all of
it) here.
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]


 



--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


lost requests using mod_jk, tomcat 4.1.27

2003-10-22 Thread Erik Wright
Hello,

I have tomcat set up to serve requests via mod_jk and apache.

While testing using JMeter, I see strange behavior. If I make, say, 100 
requests at 1 second intervals (on separate connections), 96 complete 
successfully, and the other 4 never return.

In fact, the other 4 never make it to my servlet. If I shut down tomcat, 
apache finally returns HTTP 500s for each of the requests.

Does anyone have any ideas on how to track this down? I've spent several 
days on it already, and I've made no progress! One of the things I tried 
to do was enable debug logging for the ChannelSocket class (I tried 
creating a logging.properties file in $JAVA_HOME/lib) but couldn't even 
get that to work.

Thanks,

Erik

--
http://www.spectacle.ca/
The New Online Source for Live Music in Montreal
.::514.286.1699::.


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


manual deploy works, but manager deploy is defective

2002-12-18 Thread Erik Wright
Hello,

I've been experiencing a strange problem with the Tomcat
Manager tool. I've setup Ant to deploy my WAR via the
supplied plugin, and created the appropriate manager user.
When I run the task, the tool reports success, and I can see
my application in the listing (both HTML and via Ant).

When I try to access the application, however, nothing
works. I get 404s for all pages, and my servlets are never
called (running Tomcat in the debugger with a breakpoint on
my servlet code that is never reached).

The tomcat log shows the WAR being deployed, first all the
library Jars, then the auth-constraints, and finally the
"default" and "invoker" servlets. Note that the invoker
servlet also doesn't work (I enabled the servlet-mapping in
the global web.xml file),
http://localhost:8080//servlet/foo returns a 404
too.

Of course everything works great if I manually copy my WAR
into the webapps directory.

I'm using Tomcat 4.1.17 . I've tried a few other 4.1.X (12
and 10) versions as well and had the same problem...

This is not a huge showstopper but an inconvenience. If
anyone has any ideas I'd appreciate it... Log files will be
gladly supplied (though they don't seem to reveal
anything...).

Cheers,

Erik


--
To unsubscribe, e-mail:   
For additional commands, e-mail: