Re: url prefixes behind proxy

2011-01-06 Thread Gabor Pinter

Dear Christopher,

Thank you for your reply.

>> Tomcat is version 6.0
>
> 6.0.what? We're just dying to know.

Sorry, it's 6.0.29 .
(Though at my level, the third digit may be of minor importance :)


> http://localhost:8080/tom ->path/to/tomcat/webapps/tom
>> http://localhost:80/tom/ ->path/to/tomcat/webapps/
>
> My example above is better because it will actually work.

I can see that.
But doesn't this mean that you need to add a proxy_pass for each app you 
deploy under webapp?

Plus the root app in Tomcat also needed to be moved from "/".

I can live with that, I'm just curious if it is possible to use
a global prefix ('/tom' is a bad example, say '/servlet') for a redirection.

http://localhost:8080/servlet/  -->  path/to/tomcat/webapps/

>> nginx -->  apache -->  django
>> setup on the server (working just fine).
>
> Aah, unnecessary complexity: I just love it.

The concept is from an Apress django book.
Would you live nginx out? Or Apache?
Or django?

I'm open to any suggestions.

Gabor




On 2011-01-07 06:23, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Gabor,

On 1/6/2011 2:38 PM, gabor wrote:

Tomcat is version 6.0, but it is highly experimental under my hands ;-)


6.0.what? We're just dying to know.


You have configured* the proxy to expect Tomcat to have either tom.war
or a directory deployed in tomcat/webapps called 'tom'.

e.g
   path/to/tomcat/webapps/tom.war

or
   path/to/tomcat/webapps/tom/


Oh, I'm sorry not to say that.
I would like to access Tomcat root through url http://localhost:80/tom/ .


No, you want to access the "tom" webapp through URL
http://localhost:80/tom/.


Say, to change the textbook example:
http://localhost:8080/ ->path/to/tomcat/webapps/


Unless you have butchered your configuration, the above path
(path/to/tomcat/webapps/) does not contain a webapp. Instead, it
contains directories where webapps live. Can you try this instead:

http://localhost:8080/tom ->path/to/tomcat/webapps/tom


to:
http://localhost:80/tom/ ->path/to/tomcat/webapps/


My example above is better because it will actually work.


Probably the more difficult part is when a webapp publishes a link,
(e.g., to a .jpg) without the prefix /tom/  ->  which in turn is not proxy
redirected by nginx to Tomcat... (404.htm)


So... do you want URLs of the form /not_tom/whatever.jpg to be
redirected to your /tom context, or are you saying that NginX should
send those requests elsewhere and so Tomcat doesn't care about them?


I'm thinking to use a prefix to redirect because
- I am going to have only port 80 open for the public


Not really relevant, but understandable.


- there are also some static (+a few php) pages


Also not a problem: all of this can be handled with NginX by only
mapping appropriate requests to Tomcat, regardless of their URL prefix.


(would be great just leave them as they are now)
- there is also an
nginx -->  apache -->  django
setup on the server (working just fine).


Aah, unnecessary complexity: I just love it.


Django serves from behind a prefix, that's why I thought to approach
Tomcat in a similar fashion.


Fine. Just deploy your webapp as /tom and be done with it. It will work
exactly as you'd like it to. It's the simplest possible thing you could
do, and it meets your needs.


Well, basically I use the default server.xml.
Only the  tag is hacked as described above.


Undo that and go back to default server.xml. Then, put your "tom" webapp
under path/to/tomcat/webapps/tom. Restart Tomcat and everything should
work as desired.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mMs0ACgkQ9CaO5/Lv0PC4BACeKfmpx57LRtGeLzp8W1uCwIsw
ToAAoJtw88ZWxerVDLEWq8OhflGxyIl9
=Pg4c
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Pid
On 1/6/11 7:33 PM, Ziggy wrote:
> I have gone through all the mbeans by using Jconsole but i cant find the one
> i need that tells me that the application is active and running.

You want Catalina:type=WebModule or Catalina:type=Manager depending on
what your requirements are.

I'm pretty sure I've posted this once already today, you might consider
reading the other JMX thread.


p


0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


RE: Simple Question about reading http transmission using mod_jk

2011-01-06 Thread Caldarale, Charles R
> From: Mohit Anchlia [mailto:mohitanch...@gmail.com] 
> Subject: Simple Question about reading http transmission using mod_jk

> does it just sends the handle to the stream and then tomcat 
> reads from it. It's little confusing.

Think about it: the connection between httpd and Tomcat is a comm link; how 
could httpd give Tomcat a handle when Tomcat may well be running on a 
completely different system?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Mark Eggers
- Original Message (edited) 
From: André Warnier 
To: Tomcat Users List 
Sent: Thu, January 6, 2011 12:43:32 PM
Subject: Re: Accessing context information remotely - Context.getAvailable() 
etc.

You may also want to have a look at
http://code.google.com/p/jmxsh/
- Original Message (edited) 

Thanks. It's been a long, long time since I've worked with Tcl. I'll add it to 
my tool box.

/mde/




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Simple Question about reading http transmission using mod_jk

2011-01-06 Thread Mohit Anchlia
We are using mod_jk. My question is when apache receives a request
with http payload does it first read the entire payload and then
transfers it to tomcat or does it just sends the handle to the stream
and then tomcat reads from it. It's little confusing.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ziggy,

On 1/6/2011 2:33 PM, Ziggy wrote:
> I am writing an external java application that reads this values
> periodically. This will be launched from a unix cron job. Its just a simple
> tools that periodically checks that the application is available.
> 
> I do use Jconsole and jVisualvm and also LamdaProbe but all these require
> someone to physically log on to look at anything. The tool i am writing will
> do this automatically and generate an alert if necessary. I just need to
> know which Mbean to look at. I have found the Datasource ones but not the
> ones related to the webapplication itsself.

Someone on the list (Pid?) is working on something like jmxsh
(http://code.google.com/p/jmxsh/) which appears to currently have no
committers.

Something like this might be able to help you because it is

a) already written
b) scriptable
c) capable of being run from a shell script

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mRr4ACgkQ9CaO5/Lv0PAfyQCfaz4RiO7bsBoGssJhSo45wRhl
fQUAnjBFAAIstxlg3MG0d4bHH7goZz/9
=fRUa
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



[OT] facepalm (was: Re: Trouble configuring the manager :()

2011-01-06 Thread Markus Schönhaber
06.01.2011 22:12, Christopher Schultz:

> Is there an emoticon for smacking yourself in the forehead?

There doesn't seem to be a "standard" one, though googling for "facepalm
smiley" or "facepalm emoticon" lists quite a few.
Nevertheless, I *really* like that non-emoticon one
http://www.thefacepalm.org/2010/10/baby/

-- 
Regards
  mks

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread ilya goberman

Got it, thanks

> Date: Thu, 6 Jan 2011 16:34:40 -0500
> From: ch...@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: How to disable chunked encoding for the Http11NioProtocol 
> connector.
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Ilya,
> 
> On 1/6/2011 4:17 PM, ilya goberman wrote:
> > OK. All I wanted to say is that disabling keepAlive across the board
> > is not necessary.
> 
> Nobody is suggesting that.
> 
> > If keepAlive can be applies to a single response
> > (and to be honest I am not sure it is possible), it is fine.
> 
> Of course it can: headers can be set on a per-response basis. Otherwise,
> stuff like Content-Type and Content-Length would never work.
> 
> > I was under impressing that the only way to disable keep alive is
> > globally via: maxKeepAliveRequests="1" in server.xml
> 
> That's obviously the wrong approach.
> 
> File another enhancement request to allow configuration to let client
> and/or server use of "Connection:close" to disable chunked response
> encoding and I'm sure Mark won't mark it as INVALID or WONTFIX.
> 
> It's possible nobody will actually submit a patch for it any time soon,
> but you are free to do so. Enhancement requests with accompanying
> patches are much more likely to be fixed. ;)
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk0mNXAACgkQ9CaO5/Lv0PCsPACfQpD5JEO8QEDyoaQQFg2TqN7f
> 3+MAn3N/RJa+j63Wp67tJL5Tw3J6twrY
> =u9Rn
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

Re: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ilya,

On 1/6/2011 4:17 PM, ilya goberman wrote:
> OK. All I wanted to say is that disabling keepAlive across the board
> is not necessary.

Nobody is suggesting that.

> If keepAlive can be applies to a single response
> (and to be honest I am not sure it is possible), it is fine.

Of course it can: headers can be set on a per-response basis. Otherwise,
stuff like Content-Type and Content-Length would never work.

> I was under impressing that the only way to disable keep alive is
> globally via: maxKeepAliveRequests="1" in server.xml

That's obviously the wrong approach.

File another enhancement request to allow configuration to let client
and/or server use of "Connection:close" to disable chunked response
encoding and I'm sure Mark won't mark it as INVALID or WONTFIX.

It's possible nobody will actually submit a patch for it any time soon,
but you are free to do so. Enhancement requests with accompanying
patches are much more likely to be fixed. ;)

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mNXAACgkQ9CaO5/Lv0PCsPACfQpD5JEO8QEDyoaQQFg2TqN7f
3+MAn3N/RJa+j63Wp67tJL5Tw3J6twrY
=u9Rn
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: url prefixes behind proxy

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Gabor,

On 1/6/2011 2:38 PM, gabor wrote:
> Tomcat is version 6.0, but it is highly experimental under my hands ;-)

6.0.what? We're just dying to know.

>> You have configured* the proxy to expect Tomcat to have either tom.war
>> or a directory deployed in tomcat/webapps called 'tom'.
>>
>> e.g
>>   path/to/tomcat/webapps/tom.war
>>
>> or
>>   path/to/tomcat/webapps/tom/
> 
> Oh, I'm sorry not to say that.
> I would like to access Tomcat root through url http://localhost:80/tom/ .

No, you want to access the "tom" webapp through URL
http://localhost:80/tom/.

> Say, to change the textbook example:
> http://localhost:8080/ ->   path/to/tomcat/webapps/

Unless you have butchered your configuration, the above path
(path/to/tomcat/webapps/) does not contain a webapp. Instead, it
contains directories where webapps live. Can you try this instead:

http://localhost:8080/tom ->   path/to/tomcat/webapps/tom

> to:
> http://localhost:80/tom/ ->   path/to/tomcat/webapps/

My example above is better because it will actually work.

> Probably the more difficult part is when a webapp publishes a link,
> (e.g., to a .jpg) without the prefix /tom/  -> which in turn is not proxy
> redirected by nginx to Tomcat... (404.htm)

So... do you want URLs of the form /not_tom/whatever.jpg to be
redirected to your /tom context, or are you saying that NginX should
send those requests elsewhere and so Tomcat doesn't care about them?

> I'm thinking to use a prefix to redirect because
> - I am going to have only port 80 open for the public

Not really relevant, but understandable.

> - there are also some static (+a few php) pages

Also not a problem: all of this can be handled with NginX by only
mapping appropriate requests to Tomcat, regardless of their URL prefix.

> (would be great just leave them as they are now)
> - there is also an
> nginx --> apache --> django
> setup on the server (working just fine).

Aah, unnecessary complexity: I just love it.

> Django serves from behind a prefix, that's why I thought to approach
> Tomcat in a similar fashion.

Fine. Just deploy your webapp as /tom and be done with it. It will work
exactly as you'd like it to. It's the simplest possible thing you could
do, and it meets your needs.

> Well, basically I use the default server.xml.
> Only the  tag is hacked as described above.

Undo that and go back to default server.xml. Then, put your "tom" webapp
under path/to/tomcat/webapps/tom. Restart Tomcat and everything should
work as desired.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mMs0ACgkQ9CaO5/Lv0PC4BACeKfmpx57LRtGeLzp8W1uCwIsw
ToAAoJtw88ZWxerVDLEWq8OhflGxyIl9
=Pg4c
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread ilya goberman

OK. All I wanted to say is that disabling keepAlive across the board is not 
necessary. If keepAlive can be applies to a single response (and to be honest I 
am not sure it is possible), it is fine.

I was under impressing that the only way to disable keep alive is globally via: 
maxKeepAliveRequests="1" in server.xml

> Date: Thu, 6 Jan 2011 16:08:36 -0500
> From: ch...@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: How to disable chunked encoding for the Http11NioProtocol 
> connector.
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Ilya,
> 
> On 1/6/2011 12:27 PM, ilya goberman wrote:
> > I think what was suggested before is to control this behavior by
> > setting "keepAlive" setting. I would not think this is the right
> > way.
> 
> Er, what's the difference between using "keepAlive setting" and
> "Connection: close"? AFAIK, they are the same thing.
> 
> > I would still want to preserve "keepAlive" functionality for all
> > other requests except "long running comet response".
> 
> Of course. So, you have the client set "Connection: close" (which
> disables keep-alive) and then the configuration Mark proposed causes
> chunked encoding to be avoided.
> 
> > So if it is
> > request for a web page, using keepAlive is fine. Now in order to
> > disable chunked encoding for a particular response, I would propose
> > that a developer would set "Connection:close" header.
> 
> On the server side or from the client side? I'm not sure if Mark was
> thinking client or server. I suppose server would be safer, since the
> server can make the decision and not have to ensure that clients are
> compliant.
> 
> > Using
> > connection "close" implies that closing the connection indicates the
> > end of response and chunked encoding is not necessary in this case.
> 
> So... everyone is happy, then, right? Are we arguing semantics, then?
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk0mL1QACgkQ9CaO5/Lv0PBxKwCgqjbxMKY5WKqdVLR8Ay9TpA+h
> ojwAmwdQKzXFqiumBd8j40zEgym9NOeR
> =2fnQ
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

Re: Trouble configuring the manager :(

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 1/6/2011 4:02 PM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
>> Subject: Trouble configuring the manager :(
> 
>> SEVERE: Cannot find message associated with key jaasRealm.unexpectedError
> 
> Note the unexpected realm name.

Yes, I had noticed that. Also, there's apparently a missing localized
string.

>> What am I missing, here?
> 
> A  declaration, probably. You likely want it under the 
> manager  only, rather than a global one.

Is there an emoticon for smacking yourself in the forehead? I'm working
with a modified server.xml to disable all that default junk like
 and  and stuff and I completely forgot
to re-enable the realm.

Enabling the  got her working.

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mMEkACgkQ9CaO5/Lv0PAHnACfa89CsUYE3k+HCIQDsAIxNzoS
o3UAniFbpFwglLOyO010WKNbSVVbMyri
=JERg
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ilya,

On 1/6/2011 12:27 PM, ilya goberman wrote:
> I think what was suggested before is to control this behavior by
> setting "keepAlive" setting. I would not think this is the right
> way.

Er, what's the difference between using "keepAlive setting" and
"Connection: close"? AFAIK, they are the same thing.

> I would still want to preserve "keepAlive" functionality for all
> other requests except "long running comet response".

Of course. So, you have the client set "Connection: close" (which
disables keep-alive) and then the configuration Mark proposed causes
chunked encoding to be avoided.

> So if it is
> request for a web page, using keepAlive is fine. Now in order to
> disable chunked encoding for a particular response, I would propose
> that a developer would set "Connection:close" header.

On the server side or from the client side? I'm not sure if Mark was
thinking client or server. I suppose server would be safer, since the
server can make the decision and not have to ensure that clients are
compliant.

> Using
> connection "close" implies that closing the connection indicates the
> end of response and chunked encoding is not necessary in this case.

So... everyone is happy, then, right? Are we arguing semantics, then?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mL1QACgkQ9CaO5/Lv0PBxKwCgqjbxMKY5WKqdVLR8Ay9TpA+h
ojwAmwdQKzXFqiumBd8j40zEgym9NOeR
=2fnQ
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Trouble configuring the manager :(

2011-01-06 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
> Subject: Trouble configuring the manager :(

> SEVERE: Cannot find message associated with key jaasRealm.unexpectedError

Note the unexpected realm name.

> What am I missing, here?

A  declaration, probably.  You likely want it under the manager 
 only, rather than a global one.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



Re: url prefixes behind proxy

2011-01-06 Thread Gabor Pinter

Andre,

Thank you for your detailed description!
It cleared up a lot.

Just let me ask one more question.

A simple proxy_pass results in the following mapping (correct?)

http://hostname:8080/tom/app
  |   proxy_pass to
  |   127.0.0.1:8080/tom/app
  |
(tomcat_dir)/webapps/tom/app


Is there a way to eliminate the '/tom' part as follows?
('eliminate' : make it transparent from Tomcat side)

http://hostname:8080/tom/app
  |   proxy_pass
  |
  |   127.0.0.1:8080/tom/app
  |
  |   Tomcat mapping
(tomcat_dir)/webapps/app


A rewrite in the proxy_pass can remove '/tom',
however links *served* by Tomcat will not have '/tom'.
(-> no proxy -> not found error)

"When the application on the backend returns content including 
self-referential URLs using its own backend address and port, the client 
will usually not be able to use these URLs."

( http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html )

The site above mentions Apache modul 'mod_jk' as a solution.
But my server is nginx, and google gives me approaches
with proxy_pass. Which would be fine IF  mappers on Tomcat side
would/could handle such prefixes.

If not, I guess I can hard-code the prefix into my apps (brrr),
or set up a   nginx --> Apache (mod_jk) --> Tomcat redirect.
Or?

I am sorry about the 'trivial' label if it was offending.
I am new to Tomcat, chances are my questions seem trivial or nonsense...










On 2011-01-06 21:43, André Warnier wrote:

Gabor Pinter wrote:

Dear list,

I have a very trivial problem.

My setup:
CentOS 5.5
nginx 0.8.53
Tomcat6

net ---> nginx:80 (proxy_pass) ---> tomcat:8080

Proxy redirect is triggered by prefix "/tom/"

myhost:80/tom/ ---> 127.0.0.1:8080/tom/

Now here is my question.
How can I let Tomcat know about this "/tom/" prefix?



Hi.

It is not a trivial problem.
But I think that you are taking this from the wrong perspective.
You should not need to do anything special in Tomcat (or nginx) to let
Tomcat know about the /tom/ prefix. It already knows.
In particular, you should not do



because this has nothing to do with the directories or URLs that Tomcat
recognises.
(That's probably why it is "unpredictable").


Let'start from the beginning.

In a webserver like Tomcat, or Apache or nginx, there is a notion of
"URL space".

That is to say, when you have a URL like http://hostname/a/b/c.html, and
you consider the part after the protocol and hostname (thus here, the
/a/b/c.html part), you imagine a certain hierarchical sructure so that
/b is one of the things "below" /a, and /c.html is one of the things
"below" /a/b.

This webserver runs on a physcial host, and to store the physical
resource corresponding to /c.html above, it has a filesystem, where this
file actually lives.
For example, the above file c.html may in reality be on the disk, in a
directory like
/srv/www/host1/docs/a/b/c.html.

Ok so far ?

Now, between the "URL space", and the filesystem on disk, there is a
certain "mapping" taking place, so that the webserver would know that
when it receives request for the URL "/a/b/c.html", it should look for
that file in the directory "/srv/www/host1/docs/a/b/".
That mapping is done for example under Apache by the configuration line:

DocumentRoot /srv/www/host1/docs

In other words, this tells Apache that a URL = "/" refers to the disk
directory /srv/www/host1/docs/, and that a URL like "/a" refers to the
disk directory /srv/www/host1/docs/a/, and so on.

The same kind of mapping occurs in Tomcat, except that in Tomcat it is
not a

DocumentRoot /xxx

which tells Tomcat how to map URLs to the filesystem.
It is the "appBase" attribute in the  tag, like :



This "webapps" above tells Tomcat that a URL like
"http://hostname:8080/a/b/c.html";, should be mapped to

(tomcat_directory)/webapps/a/b/c.html

The only thing a bit special with Tomcat is respect of this mapping, is
that for Tomcat, the URL "/" is not mapped directly to

(tomcat_directory)/webapps/

Instead, it is mapped to

(tomcat_directory)/webapps/ROOT/

This "ROOT" name is special, and represents for Tomcat its "default
application".
In other words, for the URL : http://hostname:8080/a.html, Tomcat will
return the file
(tomcat_dir)/webapps/ROOT/a.html

Now, to get back to your initial question :

If in nginx, you are telling nginx to pass the following URLs to Tomcat :

myhost:80/tom/ ---> 127.0.0.1:8080/tom/

then for a URL like :

http://myhost:80/tom/something.html,

nginx will forward it to Tomcat, and Tomcat will be looking for the file

(tomcat_dir)/webapps/tom/something.html

Automatically. Without having to do anything special in Tomcat.









-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache

Trouble configuring the manager :(

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

All,

This is my first time trying to configure the manager webapp.

Tomcat 6.0.29 on Linux
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)

I'm using CATALINA_BASE to run Tomcat from a different base path.
CATALINA_HOME is /usr/local/apache-tomcat-6.0.29 and CATALINA_BASE is
something under /home/chris. My  has the standard "webapps"
appBase and has autoDeploy="true".

I have done the following to add the manager webapp to my own server
instance:

$ cp -r ${CATALINA_HOME}/webapps/manager ${CATALINA_BASE}/webapps
$ cp ${CATALINA_HOME}/conf/tomcat-users.xml ${CATALINA_BASE}/conf/
$ vi ${CATALINA_BASE}/conf/tomcat-users.xml (...)
$ cat ${CATALINA_BASE}/conf/tomcat-users.xml



  
  


I have this in my ${CATALINA_BASE}/conf/server.xml:

  


  

When I start Tomcat, I can see that the manager app is being deployed
without error:

INFO: Starting service Catalina
Jan 6, 2011 3:43:59 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Jan 6, 2011 3:43:59 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory manager
Jan 6, 2011 3:43:59 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory (my-webapp)

...(startup messages from my webapp)...

Jan 6, 2011 3:44:06 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8215
Jan 6, 2011 3:44:06 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/64  config=null
Jan 6, 2011 3:44:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7270 ms

When I attempt to navigate my web browser to myhost/manager/html, I get
a 401 response and my browser asks for my username and password. I enter
"chris" and "chris" and the server emits an error message to stdout:

SEVERE: Cannot find message associated with key jaasRealm.unexpectedError
java.lang.SecurityException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.(ConfigFile.java:93)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at
javax.security.auth.login.Configuration$3.run(Configuration.java:247)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.security.auth.login.Configuration.getConfiguration(Configuration.java:242)
at
javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.security.auth.login.LoginContext.init(LoginContext.java:234)
at
javax.security.auth.login.LoginContext.(LoginContext.java:403)
at
org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:394)
at
org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:335)
at
org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
...

I have tried fully-qualifying the name of tomcat-users.xml but that
doesn't seem to help.

What am I missing, here?

I have not modified the META-INF/context.xml or WEB-INF/web.xml files
within the manager webapp.

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0mK0sACgkQ9CaO5/Lv0PB/PQCfUXE7wKjVUXdjsq6mQLfOlCZS
WTsAn2lRX0gX5oBq0tBCb5mW86J9RBel
=pqRl
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread André Warnier

Mark Eggers wrote:


A quick google turns up at least two command line JMX clients:

http://www.cyclopsgroup.org/projects/jmxterm/
http://www.jmanage.org/


You may also want to have a look at
http://code.google.com/p/jmxsh/


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Ziggy
Please see my previous response re: open source tools. :)

As i mentioned earlier, the project that i need to deploy this tool will not
allow any open source tool without it being approved which involves a long
security vetting process.

I appreciate that there are hundreds of tools out there that can do exactly
what i am trying to do but sometimes there are reasons that those tools
cannot be used due to the nature of some projects.




On Thu, Jan 6, 2011 at 8:03 PM, Mark Eggers  wrote:

> - Original Message (edited) 
> From: Ziggy 
> To: Tomcat Users List 
> Sent: Thu, January 6, 2011 11:33:07 AM
> Subject: Re: Accessing context information remotely -
> Context.getAvailable()
> etc.
>
> Thanks for the response.
> I am writing an external java application that reads this values
> periodically. This will be launched from a unix cron job. Its just a simple
> tools that periodically checks that the application is available.
>
> I have gone through all the mbeans by using Jconsole but i cant find the
> one
> i need that tells me that the application is active and running.
>
> I do use Jconsole and jVisualvm and also LamdaProbe but all these require
> someone to physically log on to look at anything. The tool i am writing
> will
> do this automatically and generate an alert if necessary. I just need to
> know which Mbean to look at. I have found the Datasource ones but not the
> ones related to the webapplication itsself.
>
> Thanks
> - Original Message (edited) 
>
> A quick google turns up at least two command line JMX clients:
>
> http://www.cyclopsgroup.org/projects/jmxterm/
> http://www.jmanage.org/
>
> However the jManage tool requires that you have jManage running on the
> target
> server.
>
> I've not used either, so your mileage may vary.
>
> . . . . just my two cents.
>
> /mde/
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Mark Eggers
- Original Message (edited) 
From: Ziggy 
To: Tomcat Users List 
Sent: Thu, January 6, 2011 11:33:07 AM
Subject: Re: Accessing context information remotely - Context.getAvailable() 
etc.

Thanks for the response.
I am writing an external java application that reads this values
periodically. This will be launched from a unix cron job. Its just a simple
tools that periodically checks that the application is available.

I have gone through all the mbeans by using Jconsole but i cant find the one
i need that tells me that the application is active and running.

I do use Jconsole and jVisualvm and also LamdaProbe but all these require
someone to physically log on to look at anything. The tool i am writing will
do this automatically and generate an alert if necessary. I just need to
know which Mbean to look at. I have found the Datasource ones but not the
ones related to the webapplication itsself.

Thanks
- Original Message (edited) 

A quick google turns up at least two command line JMX clients:

http://www.cyclopsgroup.org/projects/jmxterm/
http://www.jmanage.org/

However the jManage tool requires that you have jManage running on the target 
server.

I've not used either, so your mileage may vary.

. . . . just my two cents.

/mde/


  

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: url prefixes behind proxy

2011-01-06 Thread gabor

On 1/6/2011 8:14 PM, Pid wrote:

On 1/6/11 11:02 AM, Gabor Pinter wrote:

Dear list,

I have a very trivial problem.

My setup:
CentOS 5.5
nginx 0.8.53
Tomcat6

You're using the unreleased, but highly experimental and potentially
dangerous version 6.3.7!?

;)

First, thank you for your reply.

Tomcat is version 6.0, but it is highly experimental under my hands ;-)



net --->  nginx:80 (proxy_pass) --->  tomcat:8080

Proxy redirect is triggered by prefix "/tom/"

myhost:80/tom/   --->   127.0.0.1:8080/tom/

Now here is my question.
How can I let Tomcat know about this "/tom/" prefix?

What do you expect Tomcat to do with the prefix?

You have configured* the proxy to expect Tomcat to have either tom.war
or a directory deployed in tomcat/webapps called 'tom'.

e.g
  path/to/tomcat/webapps/tom.war

or
  path/to/tomcat/webapps/tom/


Oh, I'm sorry not to say that.
I would like to access Tomcat root through url http://localhost:80/tom/ .
Say, to change the textbook example:
http://localhost:8080/ ->   path/to/tomcat/webapps/
to:
http://localhost:80/tom/ ->   path/to/tomcat/webapps/

Probably the more difficult part is when a webapp publishes a link,
(e.g., to a .jpg) without the prefix /tom/  -> which in turn is not proxy
redirected by nginx to Tomcat... (404.htm)

I'm thinking to use a prefix to redirect because
- I am going to have only port 80 open for the public
- there are also some static (+a few php) pages
(would be great just leave them as they are now)
- there is also an
nginx --> apache --> django
setup on the server (working just fine).

Django serves from behind a prefix, that's why I thought to approach 
Tomcat in a similar fashion.




"localhost/tom" isn't valid hostname, nothing surprising about that.

My first surprise was, that it worked at all...


p

* Assuming a default server.xml - you didn't say...


Well, basically I use the default server.xml.
Only the  tag is hacked as described above.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Ziggy
Thanks for the response.
I am writing an external java application that reads this values
periodically. This will be launched from a unix cron job. Its just a simple
tools that periodically checks that the application is available.

I have gone through all the mbeans by using Jconsole but i cant find the one
i need that tells me that the application is active and running.

I do use Jconsole and jVisualvm and also LamdaProbe but all these require
someone to physically log on to look at anything. The tool i am writing will
do this automatically and generate an alert if necessary. I just need to
know which Mbean to look at. I have found the Datasource ones but not the
ones related to the webapplication itsself.

Thanks

On Thu, Jan 6, 2011 at 7:28 PM, Mark Eggers  wrote:

> - Original Message (edited) 
> From: Ziggy 
> To: Tomcat Users List 
> Sent: Thu, January 6, 2011 10:48:32 AM
> Subject: Re: Accessing context information remotely -
> Context.getAvailable()
> etc.
>
> Hi,
>
> Thanks for your response. I am aware of the activeSessions attribute under
> "Catalina:type=Manager,path=/testapp,host=localhost". I am actually doing
> this programmatically and would like to know of an Mbean that would tell me
> if the application is available. The activeSessions attribute can sometimes
> report 0 even when the application is available so it is not reliable.
>
> Thanks
>
> On Thu, Jan 6, 2011 at 6:29 PM, Pid  wrote:
>
> > On 1/6/11 6:07 PM, Ziggy wrote:
> > > I was looking at the code for the Tomcat Manager application to try and
> > find
> > > out how it is determining whether a webapp/context is running and how
> > many
> > > sesions are active. Looking at the code i think it uses these two
> methods
> > >
>
> > Connect to a Tomcat instance using JConsole and look for the 'Manager'
> > objects.
> >
> >  Catalina:type=Manager,path=/app01,host=localhost
> >
> > There's an attribute 'activeSessions'.
> >
> >
> > p
> - Original Message (edited) 
>
> Check the attribute stateName. It's STOPPED for an application stopped by
> the
> manager program, and STARTED for an application started by the manager
> program.
>
> VisualVM, JConsole, and MC4J don't require separate Tomcat instrumentation.
>
> . . . just my two cents.
>
> /mde/
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Mark Eggers
- Original Message (edited) 
From: Ziggy 
To: Tomcat Users List 
Sent: Thu, January 6, 2011 10:48:32 AM
Subject: Re: Accessing context information remotely - Context.getAvailable() 
etc.

Hi,

Thanks for your response. I am aware of the activeSessions attribute under
"Catalina:type=Manager,path=/testapp,host=localhost". I am actually doing
this programmatically and would like to know of an Mbean that would tell me
if the application is available. The activeSessions attribute can sometimes
report 0 even when the application is available so it is not reliable.

Thanks

On Thu, Jan 6, 2011 at 6:29 PM, Pid  wrote:

> On 1/6/11 6:07 PM, Ziggy wrote:
> > I was looking at the code for the Tomcat Manager application to try and
> find
> > out how it is determining whether a webapp/context is running and how
> many
> > sesions are active. Looking at the code i think it uses these two methods
> >

> Connect to a Tomcat instance using JConsole and look for the 'Manager'
> objects.
>
>  Catalina:type=Manager,path=/app01,host=localhost
>
> There's an attribute 'activeSessions'.
>
>
> p
- Original Message (edited) 

Check the attribute stateName. It's STOPPED for an application stopped by the 
manager program, and STARTED for an application started by the manager program.

VisualVM, JConsole, and MC4J don't require separate Tomcat instrumentation.

. . . just my two cents.

/mde/


  

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Pid
On 1/6/11 6:48 PM, Ziggy wrote:
> Hi,
> 
> Thanks for your response. I am aware of the activeSessions attribute under
> "Catalina:type=Manager,path=/testapp,host=localhost". I am actually doing
> this programmatically and would like to know of an Mbean that would tell me
> if the application is available. The activeSessions attribute can sometimes
> report 0 even when the application is available so it is not reliable.

You asked if you could get the same information.

Did you try JConsole?  Did you examine the other attributes?


p

>>> I was looking at the above for the above information as i am working on a
>>> client tool that tries to find out this exact information. The tool i am
>>> using connects to Tomcat via JMX but i am not sure if i can get the same
>>> information via JMX. Can i access the Context class? or is there any
>> other
>>> way (Mbeans?) i can check if a context is running via JMX?
>>
>> Connect to a Tomcat instance using JConsole and look for the 'Manager'
>> objects.
>>
>>  Catalina:type=Manager,path=/app01,host=localhost
>>
>> There's an attribute 'activeSessions'.
>>
>>
>> p
>>
>>
>>
> 



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Mark Eggers
- Original Message (edited) 
From: Ziggy 
To: Tomcat Users List 
Sent: Thu, January 6, 2011 10:07:51 AM
Subject: Accessing context information remotely - Context.getAvailable() etc.

I was looking at the code for the Tomcat Manager application to try and find
out how it is determining whether a webapp/context is running and how many
sesions are active. Looking at the code i think it uses these two methods

I was looking at the above for the above information as i am working on a
client tool that tries to find out this exact information. The tool i am
using connects to Tomcat via JMX but i am not sure if i can get the same
information via JMX. Can i access the Context class? or is there any other
way (Mbeans?) i can check if a context is running via JMX?

- Original Message  (edited) 

All of this information seems to be available via JMX. As others have pointed 
out, VisualVM (with the MBeans plugin) and JConsole both give you access to 
this 
information.

I use MC4J 1.2 beta 9 to watch and graph MBean values. It's old (and could use 
an update), but you can easily do things like graph the current number of 
sessions per web application.

Using JConsole to browse MBeans on a running Tomcat, I find MBeans that expose 
the Manager interface (including attributes such as activeSessions and 
stateName). 

There are also MBeans that expose DataSource to monitoring (including 
attributes 
such as numActive).

One way to explore what is available via JMX is to write a sample web 
application, launch it, and then connect to the Tomcat server with one of many 
available JMX tools.

. . . just my two cents.

/mde/


  

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Ziggy
Well it is a little complicated but the main reasons are

- The majority of the tools i have looked at require that the "tool" run
inside Tomcat which is where my application will also be running. This is a
problem because if Tomcat itself is not available then i cant monitor
anything
- It will be quicker for me to produce something quicker myself than it will
be to convince my boss to authorise an open source tool for a project that
is not supposed to be accessed by external users.

Thanks

On Thu, Jan 6, 2011 at 6:58 PM, Kees Jan Koster  wrote:

> Dear Ziggy,
>
> > I was looking at the above for the above information as i am working on a
> > client tool that tries to find out this exact information. The tool i am
> > using connects to Tomcat via JMX but i am not sure if i can get the same
> > information via JMX. Can i access the Context class? or is there any
> other
> > way (Mbeans?) i can check if a context is running via JMX?
>
> You can get the same information using JMX. That's how Java-monitor.com
> does it. :)
>
> Why are you making a tool to get this information? There are loads of tools
> out there.
> --
> Kees Jan
>
> http://java-monitor.com/
> kjkos...@kjkoster.org
> 06-51838192
>
> Change is good. Granted, it is good in retrospect, but change is good.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Kees Jan Koster
Dear Ziggy,

> I was looking at the above for the above information as i am working on a
> client tool that tries to find out this exact information. The tool i am
> using connects to Tomcat via JMX but i am not sure if i can get the same
> information via JMX. Can i access the Context class? or is there any other
> way (Mbeans?) i can check if a context is running via JMX?

You can get the same information using JMX. That's how Java-monitor.com does 
it. :)

Why are you making a tool to get this information? There are loads of tools out 
there.
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
06-51838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



No Content-type in the header

2011-01-06 Thread 9-ACT-SWIM-SIF-LAB
I'm not sure this is a Tomcat issue but I'll explain why I'm posting it 
here shortly.

When I execute a very simple Java console web service client I get the 
following:

Exception in thread "main" javax.xml.ws.WebServiceException: No 
Content-type in the header!

The web service is deployed to Tomcat 6.0.

The reason I'm asking this here is because I've seen many posts on the net 
for this same problem when the web service is deployed to JBoss.  The 
solution to this problem is the following:

.the following libraries (found in JBOSS_HOME/common/lib) had to be 
moved to the endorsed folder (JBOSS_HOME/lib/endorsed).

jbossws-native-jaxrpc.jar
jbossws-native-jaxws.jar
jbossws-native-jaxws-ext.jar
jbossws-native-saaj.jar

I was wondering if there is a similar problem for Tomcat.  I have found 
nothing specific on the net for this particular problem on Tomcat.

Thanks

Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Ziggy
Hi,

Thanks for your response. I am aware of the activeSessions attribute under
"Catalina:type=Manager,path=/testapp,host=localhost". I am actually doing
this programmatically and would like to know of an Mbean that would tell me
if the application is available. The activeSessions attribute can sometimes
report 0 even when the application is available so it is not reliable.

Thanks

On Thu, Jan 6, 2011 at 6:29 PM, Pid  wrote:

> On 1/6/11 6:07 PM, Ziggy wrote:
> > I was looking at the code for the Tomcat Manager application to try and
> find
> > out how it is determining whether a webapp/context is running and how
> many
> > sesions are active. Looking at the code i think it uses these two methods
> >
> > Context.getAvailalbe() //check if available
> > Context.getManager().findSessions().length // Number of sessions.
> >
> > Here is the relevant function
> >
> >protected void list(PrintWriter writer) {
> >
> > if (debug >= 1)
> > log("list: Listing contexts for virtual host '" +
> > host.getName() + "'");
> >
> > writer.println(sm.getString("managerServlet.listed",
> > host.getName()));
> > Container[] contexts = host.findChildren();
> > for (int i = 0; i < contexts.length; i++) {
> > Context context = (Context) contexts[i];
> > String displayPath = context.getPath();
> > if( displayPath.equals("") )
> > displayPath = "/";
> > if (context != null ) {
> > if (context.getAvailable()) {
> >
> writer.println(sm.getString("managerServlet.listitem",
> > displayPath,
> > "running",
> >   "" +
> > context.getManager().findSessions().length,
> > context.getDocBase()));
> > } else {
> >
> writer.println(sm.getString("managerServlet.listitem",
> > displayPath,
> > "stopped",
> > "0",
> > context.getDocBase()));
> > }
> > }
> > }
> > }
> >
> > I was looking at the above for the above information as i am working on a
> > client tool that tries to find out this exact information. The tool i am
> > using connects to Tomcat via JMX but i am not sure if i can get the same
> > information via JMX. Can i access the Context class? or is there any
> other
> > way (Mbeans?) i can check if a context is running via JMX?
>
> Connect to a Tomcat instance using JConsole and look for the 'Manager'
> objects.
>
>  Catalina:type=Manager,path=/app01,host=localhost
>
> There's an attribute 'activeSessions'.
>
>
> p
>
>
>


Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Pid
On 1/6/11 6:07 PM, Ziggy wrote:
> I was looking at the code for the Tomcat Manager application to try and find
> out how it is determining whether a webapp/context is running and how many
> sesions are active. Looking at the code i think it uses these two methods
> 
> Context.getAvailalbe() //check if available
> Context.getManager().findSessions().length // Number of sessions.
> 
> Here is the relevant function
> 
>protected void list(PrintWriter writer) {
> 
> if (debug >= 1)
> log("list: Listing contexts for virtual host '" +
> host.getName() + "'");
> 
> writer.println(sm.getString("managerServlet.listed",
> host.getName()));
> Container[] contexts = host.findChildren();
> for (int i = 0; i < contexts.length; i++) {
> Context context = (Context) contexts[i];
> String displayPath = context.getPath();
> if( displayPath.equals("") )
> displayPath = "/";
> if (context != null ) {
> if (context.getAvailable()) {
> writer.println(sm.getString("managerServlet.listitem",
> displayPath,
> "running",
>   "" +
> context.getManager().findSessions().length,
> context.getDocBase()));
> } else {
> writer.println(sm.getString("managerServlet.listitem",
> displayPath,
> "stopped",
> "0",
> context.getDocBase()));
> }
> }
> }
> }
> 
> I was looking at the above for the above information as i am working on a
> client tool that tries to find out this exact information. The tool i am
> using connects to Tomcat via JMX but i am not sure if i can get the same
> information via JMX. Can i access the Context class? or is there any other
> way (Mbeans?) i can check if a context is running via JMX?

Connect to a Tomcat instance using JConsole and look for the 'Manager'
objects.

 Catalina:type=Manager,path=/app01,host=localhost

There's an attribute 'activeSessions'.


p




0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Ziggy
I was looking at the code for the Tomcat Manager application to try and find
out how it is determining whether a webapp/context is running and how many
sesions are active. Looking at the code i think it uses these two methods

Context.getAvailalbe() //check if available
Context.getManager().findSessions().length // Number of sessions.

Here is the relevant function

   protected void list(PrintWriter writer) {

if (debug >= 1)
log("list: Listing contexts for virtual host '" +
host.getName() + "'");

writer.println(sm.getString("managerServlet.listed",
host.getName()));
Container[] contexts = host.findChildren();
for (int i = 0; i < contexts.length; i++) {
Context context = (Context) contexts[i];
String displayPath = context.getPath();
if( displayPath.equals("") )
displayPath = "/";
if (context != null ) {
if (context.getAvailable()) {
writer.println(sm.getString("managerServlet.listitem",
displayPath,
"running",
  "" +
context.getManager().findSessions().length,
context.getDocBase()));
} else {
writer.println(sm.getString("managerServlet.listitem",
displayPath,
"stopped",
"0",
context.getDocBase()));
}
}
}
}

I was looking at the above for the above information as i am working on a
client tool that tries to find out this exact information. The tool i am
using connects to Tomcat via JMX but i am not sure if i can get the same
information via JMX. Can i access the Context class? or is there any other
way (Mbeans?) i can check if a context is running via JMX?


RE: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread ilya goberman

I think what was suggested before is to control this behavior by setting 
"keepAlive" setting. I would not think this is the right way.

I would still want to preserve "keepAlive" functiojnality for all other 
requests except "long running comet response". So if it is request for a web 
page, using keepAlive is fine.
Now in order to disable chunked encoding for a particular response, I would 
propose that a developer would set "Connection:close" header. Using connection 
"close" implies that closing the connection indicates the end of response and 
chunked encoding is not necessary in this case.

> Date: Thu, 6 Jan 2011 12:12:37 -0500
> From: ch...@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: How to disable chunked encoding for the Http11NioProtocol 
> connector.
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Ilya,
> 
> On 1/5/2011 4:29 PM, ilya goberman wrote:
> > I was thinking more about it. What if Tomcat disables chunked
> > encoding if response contains "Connection: close" header.
> 
> I think that's what Mark has suggested several times, now:
> 
> On 1/5/2011 12:54 PM, Mark Thomas wrote:
> > As I said, an enhancement request to optionally use a non-chunked 
> > response when keep-alive is disabled is - in my view - a reasonable
> > one.
> 
> On 1/5/2011 4:29 PM, ilya goberman wrote:
> > So in order
> > to disable the encoding the Tomcat application will have to set just
> > one response header.
> 
> ... and set a configuration parameter in Tomcat to enable this feature.
> Apparently, the feature as you describe it was a problem fixed in a
> previous version of Tomcat and won't be reverted unless a serious
> regression is identified. Mark is offering to allow configuration to
> re-enable this behavior.
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk0l+AUACgkQ9CaO5/Lv0PAFbwCeNzfxtyfbDFvvzdKekcVCkSTC
> FQ0AoI4kc2YFrKta7Q+TFL8Cap68fc3z
> =j0Ua
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

Re: Tomcat 6 busy threads issue

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kobi,

On 1/6/2011 12:14 PM, Kobi Biton wrote:
> -Tomcat 6.0.22

Great. Any opportunities to upgrade? Your version was never released and
is over a year old.

> - yes they are load balanced simple Round Robin Linux LVS  , (LB
> distributes the requests evenly)

So, you expect each server to serve 1/N of the incoming requests per
unit time. Any session stickiness?

> - All the servers (But 1) had the following thread pool confguration
> prior the change:
>
>MaxThreads=1000 , minSpareThread=25,maxSpateThreads=75
> 
> 1 server had:
> 
>   MaxThreads=300 , minSpareThread=25,maxSpateThreads=75

Okay, that will mean that the second server will handle, at most, 300
simultaneous connections. Do you have any per-backend-server connection
limits set at the load balancer?

> For some reason the server that had MaxThreads=300 report x2
> threadCount / threadBusy Via JMX polling , only after changing its
> maxThreads to 1000 the threadCount/threadBusy count was decreased x2 and
> matched all the other servers

So, let's do an example so I can get my head around it:

N = 3

Server 1: maxThreads=1000, busy=100
Server 2: maxThreads=1000, busy=100
Server 3: maxThreads=300,  busy=200

Is that roughly what you observed? Was that consistent over a long
period of time? Did you observe what kinds of requests were being served
on server 3? If some of them were long-running, you may just be
observing a natural build-up of work on a server that reliably gets 33%
of incoming requests but has some older requests that are still processing.

> - Indeed busyThreads <= maxThreads

Good. If that weren't true, something would be terribly wrong :)

> Just trying to figure out why did the maxThreads was Impacting the
> thread busy/count ...

I can't imagine why it would, other than putting a cap on the number of
busy threads (because busyThreads <= maxThreads).

What kind of lb are you using?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0l+pYACgkQ9CaO5/Lv0PBuogCgitvm9D01NSi84oO0tVO+itdn
ByMAmwfOVpq59BhVIlUtx/EswxsBm3lJ
=AzZU
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

On 1/5/2011 5:13 PM, André Warnier wrote:
> 4.3 Message Body
> ...
> Transfer-Encoding is a property of the message, not of the
> entity, and thus MAY be added or removed by any application along the
> request/response chain.

Maybe the OP should use Apache httpd with mod_blow_chunks or something
similar out in front. Does such a beast exist? I'm sure you could whip
one up in a few minutes: all it takes is a little message buffering
which, if the OP is serious about messages only being a few bytes, won't
represent undue burden on the server.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0l+N8ACgkQ9CaO5/Lv0PC4gACfbZVIG8sJSML5byP7a+S6q5e5
2AwAn36XwVzERdyRlcnRSiDw9ZWm2pZW
=E43B
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 6 busy threads issue

2011-01-06 Thread Kobi Biton
Hi Christopher thanks for the reply.

-Tomcat 6.0.22
- yes they are load balanced simple Round Robin Linux LVS  , (LB
distributes the requests evenly)
- All the servers (But 1) had the following thread pool confguration
prior the change:
   
   MaxThreads=1000 , minSpareThread=25,maxSpateThreads=75

1 server had:

  MaxThreads=300 , minSpareThread=25,maxSpateThreads=75

For some reason the server that had MaxThreads=300 report x2
threadCount / threadBusy Via JMX polling , only after changing its
maxThreads to 1000 the threadCount/threadBusy count was decreased x2 and
matched all the other servers

- Indeed busyThreads <= maxThreads

Just trying to figure out why did the maxThreads was Impacting the
threasd busy/count ...

Kobi

On Thu, 2011-01-06 at 12:05 -0500, Christopher Schultz wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Kobi,
> 
> On 1/6/2011 11:26 AM, Kobi Biton wrote:
> > Recently I have exposed my tomcat 6
> 
> 6.what?
> 
> > instances via JMX for monitoring I noticed that 1 of the servers is
> > using twice the bust thread count then all others
> 
> Are they load-balanced in any way? That's good information to have. You
> meant "busy" threads, right?
> 
> > then I noticed a configuration diff the server had 300 as maxThreads
> > while all other had 1000 as MaxThreads After changing it all came
> > back to normal
> 
> What did you change and what is "normal"?
> 
> > can someone explain me what is the correlation between maxThreads
> > count to busyThreads ?
> 
> Presumably, busyThreads <= maxThreads.
> 
> Anything else?
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk0l9m4ACgkQ9CaO5/Lv0PDz5ACfZhVT+MFoIAIgbxVkpIiXpyPI
> lIYAn0BBA4K6uK32/0JjuuTGR5/M3pUl
> =sFxS
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

-- 
Kobi Biton
Com N S Ltd.

Mobile: +972 (54) 8017668


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ilya,

On 1/5/2011 4:29 PM, ilya goberman wrote:
> I was thinking more about it. What if Tomcat disables chunked
> encoding if response contains "Connection: close" header.

I think that's what Mark has suggested several times, now:

On 1/5/2011 12:54 PM, Mark Thomas wrote:
> As I said, an enhancement request to optionally use a non-chunked 
> response when keep-alive is disabled is - in my view - a reasonable
> one.

On 1/5/2011 4:29 PM, ilya goberman wrote:
> So in order
> to disable the encoding the Tomcat application will have to set just
> one response header.

... and set a configuration parameter in Tomcat to enable this feature.
Apparently, the feature as you describe it was a problem fixed in a
previous version of Tomcat and won't be reverted unless a serious
regression is identified. Mark is offering to allow configuration to
re-enable this behavior.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0l+AUACgkQ9CaO5/Lv0PAFbwCeNzfxtyfbDFvvzdKekcVCkSTC
FQ0AoI4kc2YFrKta7Q+TFL8Cap68fc3z
=j0Ua
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 6 busy threads issue

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kobi,

On 1/6/2011 11:26 AM, Kobi Biton wrote:
> Recently I have exposed my tomcat 6

6.what?

> instances via JMX for monitoring I noticed that 1 of the servers is
> using twice the bust thread count then all others

Are they load-balanced in any way? That's good information to have. You
meant "busy" threads, right?

> then I noticed a configuration diff the server had 300 as maxThreads
> while all other had 1000 as MaxThreads After changing it all came
> back to normal

What did you change and what is "normal"?

> can someone explain me what is the correlation between maxThreads
> count to busyThreads ?

Presumably, busyThreads <= maxThreads.

Anything else?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0l9m4ACgkQ9CaO5/Lv0PDz5ACfZhVT+MFoIAIgbxVkpIiXpyPI
lIYAn0BBA4K6uK32/0JjuuTGR5/M3pUl
=sFxS
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Quick Questions on some Tomcat settings

2011-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Josh,

On 1/6/2011 7:56 AM, Josh Gooding wrote:
> thank you thank  you thank you!  I cannot thank you all enough!

Beer is always acceptable, though sometimes tough to ship.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0l9XEACgkQ9CaO5/Lv0PAMxACgtdYCkTTFTKXzT6pzqkYsdA+3
vXgAoKa9N6HgIz5/VDGRVeBqyJs/pwvY
=k8mP
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Tomcat 6 busy threads issue

2011-01-06 Thread Kobi Biton
Hello Experts,

 Recently I have exposed my tomcat 6 instances via JMX for monitoring I
noticed that 1 of the servers is using twice the bust thread count then
all others  , then I noticed a configuration diff the server had 300 as
maxThreads while all other had 1000 as MaxThreads After changing it all
came back to normal can someone explain me what is the correlation
between maxThreads count to busyThreads ? 

Thanks


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Comet and multipart

2011-01-06 Thread André Warnier

sol myr wrote:

Thanks :)

You're correct about blocking inputStreams, but I actually need Tomcat to write 
a multipart *response*, on an OutputStream (the reading side is on the client, 
and our client-side programmers will manage it without blocking).
I wondered whether I'll have to hand-code it (manually output the headers, 
etc), or is there some utilities on Tomcat/apach.

Depending on what you need precisely, you may want to have a look at stuff available in 
the "java mail" part.  That should have code re-usable to construct a MIME multi-part body.
Another place to look would be the Apache HttpClient code.  In principle, it is used to 
build multi-part *requests*, but the code can probably be re-used too.


There are things like these which simplify life :

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.commons.httpclient.methods.multipart.PartBase;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat monitoring using JMX

2011-01-06 Thread Pid
On 1/6/11 12:44 PM, Ziggy wrote:
> Hi,
> 
> I am using JMX to connect to a Tomcat instance and looking at attributes for
> a jdbc datasource as shown below.
> 
> MBeanServerConnection conn = jmxc.getMBeanServerConnection();
> ObjectName on = new
> ObjectName("Catalina:type=DataSource,path=/appdb,host=localhost,class=javax.sql.DataSource,name=\"jdbc/appdb\"");
> mbsc.getAttribute(on, "numIdle")
> 
> Is there an Mbean provided by Tomcat that can provide me the following
> information
> 
> - Whether Tomcat is running

Well you won't be able to connect to it to get the Bean if it's isn't.

> - Whether a specific web app running under a specific context is runnin

Catalina:type=WebModule,... etc

> - The health of the environment in general (tomcat, OS etc)

Define "health".

> - Whether a JNDI datasource is available and if possible how many active
> database connections there are and how many free.

You've already got the DataSource above, why not connect JConsole to
Tomcat and explore the other attributes?

> I have been google'ing around but the majority of the examples talk about
> writing your own Mbean and including it as part of the application. I am
> trying to write an external client utility that will monitor the application
> away from Tomcat.

JConsole?  VisualVM?


p

> Thanks
> 



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Comet and multipart

2011-01-06 Thread sol myr
Thanks :)

You're correct about blocking inputStreams, but I actually need Tomcat to write 
a multipart *response*, on an OutputStream (the reading side is on the client, 
and our client-side programmers will manage it without blocking).
I wondered whether I'll have to hand-code it (manually output the headers, 
etc), or is there some utilities on Tomcat/apach.

Thanks anyway :)


--- On Tue, 1/4/11, Filip Hanik - Dev Lists  wrote:

From: Filip Hanik - Dev Lists 
Subject: Re: Comet and multipart
To: "Tomcat Users List" 
Date: Tuesday, January 4, 2011, 9:43 AM

> 1) If we use multipart format (to separate between messages), does 
> Tomcat/Apache have utilities to make it easier? Or should we hand-code the 
> appropriate headers, separators, etc?
Not in Tomcat 6. The risk of using any utilities out there, is that they will 
want to block on inputstream.read until the entire request 
body has been read, and I suspect that's not what you want.




  

Re: tomcat 7.0.4 on MAC my app works on Windows get...

2011-01-06 Thread Joe Greenawalt
Someone here was passing it to tomcat on the startup along with a bunch of
other jvm parameters, probably in hopes of trying increase the performance.

On Thu, Jan 6, 2011 at 3:02 AM, Pid  wrote:

> On 1/5/11 8:44 PM, Joe Greenawalt wrote:
> > So i went to the appservers and sure enough it was there *
> > -Xverify:none*,
>
> Out of interest in which config file was this set?
>
> It's not an attribute set as standard by Tomcat.
>
>
> p
>


Re: Quick Questions on some Tomcat settings

2011-01-06 Thread Josh Gooding
thank you thank  you thank you!  I cannot thank you all enough!

On Wed, Jan 5, 2011 at 9:53 PM, Caldarale, Charles R <
chuck.caldar...@unisys.com> wrote:

> > From: Josh Gooding [mailto:josh.good...@gmail.com]
> > Subject: Re: Quick Questions on some Tomcat settings
>
> > I have:
> > 
> > and a  defined as:
> >  >   unpackWARs="true" autoDeploy="true"
> >   xmlValidation="false" xmlNamespaceAware="false">
> > proj-name
> > 
>
> I suggest you undo all that, and put server.xml back the way it was.  What
> you've done is not really useful.
>
> > should the appBase be defined as: /webapps/proj-name folder?
>
> Absolutely not.  What you actually need to do is stop Tomcat, restore
> server.xml, delete Tomcat's ROOT directory, rename webapps/proj-name to
> webapps/ROOT (case matters), and restart Tomcat.  That will make your webapp
> the default one.  (If you want to keep Tomcat's home page for some reason,
> just rename the original ROOT directory to something else rather than
> deleting it.)
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Tomcat monitoring using JMX

2011-01-06 Thread Ziggy
Hi,

I am using JMX to connect to a Tomcat instance and looking at attributes for
a jdbc datasource as shown below.

MBeanServerConnection conn = jmxc.getMBeanServerConnection();
ObjectName on = new
ObjectName("Catalina:type=DataSource,path=/appdb,host=localhost,class=javax.sql.DataSource,name=\"jdbc/appdb\"");
mbsc.getAttribute(on, "numIdle")

Is there an Mbean provided by Tomcat that can provide me the following
information

- Whether Tomcat is running
- Whether a specific web app running under a specific context is runnin
- The health of the environment in general (tomcat, OS etc)
- Whether a JNDI datasource is available and if possible how many active
database connections there are and how many free.

I have been google'ing around but the majority of the examples talk about
writing your own Mbean and including it as part of the application. I am
trying to write an external client utility that will monitor the application
away from Tomcat.

Thanks


Re: url prefixes behind proxy

2011-01-06 Thread André Warnier

Gabor Pinter wrote:

Dear list,

I have a very trivial problem.

My setup:
CentOS 5.5
nginx 0.8.53
Tomcat6

net ---> nginx:80 (proxy_pass) ---> tomcat:8080

Proxy redirect is triggered by prefix "/tom/"

myhost:80/tom/  --->  127.0.0.1:8080/tom/

Now here is my question.
How can I let Tomcat know about this "/tom/" prefix?

manner


The Tomcat welcome page ignores prefix /tom/ in links
(hence, no pix + links are wrong ).
However, in apps (e.g. 'manager', 'examples') links are prefixed by 
/tom/ (so pix & links are fine).



What is the authentic way to make the prefix absolutely transparent?



Hi.

It is not a trivial problem.
But I think that you are taking this from the wrong perspective.
You should not need to do anything special in Tomcat (or nginx) to let Tomcat know about 
the /tom/ prefix. It already knows.

In particular, you should not do



because this has nothing to do with the directories or URLs that Tomcat 
recognises.
(That's probably why it is "unpredictable").


Let'start from the beginning.

In a webserver like Tomcat, or Apache or nginx, there is a notion of "URL 
space".

That is to say, when you have a URL like http://hostname/a/b/c.html, and you consider the 
part after the protocol and hostname (thus here, the /a/b/c.html part), you imagine a 
certain hierarchical sructure so that /b is one of the things "below" /a, and /c.html is 
one of the things "below" /a/b.


This webserver runs on a physcial host, and to store the physical resource corresponding 
to /c.html above, it has a filesystem, where this file actually lives.

For example, the above file c.html may in reality be on the disk, in a 
directory like
/srv/www/host1/docs/a/b/c.html.

Ok so far ?

Now, between the "URL space", and the filesystem on disk, there is a certain "mapping" 
taking place, so that the webserver would know that when it receives  request for the URL 
"/a/b/c.html", it should look for that file in the directory "/srv/www/host1/docs/a/b/".

That mapping is done for example under Apache by the configuration line:

DocumentRoot /srv/www/host1/docs

In other words, this tells Apache that a URL = "/" refers to the disk directory 
/srv/www/host1/docs/, and that a URL like "/a" refers to the disk directory 
/srv/www/host1/docs/a/, and so on.


The same kind of mapping occurs in Tomcat, except that in Tomcat it is not a

DocumentRoot /xxx

which tells Tomcat how to map URLs to the filesystem.
It is the "appBase" attribute in the  tag, like :



This "webapps" above tells Tomcat that a URL like "http://hostname:8080/a/b/c.html";, 
should be mapped to


(tomcat_directory)/webapps/a/b/c.html

The only thing a bit special with Tomcat is respect of this mapping, is that for Tomcat, 
the URL "/" is not mapped directly to


(tomcat_directory)/webapps/

Instead, it is mapped to

(tomcat_directory)/webapps/ROOT/

This "ROOT" name is special, and represents for Tomcat its "default 
application".
In other words, for the URL : http://hostname:8080/a.html, Tomcat will return 
the file
(tomcat_dir)/webapps/ROOT/a.html

Now, to get back to your initial question :

If in nginx, you are telling nginx to pass the following URLs to Tomcat :

myhost:80/tom/  --->  127.0.0.1:8080/tom/

then for a URL like :

http://myhost:80/tom/something.html,

nginx will forward it to Tomcat, and Tomcat will be looking for the file

(tomcat_dir)/webapps/tom/something.html

Automatically.  Without having to do anything special in Tomcat.









-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: url prefixes behind proxy

2011-01-06 Thread Pid
On 1/6/11 11:02 AM, Gabor Pinter wrote:
> Dear list,
> 
> I have a very trivial problem.
> 
> My setup:
> CentOS 5.5
> nginx 0.8.53
> Tomcat6

You're using the unreleased, but highly experimental and potentially
dangerous version 6.3.7!?

;)


> net ---> nginx:80 (proxy_pass) ---> tomcat:8080
> 
> Proxy redirect is triggered by prefix "/tom/"
> 
> myhost:80/tom/  --->  127.0.0.1:8080/tom/
> 
> Now here is my question.
> How can I let Tomcat know about this "/tom/" prefix?

What do you expect Tomcat to do with the prefix?

You have configured* the proxy to expect Tomcat to have either tom.war
or a directory deployed in tomcat/webapps called 'tom'.

e.g
 path/to/tomcat/webapps/tom.war

or
 path/to/tomcat/webapps/tom/


>  manner

"localhost/tom" isn't valid hostname, nothing surprising about that.


p

* Assuming a default server.xml - you didn't say...

> The Tomcat welcome page ignores prefix /tom/ in links
> (hence, no pix + links are wrong ).
> However, in apps (e.g. 'manager', 'examples') links are prefixed by
> /tom/ (so pix & links are fine).
> 
> 
> What is the authentic way to make the prefix absolutely transparent?
> 
> Thanks in advance!
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


url prefixes behind proxy

2011-01-06 Thread Gabor Pinter

Dear list,

I have a very trivial problem.

My setup:
CentOS 5.5
nginx 0.8.53
Tomcat6

net ---> nginx:80 (proxy_pass) ---> tomcat:8080

Proxy redirect is triggered by prefix "/tom/"

myhost:80/tom/  --->  127.0.0.1:8080/tom/

Now here is my question.
How can I let Tomcat know about this "/tom/" prefix?

However, in apps (e.g. 'manager', 'examples') links are prefixed by 
/tom/ (so pix & links are fine).



What is the authentic way to make the prefix absolutely transparent?

Thanks in advance!

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: tomcat 7.0.4 on MAC my app works on Windows get...

2011-01-06 Thread Pid
On 1/5/11 8:44 PM, Joe Greenawalt wrote:
> So i went to the appservers and sure enough it was there *
> -Xverify:none*,

Out of interest in which config file was this set?

It's not an attribute set as standard by Tomcat.


p


0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature