Re: Documentation for Catalina Base

2018-07-31 Thread Marek Czernek

Hi,

On 07/31/2018 03:24 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Marek,

On 7/31/18 3:37 AM, Marek Czernek wrote:

Hi Christopher,

thanks so much for finding the time to reply. Find my reasoning
inline.

On 07/30/2018 06:25 PM, Christopher Schultz wrote: Marek,

On 7/30/18 3:22 AM, Marek Czernek wrote:

Hi there,

recently, we noticed the lack of documentation for Catalina
Base, and I wanted to find out more about it. Other than a
strangely obscure txt file [1], I did not find the concept
and usage of Catalina Base documented in the Tomcat docs.

Do you mean the CATALINA_BASE environment variable, which is
copied into a running JVM as the "catalina.base" system property?

Yep, you got it.


2) If not, is there any reason for it not being documented?
While I don't want to duplicate text, I do not consider a txt
file somewhere a sufficient docs.

What, it needs to be in TeX, too?

:)) Joking aside though, documentation should say several things
at the very least:
1. What it is 2. How to use it 3. When to use it
All the documentation links you provided simply say that such
variable exists and that you can use it to create multiple
instances of Tomcat. So in the HTML docs, I'm missing information
on:
1) How do you set it up

Well, it's an environment variable so... set it in your shell? There
are many ways to set an environment variable. Shall we cover them all?


2) What exactly must be in catalina.base such that Tomcat
actually starts (since if you point it to an empty directory,
Tomcat fails to start)

The RUNNING.txt file explains exactly what must be in CATALINA_BASE
versus CATALINA_HOME. Is the primary complaint that this information
is not also in the online documentation?


3) What are the advantages of catalina.base, i.e. why does it
exist. Saying that 'if you want to multiple instances of Tomcat,
use catalina.base' is, in my mind, missing why you'd want to use
catalina.base instead of simply copy-paste the whole tomcat
directory as many times as you want. I mean, we want to foster
good practices, don't we?

RUNNING.txt suggests that a split-configuration allows for the
"desirable" situation of sharing a copy of Tomcat amongst multiple
users. It ignores, however, the most beneficial aspect on a split
configuration: ease of upgrading.

Perhaps that could be included in the documentation, wherever it ends up
.


When we have beautiful HTML documentation that is deep and
well-written, I wouldn't expect that users are suddenly required
to read a  shell/bat script, or some txt file that they randomly
found while googling, to get full information on catalina.base.

Fair enough.


So I personally see two options here:
1) We can document it in the Tomcat upstream documentation
2) We can document it in our downstream documentation

Having just recently written my own downstream documentation for
Apache Solr (whose documentation is indeed also deep and
well-written), I'd say that we don't want you to have to do that.


(and you might say that the third option is don't document it at
all, which I will raise internally and will see what would that
yield - I'll take the recommendation of the community very
seriously)
If the Tomcat community believes that catalina.base is, in fact,
well documented, I'm of course OK with that; that's why I'm
asking here.
What do you think? Do I make sense? :)

Makes sense.

Where would you have expected to see the documentation for these
settings? They are effectively used only from the various
launch-related scripts (e.g. bin/catalina.sh|bat and bin/service.bat)
but they can also be used in embedded (application) environments, too.
So I don't think it makes sense to put that documentation into e.g.
the "scripts documentation".

How about expanding this section, here:
https://tomcat.apache.org/tomcat-9.0-doc/introduction.html#Directories_a
nd_Files
That sounds reasonable to me. Cheers, I'll see what we can do in terms 
of documenting it! :)


- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltgYwEACgkQHPApP6U8
pFjN9RAApvnqRPtEtB7OGHSKxcVMSNrlIYmJad5+JQWvfyViFgl3M0/UsDSHV57I
rbU+M1PMbdMss/wi3Yul6VY6JFcwDkBNLjYQHCf/r5eAR7ChGl20kXJeTvnUoq1F
6rRqeUey3qzh5CvrvljWsm2ZBj+FuyQZa8RkLSU+h5yiZZqqz9o4ZpypWOqjzoNH
Y6YyZitwnYcpzrdKhBBfgWDS/Ly0sed4Vswf4NwCLh6PQB6HR0Xcs/xsY3hQ5WHm
TvI5I7F7/lvUhxSVeVOteuMm2qb9aBg15lJmMx6y4Zls+e4HnbPxpcinCmDZ68gV
IoG7HRJ1SlUvDQ6TaK7jXGjUuIrM5HA3nn9SajgE3W5S8pO0V/ad0YtMTLWsaXjz
AGbFXcrWt1kne8Mg5XcZUHV46Hiwfm3t5R2lzPy/gao+6uEEqdqUIJDfuC5rLvy9
Dk2gPV6bR50QI7bIFgq2p4xYnAR05Md/5T+Dl1qeMnJCUk56kmVRhxZP551/TD9E
ED+oM1xLpZ6KowORBG2LbAjuMSGNuEG29lfpGR/B/j9gvdOkwA0jOvEUYUVI1H5O
O2YEE6pfU0hS79L0WFFp5I8SbKa8xa4RqdW4lEGseWSvQBoJ/+X5XQZarXqYBaLZ
Vw/hRIY6/XIc+mG5ZsZxebGRiM+OzmHnrZ3z97f5AsSGMRYBb1o=
=0V/v
-END PGP SIGNATURE-

-

Re: Tomcat error at run-time.

2018-07-31 Thread noel joseph
Hey Chris,
 I am having a little difficulty in logging. As mentioned before I am new
to tomcat and don't exactly know how to enable logging.
Could you please instruct me on how to do so.

Thanks,
Noel

On Tue, Jul 31, 2018 at 7:49 PM, noel joseph  wrote:

> Thank you so much Cris I will try your methods and let you know off the
> results. Thanks for the quick response!
>
> Cheers
> Noel
>
> On Tue, Jul 31, 2018, 6:44 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA256
>>
>> Noel,
>>
>> On 7/31/18 2:54 AM, noel joseph wrote:
>> > Hi, I am rather new to tomcat, I've been trying to embed tomcat in
>> > a java application. I further want to convert this into a java web
>> > start file so that on deploying it I can have a separate tomcat
>> > server for my application. The error I am facing is...
>> > org.apache.catalina.LifecycleException: A child container failed
>> > during start.
>>
>> A "child container" usually ends up being something like an
>> application. Do you have any logging enabled? If so, what does the log
>> say? If not, try enabling logging and then checking the log. Tomcat is
>> usually pretty verbose about what happened and what it happened to.
>>
>> > I tried a couple of methods to solve it but with no use, the error
>> > still stays. I am using embedded tomcat 8.5.23, I changed it to the
>> > latest tomcat 9.0.10 which fixed the error but then the server
>> > didn't start. it just stops at.. WARNING: Creation of secureRandom
>> > insatnce.
>>
>> If you are hanging on creating SecureRandom, your server (or
>> workstation) might have run out of cryptographic entropy. This can
>> happen when you restart a server like Tomcat too rapidly and the OS
>> doesn't have enough time to re-fill the entropy pool.
>>
>> Can you take a thread dump[1] of the running process the next time
>> this stalls, just to be sure?
>>
>> > By reverting back to tomcat 8.5.23 this was solved but again I'm
>> > facing the child container failed error.
>> >
>> > Please let me know if there is a fix to my issue or if there is a
>> > better version of tomcat that I can use.
>>
>> The problem is likely with a component of your application. Logs will
>> help discover the root of the problem.
>>
>> The decision to use Tomcat 8.5 or Tomcat 9.0 has more to do with your
>> risk-aversion. Both versions are still under active development, but
>> Tomcat 8.5 is more mature and stable (from a code perspective, not
>> that it is any more reliable than 9.0). Both versions should be
>> maintained for the next few years.
>>
>> Hope that helps,
>> - -chris
>>
>> [1]
>> https://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my
>> _running_webapp_.3F
>> -BEGIN PGP SIGNATURE-
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltgYMsACgkQHPApP6U8
>> pFiNlA//bg52WqByfHyAAEMep0a47ZIZ5Bn8D951/p6k5fht/G31ZlzLXXwYzlBk
>> Redx7Aozx2JG7C0mfPXKHxcr8TqxPcEFC4LDBPs+ywRNhIkGE+ZQtVfIS9+3Wmz1
>> aKUsXiK0DYMiRHoHNY0V0G8Zt6sJNlT0MkFpAVbD3EcHm2vrw8T4G0+9lOslMe01
>> Pd172hZ+xE9zpouceFNFPHJVWldwSgxrXNvQOV0VdBVTME7BGMf6yWzJrMxLTNj6
>> z8EY501ZZd3awrva+JMRFnzQS4qS7dRBMgIP7qJ5S8LLH+OuWcJ99a1s1AAgX9hq
>> x+bsuOugiZITz/GAD8+lbTIfiGeZefIALyekYCEwBH8lgMAqlZRhGc+H/5UsFwiX
>> 1XEgDbaINHOrMWOBFJVAmT6b3pkSt/Rj2mnb0knYjRDVbcmkPyj3P1Px2opQjEkt
>> adCxpCQYGDQh/Ddy+q0nj7flAkIgGRwQi7jIfLUJRvE00N0QlTNGscbXr+lzbQCr
>> kh3xrvGsEWhiNluhZAosGmpwQPtcCByV4EBjNpvF4/p3mXEIOm/f+k9X816ian4B
>> nDJOyjwDhxVFNVfHR7tP991CMPuQnK1SZf8wRj2S91Un9E+QOrtxusAOQch96M0D
>> 4nKYH3vlduzaeqbdhSa5vAzsTVGffICl6PmowWeNGQ4I4c1vcBI=
>> =x/SS
>> -END PGP SIGNATURE-
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>


Re: Tomcat9 ROOT deploy

2018-07-31 Thread Mounika Reddy
What I found is when I renamed .xml to ROOT.xml  in
/conf/Catalina/
then war file exploded in to the ROOT directory in tomcat web apps
folder. Is this the expected behavior?? Because when I used
as an exploded folder then it referred to it from the same
/deploy folder.

On Tue, Jul 31, 2018 at 2:30 PM, Mounika Reddy  wrote:
> If I renamed ROOT.xml to .xml in the
> /conf/Catalina/ then it picked up the file and
> deployed in to webapps/. How can I make it so that
> it deploys to the ROOT folder.
>
> On Tue, Jul 31, 2018 at 2:09 PM, Mounika Reddy  wrote:
>> In the same deploy folder where I had my war file.
>>
>> On Tue, Jul 31, 2018 at 1:20 PM, Mark Thomas  wrote:
>>> On 31/07/18 17:13, Mounika Reddy wrote:
 I tried first with the name as the war file name and didn't even pick
 my change but somehow it shows deployment is completed. I don't see
 the
 exploded war file.
>>>
>>> Where did you look?
>>>
>>> Mark
>>>
>>>

 31-Jul-2018 12:10:15.342 INFO [main]
 org.apache.catalina.startup.HostConfig.deployDescriptor Deploying
 configuration descriptor
 [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml]
 31-Jul-2018 12:10:16.921 INFO [main]
 org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
 configuration descriptor
 [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml] has finished in
 [1,563] ms

 On Tue, Jul 31, 2018 at 11:52 AM, Mark Thomas  wrote:
> On 31/07/18 16:44, Mounika Reddy wrote:
>> Hi all,
>>
>> I'm trying to deploy a war file in tomcat and publish to root context.
>> I have created a ROOT.xml file in
>> /conf/Catalina//ROOT.xml. The issue is tomcat
>> not picking up war file or neither exploding war file into a
>> directory. But if I unpack war file into a folder then it's picking up
>> properly. War file name is cas##1.0.0.war
>>
>> Host definition in server.xml:
>>
>> > unpackWARs="true" autoDeploy="true">
>>
>> Contents of ROOT.xml
>>
>> 
>> >   docBase="../deploy/cas"
>> />
>
> The docBase above does not match the file structure below.
>
> It looks like you need docBase="../deploy/cas##1.0.0.war"
>
>
>>
>> My tomcat folder structure:
>>
>> 
>>   -- bin
>>   -- conf
>>   -- deploy
>>-- cas##1.0.0.war
>>   -- logs
>>   -- lib
>>   -- temp
>>   -- webapps
>>   -- work
>>
>> Versions:
>> Tomcat 9.0.1
>> Java 9.0.1
>> Windows Server 2012
>>
>> Thanks.
>>
>> -
>> 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
>

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

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



Re: Tomcat9 ROOT deploy

2018-07-31 Thread Mounika Reddy
If I renamed ROOT.xml to .xml in the
/conf/Catalina/ then it picked up the file and
deployed in to webapps/. How can I make it so that
it deploys to the ROOT folder.

On Tue, Jul 31, 2018 at 2:09 PM, Mounika Reddy  wrote:
> In the same deploy folder where I had my war file.
>
> On Tue, Jul 31, 2018 at 1:20 PM, Mark Thomas  wrote:
>> On 31/07/18 17:13, Mounika Reddy wrote:
>>> I tried first with the name as the war file name and didn't even pick
>>> my change but somehow it shows deployment is completed. I don't see
>>> the
>>> exploded war file.
>>
>> Where did you look?
>>
>> Mark
>>
>>
>>>
>>> 31-Jul-2018 12:10:15.342 INFO [main]
>>> org.apache.catalina.startup.HostConfig.deployDescriptor Deploying
>>> configuration descriptor
>>> [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml]
>>> 31-Jul-2018 12:10:16.921 INFO [main]
>>> org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
>>> configuration descriptor
>>> [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml] has finished in
>>> [1,563] ms
>>>
>>> On Tue, Jul 31, 2018 at 11:52 AM, Mark Thomas  wrote:
 On 31/07/18 16:44, Mounika Reddy wrote:
> Hi all,
>
> I'm trying to deploy a war file in tomcat and publish to root context.
> I have created a ROOT.xml file in
> /conf/Catalina//ROOT.xml. The issue is tomcat
> not picking up war file or neither exploding war file into a
> directory. But if I unpack war file into a folder then it's picking up
> properly. War file name is cas##1.0.0.war
>
> Host definition in server.xml:
>
>  unpackWARs="true" autoDeploy="true">
>
> Contents of ROOT.xml
>
> 
>    docBase="../deploy/cas"
> />

 The docBase above does not match the file structure below.

 It looks like you need docBase="../deploy/cas##1.0.0.war"


>
> My tomcat folder structure:
>
> 
>   -- bin
>   -- conf
>   -- deploy
>-- cas##1.0.0.war
>   -- logs
>   -- lib
>   -- temp
>   -- webapps
>   -- work
>
> Versions:
> Tomcat 9.0.1
> Java 9.0.1
> Windows Server 2012
>
> Thanks.
>
> -
> 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

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

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



Re: Tomcat9 ROOT deploy

2018-07-31 Thread Mounika Reddy
In the same deploy folder where I had my war file.

On Tue, Jul 31, 2018 at 1:20 PM, Mark Thomas  wrote:
> On 31/07/18 17:13, Mounika Reddy wrote:
>> I tried first with the name as the war file name and didn't even pick
>> my change but somehow it shows deployment is completed. I don't see
>> the
>> exploded war file.
>
> Where did you look?
>
> Mark
>
>
>>
>> 31-Jul-2018 12:10:15.342 INFO [main]
>> org.apache.catalina.startup.HostConfig.deployDescriptor Deploying
>> configuration descriptor
>> [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml]
>> 31-Jul-2018 12:10:16.921 INFO [main]
>> org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
>> configuration descriptor
>> [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml] has finished in
>> [1,563] ms
>>
>> On Tue, Jul 31, 2018 at 11:52 AM, Mark Thomas  wrote:
>>> On 31/07/18 16:44, Mounika Reddy wrote:
 Hi all,

 I'm trying to deploy a war file in tomcat and publish to root context.
 I have created a ROOT.xml file in
 /conf/Catalina//ROOT.xml. The issue is tomcat
 not picking up war file or neither exploding war file into a
 directory. But if I unpack war file into a folder then it's picking up
 properly. War file name is cas##1.0.0.war

 Host definition in server.xml:

 >>> unpackWARs="true" autoDeploy="true">

 Contents of ROOT.xml

 
 >>>   docBase="../deploy/cas"
 />
>>>
>>> The docBase above does not match the file structure below.
>>>
>>> It looks like you need docBase="../deploy/cas##1.0.0.war"
>>>
>>>

 My tomcat folder structure:

 
   -- bin
   -- conf
   -- deploy
-- cas##1.0.0.war
   -- logs
   -- lib
   -- temp
   -- webapps
   -- work

 Versions:
 Tomcat 9.0.1
 Java 9.0.1
 Windows Server 2012

 Thanks.

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

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



Re: What is the correct place to specifiy SPI service files for Java?

2018-07-31 Thread Mark Thomas
On 31/07/18 17:06, Thorsten Schöning wrote:
> Hi all,
> 
> I would like to get some attention on some older SO-question[1] about
> where to place SPI-service files of Java.
> 
> Following the docs, those should be placed in META-INF at the top
> level of some JAR and webapps designed to be used with Tomcat provide
> such a folder.

Correct. With the caveat that if the web application defines an
 in web.xml, only those JARs are searched.

See
https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/startup/WebappServiceLoader.java
for details.

Mark


> But it seems to be ignored during search for
> SPI-service files, instead those seem to be assumed in
> WEB-INF/classes/META-INF/services. The can easily be seen e.g. using
> Process Monitor in Windows.
> 
> As the SO-question lacks some official Tomcat-documentation or such, I
> am asking here: What is the correct place for such service files? Can
> this be configured somehow? Why is META-INF at the top level ignored?
> Is it used at all for anything or only WEB-INF/classes/META-INF for
> anything which is normally assumed to be in META-INF itself?
> 
> Thanks!
> 
> [1]: 
> https://stackoverflow.com/questions/7692497/tomcat-wont-load-my-meta-inf-services-javax-servlet-servletcontainerinitializ
> 
> Mit freundlichen Grüßen,
> 
> Thorsten Schöning
> 


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



Re: Tomcat9 ROOT deploy

2018-07-31 Thread Mark Thomas
On 31/07/18 17:13, Mounika Reddy wrote:
> I tried first with the name as the war file name and didn't even pick
> my change but somehow it shows deployment is completed. I don't see
> the
> exploded war file.

Where did you look?

Mark


> 
> 31-Jul-2018 12:10:15.342 INFO [main]
> org.apache.catalina.startup.HostConfig.deployDescriptor Deploying
> configuration descriptor
> [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml]
> 31-Jul-2018 12:10:16.921 INFO [main]
> org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
> configuration descriptor
> [C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml] has finished in
> [1,563] ms
> 
> On Tue, Jul 31, 2018 at 11:52 AM, Mark Thomas  wrote:
>> On 31/07/18 16:44, Mounika Reddy wrote:
>>> Hi all,
>>>
>>> I'm trying to deploy a war file in tomcat and publish to root context.
>>> I have created a ROOT.xml file in
>>> /conf/Catalina//ROOT.xml. The issue is tomcat
>>> not picking up war file or neither exploding war file into a
>>> directory. But if I unpack war file into a folder then it's picking up
>>> properly. War file name is cas##1.0.0.war
>>>
>>> Host definition in server.xml:
>>>
>>> >> unpackWARs="true" autoDeploy="true">
>>>
>>> Contents of ROOT.xml
>>>
>>> 
>>> >>   docBase="../deploy/cas"
>>> />
>>
>> The docBase above does not match the file structure below.
>>
>> It looks like you need docBase="../deploy/cas##1.0.0.war"
>>
>>
>>>
>>> My tomcat folder structure:
>>>
>>> 
>>>   -- bin
>>>   -- conf
>>>   -- deploy
>>>-- cas##1.0.0.war
>>>   -- logs
>>>   -- lib
>>>   -- temp
>>>   -- webapps
>>>   -- work
>>>
>>> Versions:
>>> Tomcat 9.0.1
>>> Java 9.0.1
>>> Windows Server 2012
>>>
>>> Thanks.
>>>
>>> -
>>> 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
>>
> 
> -
> 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: Tomcat9 ROOT deploy

2018-07-31 Thread Mounika Reddy
I tried first with the name as the war file name and didn't even pick
my change but somehow it shows deployment is completed. I don't see
the
exploded war file.

31-Jul-2018 12:10:15.342 INFO [main]
org.apache.catalina.startup.HostConfig.deployDescriptor Deploying
configuration descriptor
[C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml]
31-Jul-2018 12:10:16.921 INFO [main]
org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
configuration descriptor
[C:\QA\tomcat9_cas\conf\Catalina\mysite.com\ROOT.xml] has finished in
[1,563] ms

On Tue, Jul 31, 2018 at 11:52 AM, Mark Thomas  wrote:
> On 31/07/18 16:44, Mounika Reddy wrote:
>> Hi all,
>>
>> I'm trying to deploy a war file in tomcat and publish to root context.
>> I have created a ROOT.xml file in
>> /conf/Catalina//ROOT.xml. The issue is tomcat
>> not picking up war file or neither exploding war file into a
>> directory. But if I unpack war file into a folder then it's picking up
>> properly. War file name is cas##1.0.0.war
>>
>> Host definition in server.xml:
>>
>> > unpackWARs="true" autoDeploy="true">
>>
>> Contents of ROOT.xml
>>
>> 
>> >   docBase="../deploy/cas"
>> />
>
> The docBase above does not match the file structure below.
>
> It looks like you need docBase="../deploy/cas##1.0.0.war"
>
>
>>
>> My tomcat folder structure:
>>
>> 
>>   -- bin
>>   -- conf
>>   -- deploy
>>-- cas##1.0.0.war
>>   -- logs
>>   -- lib
>>   -- temp
>>   -- webapps
>>   -- work
>>
>> Versions:
>> Tomcat 9.0.1
>> Java 9.0.1
>> Windows Server 2012
>>
>> Thanks.
>>
>> -
>> 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
>

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



What is the correct place to specifiy SPI service files for Java?

2018-07-31 Thread Thorsten Schöning
Hi all,

I would like to get some attention on some older SO-question[1] about
where to place SPI-service files of Java.

Following the docs, those should be placed in META-INF at the top
level of some JAR and webapps designed to be used with Tomcat provide
such a folder. But it seems to be ignored during search for
SPI-service files, instead those seem to be assumed in
WEB-INF/classes/META-INF/services. The can easily be seen e.g. using
Process Monitor in Windows.

As the SO-question lacks some official Tomcat-documentation or such, I
am asking here: What is the correct place for such service files? Can
this be configured somehow? Why is META-INF at the top level ignored?
Is it used at all for anything or only WEB-INF/classes/META-INF for
anything which is normally assumed to be in META-INF itself?

Thanks!

[1]: 
https://stackoverflow.com/questions/7692497/tomcat-wont-load-my-meta-inf-services-javax-servlet-servletcontainerinitializ

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


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



Re: Tomcat9 ROOT deploy

2018-07-31 Thread Mark Thomas
On 31/07/18 16:44, Mounika Reddy wrote:
> Hi all,
> 
> I'm trying to deploy a war file in tomcat and publish to root context.
> I have created a ROOT.xml file in
> /conf/Catalina//ROOT.xml. The issue is tomcat
> not picking up war file or neither exploding war file into a
> directory. But if I unpack war file into a folder then it's picking up
> properly. War file name is cas##1.0.0.war
> 
> Host definition in server.xml:
> 
>  unpackWARs="true" autoDeploy="true">
> 
> Contents of ROOT.xml
> 
> 
>docBase="../deploy/cas"
> />

The docBase above does not match the file structure below.

It looks like you need docBase="../deploy/cas##1.0.0.war"


> 
> My tomcat folder structure:
> 
> 
>   -- bin
>   -- conf
>   -- deploy
>-- cas##1.0.0.war
>   -- logs
>   -- lib
>   -- temp
>   -- webapps
>   -- work
> 
> Versions:
> Tomcat 9.0.1
> Java 9.0.1
> Windows Server 2012
> 
> Thanks.
> 
> -
> 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



Tomcat9 ROOT deploy

2018-07-31 Thread Mounika Reddy
Hi all,

I'm trying to deploy a war file in tomcat and publish to root context.
I have created a ROOT.xml file in
/conf/Catalina//ROOT.xml. The issue is tomcat
not picking up war file or neither exploding war file into a
directory. But if I unpack war file into a folder then it's picking up
properly. War file name is cas##1.0.0.war

Host definition in server.xml:



Contents of ROOT.xml




My tomcat folder structure:


  -- bin
  -- conf
  -- deploy
   -- cas##1.0.0.war
  -- logs
  -- lib
  -- temp
  -- webapps
  -- work

Versions:
Tomcat 9.0.1
Java 9.0.1
Windows Server 2012

Thanks.

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



Re: Tomcat error at run-time.

2018-07-31 Thread noel joseph
Thank you so much Cris I will try your methods and let you know off the
results. Thanks for the quick response!

Cheers
Noel

On Tue, Jul 31, 2018, 6:44 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Noel,
>
> On 7/31/18 2:54 AM, noel joseph wrote:
> > Hi, I am rather new to tomcat, I've been trying to embed tomcat in
> > a java application. I further want to convert this into a java web
> > start file so that on deploying it I can have a separate tomcat
> > server for my application. The error I am facing is...
> > org.apache.catalina.LifecycleException: A child container failed
> > during start.
>
> A "child container" usually ends up being something like an
> application. Do you have any logging enabled? If so, what does the log
> say? If not, try enabling logging and then checking the log. Tomcat is
> usually pretty verbose about what happened and what it happened to.
>
> > I tried a couple of methods to solve it but with no use, the error
> > still stays. I am using embedded tomcat 8.5.23, I changed it to the
> > latest tomcat 9.0.10 which fixed the error but then the server
> > didn't start. it just stops at.. WARNING: Creation of secureRandom
> > insatnce.
>
> If you are hanging on creating SecureRandom, your server (or
> workstation) might have run out of cryptographic entropy. This can
> happen when you restart a server like Tomcat too rapidly and the OS
> doesn't have enough time to re-fill the entropy pool.
>
> Can you take a thread dump[1] of the running process the next time
> this stalls, just to be sure?
>
> > By reverting back to tomcat 8.5.23 this was solved but again I'm
> > facing the child container failed error.
> >
> > Please let me know if there is a fix to my issue or if there is a
> > better version of tomcat that I can use.
>
> The problem is likely with a component of your application. Logs will
> help discover the root of the problem.
>
> The decision to use Tomcat 8.5 or Tomcat 9.0 has more to do with your
> risk-aversion. Both versions are still under active development, but
> Tomcat 8.5 is more mature and stable (from a code perspective, not
> that it is any more reliable than 9.0). Both versions should be
> maintained for the next few years.
>
> Hope that helps,
> - -chris
>
> [1]
> https://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my
> _running_webapp_.3F
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltgYMsACgkQHPApP6U8
> pFiNlA//bg52WqByfHyAAEMep0a47ZIZ5Bn8D951/p6k5fht/G31ZlzLXXwYzlBk
> Redx7Aozx2JG7C0mfPXKHxcr8TqxPcEFC4LDBPs+ywRNhIkGE+ZQtVfIS9+3Wmz1
> aKUsXiK0DYMiRHoHNY0V0G8Zt6sJNlT0MkFpAVbD3EcHm2vrw8T4G0+9lOslMe01
> Pd172hZ+xE9zpouceFNFPHJVWldwSgxrXNvQOV0VdBVTME7BGMf6yWzJrMxLTNj6
> z8EY501ZZd3awrva+JMRFnzQS4qS7dRBMgIP7qJ5S8LLH+OuWcJ99a1s1AAgX9hq
> x+bsuOugiZITz/GAD8+lbTIfiGeZefIALyekYCEwBH8lgMAqlZRhGc+H/5UsFwiX
> 1XEgDbaINHOrMWOBFJVAmT6b3pkSt/Rj2mnb0knYjRDVbcmkPyj3P1Px2opQjEkt
> adCxpCQYGDQh/Ddy+q0nj7flAkIgGRwQi7jIfLUJRvE00N0QlTNGscbXr+lzbQCr
> kh3xrvGsEWhiNluhZAosGmpwQPtcCByV4EBjNpvF4/p3mXEIOm/f+k9X816ian4B
> nDJOyjwDhxVFNVfHR7tP991CMPuQnK1SZf8wRj2S91Un9E+QOrtxusAOQch96M0D
> 4nKYH3vlduzaeqbdhSa5vAzsTVGffICl6PmowWeNGQ4I4c1vcBI=
> =x/SS
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: cors filter in WEB-INF/web.xml

2018-07-31 Thread Luis Rodríguez Fernández
Hello Masber,

In order to get accurate answers it would be helpful if you could provide
details like:

- Platform details: OS, jdk/jre, apache-tomcat version...
- "I went through documentation" which one? perhaps
https://tomcat.apache.org/tomcat-9.0-doc/config/filter.html#CORS_Filter
- "my web client still complains" I guess that you get some error response
here; have you checked your logs?

Hope it helps,

Luis





2018-07-28 9:00 GMT+02:00 masber masber :

> Dear Apache Tomcat community,
>
>
> I am learning Tomcat and would like to create a crosfilter, I went through
> the documentation and added the code suggested but my web client still
> complains.
>
>
> This is the content of my web.xml file:
>
>
> 
>
> Archetype Created Web Application
>
>
> 
>
> jersey-servlet
>
> org.glassfish.jersey.servlet.
> ServletContainer
>
>
> 
>
> jersey.config.server.provider.packages param-name>
>
> returnitRest
>
> 
>
>
> 
>
> jersey.config.server.provider.classnames param-name>
>
> org.glassfish.jersey.media.multipart.
> MultiPartFeature
>
> 
>
>
> 
>
> javax.ws.rs.Application
>
> returnitRest.AppConfig
>
> 
>
>
> 1
>
> 
>
>
> 
>
> jersey-servlet
>
> /rest/*
>
> 
>
>
> 
>
>   CorsFilter
>
>   org.apache.catalina.filters.CorsFilter
>
>   
>
> cors.allowed.origins
>
> *
>
>   
>
>   
>
> cors.allowed.methods
>
> GET,POST,HEAD,OPTIONS,PUT
>
>   
>
>   
>
> cors.allowed.headers
>
> Content-Type,X-Requested-With,accept,Origin,
> Access-Control-Request-Method,Access-Control-Request-Headers
>
>   
>
>   
>
> cors.exposed.headers
>
> Access-Control-Allow-Origin,Access-Control-
> Allow-Credentials
>
>   
>
>   
>
> cors.support.credentials
>
> true
>
>   
>
>   
>
> cors.preflight.maxage
>
> 10
>
>   
>
> 
>
> 
>
>   CorsFilter
>
>   /*
>
> 
>
> 
>
>
> I was wondering whether someone could help me to understand what I am
> doing wrong?
>
>
> thank you very much
>
>


-- 

"Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better."

- Samuel Beckett


Re: Documentation for Catalina Base

2018-07-31 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Stefan,

On 7/31/18 4:24 AM, Stefan Mayr wrote:
> Hi,
> 
> Am 30.07.2018 um 18:25 schrieb Christopher Schultz:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
>> 
>> Marek,
>> 
>> On 7/30/18 3:22 AM, Marek Czernek wrote:
>>> Hi there,
>>> 
>>> recently, we noticed the lack of documentation for Catalina
>>> Base, and I wanted to find out more about it. Other than a
>>> strangely obscure txt file [1], I did not find the concept and
>>> usage of Catalina Base documented in the Tomcat docs.
>> 
>> Do you mean the CATALINA_BASE environment variable, which is
>> copied into a running JVM as the "catalina.base" system
>> property?
>> 
>>> My questions are:
>>> 
>>> 1) Did I overlook it being documented somewhere?
>> 
>> Other than in RUNNING.txt (where it is thoroughly described), it
>> is documented in:
>> 
>> 1. bin/catalina.sh and bin/catalina.bat 2. The "Directories and
>> Files" section of each Tomcat X documentation (e.g. 
>> https://tomcat.apache.org/tomcat-9.0-doc/introduction.html#Directorie
s_a
>>
>> 
nd_Files)
>> 3. The "Introduction" section of each Tomcat X configuration
>> guide for the "context" container (e.g. 
>> https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Introduc
tio
>>
>> 
n)
>> 
>>> 2) If not, is there any reason for it not being documented?
>>> While I don't want to duplicate text, I do not consider a txt
>>> file somewhere a sufficient docs.
>> 
>> What, it needs to be in TeX, too?
>> 
>>> If the answer to both of my questions is no, we'll create a
>>> patch against the Tomcat docs.
>>> 
>>> [1] https://tomcat.apache.org/tomcat-9.0-doc/RUNNING.txt
>> 
>> Patches are always welcome, but I believe it is currently 
>> properly-documented.
>> 
>> Is there something specific you were looking for and could not
>> find?
> 
> That's the point to ask for some details I'm struggeling with
> 
> 1. $CATALINA_BASE/bin/tomcat-juli.jar: when do I need to place this
> jar in this directory? It is only clear to have it in CATALINA_BASE
> for the documented switch to log4j. From reading catalina.sh I
> would say it is only necessary to place it in CATALINA_BASE when we
> want to use a different version. Is this assumption correct?

That file should generally be in CATALINA_HOME/bin and should match
the version of Tomcat is shipped with. If you want to use log4j for
logging, I would *always* place the replacement JULI implementation
into CATALINA_BASE/lib and leave the Tomcat "stock" installation alone.

> 2. $CATALINA_BASE/conf: What files have to be in this directory?

server.xml
web.xml (though I have argued that this should inherit from CATALINA_HOM
E)

There are other things that you might want to add, depending upon your
needs.

> If they are not present - are they loaded from CATALINA_HOME? 
> RUNNING.txt only mentions server.xml. But it looks like we need to 
> have at least a copy of web.xml in this directory too.
Yes, this is true:
https://bz.apache.org/bugzilla/show_bug.cgi?id=61877

> Reading catalina.sh we also should copy (or link) catalina.policy
> when running with a security manager.

Correct.

> For other files the situation is not clear, e.g. 
> catalina.properties, context.xml
Both catalina.properties and context.xml will fall-back to
CATALINA_HOME if they don't exist in CATALINA_BASE.

You may also want to put a static-user file e.g. tomcat-users.xml into
your CATALINA_BASE/conf directory. All paths in server.xml are
relative to CATALINA_BASE, so if you e.g. configure a  like
this:



Then conf/tomcat-users.xml will be found in CATALINA_BASE. Of course,
you can always use an absolute path and put it anywhere you want... it
doesn't have to be in that location, though many people will expect it
to be there if it's being used.

> ... Some stackoverflow answers to that question recommend to copy
> the whole conf directory from CATALINA_HOME to CATALINA_BASE. I'm
> not sure if this is a good idea if I don't need to change the 
> defaults. The documentation could be improved by listing the files
> that are mandatory in CATALINA_BASE

+1

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltgZVoACgkQHPApP6U8
pFgxjhAAlMCi5kCjPx9ENkgNu1ifBQ5ziI/Jl+76G2tjMgH4wWxXqAG3FONchNBT
5wztEvyHTmkwS13o3z+8/3liaHSY6NSsVKyfNAR6QQA44mDOTEgpwAdPMYDl1doo
WKTOjbm59jrPIAk1Fo5P3cyodzWBHU0G2R+EMlExZ/cHJ7LezDHZ+i8b6dKAsBSl
qlahYEZvDFbGCEkPAtl5LkshKkfu/ZCoJwPZecHlv9R/DVUs7uutSVL0ubmwLf7e
gv++zf5g8UOxRI3za8VnurM+Wjt0vxzizqh7krAQkz51MZaN+Vt6mzO4wAWb9KNr
vSKu0Xu/U/8dfPIUZ5BskAU6hXQ9zZptcQiiTUUDNCVdtoI0zjqwfMHRJ89wZgAr
E3yBoi4rYZ+JSRJxjSAXrOhRYKwVXFKHsTbjJbxWn3CCppvnasU2eOxCl7b/aJwQ
qbZotXjJwkvWwLus1qmfVbv/h6Ju/4VVjdqn00pQmxCkOGjNUa+YrNPsL8v6t+sk
Ner1S+trNcr2jZgHEgODiRwpM3l6fT9PYi8jLjT1cbd+6U+w8Y1rBt4/EURpF+tA
c4x26NnATHeXOmT8EjYxyC7v2IB0/LyNiB23c5YsExpOxEQNvC5K0uIXkdkAHIqt
uTKDtx5XDU1c+JUjWgk8uTX2NFandWVWWk9J7pt1Hy

Re: Documentation for Catalina Base

2018-07-31 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Marek,

On 7/31/18 3:37 AM, Marek Czernek wrote:
> Hi Christopher,
> 
> thanks so much for finding the time to reply. Find my reasoning
> inline.
> 
> On 07/30/2018 06:25 PM, Christopher Schultz wrote: Marek,
> 
> On 7/30/18 3:22 AM, Marek Czernek wrote:
 Hi there,
 
 recently, we noticed the lack of documentation for Catalina
 Base, and I wanted to find out more about it. Other than a
 strangely obscure txt file [1], I did not find the concept
 and usage of Catalina Base documented in the Tomcat docs.
> Do you mean the CATALINA_BASE environment variable, which is
> copied into a running JVM as the "catalina.base" system property?
>> Yep, you got it.
> 
>> 
 2) If not, is there any reason for it not being documented?
 While I don't want to duplicate text, I do not consider a txt
 file somewhere a sufficient docs.
> What, it needs to be in TeX, too?
>> :)) Joking aside though, documentation should say several things
>> at the very least:
> 
>> 1. What it is 2. How to use it 3. When to use it
> 
>> All the documentation links you provided simply say that such
>> variable exists and that you can use it to create multiple
>> instances of Tomcat. So in the HTML docs, I'm missing information
>> on:
> 
>> 1) How do you set it up

Well, it's an environment variable so... set it in your shell? There
are many ways to set an environment variable. Shall we cover them all?

>> 2) What exactly must be in catalina.base such that Tomcat
>> actually starts (since if you point it to an empty directory,
>> Tomcat fails to start)

The RUNNING.txt file explains exactly what must be in CATALINA_BASE
versus CATALINA_HOME. Is the primary complaint that this information
is not also in the online documentation?

>> 3) What are the advantages of catalina.base, i.e. why does it
>> exist. Saying that 'if you want to multiple instances of Tomcat,
>> use catalina.base' is, in my mind, missing why you'd want to use 
>> catalina.base instead of simply copy-paste the whole tomcat
>> directory as many times as you want. I mean, we want to foster
>> good practices, don't we?

RUNNING.txt suggests that a split-configuration allows for the
"desirable" situation of sharing a copy of Tomcat amongst multiple
users. It ignores, however, the most beneficial aspect on a split
configuration: ease of upgrading.

Perhaps that could be included in the documentation, wherever it ends up
.

>> When we have beautiful HTML documentation that is deep and
>> well-written, I wouldn't expect that users are suddenly required
>> to read a  shell/bat script, or some txt file that they randomly
>> found while googling, to get full information on catalina.base.

Fair enough.

>> So I personally see two options here:
> 
>> 1) We can document it in the Tomcat upstream documentation
> 
>> 2) We can document it in our downstream documentation

Having just recently written my own downstream documentation for
Apache Solr (whose documentation is indeed also deep and
well-written), I'd say that we don't want you to have to do that.

>> (and you might say that the third option is don't document it at
>> all, which I will raise internally and will see what would that
>> yield - I'll take the recommendation of the community very
>> seriously)
> 
>> If the Tomcat community believes that catalina.base is, in fact,
>> well documented, I'm of course OK with that; that's why I'm
>> asking here.
> 
>> What do you think? Do I make sense? :)

Makes sense.

Where would you have expected to see the documentation for these
settings? They are effectively used only from the various
launch-related scripts (e.g. bin/catalina.sh|bat and bin/service.bat)
but they can also be used in embedded (application) environments, too.
So I don't think it makes sense to put that documentation into e.g.
the "scripts documentation".

How about expanding this section, here:
https://tomcat.apache.org/tomcat-9.0-doc/introduction.html#Directories_a
nd_Files

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltgYwEACgkQHPApP6U8
pFjN9RAApvnqRPtEtB7OGHSKxcVMSNrlIYmJad5+JQWvfyViFgl3M0/UsDSHV57I
rbU+M1PMbdMss/wi3Yul6VY6JFcwDkBNLjYQHCf/r5eAR7ChGl20kXJeTvnUoq1F
6rRqeUey3qzh5CvrvljWsm2ZBj+FuyQZa8RkLSU+h5yiZZqqz9o4ZpypWOqjzoNH
Y6YyZitwnYcpzrdKhBBfgWDS/Ly0sed4Vswf4NwCLh6PQB6HR0Xcs/xsY3hQ5WHm
TvI5I7F7/lvUhxSVeVOteuMm2qb9aBg15lJmMx6y4Zls+e4HnbPxpcinCmDZ68gV
IoG7HRJ1SlUvDQ6TaK7jXGjUuIrM5HA3nn9SajgE3W5S8pO0V/ad0YtMTLWsaXjz
AGbFXcrWt1kne8Mg5XcZUHV46Hiwfm3t5R2lzPy/gao+6uEEqdqUIJDfuC5rLvy9
Dk2gPV6bR50QI7bIFgq2p4xYnAR05Md/5T+Dl1qeMnJCUk56kmVRhxZP551/TD9E
ED+oM1xLpZ6KowORBG2LbAjuMSGNuEG29lfpGR/B/j9gvdOkwA0jOvEUYUVI1H5O
O2YEE6pfU0hS79L0WFFp5I8SbKa8xa4RqdW4lEGseWSvQBoJ/+X5XQZarXqYBaLZ
Vw/hRIY6/XIc+mG5ZsZxebGRiM+OzmHnrZ3z97f5AsSGMRYBb1o=
=0V/v
-END PGP SIGNATURE-


Re: Tomcat error at run-time.

2018-07-31 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Noel,

On 7/31/18 2:54 AM, noel joseph wrote:
> Hi, I am rather new to tomcat, I've been trying to embed tomcat in
> a java application. I further want to convert this into a java web
> start file so that on deploying it I can have a separate tomcat
> server for my application. The error I am facing is... 
> org.apache.catalina.LifecycleException: A child container failed
> during start.

A "child container" usually ends up being something like an
application. Do you have any logging enabled? If so, what does the log
say? If not, try enabling logging and then checking the log. Tomcat is
usually pretty verbose about what happened and what it happened to.

> I tried a couple of methods to solve it but with no use, the error
> still stays. I am using embedded tomcat 8.5.23, I changed it to the
> latest tomcat 9.0.10 which fixed the error but then the server
> didn't start. it just stops at.. WARNING: Creation of secureRandom
> insatnce.

If you are hanging on creating SecureRandom, your server (or
workstation) might have run out of cryptographic entropy. This can
happen when you restart a server like Tomcat too rapidly and the OS
doesn't have enough time to re-fill the entropy pool.

Can you take a thread dump[1] of the running process the next time
this stalls, just to be sure?

> By reverting back to tomcat 8.5.23 this was solved but again I'm
> facing the child container failed error.
> 
> Please let me know if there is a fix to my issue or if there is a
> better version of tomcat that I can use.

The problem is likely with a component of your application. Logs will
help discover the root of the problem.

The decision to use Tomcat 8.5 or Tomcat 9.0 has more to do with your
risk-aversion. Both versions are still under active development, but
Tomcat 8.5 is more mature and stable (from a code perspective, not
that it is any more reliable than 9.0). Both versions should be
maintained for the next few years.

Hope that helps,
- -chris

[1]
https://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my
_running_webapp_.3F
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltgYMsACgkQHPApP6U8
pFiNlA//bg52WqByfHyAAEMep0a47ZIZ5Bn8D951/p6k5fht/G31ZlzLXXwYzlBk
Redx7Aozx2JG7C0mfPXKHxcr8TqxPcEFC4LDBPs+ywRNhIkGE+ZQtVfIS9+3Wmz1
aKUsXiK0DYMiRHoHNY0V0G8Zt6sJNlT0MkFpAVbD3EcHm2vrw8T4G0+9lOslMe01
Pd172hZ+xE9zpouceFNFPHJVWldwSgxrXNvQOV0VdBVTME7BGMf6yWzJrMxLTNj6
z8EY501ZZd3awrva+JMRFnzQS4qS7dRBMgIP7qJ5S8LLH+OuWcJ99a1s1AAgX9hq
x+bsuOugiZITz/GAD8+lbTIfiGeZefIALyekYCEwBH8lgMAqlZRhGc+H/5UsFwiX
1XEgDbaINHOrMWOBFJVAmT6b3pkSt/Rj2mnb0knYjRDVbcmkPyj3P1Px2opQjEkt
adCxpCQYGDQh/Ddy+q0nj7flAkIgGRwQi7jIfLUJRvE00N0QlTNGscbXr+lzbQCr
kh3xrvGsEWhiNluhZAosGmpwQPtcCByV4EBjNpvF4/p3mXEIOm/f+k9X816ian4B
nDJOyjwDhxVFNVfHR7tP991CMPuQnK1SZf8wRj2S91Un9E+QOrtxusAOQch96M0D
4nKYH3vlduzaeqbdhSa5vAzsTVGffICl6PmowWeNGQ4I4c1vcBI=
=x/SS
-END PGP SIGNATURE-

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



Re: Persist authenticated sessions across tomcat restarts

2018-07-31 Thread Tim K
On Tue, Jul 31, 2018, 7:42 AM Burghard Britzke 
wrote:

> that is, what „transient“ means...
> --
> Gruß
> burghard.britzke
> https://britzke.berlin/
>
> Am 31.07.2018 um 13:39 schrieb Tim K :
>
> On Tue, Jul 31, 2018, 7:31 AM Felix Schumacher <
> felix.schumac...@internetallee.de> wrote:
>
> Am 30.07.2018 17:57, schrieb Tim K:
>
> On Mon, Jul 30, 2018, 4:26 AM Felix Schumacher <
> felix.schumac...@internetallee.de> wrote:
>
> Am 27.07.2018 13:36, schrieb Tim K:
>
> Hello,
>
> I'm creating a new app under Tomcat 9.0.8 (local dev: windows, live
> servers: linux).
>
> I have successfully created a custom JAAS authentication, which works
> just
> fine.
>
> I have SSO enabled at the moment, but not sure if I really need it.
>
> I left the default StandardManager config in place, I do see
> the SESSIONS.ser get created upon a shutdown and I see it get removed
> upon
> startup, so I'm assuming it's reading it in...
>
> I'm expecting that once a user authenticates with the JAAS module one
> time,
> and has a valid session, if I restart tomcat on the backend, that user
> will
> NOT need to re-authenticate, but it appears to be kicking them back to
> the
> login screen after the restart, and it's not accepting their
>
> JSESSIONID
>
> cookie value, it's giving them a new one upon hitting a secured
> resource.
>
> From what I've read, I believe that JAAS can cache an authenticated
> session, but it doesn't appear to be working for me.  Is there
> something
> I'm missing?  Also, I'm using form-login.
>
>
> Are your Principal classes serializable?
> Do you see any Exceptions in the log files when you restart Tomcat?
>
> Regards,
>  Felix
>
>
> Thank you,
>
> Tim
>
>
>
> No exceptions in log.  And it doesn't work even when I don't store
> anything within the session.
>
>
> I have digged deeper now and it seems that the principal object is
> removed from the session before it is persisted.
>
> In StandardSession.java you can find the following comment:
>
>  /**
>* The authenticated Principal associated with this session, if any.
>* IMPLEMENTATION NOTE:  This object is not saved and
>* restored across session serializations!
>*/
>  protected transient Principal principal = null;
>
>
> This variable stores the authenticated user.
>
> Regards,
>  Felix
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> 
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
>
>
> So are you saying that persisting the authenticated session is not
> possible with tomcat?
>
>
I stumbled upon this page:
https://gist.github.com/tdakanalis/06d168925f80a72859cb

It appears you can do it with some customization.


Re: Persist authenticated sessions across tomcat restarts

2018-07-31 Thread Burghard Britzke
that is, what „transient“ means...
--
Gruß
burghard.britzke
https://britzke.berlin/

> Am 31.07.2018 um 13:39 schrieb Tim K :
> 
> On Tue, Jul 31, 2018, 7:31 AM Felix Schumacher <
> felix.schumac...@internetallee.de> wrote:
> 
>> Am 30.07.2018 17:57, schrieb Tim K:
>>> On Mon, Jul 30, 2018, 4:26 AM Felix Schumacher <
>>> felix.schumac...@internetallee.de> wrote:
>>> 
 Am 27.07.2018 13:36, schrieb Tim K:
> Hello,
> 
> I'm creating a new app under Tomcat 9.0.8 (local dev: windows, live
> servers: linux).
> 
> I have successfully created a custom JAAS authentication, which works
> just
> fine.
> 
> I have SSO enabled at the moment, but not sure if I really need it.
> 
> I left the default StandardManager config in place, I do see
> the SESSIONS.ser get created upon a shutdown and I see it get removed
> upon
> startup, so I'm assuming it's reading it in...
> 
> I'm expecting that once a user authenticates with the JAAS module one
> time,
> and has a valid session, if I restart tomcat on the backend, that user
> will
> NOT need to re-authenticate, but it appears to be kicking them back to
> the
> login screen after the restart, and it's not accepting their
>> JSESSIONID
> cookie value, it's giving them a new one upon hitting a secured
> resource.
> 
> From what I've read, I believe that JAAS can cache an authenticated
> session, but it doesn't appear to be working for me.  Is there
> something
> I'm missing?  Also, I'm using form-login.
 
 Are your Principal classes serializable?
 Do you see any Exceptions in the log files when you restart Tomcat?
 
 Regards,
  Felix
 
> 
> Thank you,
> 
> Tim
>> 
>>> 
>>> No exceptions in log.  And it doesn't work even when I don't store
>>> anything within the session.
>> 
>> I have digged deeper now and it seems that the principal object is
>> removed from the session before it is persisted.
>> 
>> In StandardSession.java you can find the following comment:
>> 
>>  /**
>>* The authenticated Principal associated with this session, if any.
>>* IMPLEMENTATION NOTE:  This object is not saved and
>>* restored across session serializations!
>>*/
>>  protected transient Principal principal = null;
>> 
>> 
>> This variable stores the authenticated user.
>> 
>> Regards,
>>  Felix
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
>> 
>> So are you saying that persisting the authenticated session is not
>> possible with tomcat?



signature.asc
Description: Message signed with OpenPGP


Re: Persist authenticated sessions across tomcat restarts

2018-07-31 Thread Tim K
On Tue, Jul 31, 2018, 7:31 AM Felix Schumacher <
felix.schumac...@internetallee.de> wrote:

> Am 30.07.2018 17:57, schrieb Tim K:
> > On Mon, Jul 30, 2018, 4:26 AM Felix Schumacher <
> > felix.schumac...@internetallee.de> wrote:
> >
> >> Am 27.07.2018 13:36, schrieb Tim K:
> >> > Hello,
> >> >
> >> > I'm creating a new app under Tomcat 9.0.8 (local dev: windows, live
> >> > servers: linux).
> >> >
> >> > I have successfully created a custom JAAS authentication, which works
> >> > just
> >> > fine.
> >> >
> >> > I have SSO enabled at the moment, but not sure if I really need it.
> >> >
> >> > I left the default StandardManager config in place, I do see
> >> > the SESSIONS.ser get created upon a shutdown and I see it get removed
> >> > upon
> >> > startup, so I'm assuming it's reading it in...
> >> >
> >> > I'm expecting that once a user authenticates with the JAAS module one
> >> > time,
> >> > and has a valid session, if I restart tomcat on the backend, that user
> >> > will
> >> > NOT need to re-authenticate, but it appears to be kicking them back to
> >> > the
> >> > login screen after the restart, and it's not accepting their
> JSESSIONID
> >> > cookie value, it's giving them a new one upon hitting a secured
> >> > resource.
> >> >
> >> > From what I've read, I believe that JAAS can cache an authenticated
> >> > session, but it doesn't appear to be working for me.  Is there
> >> > something
> >> > I'm missing?  Also, I'm using form-login.
> >>
> >> Are your Principal classes serializable?
> >> Do you see any Exceptions in the log files when you restart Tomcat?
> >>
> >> Regards,
> >>   Felix
> >>
> >> >
> >> > Thank you,
> >> >
> >> > Tim
>
> >
> > No exceptions in log.  And it doesn't work even when I don't store
> > anything within the session.
>
> I have digged deeper now and it seems that the principal object is
> removed from the session before it is persisted.
>
> In StandardSession.java you can find the following comment:
>
>   /**
> * The authenticated Principal associated with this session, if any.
> * IMPLEMENTATION NOTE:  This object is not saved and
> * restored across session serializations!
> */
>   protected transient Principal principal = null;
>
>
> This variable stores the authenticated user.
>
> Regards,
>   Felix
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
> So are you saying that persisting the authenticated session is not
> possible with tomcat?


Re: Persist authenticated sessions across tomcat restarts

2018-07-31 Thread Felix Schumacher

Am 30.07.2018 17:57, schrieb Tim K:

On Mon, Jul 30, 2018, 4:26 AM Felix Schumacher <
felix.schumac...@internetallee.de> wrote:


Am 27.07.2018 13:36, schrieb Tim K:
> Hello,
>
> I'm creating a new app under Tomcat 9.0.8 (local dev: windows, live
> servers: linux).
>
> I have successfully created a custom JAAS authentication, which works
> just
> fine.
>
> I have SSO enabled at the moment, but not sure if I really need it.
>
> I left the default StandardManager config in place, I do see
> the SESSIONS.ser get created upon a shutdown and I see it get removed
> upon
> startup, so I'm assuming it's reading it in...
>
> I'm expecting that once a user authenticates with the JAAS module one
> time,
> and has a valid session, if I restart tomcat on the backend, that user
> will
> NOT need to re-authenticate, but it appears to be kicking them back to
> the
> login screen after the restart, and it's not accepting their JSESSIONID
> cookie value, it's giving them a new one upon hitting a secured
> resource.
>
> From what I've read, I believe that JAAS can cache an authenticated
> session, but it doesn't appear to be working for me.  Is there
> something
> I'm missing?  Also, I'm using form-login.

Are your Principal classes serializable?
Do you see any Exceptions in the log files when you restart Tomcat?

Regards,
  Felix

>
> Thank you,
>
> Tim




No exceptions in log.  And it doesn't work even when I don't store
anything within the session.


I have digged deeper now and it seems that the principal object is 
removed from the session before it is persisted.


In StandardSession.java you can find the following comment:

 /**
   * The authenticated Principal associated with this session, if any.
   * IMPLEMENTATION NOTE:  This object is not saved and
   * restored across session serializations!
   */
 protected transient Principal principal = null;


This variable stores the authenticated user.

Regards,
 Felix

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



Re: Documentation for Catalina Base

2018-07-31 Thread Stefan Mayr
Hi,

Am 30.07.2018 um 18:25 schrieb Christopher Schultz:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> Marek,
> 
> On 7/30/18 3:22 AM, Marek Czernek wrote:
>> Hi there,
>>
>> recently, we noticed the lack of documentation for Catalina Base,
>> and I wanted to find out more about it. Other than a strangely
>> obscure txt file [1], I did not find the concept and usage of
>> Catalina Base documented in the Tomcat docs.
> 
> Do you mean the CATALINA_BASE environment variable, which is copied
> into a running JVM as the "catalina.base" system property?
> 
>> My questions are:
>>
>> 1) Did I overlook it being documented somewhere?
> 
> Other than in RUNNING.txt (where it is thoroughly described), it is
> documented in:
> 
> 1. bin/catalina.sh and bin/catalina.bat
> 2. The "Directories and Files" section of each Tomcat X documentation
> (e.g.
> https://tomcat.apache.org/tomcat-9.0-doc/introduction.html#Directories_a
> nd_Files)
> 3. The "Introduction" section of each Tomcat X configuration guide for
> the "context" container (e.g.
> https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Introductio
> n)
> 
>> 2) If not, is there any reason for it not being documented? While
>> I don't want to duplicate text, I do not consider a txt file
>> somewhere a sufficient docs.
> 
> What, it needs to be in TeX, too?
> 
>> If the answer to both of my questions is no, we'll create a patch 
>> against the Tomcat docs.
>>
>> [1] https://tomcat.apache.org/tomcat-9.0-doc/RUNNING.txt
> 
> Patches are always welcome, but I believe it is currently
> properly-documented.
> 
> Is there something specific you were looking for and could not find?

That's the point to ask for some details I'm struggeling with

1. $CATALINA_BASE/bin/tomcat-juli.jar: when do I need to place this jar
in this directory? It is only clear to have it in CATALINA_BASE for the
documented switch to log4j. From reading catalina.sh I would say it is
only necessary to place it in CATALINA_BASE when we want to use a
different version. Is this assumption correct?

2. $CATALINA_BASE/conf: What files have to be in this directory? If they
are not present - are they loaded from CATALINA_HOME? RUNNING.txt only
mentions server.xml. But it looks like we need to have at least a copy
of web.xml in this directory too. Reading catalina.sh we also should
copy (or link) catalina.policy when running with a security manager. For
other files the situation is not clear, e.g. catalina.properties,
context.xml, ... Some stackoverflow answers to that question recommend
to copy the whole conf directory from CATALINA_HOME to CATALINA_BASE.
I'm not sure if this is a good idea if I don't need to change the
defaults. The documentation could be improved by listing the files that
are mandatory in CATALINA_BASE

Regards,

Stefan

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



Re: Documentation for Catalina Base

2018-07-31 Thread Marek Czernek

Hi Christopher,

thanks so much for finding the time to reply. Find my reasoning inline.

On 07/30/2018 06:25 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Marek,

On 7/30/18 3:22 AM, Marek Czernek wrote:

Hi there,

recently, we noticed the lack of documentation for Catalina Base,
and I wanted to find out more about it. Other than a strangely
obscure txt file [1], I did not find the concept and usage of
Catalina Base documented in the Tomcat docs.

Do you mean the CATALINA_BASE environment variable, which is copied
into a running JVM as the "catalina.base" system property?

Yep, you got it.



2) If not, is there any reason for it not being documented? While
I don't want to duplicate text, I do not consider a txt file
somewhere a sufficient docs.

What, it needs to be in TeX, too?
:)) Joking aside though, documentation should say several things at the 
very least:


1. What it is
2. How to use it
3. When to use it

All the documentation links you provided simply say that such variable 
exists and that you can use it to create multiple instances of Tomcat. 
So in the HTML docs, I'm missing information on:


1) How do you set it up

2) What exactly must be in catalina.base such that Tomcat actually 
starts (since if you point it to an empty directory, Tomcat fails to start)


3) What are the advantages of catalina.base, i.e. why does it exist. 
Saying that 'if you want to multiple instances of Tomcat, use 
catalina.base' is, in my mind, missing why you'd want to use 
catalina.base instead of simply copy-paste the whole tomcat directory as 
many times as you want. I mean, we want to foster good practices, don't we?


When we have beautiful HTML documentation that is deep and well-written, 
I wouldn't expect that users are suddenly required to read a  shell/bat 
script, or some txt file that they randomly found while googling, to get 
full information on catalina.base.


So I personally see two options here:

1) We can document it in the Tomcat upstream documentation

2) We can document it in our downstream documentation

(and you might say that the third option is don't document it at all, 
which I will raise internally and will see what would that yield - I'll 
take the recommendation of the community very seriously)


If the Tomcat community believes that catalina.base is, in fact, well 
documented, I'm of course OK with that; that's why I'm asking here.


What do you think? Do I make sense? :)

Cheers!


If the answer to both of my questions is no, we'll create a patch
against the Tomcat docs.

[1] https://tomcat.apache.org/tomcat-9.0-doc/RUNNING.txt

Patches are always welcome, but I believe it is currently
properly-documented.

Is there something specific you were looking for and could not find?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAltfO+AACgkQHPApP6U8
pFgGqg//ZXOXdoT2H59lHUHRBM+p2gUHBzFzjUUzx/4QHE4r71rGxGWBFfaqi0ZW
/TNs93JDhlELtaxwIU5BipIdoAqy7BXd/YpcslLOjwIdUKjr2YYd+JMm/FrAWbdM
dMQjilWLw24TbewMnCUe5KnQnKfE+fL/ehTKrS2W69cYaEqkxklURKo253MNmRsv
p3BsZOhKgP9DeTNPEk84GseXaAYN6Wm3b0QLkgB/rG4Q4XWnB7KzDBk79fVLi9Ac
czbhY/fyCYaNSVqau7LRdfMvqNy34+dYi1wU6vKrmFx5yBjIggNuE/hxI6LhWgMm
17ivwBN/Vjgp1zZN/T/BpsatmN+wTsILEcapDSaodOT2fqgbeskdYdZj9lgXffRl
rpVHYzEQ8Uc/kSFqxddFclKxpU8lE942up53E3bjmwyE7moxAD5chGEZItfRyKJe
WIHfeErlEEebZiHNslLxV0S9/jomK51F8UplAr2iYDNvk712sPm/CySAF9UzXMcv
w8iJINvhnObGDB2SRfWGHR69/B80AthRMQRCZHvI4jbPensUnm2+YTAZVk+Caina
ULh5bZ/EpNJbku23ZRZLtRJPcPoKrcy8obwQlUS3Geyqp0JV71ig/CGnUe+Iv5B9
UMxsDmnZ1AKx/dPFzp95c2gtOsWbxmGGecvxKZMvj3hQzSquxqw=
=brp0
-END PGP SIGNATURE-

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



--

Marek Czernek

JWS/JBCS Associate Quality Engineer, RHCA

Find me at www.halfastack.com