Re: Restarting Tomcat from within itself?

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Andrew,

On 1/28/13 2:18 PM, Andrew Kujtan wrote:
>> -Original Message- From: Christopher Schultz
>> [mailto:ch...@christopherschultz.net] Sent: Monday, January 28,
>> 2013 2:01 PM To: Tomcat Users List Subject: Re: Restarting Tomcat
>> from within itself?
>> 
> Andrew,
> 
> On 1/28/13 1:49 PM, Andrew Kujtan wrote:
> -Original Message- From: Christopher Schultz 
> [mailto:ch...@christopherschultz.net] Sent: Monday, January
> 28, 2013 10:33 AM To: Tomcat Users List Subject: Re:
> Restarting Tomcat from within itself?
> 
 Daniel,
 
 On 1/28/13 8:19 AM, Daniel Mikusa wrote:
>>> On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:
>>> 
 Hi,
 
 Is it possible to restart tomcat from within itself?
 
 
> FWIW, It is possible to restart tomcat by calling,
 
> org.apache.catalina.startup.Bootstrap.main(new String[] {
> "stop" });
 
> then use a shutdown hook to start it up again,
 
> But I really don't recommend it.
> 
> What would your shutdown hook do, then?
> 
> -chris
> 
>> Just use a ProcessBuilder to call the startup script in a new
>> process.

This seems like a risky proposition (I suppose no less risky than
using -XX:OnOutOfMemoryError). If you run Tomcat under jsvc (or as a
Windows Service), I believe you can configure both of those strategies
to re-start Tomcat if it stops for some reason. In that case, a simple
System.exit() will shut-down Tomcat (or you can send a SHUTDOWN
command to your own shutdown port) and the service-monitor can
re-start it.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEG7REACgkQ9CaO5/Lv0PDDVgCfQHgkF6c1ohuWY20iFJuVkigs
RewAnRLNVNwJye7t8YhlZoKx/C920bj7
=I1SP
-END PGP SIGNATURE-

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



RE: Restarting Tomcat from within itself?

2013-01-28 Thread Sunil Shevante
To add information to the query - I dont have access to the server. So I cannot 
setup jobs or change tomcat startup parameters.

I have hosted my site with a provider and I only have cpanel access. Hence I am 
looking for some code which would restart/reintialize tomcat from within.

Website - www.investorschoolindia.com



--- On Tue, 1/29/13, Andrew Kujtan  wrote:

From: Andrew Kujtan 
Subject: RE: Restarting Tomcat from within itself?
To: "Tomcat Users List" 
Date: Tuesday, January 29, 2013, 12:48 AM



> -Original Message-
> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Sent: Monday, January 28, 2013 2:01 PM
> To: Tomcat Users List
> Subject: Re: Restarting Tomcat from within itself?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> Andrew,
> 
> On 1/28/13 1:49 PM, Andrew Kujtan wrote:
> >> -Original Message- From: Christopher Schultz
> >> [mailto:ch...@christopherschultz.net] Sent: Monday, January 28,
> >> 2013 10:33 AM To: Tomcat Users List Subject: Re: Restarting Tomcat
> >> from within itself?
> >>
> > Daniel,
> >
> > On 1/28/13 8:19 AM, Daniel Mikusa wrote:
>  On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:
> 
> > Hi,
> >
> > Is it possible to restart tomcat from within itself?
> >
> >
> >> FWIW, It is possible to restart tomcat by calling,
> >
> >> org.apache.catalina.startup.Bootstrap.main(new String[] { "stop"
> >> });
> >
> >> then use a shutdown hook to start it up again,
> >
> >> But I really don't recommend it.
> 
> What would your shutdown hook do, then?
> 
> - -chris

Just use a ProcessBuilder to call the startup script in a new process.

> -BEGIN PGP SIGNATURE-
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org

> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

> 
> iEYEAREIAAYFAlEGyvkACgkQ9CaO5/Lv0PAYJACghkS1q1PS8twbUz2ITogaw6uW
> oXoAoLD7TAO5YNi1+N4tcmEej0aBu1qr
> =23Sy
> -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: LDAP on TOMCAT 7.0.30

2013-01-28 Thread chris derham
>>> Do you need a plug-in or anything like that? Does it need to be
>>> specifically enabled?
>>
>> No, we use it all the time with IE, Firefox, and I believe Chrome
>> as well.

Last time I was working in this area a few years ago, it worked by
default in IE and had to be turned on in FF. A rogue website would
request the token and do malicious things if it is handed out by the
browser whenever asked. The link explains the settings required.
Perhaps this has changed "recently" and works auto-magically now?

http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.doc/info/exp/ae/tsec_SPNEGO_configweb_new.html

Thanks

Chris

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



RE: Restarting Tomcat from within itself?

2013-01-28 Thread Andrew Kujtan


> -Original Message-
> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Sent: Monday, January 28, 2013 2:01 PM
> To: Tomcat Users List
> Subject: Re: Restarting Tomcat from within itself?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> Andrew,
> 
> On 1/28/13 1:49 PM, Andrew Kujtan wrote:
> >> -Original Message- From: Christopher Schultz
> >> [mailto:ch...@christopherschultz.net] Sent: Monday, January 28,
> >> 2013 10:33 AM To: Tomcat Users List Subject: Re: Restarting Tomcat
> >> from within itself?
> >>
> > Daniel,
> >
> > On 1/28/13 8:19 AM, Daniel Mikusa wrote:
>  On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:
> 
> > Hi,
> >
> > Is it possible to restart tomcat from within itself?
> >
> >
> >> FWIW, It is possible to restart tomcat by calling,
> >
> >> org.apache.catalina.startup.Bootstrap.main(new String[] { "stop"
> >> });
> >
> >> then use a shutdown hook to start it up again,
> >
> >> But I really don't recommend it.
> 
> What would your shutdown hook do, then?
> 
> - -chris

Just use a ProcessBuilder to call the startup script in a new process.

> -BEGIN PGP SIGNATURE-
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iEYEAREIAAYFAlEGyvkACgkQ9CaO5/Lv0PAYJACghkS1q1PS8twbUz2ITogaw6uW
> oXoAoLD7TAO5YNi1+N4tcmEej0aBu1qr
> =23Sy
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Restarting Tomcat from within itself?

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Andrew,

On 1/28/13 1:49 PM, Andrew Kujtan wrote:
>> -Original Message- From: Christopher Schultz
>> [mailto:ch...@christopherschultz.net] Sent: Monday, January 28,
>> 2013 10:33 AM To: Tomcat Users List Subject: Re: Restarting
>> Tomcat from within itself?
>> 
> Daniel,
> 
> On 1/28/13 8:19 AM, Daniel Mikusa wrote:
 On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:
 
> Hi,
> 
> Is it possible to restart tomcat from within itself?
> 
> 
>> FWIW, It is possible to restart tomcat by calling,
> 
>> org.apache.catalina.startup.Bootstrap.main(new String[] { "stop"
>> });
> 
>> then use a shutdown hook to start it up again,
> 
>> But I really don't recommend it.

What would your shutdown hook do, then?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGyvkACgkQ9CaO5/Lv0PAYJACghkS1q1PS8twbUz2ITogaw6uW
oXoAoLD7TAO5YNi1+N4tcmEej0aBu1qr
=23Sy
-END PGP SIGNATURE-

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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

David,

On 1/28/13 1:18 PM, David kerber wrote:
> On 1/28/2013 1:07 PM, Christopher Schultz wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
>> 
>> André,
>> 
>> On 1/28/13 12:32 PM, André Warnier wrote:
>>> Christopher Schultz wrote:
 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
 
 Chris,
 
 On 1/28/13 7:47 AM, chris derham wrote:
>> 1) All 3 applications  are browser compatible  and users
>> may use other then IE hence IE alone can be ruled out
> Do you mean "multiple browsers access these web
> applications, so we can't use anything that is IE
> specific"? Assuming that you do, I don't believe that
> anybody suggested anything that is IE specific, e.g. the
> SSO solutions so far posted will work in other browsers as
> well. Can you elaborate on what you mean exactly please?
 
 I think auto-forwarding credentials from the client system 
 through the browser generally requires MSIE. I've never done 
 anything like that and have no idea what I'm talking about,
 so I may be completely wrong.
 
>>> 
>>> You are. Firefox supports "Windows Integrated Authentication"
>>> fine too, and I believe most usual current browsers do.
>> 
>> Do you need a plug-in or anything like that? Does it need to be 
>> specifically enabled?
> 
> No, we use it all the time with IE, Firefox, and I believe Chrome
> as well.

Cool - good to know!

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGyr4ACgkQ9CaO5/Lv0PCt9ACgmOSPJwFdRw8++218bCT9LojO
4fIAoMHijn0pSJ0OMxQGTkKw4vNzW9aM
=W+zJ
-END PGP SIGNATURE-

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Mark Eggers

On 1/28/2013 10:06 AM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:25 AM, Tiago Sousa wrote:

Em 28/01/2013 16:16, Christopher Schultz escreveu: Tiago,

On 1/28/13 11:02 AM, Tiago Sousa wrote:

Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:

Thanks, one more time, for your reply. The problem with
log4j 1.x is that it outputs the following error:
log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.Embedded). log4j:WARN
Please initialize the log4j system properly.

I know that this is a common error, usually related
with classpath problems. In my case, the configuration
i'm using doesn´t seem to be have those sort of
problems

This is a symptom of having your log4j.properties in the
wrong place.

You never said anything about using Tomcat Embedded. If you
are using Embedded Tomcat, you'll have to make sure that
your log4j.properties file is in the CLASSPATH of the JVM
when it starts.

-chris

-







To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi. Thanks for your reply. Isn´t that assured (log4j in
classpath) putting the log4j.properties in apache lib folder
since i'm using tomcat 6.x?

If you are using Tomcat Embedded, you are entirely responsible for
your own CLASSPATH. The "Embedded" class causes the logger to be
initialized before any real code gets executed (it's in the first
static initializer in the class), so "Embedded" can't change the
CLASSPATH or launch a new ClassLoader for that purpose.

Can you please describe your environment? It's been tough to get
details from you.

-chris


-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi,

Sorry, i am a newbie in tomcat issues. I'm just "following
orders"... :-) My configuration is the most standard i could find:

1 step: download apache-tomcat-6.0.36.zip from apache.org 2 -
unzip 3 - erase logging.properties from conf folder 4 - copy jar
files (juli and juli-adapters)from extras to bin and lib
directories, respectively. 5 - create a logging.properties file
(standard definitions as in apache.org) and put it in lib folder.
6- download log4j.1.2.7.jar and put it in lib folder.

And that's it. I'm using tomcat in windows.

Hope this helps you to help me...


So where does the Embedded class come in? How do you launch Tomcat?

- -chris


I just tried this - finally upgraded to 6.0.36 on this machine (been 
using 7.0.x, so I haven't thought much about it).


OS: Windows 7 Home Premium 64 bit
JRE:1.7.0_11 64 bit
Tomcat: 6.0.36
Editor: jEdit

I normally use Cygwin to unpack the zip file and edit stuff, but that 
can leave ownership / permissions in strange states. So this time I did 
the following.


1. Unpack the zip file in C:\Users\\Apache\apache-6.0.36 (IZArc)
2. Make the appropriate edits to %CATALINA_HOME%\conf\tomcat-users.xml
3. Add setenv.bat to %CATALINA_HOME%\bin for JMX
4. Add URIEncoding=UTF-8 to Connector elements
5. Enable AccessLogValve
6. Add MySQL and mail jars to %CATALINA_HOME%\lib for some applications

Double-clicking on startup.bat from Windows Explorer results in the 
expected execution. I get entries in the appropriate log files.


Now I do the following:

1. back up tomcat-juli.jar
2. replace it with the tomcat-juli.jar from Extras
3. add log4j-1.2.17.jar to %CATALINA_HOME%\lib
4. add tomcat-juli-adapters.jar to %CATALINA_HOME%\lib
5. Create log4j.properties
   a. Copy from Tomcat web site
   b. Save in %CATALINA_HOME%\conf
6. Remove logging.properties from %CATALINA_HOME%\conf

Start Tomcat by double-clicking startup.bat in %CATALINA_HOME%\bin from 
Windows Explorer.


The result:

I get the same warning (No appenders could be found for logger 
(org.apache.catalina.startup.Embedded). I get no log files in 
%CATALINA_HOME%\logs other than the access log.


I also verified that I have no web applications with log4j-1.2.17.jar in 
a WEB-INF/lib, nor do I have log4j.xml floating around in 
%CATALINA_HOME%\webapps.


I'm not a Windows person and normally just use JULI logging for Tomcat. 
So maybe I've done something wrong . . . dunno.


Hmm. Maybe I'll try rewriting the log4j.properties as log4j.xml.

. . . . 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: Restarting Tomcat from within itself?

2013-01-28 Thread Andrew Kujtan


> -Original Message-
> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Sent: Monday, January 28, 2013 10:33 AM
> To: Tomcat Users List
> Subject: Re: Restarting Tomcat from within itself?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> Daniel,
> 
> On 1/28/13 8:19 AM, Daniel Mikusa wrote:
> > On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:
> >
> >> Hi,
> >>
> >> Is it possible to restart tomcat from within itself?
> >>

FWIW, It is possible to restart tomcat by calling,

org.apache.catalina.startup.Bootstrap.main(new String[] { "stop" });

then use a shutdown hook to start it up again,

But I really don't recommend it. 

> >> I host a JSP website and somehow the memory utilization keeps on
> >> increasing from time to time. I then have to manually restart
> Tomcat.
> >>
> >> While I understand that in the long term, I should focus on fixing
> >> the memory leaks, is there a way by which I can restart Tomcat after
> >> the free memory goes below a threshold percentage?
> >
> > I wouldn't try to do this inside Tomcat.  With the tools provided by
> > the JVM (jmap or JMX), you can monitor just as easily from outside
> > Tomcat.  Instead, create a monitoring script to watch the Tomcat
> > process.  When memory usage hits a certain level, dump the heap (so
> > you can analyze your memory problem later) and restart Tomcat.
> 
> +1
> 
> If you want to chance it, you could set -XX:OnOutOfMemoryError=
> and write a script that tries to dump your heap (or just have the JVM
> do that for you) and then bounce Tomcat.
> 
> Note that not all OOMEs are life-threatening for the JVM.
> 
> I have experienced two kinds of OOMEs:
> 
> 1) Truly out of memory: your app simply needs more heap. In these
>cases, the JVM generally goes into GC panic for a short amount of
>time trying to free-up memory and then finally throws OOME.
>Nothing meaningful seems to work after that: DBCPs run dry,
>etc. In these cases, I have had to restart my JVM completely
>in order for any users to get anything meaningful done.
> 
> 2. Transient memory exhaustion: this happens when we have some careless
>code that loads 100,000 records from a single database query all
>into a big java.util.List or something like that. In these cases,
>a single thread gets an OOME, the List gets GC'd very quickly, and
>the server (and JVM) are fine. We generally do restart our JVMs when
>this happens, but we can wait until off-hours when fewer users are
>likely to be impacted in any way.
> 
> > Alternatively, you could use a preexisting tool to monitor your
> Tomcat
> > instance like Nagios or Hyperic.
> 
> These solutions really only monitor. Yes, you can configure them to
> "react" to certain situations by abusing the notification system, but
> they are really meant for monitoring and notification, not for
> automated tasks.
> 
> >> I am using tomcat 6.0.14 on unix.
> >
> > This is really old, upgrade.
> 
> +10
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iEYEAREIAAYFAlEGmisACgkQ9CaO5/Lv0PAMeACfflakV2t8RT5kjF/wQf8joYl9
> swgAmgL1pwbvX5yLe2jUSGaOXXr5SDzf
> =MaHM
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread David kerber

On 1/28/2013 1:07 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/28/13 12:32 PM, André Warnier wrote:

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE- Hash: SHA256

Chris,

On 1/28/13 7:47 AM, chris derham wrote:

1) All 3 applications  are browser compatible  and users may
use other then IE hence IE alone can be ruled out

Do you mean "multiple browsers access these web applications,
so we can't use anything that is IE specific"? Assuming that
you do, I don't believe that anybody suggested anything that is
IE specific, e.g. the SSO solutions so far posted will work in
other browsers as well. Can you elaborate on what you mean
exactly please?


I think auto-forwarding credentials from the client system
through the browser generally requires MSIE. I've never done
anything like that and have no idea what I'm talking about, so I
may be completely wrong.



You are. Firefox supports "Windows Integrated Authentication" fine
too, and I believe most usual current browsers do.


Do you need a plug-in or anything like that? Does it need to be
specifically enabled?


No, we use it all the time with IE, Firefox, and I believe Chrome as well.

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Tiago Sousa

Em 28/01/2013 18:06, Christopher Schultz escreveu:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:25 AM, Tiago Sousa wrote:

Em 28/01/2013 16:16, Christopher Schultz escreveu: Tiago,

On 1/28/13 11:02 AM, Tiago Sousa wrote:

Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:

Thanks, one more time, for your reply. The problem with
log4j 1.x is that it outputs the following error:
log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.Embedded). log4j:WARN
Please initialize the log4j system properly.

I know that this is a common error, usually related
with classpath problems. In my case, the configuration
i'm using doesn´t seem to be have those sort of
problems

This is a symptom of having your log4j.properties in the
wrong place.

You never said anything about using Tomcat Embedded. If you
are using Embedded Tomcat, you'll have to make sure that
your log4j.properties file is in the CLASSPATH of the JVM
when it starts.

-chris

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi. Thanks for your reply. Isn´t that assured (log4j in
classpath) putting the log4j.properties in apache lib folder
since i'm using tomcat 6.x?

If you are using Tomcat Embedded, you are entirely responsible for
your own CLASSPATH. The "Embedded" class causes the logger to be
initialized before any real code gets executed (it's in the first
static initializer in the class), so "Embedded" can't change the
CLASSPATH or launch a new ClassLoader for that purpose.

Can you please describe your environment? It's been tough to get
details from you.

-chris

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi,

Sorry, i am a newbie in tomcat issues. I'm just "following
orders"... :-) My configuration is the most standard i could find:

1 step: download apache-tomcat-6.0.36.zip from apache.org 2 -
unzip 3 - erase logging.properties from conf folder 4 - copy jar
files (juli and juli-adapters)from extras to bin and lib
directories, respectively. 5 - create a logging.properties file
(standard definitions as in apache.org) and put it in lib folder.
6- download log4j.1.2.7.jar and put it in lib folder.

And that's it. I'm using tomcat in windows.

Hope this helps you to help me...

So where does the Embedded class come in? How do you launch Tomcat?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGvh0ACgkQ9CaO5/Lv0PBTegCghwcFu8BHD+f1ypRitUCopu7q
QToAnjYdCSgrUwnS1LzaGfa7zFujJtwN
=83/y
-END PGP SIGNATURE-

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



Hi.

I start Tomcat using the startup script bin/startup.bat.

Tiago

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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/28/13 12:32 PM, André Warnier wrote:
> Christopher Schultz wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
>> 
>> Chris,
>> 
>> On 1/28/13 7:47 AM, chris derham wrote:
 1) All 3 applications  are browser compatible  and users may
 use other then IE hence IE alone can be ruled out
>>> Do you mean "multiple browsers access these web applications,
>>> so we can't use anything that is IE specific"? Assuming that
>>> you do, I don't believe that anybody suggested anything that is
>>> IE specific, e.g. the SSO solutions so far posted will work in
>>> other browsers as well. Can you elaborate on what you mean
>>> exactly please?
>> 
>> I think auto-forwarding credentials from the client system
>> through the browser generally requires MSIE. I've never done
>> anything like that and have no idea what I'm talking about, so I
>> may be completely wrong.
>> 
> 
> You are. Firefox supports "Windows Integrated Authentication" fine
> too, and I believe most usual current browsers do.

Do you need a plug-in or anything like that? Does it need to be
specifically enabled?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGvnoACgkQ9CaO5/Lv0PB9FQCgr0csun/TDZdiI1ZuWf1K/M63
/BUAnRunq5Lr/2V497Thhz9cbuMU90CV
=r/u1
-END PGP SIGNATURE-

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



Re: FW: Destroying resources created with a custom ObjectFactory

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Xavier,

On 1/28/13 12:20 PM, Xavier Dury wrote:
> I'm using Tomcat 7.0.x and made a custom 
> javax.naming.spi.ObjectFactory to create a Ehcache manager,
> exposing a configured CacheManager to an application through
> (local) JNDI. My question is: how/where can I call the
> CacheManager.shutdown() method when my application is
> (re|un)deployed? I tried adding a NamespaceChangerListener to the
> (Event)Context passed to the ObjectFactory.getObjectInstance()
> method without luck.

What does your configuration look like? Are you using  in
server.xml/context.xml?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGvlMACgkQ9CaO5/Lv0PAmawCfS5ZP+1RzKbQJzZBtwo6vrPj1
Z6YAn3NHTr/oiR7RUVgzZgMcs5NDNlCq
=iX5J
-END PGP SIGNATURE-

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:25 AM, Tiago Sousa wrote:
> Em 28/01/2013 16:16, Christopher Schultz escreveu: Tiago,
> 
> On 1/28/13 11:02 AM, Tiago Sousa wrote:
 Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,
 
 On 1/28/13 8:49 AM, Tiago Sousa wrote:
>>> Thanks, one more time, for your reply. The problem with
>>> log4j 1.x is that it outputs the following error:
>>> log4j:WARN No appenders could be found for logger 
>>> (org.apache.catalina.startup.Embedded). log4j:WARN
>>> Please initialize the log4j system properly.
>>> 
>>> I know that this is a common error, usually related
>>> with classpath problems. In my case, the configuration
>>> i'm using doesn´t seem to be have those sort of
>>> problems
 This is a symptom of having your log4j.properties in the
 wrong place.
 
 You never said anything about using Tomcat Embedded. If you
 are using Embedded Tomcat, you'll have to make sure that
 your log4j.properties file is in the CLASSPATH of the JVM
 when it starts.
 
 -chris
> -
>
>
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail:
> users-h...@tomcat.apache.org
> 
 Hi. Thanks for your reply. Isn´t that assured (log4j in
 classpath) putting the log4j.properties in apache lib folder
 since i'm using tomcat 6.x?
> If you are using Tomcat Embedded, you are entirely responsible for 
> your own CLASSPATH. The "Embedded" class causes the logger to be 
> initialized before any real code gets executed (it's in the first 
> static initializer in the class), so "Embedded" can't change the 
> CLASSPATH or launch a new ClassLoader for that purpose.
> 
> Can you please describe your environment? It's been tough to get 
> details from you.
> 
> -chris
>> 
>> -
>>
>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
> Hi,
> 
> Sorry, i am a newbie in tomcat issues. I'm just "following
> orders"... :-) My configuration is the most standard i could find:
> 
> 1 step: download apache-tomcat-6.0.36.zip from apache.org 2 -
> unzip 3 - erase logging.properties from conf folder 4 - copy jar
> files (juli and juli-adapters)from extras to bin and lib 
> directories, respectively. 5 - create a logging.properties file
> (standard definitions as in apache.org) and put it in lib folder. 
> 6- download log4j.1.2.7.jar and put it in lib folder.
> 
> And that's it. I'm using tomcat in windows.
> 
> Hope this helps you to help me...

So where does the Embedded class come in? How do you launch Tomcat?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGvh0ACgkQ9CaO5/Lv0PBTegCghwcFu8BHD+f1ypRitUCopu7q
QToAnjYdCSgrUwnS1LzaGfa7zFujJtwN
=83/y
-END PGP SIGNATURE-

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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread André Warnier

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Chris,

On 1/28/13 7:47 AM, chris derham wrote:

1) All 3 applications  are browser compatible  and users may use
other then IE hence IE alone can be ruled out

Do you mean "multiple browsers access these web applications, so
we can't use anything that is IE specific"? Assuming that you do, I
don't believe that anybody suggested anything that is IE specific,
e.g. the SSO solutions so far posted will work in other browsers as
well. Can you elaborate on what you mean exactly please?


I think auto-forwarding credentials from the client system through the
browser generally requires MSIE. I've never done anything like that
and have no idea what I'm talking about, so I may be completely wrong.



You are. Firefox supports "Windows Integrated Authentication" fine too, and I believe most 
usual current browsers do.


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



FW: Destroying resources created with a custom ObjectFactory

2013-01-28 Thread Xavier Dury
Hi,

I'm using Tomcat 7.0.x and made a custom javax.naming.spi.ObjectFactory to 
create a Ehcache manager, exposing a configured CacheManager to an application 
through (local) JNDI.
My question is: how/where can I call the CacheManager.shutdown() method when my 
application is (re|un)deployed?
I tried adding a NamespaceChangerListener to the (Event)Context passed to the 
ObjectFactory.getObjectInstance() method without luck.
Thanks,
Xavier  
  

Re: Tomcat6+webapps+log4j

2013-01-28 Thread Tiago Sousa

Em 28/01/2013 16:16, Christopher Schultz escreveu:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:02 AM, Tiago Sousa wrote:

Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:

Thanks, one more time, for your reply. The problem with log4j
1.x is that it outputs the following error: log4j:WARN No
appenders could be found for logger
(org.apache.catalina.startup.Embedded). log4j:WARN Please
initialize the log4j system properly.

I know that this is a common error, usually related with
classpath problems. In my case, the configuration i'm using
doesn´t seem to be have those sort of problems

This is a symptom of having your log4j.properties in the wrong
place.

You never said anything about using Tomcat Embedded. If you are
using Embedded Tomcat, you'll have to make sure that your
log4j.properties file is in the CLASSPATH of the JVM when it
starts.

-chris

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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


Hi. Thanks for your reply. Isn´t that assured (log4j in classpath)
putting the log4j.properties in apache lib folder since i'm using
tomcat 6.x?

If you are using Tomcat Embedded, you are entirely responsible for
your own CLASSPATH. The "Embedded" class causes the logger to be
initialized before any real code gets executed (it's in the first
static initializer in the class), so "Embedded" can't change the
CLASSPATH or launch a new ClassLoader for that purpose.

Can you please describe your environment? It's been tough to get
details from you.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGpFUACgkQ9CaO5/Lv0PCXmACgjoQhdKJ0czXMdIAfYKwOsOpH
D4UAnjTr99Jd/sebfuP5IhOJLYB6a+On
=ocWz
-END PGP SIGNATURE-

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


Hi,

Sorry, i am a newbie in tomcat issues.
I'm just "following orders"... :-)
My configuration is the most standard i could find:

1 step: download apache-tomcat-6.0.36.zip from apache.org
2 - unzip
3 - erase logging.properties from conf folder
4 - copy jar files (juli and juli-adapters)from extras to bin and lib 
directories, respectively.
5 - create a logging.properties file (standard definitions as in 
apache.org) and put it in lib folder.

6- download log4j.1.2.7.jar and put it in lib folder.

And that's it. I'm using tomcat in windows.

Hope this helps you to help me...

Tiago


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



Re: Restarting Tomcat from within itself?

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hassan,

On 1/28/13 10:43 AM, Hassan Schroeder wrote:
> On Mon, Jan 28, 2013 at 7:32 AM, Christopher Schultz 
>  wrote:
> 
>>> Alternatively, you could use a preexisting tool to monitor
>>> your Tomcat instance like Nagios or Hyperic.
>> 
>> These solutions really only monitor. Yes, you can configure them
>> to "react" to certain situations by abusing the notification
>> system, but they are really meant for monitoring and
>> notification, not for automated tasks.
> 
> Unlike, say, http://mmonit.com/monit/   :-)

Hey, that's cool. Thanks for the reference.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGpKEACgkQ9CaO5/Lv0PCsWgCcDl0zhBl76bANry7kINfPLI3u
ObYAoLg3BGf3MDEkFzpHq2oLRqRxDUkG
=XvkL
-END PGP SIGNATURE-

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 11:02 AM, Tiago Sousa wrote:
> Em 28/01/2013 15:41, Christopher Schultz escreveu: Tiago,
> 
> On 1/28/13 8:49 AM, Tiago Sousa wrote:
 Thanks, one more time, for your reply. The problem with log4j
 1.x is that it outputs the following error: log4j:WARN No
 appenders could be found for logger
 (org.apache.catalina.startup.Embedded). log4j:WARN Please
 initialize the log4j system properly.
 
 I know that this is a common error, usually related with
 classpath problems. In my case, the configuration i'm using
 doesn´t seem to be have those sort of problems
> This is a symptom of having your log4j.properties in the wrong
> place.
> 
> You never said anything about using Tomcat Embedded. If you are
> using Embedded Tomcat, you'll have to make sure that your
> log4j.properties file is in the CLASSPATH of the JVM when it
> starts.
> 
> -chris
>> 
>> -
>>
>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
> Hi. Thanks for your reply. Isn´t that assured (log4j in classpath)
> putting the log4j.properties in apache lib folder since i'm using
> tomcat 6.x?

If you are using Tomcat Embedded, you are entirely responsible for
your own CLASSPATH. The "Embedded" class causes the logger to be
initialized before any real code gets executed (it's in the first
static initializer in the class), so "Embedded" can't change the
CLASSPATH or launch a new ClassLoader for that purpose.

Can you please describe your environment? It's been tough to get
details from you.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGpFUACgkQ9CaO5/Lv0PCXmACgjoQhdKJ0czXMdIAfYKwOsOpH
D4UAnjTr99Jd/sebfuP5IhOJLYB6a+On
=ocWz
-END PGP SIGNATURE-

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Tiago Sousa

Em 28/01/2013 15:41, Christopher Schultz escreveu:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:

Thanks, one more time, for your reply. The problem with log4j 1.x
is that it outputs the following error: log4j:WARN No appenders
could be found for logger (org.apache.catalina.startup.Embedded).
log4j:WARN Please initialize the log4j system properly.

I know that this is a common error, usually related with classpath
problems. In my case, the configuration i'm using doesn´t seem to
be have those sort of problems

This is a symptom of having your log4j.properties in the wrong place.

You never said anything about using Tomcat Embedded. If you are using
Embedded Tomcat, you'll have to make sure that your log4j.properties
file is in the CLASSPATH of the JVM when it starts.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGnBcACgkQ9CaO5/Lv0PCGeQCfdQvJ+vyTLdsHcrwCpCnoTppE
Rp8An3UKaCGB4wMzd7C6ScoidsQtXTKG
=BTbI
-END PGP SIGNATURE-

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


Hi.
Thanks for your reply.
Isn´t that assured (log4j in classpath) putting the log4j.properties in 
apache lib folder since i'm using tomcat 6.x?


Thanks again.

Tiago

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



Re: Restarting Tomcat from within itself?

2013-01-28 Thread Hassan Schroeder
On Mon, Jan 28, 2013 at 7:32 AM, Christopher Schultz
 wrote:

>> Alternatively, you could use a preexisting tool to monitor your
>> Tomcat instance like Nagios or Hyperic.
>
> These solutions really only monitor. Yes, you can configure them to
> "react" to certain situations by abusing the notification system, but
> they are really meant for monitoring and notification, not for
> automated tasks.

Unlike, say, http://mmonit.com/monit/   :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 8:49 AM, Tiago Sousa wrote:
> Thanks, one more time, for your reply. The problem with log4j 1.x
> is that it outputs the following error: log4j:WARN No appenders
> could be found for logger (org.apache.catalina.startup.Embedded). 
> log4j:WARN Please initialize the log4j system properly.
> 
> I know that this is a common error, usually related with classpath 
> problems. In my case, the configuration i'm using doesn´t seem to
> be have those sort of problems

This is a symptom of having your log4j.properties in the wrong place.

You never said anything about using Tomcat Embedded. If you are using
Embedded Tomcat, you'll have to make sure that your log4j.properties
file is in the CLASSPATH of the JVM when it starts.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGnBcACgkQ9CaO5/Lv0PCGeQCfdQvJ+vyTLdsHcrwCpCnoTppE
Rp8An3UKaCGB4wMzd7C6ScoidsQtXTKG
=BTbI
-END PGP SIGNATURE-

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/28/13 6:03 AM, Tiago Sousa wrote:
> Just another symptom: initially i also thought that could be a 
> permissions problem but it's strange that JULI could create the log
> file while log4j couldn´t. I've tried several other approaches but
> in none the files were created. I´ve tried the same configuration
> in Linux. A catalina.out file was created but the other log files:
> manager, host-manager, admin weren´t.

Note that catalina.out is created via shell redirection (if you use
startup scripts) or by fd redirection (if you use jsvc, procrun, etc.)
while the other logs are all done by the Java-based logging mechanism.

If you haven't configured JULI or log4j properly, you'll get no logs
except for catalina.out. I think it's actually possible to launch your
JVM in such a way that the script (or jsvc/procrun) has write
permissions but the JVM does not. You'd probably have to really make a
mess of your configuration to achieve that, but it's technically
possible. Double-check your process table to see who the effective uid
is, just in case.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGmxMACgkQ9CaO5/Lv0PAH0gCgpXLn2KClGbpbk0hs8XPkJvnG
jh8AniWaKGQlqIcA5Ex2yMyWmK39N4Jq
=78hN
-END PGP SIGNATURE-

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



Re: Restarting Tomcat from within itself?

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Daniel,

On 1/28/13 8:19 AM, Daniel Mikusa wrote:
> On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:
> 
>> Hi,
>> 
>> Is it possible to restart tomcat from within itself?
>> 
>> I host a JSP website and somehow the memory utilization keeps on 
>> increasing from time to time. I then have to manually restart 
>> Tomcat.
>> 
>> While I understand that in the long term, I should focus on
>> fixing the memory leaks, is there a way by which I can restart
>> Tomcat after the free memory goes below a threshold percentage?
> 
> I wouldn't try to do this inside Tomcat.  With the tools provided
> by the JVM (jmap or JMX), you can monitor just as easily from
> outside Tomcat.  Instead, create a monitoring script to watch the
> Tomcat process.  When memory usage hits a certain level, dump the
> heap (so you can analyze your memory problem later) and restart
> Tomcat.

+1

If you want to chance it, you could set -XX:OnOutOfMemoryError=
and write a script that tries to dump your heap (or just have the JVM
do that for you) and then bounce Tomcat.

Note that not all OOMEs are life-threatening for the JVM.

I have experienced two kinds of OOMEs:

1) Truly out of memory: your app simply needs more heap. In these
   cases, the JVM generally goes into GC panic for a short amount of
   time trying to free-up memory and then finally throws OOME.
   Nothing meaningful seems to work after that: DBCPs run dry,
   etc. In these cases, I have had to restart my JVM completely
   in order for any users to get anything meaningful done.

2. Transient memory exhaustion: this happens when we have some careless
   code that loads 100,000 records from a single database query all
   into a big java.util.List or something like that. In these cases,
   a single thread gets an OOME, the List gets GC'd very quickly, and
   the server (and JVM) are fine. We generally do restart our JVMs when
   this happens, but we can wait until off-hours when fewer users are
   likely to be impacted in any way.

> Alternatively, you could use a preexisting tool to monitor your 
> Tomcat instance like Nagios or Hyperic.

These solutions really only monitor. Yes, you can configure them to
"react" to certain situations by abusing the notification system, but
they are really meant for monitoring and notification, not for
automated tasks.

>> I am using tomcat 6.0.14 on unix.
> 
> This is really old, upgrade.

+10

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGmisACgkQ9CaO5/Lv0PAMeACfflakV2t8RT5kjF/wQf8joYl9
swgAmgL1pwbvX5yLe2jUSGaOXXr5SDzf
=MaHM
-END PGP SIGNATURE-

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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Chris,

On 1/28/13 7:47 AM, chris derham wrote:
>> 1) All 3 applications  are browser compatible  and users may use
>> other then IE hence IE alone can be ruled out
> 
> Do you mean "multiple browsers access these web applications, so
> we can't use anything that is IE specific"? Assuming that you do, I
> don't believe that anybody suggested anything that is IE specific,
> e.g. the SSO solutions so far posted will work in other browsers as
> well. Can you elaborate on what you mean exactly please?

I think auto-forwarding credentials from the client system through the
browser generally requires MSIE. I've never done anything like that
and have no idea what I'm talking about, so I may be completely wrong.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGmHsACgkQ9CaO5/Lv0PCqkgCcDZwZB2pNlbUKkklhJ+OBBiLU
NAgAoLZ3TWwl8lflIJsHT0jfnbDm4l9V
=DrZr
-END PGP SIGNATURE-

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



Re: Not able to read file from jar in tomcat

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Bibin,

On 1/28/13 6:07 AM, Bibin Balakrishnan wrote:
> I have a web application running under tomcat 7, and in one of the
> class, Im trying to read a file in one of the jar under WEB-INF/lib
> folder.
> 
> URL resourceURL = 
> MyClass.class.getClassLoader().getResource("xml/xslt/master.xsl");

I usually see paths starting with a "/" but that doesn't seem to be a
requirement of the ClassLoader API.

> File xslfile = new File(resourceURL.getPath());

As Konstantin points out, that's not going to work unless the
resourceURL is an actual file on the disk. This URL:

> file://MyApp/WEB-INF/lib/MyComponent.jar!/xml/xslt/master.xsl

...is
> 
a file in a JAR on the disk. If you want to read this file,
you're going to have to call URL.openStream to read from it, or use
ClassLoader.getResourceAsStream as you have done below:

> InputStream xslFile = 
> MyClass.class.getClassLoader().getResourceAsStream("xml/xslt/master.xsl");
>
> 
Can anyone explain what is preventing the creation of File from the jar
> resource, whereas the inputstream creation is working perfectly
> fine. Is there any additional permission settings needed from
> tomcat side, to read a file inside jar ?

Nope, the java.io.File is simply never going to work because you are
trying to read something that is not a file on the disk.

> EDIT: One more observation, if the file is placed under
> WEB-INF/classes, creation of File with above code works fine. Issue
> is only when it is placed in a jar under WEB-INF/lib

Correct. In that case, you do have a file on the disk to read... it's
no longer tucked-inside a JAR File.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGmAQACgkQ9CaO5/Lv0PA5oQCdH7kfLOueStm/3YtIQ8Kte/qD
3KwAnRycJfiKuSnwgHZ+1dOk+kl7gwAv
=BdZz
-END PGP SIGNATURE-

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



Re: [OT] Best way to log requests from a servlet and to a database?

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Brian,

On 1/26/13 11:29 PM, Brian Braun wrote:
> I finally found this, implemented it and works great! 
> http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/LinkedBlockingQueue.html
>
>  However, if I get significantly more requests, this may not be
> enough because MySQL will get slower and the queue will get full.

MySQL shouldn't "get slower" unless something is badly misconfigured.
If you have lots of indexes on your logging table, you're doing it
wrong. What table type, etc. are you using? MySQL might not be the
best solution for logging. Do you really need ACID?

> I think I could start using this queue, and if it gets full I
> could failover to Amazons Queue service. What do you think?

I think if you expect to failover, you should consider why that would
happen. If you can't handle your normal load using just MySQL, then
you may as well go for the complete Amazon solution.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGlnsACgkQ9CaO5/Lv0PBgaQCfa+e50e7hirdyD/o6ngLqCxyv
EkUAoKyzk+L/L7YAdytKs+5aUNtqED+W
=t6eB
-END PGP SIGNATURE-

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



Re: Different webapp paths on different hosts

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

bxqdev,

On 1/26/13 1:09 AM, bxqdev wrote:
> 
> 
> On 1/26/2013 1:05 AM, Christopher Schultz wrote: Dude,
> 
> On 1/25/13 12:38 AM, bxqdev wrote:
 i want to have one instance of webapp,
> 
> No problem.
> 
 which has two paths,
> 
> Problem: one context = one path = one instance
> 
> If you want two separate paths, you need two separate contexts.
> 
 and each of the paths serves the root of different domains
> 
> That just doesn't make any sense. The root of a domain is, by 
> definition, "/" (contextPath=""), so there aren't any other paths
> to consider.
> 
>> looks like the goal is not reachable with plain tomcat
>> configuration.
> 
> 
 once again: * one webapp * has 2 different paths: "/path1"
 and "/path2" * served on 2 domains * when user goes to 
 http://path1.com/ -> {webapp}/path1 is served as root path *
 when user goes to http://path2.com/ -> {webapp}/path2 is
 served as root path
 
 is it possible?
> 
> What you are saying is nonsensical (specifically, the part where
> you say that you want /path1 to be mapped to "root".
> 
> If you want two virtual hosts, then define two virtual hosts. If
> you want an app on each host configured as ROOT, then make your
> two virtual hosts have two separate appBase directories (which
> should be a requirement in the first place of two virtual hosts)
> and toss a copy of your WAR file in each appBase, both named
> ROOT.war (cApITaLS matter).
> 
> You can't deploy a single copy (in memory) of your webapp and
> expect to get all your requirements above met. If you want to have
> a single WAR file on the disk and deploy it multiple times, you
> *can* do that but I'm not sure why anyone would want to.
> 
>> looks like the goal is not reachable with plain tomcat
>> configuration.

I seriously don't understand your "goal" or your "problem". It sounds
like you want two separate webapps smashed into a single context where
one webapp gets served by one domain and another webapps gets served
by the other domain. I don't know why you don't just split them up
into two separate webapps just like $DIETY intended.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGlY0ACgkQ9CaO5/Lv0PD86wCfcid6tNjOzzR0BJZh2tF5672y
09kAmwQ/o+S3jP3Ii033Wfm1UkVmecXs
=shqR
-END PGP SIGNATURE-

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



Re: Different webapp paths on different hosts

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

bxqdev,

On 1/26/13 3:04 PM, bxqdev wrote:
> On 1/26/2013 9:36 PM, Caldarale, Charles R wrote:
>>> From: cjder...@gmail.com [mailto:cjder...@gmail.com] On Behalf
>>> Of chris derham Subject: Re: Different webapp paths on
>>> different hosts
>> 
>>> To my mind if you deploy the app as ROOT.war, as long as DNS
>>> is configured correctly, that single context will serve
>>> responses to http://app1.com/ and http://app2.com/. This
>>> appears solves the explicit requirement stated above.
>> 
>> Which is what I suggested back on 23 January:
>> 
>>> Assuming path1.com and path2.com evaluate to the same IP
>>> address (or at least to the same system), this will happen
>>> automatically with a single  element in the Tomcat
>>> configuration.
>> 
>> But the OP refuses to supply any information about why that's
>> not sufficient.
>> 
>> - Chuck
> 
> in this case http://app1.com/ and http://app2.com/ will serve the
> same content. i need different content on different domains.

Something actually made a little "pop" in my brain when I read that. I
gotta go... I think I smell toast burning...

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGlRIACgkQ9CaO5/Lv0PBywQCeO1wxbRMQX6reeKVzCaYCjIY8
F74An104rdsUKFUucCNBZgfBC3Mh+7Lr
=d8JI
-END PGP SIGNATURE-

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



Re: Best way to log requests from a servlet and to a database?

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Brian,

On 1/25/13 9:00 PM, Brian Braun wrote:
> Until recently, all this happened in a syncronous way. I mean,
> before the Tomcat thread delivered the response, it had to create
> the records in the database table. The problem is that this log
> used to take more than 90% of the total time, and even worse: when
> the database got slower then the service took about 10-15 seconds
> instead of just 20 milliseconds.

Ouch.

What kind of tables are you using? How many records count as a "log"?
In how many tables? How many indexes do you have on that/those table/s?

> I recetly made an improvement: Each Tomcat thread creates an extra
> thread doing a "(new Thread(new certain Object)).start();" that
> takes care of the SQL insertion in an asyncronous way, so the
> response gets to the clients faster. But these threads take too
> much RAM when MySQL runs slower and threads multiply, and with a
> few thousands of them the JVM Tomcat runs of the memory.

Yup: you'll at least want to run an Executor to limit the number of
new threads you create. That's a bad suggestion, anyway, because there
are better techniques you can use.

> What I need is to be able to accept as much HTTP requests as
> possible, to log every one of them as fast as possible (not
> syncronously), and to make everything fast and with a very low
> usage of RAM when MySQL gets slow and inserts need to queue. I
> think I need some kind of queue to buffer the entries when the
> speed of http request is higher than the speed of insertions in the
> database log.

So, if you don't need synchronous log-writing does that mean you can
also tolerate some logs being missed? They are kind of two sides of
the came coin.

> I'm thinking about these ideas:
> 
> 1- Creating some kind of FIFO queue myself, maybe using some of
> those Apache commons collections, and the some kind of thread that
> polls the collection and creates the database records. But what
> collection should I use? And how should I program the thread that
> polls it, so it won't monopolize the CPU? I think that a "Do while
> (true)" would eat the CPU cycles. And that about making it
> thread safe? How to do it?

You can use while(!stop) { Object.wait(); dequeue(); } which will be
somewhat reasonable. Then you set "stop" when you want to shut-down
your queue-processor (like from a ServletContextListener). Be sure to
make that member volatile.

> 2- log4J? I have never used it directly, but it seems that this
> framework is algo designed to creat "appenders" that talk to the
> database. Would that be the way to do it?

If you can deal with the restrictions of log4j (basically, you
generate a line of text and that can get inserted into the db). I
haven't checked how the JDBCAppender works, but I would hope they
write more than one message to the db in each transaction.

Honestly, I would try log4j: it's already written for you and you can
log to it very simply and configure it simply as well. So, it's cheap
to compare it to your current situation.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGlIIACgkQ9CaO5/Lv0PAEsACfVvL/sAxua5yYF2UvARPzt4jS
M6EAoIJ71sbsYQmUwHmfqWKCoLDFYCwS
=LlXJ
-END PGP SIGNATURE-

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



Re: jsp:getProperty not working

2013-01-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Benin,

On 1/25/13 6:56 PM, Benin Technologies wrote:
> I'm new to Tomcat/JSP
> 
> I have a JSP page that instantiates a bean, then it access the
> bean through a scriptlet, it works fine. But when I replace the
> scriptlet by a  
> Take my code below : <%= employee.getFirstName() %> IS WORKING, it
> displays the employee's firstname  property="firstName" />  IS NOT WORKING, displays nothing
> 
> any idea why ?
> 
> 
> 
>  scope="request" />  <% Vector v
> =(Vector)request.getAttribute("list"); Iterator i =
> v.iterator(); int j = 0; while (i.hasNext()) { employee =
> (EmployeeBean)i.next(); %>
> 
> <%= employee.getFirstName() %>
>  WORKS 
> DOESN'T WORK !! WHY ?
> 
> <% } %> 

Is that the full JSP? It looks like you may have your bean "employee"
in the request scope, and you haven't set a first name. Your loop may
use a page-scoped bean (or really not a scoped bean at all -- you
appear to be simply using inline scriptlets).

Try using  instead of writing a scriptlet for your loop.

What version of Tomcat are you using?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEGkuQACgkQ9CaO5/Lv0PBQ/ACgj6GheM51mjoYSx8rrcqVfiD4
kwsAn14hemCRA9Dr4nGkvI9VxFaB0EmU
=gFh0
-END PGP SIGNATURE-

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Tiago Sousa

Em 28/01/2013 12:56, Konstantin Kolinko escreveu:

2013/1/28 Tiago Sousa :

Em 25/01/2013 19:39, Christopher Schultz escreveu:

On 1/25/13 4:45 AM, Tiago Sousa wrote:

Em 25/01/2013 08:59, Konstantin Kolinko escreveu:

2013/1/24 Tiago Sousa :

Hello to all.

I have tomcat 6

Which version?

I'm using tomcat 6.0.16.

Did you install it from a zip file downloaded from
tomcat.apache.org?

Yes, i installed using a zip file downloaded from
tomcat.apache.org.


using JULI for logging (logging.properties in conf dir) plus
several webapps using its own log4j.properties.

I need to centralized all the logs so i thought to put a
global/shared log4j.properties in $CATALINA_BASE\lib so that
tomcat and each webapp can be controlled through this file. OK,
but make sure that all jars are in their proper places.
Sometimes people read the doc incorrectly.

http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Ok, i think i've done it, namely:

* Put|log4j.jar|and|tomcat-juli-adapters.jar|from "extras"
into|$CATALINA_HOME/lib|. *
Replace|$CATALINA_HOME/bin/tomcat-juli.jar|with|tomcat-juli.jar|from



"extras".


The problem i'm facing is that no logs are produced. At this time
i'm trying to configure just TOMCAT, no webapps, to log through
log4j but still no logs are produced. I've folowed the tutorial in
Apache logging webpage with the standard log4j.properties. No logs
in $CATALINA_BASE\logs.

Which tutorial did you follow?

The one you mentioned:
http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Did you configure them to be written to "${catalina.base}/logs"
? Maybe it tries to write them elsewhere?

It is configured in its standard version (
http://tomcat.apache.org/tomcat-6.0-doc/logging.html), which i am
using.

Is the file readable?

There is no file, tomcat does not create one and that is my
problem.

I think Konstantin meant "is the config file readable" or perhaps "is
the logs/ directory writable". Of course, all permissions must be
relative to the effective uid running Tomcat.

Check catalina.out. If you don't have a log4j.properties file (or
similar) available, I believe you'll get a message on stdout saying
"You haven't configured log4j properly" and you won't get any further
log messages anywhere.



Hi...

Just a final tip, i´m using log4j-api-2.0-beta3 as my log4j.jar (without
renaming it).
Any problem with that?


File name is not a problem, but using a wrong version of the library
is a problem.
There are a couple of issues to start

1. The Apache Commons Logging library is designed and compiled to use Log4J 1.x

Log4J 2 docs say that you need an adapter to use it with Commons
Logging. (I have not used it yet so I do not know what mileage is
here). YMMV.

2. "log4j.properties" is not a valid configuration file for log4j 2.
Its configuration files are either XML or JSON.
http://logging.apache.org/log4j/2.x/manual/configuration.html

Try with 1.2.17
http://logging.apache.org/log4j/1.2/download.html

Best regards,
Konstantin Kolinko

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


Hi,
Thanks, one more time, for your reply.
The problem with log4j 1.x is that it outputs the following error:
log4j:WARN No appenders could be found for logger 
(org.apache.catalina.startup.Embedded).

log4j:WARN Please initialize the log4j system properly.

I know that this is a common error, usually related with classpath 
problems. In my case, the configuration i'm using doesn´t seem to be 
have those sort of problems


Any idea?
Tiago



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



Re: Restarting Tomcat from within itself?

2013-01-28 Thread Daniel Mikusa
On Jan 26, 2013, at 5:19 AM, Sunil Shevante wrote:

> Hi,
> 
> Is it possible to restart tomcat from within itself?
> 
> I host a JSP website and somehow the memory utilization keeps on increasing 
> from time to time. I then have to manually restart Tomcat.
> 
> While I understand that in the long term, I should focus on fixing the memory 
> leaks, is there a way by which I can restart Tomcat after the free memory 
> goes below a threshold percentage?

I wouldn't try to do this inside Tomcat.  With the tools provided by the JVM 
(jmap or JMX), you can monitor just as easily from outside Tomcat.  Instead, 
create a monitoring script to watch the Tomcat process.  When memory usage hits 
a certain level, dump the heap (so you can analyze your memory problem later) 
and restart Tomcat.

Alternatively, you could use a preexisting tool to monitor your Tomcat instance 
like Nagios or Hyperic.

> 
> I am using tomcat 6.0.14 on unix.

This is really old, upgrade.

Dan

> 
> Thanks,
> Sunil

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Konstantin Kolinko
2013/1/28 Tiago Sousa :
> Em 25/01/2013 19:39, Christopher Schultz escreveu:
>>
>> On 1/25/13 4:45 AM, Tiago Sousa wrote:
>>>
>>> Em 25/01/2013 08:59, Konstantin Kolinko escreveu:

 2013/1/24 Tiago Sousa :
>
> Hello to all.
>
> I have tomcat 6

 Which version?
>>>
>>> I'm using tomcat 6.0.16.

 Did you install it from a zip file downloaded from
 tomcat.apache.org?
>>>
>>> Yes, i installed using a zip file downloaded from
>>> tomcat.apache.org.
>>>
 using JULI for logging (logging.properties in conf dir) plus
 several webapps using its own log4j.properties.

 I need to centralized all the logs so i thought to put a
 global/shared log4j.properties in $CATALINA_BASE\lib so that
 tomcat and each webapp can be controlled through this file. OK,
 but make sure that all jars are in their proper places.
 Sometimes people read the doc incorrectly.

 http://tomcat.apache.org/tomcat-6.0-doc/logging.html
>>>
>>> Ok, i think i've done it, namely:
>>>
>>> * Put|log4j.jar|and|tomcat-juli-adapters.jar|from "extras"
>>> into|$CATALINA_HOME/lib|. *
>>> Replace|$CATALINA_HOME/bin/tomcat-juli.jar|with|tomcat-juli.jar|from
>>>
>>>
>> "extras".
>>>
>>>
>>> The problem i'm facing is that no logs are produced. At this time
>>> i'm trying to configure just TOMCAT, no webapps, to log through
>>> log4j but still no logs are produced. I've folowed the tutorial in
>>> Apache logging webpage with the standard log4j.properties. No logs
>>> in $CATALINA_BASE\logs.

 Which tutorial did you follow?
>>>
>>> The one you mentioned:
>>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html

 Did you configure them to be written to "${catalina.base}/logs"
 ? Maybe it tries to write them elsewhere?
>>>
>>> It is configured in its standard version (
>>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html), which i am
>>> using.

 Is the file readable?
>>>
>>> There is no file, tomcat does not create one and that is my
>>> problem.
>>
>> I think Konstantin meant "is the config file readable" or perhaps "is
>> the logs/ directory writable". Of course, all permissions must be
>> relative to the effective uid running Tomcat.
>>
>> Check catalina.out. If you don't have a log4j.properties file (or
>> similar) available, I believe you'll get a message on stdout saying
>> "You haven't configured log4j properly" and you won't get any further
>> log messages anywhere.
>>
>>
> Hi...
>
> Just a final tip, i´m using log4j-api-2.0-beta3 as my log4j.jar (without
> renaming it).
> Any problem with that?
>

File name is not a problem, but using a wrong version of the library
is a problem.
There are a couple of issues to start

1. The Apache Commons Logging library is designed and compiled to use Log4J 1.x

Log4J 2 docs say that you need an adapter to use it with Commons
Logging. (I have not used it yet so I do not know what mileage is
here). YMMV.

2. "log4j.properties" is not a valid configuration file for log4j 2.
Its configuration files are either XML or JSON.
http://logging.apache.org/log4j/2.x/manual/configuration.html

Try with 1.2.17
http://logging.apache.org/log4j/1.2/download.html

Best regards,
Konstantin Kolinko

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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread chris derham
> 1) All 3 applications  are browser compatible  and users may use other then
> IE
> hence IE alone can be ruled out

Do you mean "multiple browsers access these web applications, so we
can't use anything that is IE specific"? Assuming that you do, I don't
believe that anybody suggested anything that is IE specific, e.g. the
SSO solutions so far posted will work in other browsers as well. Can
you elaborate on what you mean exactly please?

Thanks

Chris

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



Re: Not able to read file from jar in tomcat

2013-01-28 Thread Konstantin Kolinko
2013/1/28 Bibin Balakrishnan :
> I have a web application running under tomcat 7, and in one of the class,
> Im trying to read a file in one of the jar under WEB-INF/lib folder.
>
> URL resourceURL =
> MyClass.class.getClassLoader().getResource("xml/xslt/master.xsl");
> File xslfile = new File(resourceURL.getPath());

java.io.File represents a file on a hard drive.

A file contained inside a JAR archive cannot be represented by
java.io.File, but it can be by java.net.URL.  Thus using an url works,
but using a file does not.

> AssertUtil.assertTrue(xslfile.exists(),"xsl file not found");
> Both MyClass and master.xsl resides in the same jar and there is no issue
> with packaging. But above snippet fails in the assertion statement as
> xslfile.exists returns false. The URL correctly resolves to the location of
> the file inside the jar as given below
>
> file://MyApp/WEB-INF/lib/MyComponent.jar!/xml/xslt/master.xsl
> where MY_WEBAPP_LOCATION corresponds to the absolute path to my tomcat
> servers webapp directory.
>
> But if I rewrite the code as below to read as inputstream, it works fine.
>
> InputStream xslFile =
> MyClass.class.getClassLoader().getResourceAsStream("xml/xslt/master.xsl");
> Can anyone explain what is preventing the creation of File from the jar
> resource, whereas the inputstream creation is working perfectly fine. Is
> there any additional permission settings needed from tomcat side, to read a
> file inside jar ?
>
> EDIT: One more observation, if the file is placed under WEB-INF/classes,
> creation of File with above code works fine. Issue is only when it is
> placed in a jar under WEB-INF/lib

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Tiago Sousa

Em 25/01/2013 19:39, Christopher Schultz escreveu:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/25/13 4:45 AM, Tiago Sousa wrote:

Em 25/01/2013 08:59, Konstantin Kolinko escreveu:

2013/1/24 Tiago Sousa :

Hello to all.

I have tomcat 6

Which version?

I'm using tomcat 6.0.16.

Did you install it from a zip file downloaded from
tomcat.apache.org?

Yes, i installed using a zip file downloaded from
tomcat.apache.org.


using JULI for logging (logging.properties in conf dir) plus
several webapps using its own log4j.properties.

I need to centralized all the logs so i thought to put a
global/shared log4j.properties in $CATALINA_BASE\lib so that
tomcat and each webapp can be controlled through this file. OK,
but make sure that all jars are in their proper places.
Sometimes people read the doc incorrectly.

http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Ok, i think i've done it, namely:

* Put|log4j.jar|and|tomcat-juli-adapters.jar|from "extras"
into|$CATALINA_HOME/lib|. *
Replace|$CATALINA_HOME/bin/tomcat-juli.jar|with|tomcat-juli.jar|from



"extras".


The problem i'm facing is that no logs are produced. At this time
i'm trying to configure just TOMCAT, no webapps, to log through
log4j but still no logs are produced. I've folowed the tutorial in
Apache logging webpage with the standard log4j.properties. No logs
in $CATALINA_BASE\logs.

Which tutorial did you follow?

The one you mentioned:
http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Did you configure them to be written to "${catalina.base}/logs"
? Maybe it tries to write them elsewhere?

It is configured in its standard version (
http://tomcat.apache.org/tomcat-6.0-doc/logging.html), which i am
using.

Is the file readable?

There is no file, tomcat does not create one and that is my
problem.

I think Konstantin meant "is the config file readable" or perhaps "is
the logs/ directory writable". Of course, all permissions must be
relative to the effective uid running Tomcat.

Check catalina.out. If you don't have a log4j.properties file (or
similar) available, I believe you'll get a message on stdout saying
"You haven't configured log4j properly" and you won't get any further
log messages anywhere.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEC330ACgkQ9CaO5/Lv0PBrVQCfb9A0KMGRe0aoqRSeYrHT1WNx
0lwAn3ed8h09a7fv7Vg4jCgerDUrPFD1
=G3j0
-END PGP SIGNATURE-

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


Hi...

Just a final tip, i´m using log4j-api-2.0-beta3 as my log4j.jar (without 
renaming it).

Any problem with that?

Thanks.

Tiago

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



Re: Tomcat6+webapps+log4j

2013-01-28 Thread Tiago Sousa

Em 25/01/2013 19:39, Christopher Schultz escreveu:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Tiago,

On 1/25/13 4:45 AM, Tiago Sousa wrote:

Em 25/01/2013 08:59, Konstantin Kolinko escreveu:

2013/1/24 Tiago Sousa :

Hello to all.

I have tomcat 6

Which version?

I'm using tomcat 6.0.16.

Did you install it from a zip file downloaded from
tomcat.apache.org?

Yes, i installed using a zip file downloaded from
tomcat.apache.org.


using JULI for logging (logging.properties in conf dir) plus
several webapps using its own log4j.properties.

I need to centralized all the logs so i thought to put a
global/shared log4j.properties in $CATALINA_BASE\lib so that
tomcat and each webapp can be controlled through this file. OK,
but make sure that all jars are in their proper places.
Sometimes people read the doc incorrectly.

http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Ok, i think i've done it, namely:

* Put|log4j.jar|and|tomcat-juli-adapters.jar|from "extras"
into|$CATALINA_HOME/lib|. *
Replace|$CATALINA_HOME/bin/tomcat-juli.jar|with|tomcat-juli.jar|from



"extras".


The problem i'm facing is that no logs are produced. At this time
i'm trying to configure just TOMCAT, no webapps, to log through
log4j but still no logs are produced. I've folowed the tutorial in
Apache logging webpage with the standard log4j.properties. No logs
in $CATALINA_BASE\logs.

Which tutorial did you follow?

The one you mentioned:
http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Did you configure them to be written to "${catalina.base}/logs"
? Maybe it tries to write them elsewhere?

It is configured in its standard version (
http://tomcat.apache.org/tomcat-6.0-doc/logging.html), which i am
using.

Is the file readable?

There is no file, tomcat does not create one and that is my
problem.

I think Konstantin meant "is the config file readable" or perhaps "is
the logs/ directory writable". Of course, all permissions must be
relative to the effective uid running Tomcat.

Check catalina.out. If you don't have a log4j.properties file (or
similar) available, I believe you'll get a message on stdout saying
"You haven't configured log4j properly" and you won't get any further
log messages anywhere.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEC330ACgkQ9CaO5/Lv0PBrVQCfb9A0KMGRe0aoqRSeYrHT1WNx
0lwAn3ed8h09a7fv7Vg4jCgerDUrPFD1
=G3j0
-END PGP SIGNATURE-

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


Hi.

Just another symptom: initially i also thought that could be a 
permissions problem but it's strange that JULI could create the log file 
while log4j couldn´t.

I've tried several other approaches but in none the files were created.
I´ve tried the same configuration in Linux. A catalina.out file was 
created but the other log files: manager, host-manager, admin weren´t.


Any ideas?

Thanks.

Tiago



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



Re: How to prevent CVE-2012-5568 in Tomcat 7.0.32

2013-01-28 Thread Mark Thomas
On 28/01/2013 06:49, Aditi Sinha wrote:
> Thanks a lot Mark for the information.

Added to the security pages:
http://tomcat.apache.org/security-7.html#Not_a_vulnerability_in_Tomcat
http://tomcat.apache.org/security-6.html#Not_a_vulnerability_in_Tomcat

Mark


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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread N.s.Karthik
Hi

Thx for the Quick reply

1) All 3 applications  are browser compatible  and users may use other then
IE  
hence IE alone can be ruled out

What about the other (2 & 3) options


with regards
karthik




--
View this message in context: 
http://tomcat.10.n6.nabble.com/LDAP-on-TOMCAT-7-0-30-tp4993107p4993116.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread Mark Thomas
On 28/01/2013 09:06, André Warnier wrote:
> N.s.Karthik wrote:
>> Hi
>>
>> Spec :  JDK1.6,   Tomcat 7.0.30,   Linux 64
>> bit Suse 
>> So far we have been using  3 killer Ajax web based applications with
>> each app provided with separate DB schema.
>>
>> The Requirement  is to provide a SSO "Single Sign On"  Logic with
>> existing
>> LDAP Server.
>> The AAA has to validated  Only once for login
>>
>> 1) What Options do i have in providing SSO Logic
>> 2)Can Cookies be used for resolving the requirement.
>> 3)Can the browser pick up the Client System Login credentials ( Win
>> start-up
>> credentials) for the authorization.
>>
> Have a look at Jespa : www.ioplex.com

There is also built-in support for Windows authentication in Tomcat as
well as other third-party libraries that do this. See:
http://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html

I'll add Jespa to that page.

Mark

> 
> -
> 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: [OT] Best way to log requests from a servlet and to a database?

2013-01-28 Thread André Warnier

Caldarale, Charles R wrote:
From: Brian Braun [mailto:brianbr...@gmail.com] 
Subject: Re: [OT] Best way to log requests from a servlet and to a database?



However, if I get significantly more requests, this may not be enough
because MySQL will get slower and the queue will get full. I think I could
start using this queue, and if it gets full I could failover to Amazons
Queue service. What do you think?


I think it would be cheaper for you to just spool the excess logging objects to 
your own local disk if the in-memory queue reaches some predetermined limit.  
However, if your DB server really can't keep up, you'll need some strategy to 
just discard log entries or reject requests until it can, even if you overflow 
to local disk.



Not being myself a Java specialist, and given the expressed requirements and transactions 
volume, my instinctive reaction would be to just write the log entries as some kind of 
text line into a local disk file, and then process that disk file with a totally separate 
program, to create the required log entries in the back-end database.
The idea is to make the action of writing the log entries as fast, simple and lightweight 
as possible for the real-time process (the webapp), and leave the brunt of the work to a 
separate process which can run at a more leisurely pace, deal with access contention to 
the back-end db, only run at specified intervals and times etc.
The local disk file can be "rotated" regularly, to prevent each file instance from 
becoming too large, and the process which reads the files could only process the rotated 
ones (to avoid contention with the webapp on the current logfile).
Such a design would provide a kind of buffering automatically, with a predictable time and 
memory overhead for the webapp writing each log entry to the local logfile.
Considering the disk capacities available nowadays, I believe that it would be quite 
unlikely that one would ever reach the point where the logfiles volume would get too large 
to fit.



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



Re: LDAP on TOMCAT 7.0.30

2013-01-28 Thread André Warnier

N.s.Karthik wrote:

Hi

Spec :  JDK1.6,  
 Tomcat 7.0.30, 
  Linux 64 bit Suse  

So far we have been using  3 killer Ajax web based applications 
with each app provided with separate DB schema.


The Requirement  is to provide a SSO "Single Sign On"  Logic with existing
LDAP Server.
The AAA has to validated  Only once for login

1) What Options do i have in providing SSO Logic
2)Can Cookies be used for resolving the requirement.
3)Can the browser pick up the Client System Login credentials ( Win start-up
credentials) for the authorization.


Have a look at Jespa : www.ioplex.com

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