You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lightbulb432 <ve...@hotmail.com> on 2007/05/30 00:14:34 UTC

Questions about Contexts

How are extremely large web applications divided up into contexts (as I’d
imagine these applications don’t reside within just a single WAR)? Let’s say
you have different functional areas, like user registration, search, file
management, etc, could each of those be divided up into its own context, or
is that too fine-grained?

Do any of you manage applications that, while logically being "one"
application, are actually deployed to multiple contexts? If so, could you
share some of your experiences in doing this – the benefits and limitations:
not only with single sign-on (which Tomcat makes easy), but things like
session management, concurrency to the data layer, and things that I can’t
even think of…

Or is dividing up one WAR into multiple WARs or the other way around as
simple as cutting and pasting the appropriate JSPs/Servlets/JavaBeans and
tweaking the web.xml files accordingly? I’d imagine there’s much else that
needs to be watched out for.

Thanks.
-- 
View this message in context: http://www.nabble.com/Questions-about-Contexts-tf3836951.html#a10863826
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: context.xml locations and servlet mappings

Posted by Pid <p...@pidster.com>.
Angelov, Rossen wrote:
> Thank you for explaining about the META-INF location. Mine is following
> exactly the same pattern as you described, but still the servlet
> mappings are not functioning when using the META-INF/context.xml. 

When you define a Context inside the Host, the path attribute is 
permitted.  When you define a Context elsewhere the path attribute is 
not permitted, (as Chris explained), but the path is defined by the 
directory name, or the .war file name.

ROOT is a special name for the default context, it's upper case and is 
the means used to define the default context.  You can't define the 
default context using another name if you're using the recommended 
method of deploying a context.

Hence my example below.

p


(p.s. just reply to the group, not me as well.)



> Do you have any clues why this could be happening? The mappings work
> fine when inside the host element in server.xml.
> 
> Ross
> 
> -----Original Message-----
> From: Pid [mailto:p@pidster.com] 
> Sent: Monday, June 04, 2007 5:25 PM
> To: Tomcat Users List
> Subject: Re: context.xml locations and servlet mappings
> 
> 
> One META-INF/context.xml per Context is the intended usage.
> 
> The appBase "../your/app/base" should contain:
> 
> .../app/base/ROOT/index.jsp
> .../app/base/ROOT/WEB-INF/web.xml
> .../app/base/ROOT/META-INF/context.xml
> 
> .../app/base/Other/index.jsp
> .../app/base/Other/WEB-INF/web.xml
> .../app/base/Other/META-INF/context.xml
> 
> 
> for "/index.jsp" and "/Other/index.jsp", where ROOT is the location for
> the default Context.
> 
> 
> p
> 
> 
> 
> 
> Angelov, Rossen wrote:
>> Chris,
>>
>> This didn't help. Removing them is not generating errors, the servlet
>> still loads on startup, but then the mapping don't work. 
>>
>> It doesn't make sense to remove the path and the docBase. Especially
> the
>> docBase, it specifies the Context Root. If it's empty, it probably
> uses
>> the host appBase for root, but this is incorrect. I should be able to
>> specify the context root. What about the cases when there are more
> than
>> one contexts per host?
>>
>> The problem seems to be somewhere else, but thanks for the advise.
>>
>> Ross
>>
>> -----Original Message-----
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Sent: Monday, June 04, 2007 4:46 PM
>> To: Tomcat Users List
>> Subject: Re: context.xml locations and servlet mappings
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Ross,
>>
>> Angelov, Rossen wrote:
>>> META-INF/context.xml
>>> 		  <Context path="" docBase="html" debug="0"
>>> privileged="true">
>>
>> Take out the "path" and "docBase" parameters. They are either illegal
> or
>> ill-advised when using META-INF/context.xml.
>>
>> This might not be /the/ problem, but you should definitely remove
> those
>> two attributes.
>>
>> - -chris
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.7 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFGZIgZ9CaO5/Lv0PARAoQoAKCIs1myORR5N3hhQAaBcEsyOZmi6ACfXMrx
>> HUvaShUKZFwX385E0A1dq98=
>> =3Rfo
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
>> e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>> "This communication is intended solely for the addressee and is
> confidential and not for third party unauthorized distribution"
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> "This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution"
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


RE: context.xml locations and servlet mappings

Posted by "Angelov, Rossen" <Ro...@SourceMedia.com>.
Thank you for explaining about the META-INF location. Mine is following
exactly the same pattern as you described, but still the servlet
mappings are not functioning when using the META-INF/context.xml. 

Do you have any clues why this could be happening? The mappings work
fine when inside the host element in server.xml.

Ross

-----Original Message-----
From: Pid [mailto:p@pidster.com] 
Sent: Monday, June 04, 2007 5:25 PM
To: Tomcat Users List
Subject: Re: context.xml locations and servlet mappings


One META-INF/context.xml per Context is the intended usage.

The appBase "../your/app/base" should contain:

.../app/base/ROOT/index.jsp
.../app/base/ROOT/WEB-INF/web.xml
.../app/base/ROOT/META-INF/context.xml

.../app/base/Other/index.jsp
.../app/base/Other/WEB-INF/web.xml
.../app/base/Other/META-INF/context.xml


for "/index.jsp" and "/Other/index.jsp", where ROOT is the location for
the default Context.


p




Angelov, Rossen wrote:
> Chris,
> 
> This didn't help. Removing them is not generating errors, the servlet
> still loads on startup, but then the mapping don't work. 
> 
> It doesn't make sense to remove the path and the docBase. Especially
the
> docBase, it specifies the Context Root. If it's empty, it probably
uses
> the host appBase for root, but this is incorrect. I should be able to
> specify the context root. What about the cases when there are more
than
> one contexts per host?
> 
> The problem seems to be somewhere else, but thanks for the advise.
> 
> Ross
> 
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Sent: Monday, June 04, 2007 4:46 PM
> To: Tomcat Users List
> Subject: Re: context.xml locations and servlet mappings
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Ross,
> 
> Angelov, Rossen wrote:
>> META-INF/context.xml
>> 		  <Context path="" docBase="html" debug="0"
>> privileged="true">
> 
> 
> Take out the "path" and "docBase" parameters. They are either illegal
or
> ill-advised when using META-INF/context.xml.
> 
> This might not be /the/ problem, but you should definitely remove
those
> two attributes.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGZIgZ9CaO5/Lv0PARAoQoAKCIs1myORR5N3hhQAaBcEsyOZmi6ACfXMrx
> HUvaShUKZFwX385E0A1dq98=
> =3Rfo
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> "This communication is intended solely for the addressee and is
confidential and not for third party unauthorized distribution"
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


"This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution"

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: context.xml locations and servlet mappings

Posted by Pid <p...@pidster.com>.
One META-INF/context.xml per Context is the intended usage.

The appBase "../your/app/base" should contain:

.../app/base/ROOT/index.jsp
.../app/base/ROOT/WEB-INF/web.xml
.../app/base/ROOT/META-INF/context.xml

.../app/base/Other/index.jsp
.../app/base/Other/WEB-INF/web.xml
.../app/base/Other/META-INF/context.xml


for "/index.jsp" and "/Other/index.jsp", where ROOT is the location for 
the default Context.


p




Angelov, Rossen wrote:
> Chris,
> 
> This didn't help. Removing them is not generating errors, the servlet
> still loads on startup, but then the mapping don't work. 
> 
> It doesn't make sense to remove the path and the docBase. Especially the
> docBase, it specifies the Context Root. If it's empty, it probably uses
> the host appBase for root, but this is incorrect. I should be able to
> specify the context root. What about the cases when there are more than
> one contexts per host?
> 
> The problem seems to be somewhere else, but thanks for the advise.
> 
> Ross
> 
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Sent: Monday, June 04, 2007 4:46 PM
> To: Tomcat Users List
> Subject: Re: context.xml locations and servlet mappings
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Ross,
> 
> Angelov, Rossen wrote:
>> META-INF/context.xml
>> 		  <Context path="" docBase="html" debug="0"
>> privileged="true">
> 
> 
> Take out the "path" and "docBase" parameters. They are either illegal or
> ill-advised when using META-INF/context.xml.
> 
> This might not be /the/ problem, but you should definitely remove those
> two attributes.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGZIgZ9CaO5/Lv0PARAoQoAKCIs1myORR5N3hhQAaBcEsyOZmi6ACfXMrx
> HUvaShUKZFwX385E0A1dq98=
> =3Rfo
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> "This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution"
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


RE: context.xml locations and servlet mappings

Posted by "Angelov, Rossen" <Ro...@SourceMedia.com>.
Chris,

This didn't help. Removing them is not generating errors, the servlet
still loads on startup, but then the mapping don't work. 

It doesn't make sense to remove the path and the docBase. Especially the
docBase, it specifies the Context Root. If it's empty, it probably uses
the host appBase for root, but this is incorrect. I should be able to
specify the context root. What about the cases when there are more than
one contexts per host?

The problem seems to be somewhere else, but thanks for the advise.

Ross

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Monday, June 04, 2007 4:46 PM
To: Tomcat Users List
Subject: Re: context.xml locations and servlet mappings

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ross,

Angelov, Rossen wrote:
> META-INF/context.xml
> 		  <Context path="" docBase="html" debug="0"
> privileged="true">


Take out the "path" and "docBase" parameters. They are either illegal or
ill-advised when using META-INF/context.xml.

This might not be /the/ problem, but you should definitely remove those
two attributes.

- -chris

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

iD8DBQFGZIgZ9CaO5/Lv0PARAoQoAKCIs1myORR5N3hhQAaBcEsyOZmi6ACfXMrx
HUvaShUKZFwX385E0A1dq98=
=3Rfo
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


"This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution"

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: context.xml locations and servlet mappings

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ross,

Angelov, Rossen wrote:
> META-INF/context.xml
> 		  <Context path="" docBase="html" debug="0"
> privileged="true">


Take out the "path" and "docBase" parameters. They are either illegal or
ill-advised when using META-INF/context.xml.

This might not be /the/ problem, but you should definitely remove those
two attributes.

- -chris

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

iD8DBQFGZIgZ9CaO5/Lv0PARAoQoAKCIs1myORR5N3hhQAaBcEsyOZmi6ACfXMrx
HUvaShUKZFwX385E0A1dq98=
=3Rfo
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


context.xml locations and servlet mappings

Posted by "Angelov, Rossen" <Ro...@SourceMedia.com>.
Hi,

I am experiencing a weird problem; when configuring my context in
META-INF/context.xml, the servlet mappings stop working.

I am trying to migrate web applications setup to run on Tomcat 5.0 to
Tomcat 5.5 or 6. Currently one or more contexts are configured inside a
host in server.xml. When I try moving these contexts in
META-INF/context.xml, the servlet mappings in web.xml stop working and I
can't figure out where the problem is. If I put the context back to
server.xml, the mappings work fine and pages display correctly.

Any help will be appreciated.

web.xml
...
<servlet-mapping>
  <servlet-name>myServlet</servlet-name>
  <url-pattern>*.html</url-pattern>
</servlet-mapping>
...

Server.xml
	<Host name="hostname" appBase="C:\projects\myApp" .../>

META-INF/context.xml
		  <Context path="" docBase="html" debug="0"
privileged="true">
			  </Context>
Also tried
		  <Context docBase="html" debug="0" privileged="true">
			  </Context>

The WEB-INF and META-INF are in C:\projects\myApp\html

I am also not sure what is correct location for META-INF.

Thanks,
Ross

"This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution"

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org