ProcessBuilder and waitFor prevents tomcat to continue

2013-10-14 Thread honyk
Dear All,

my web app executes long running external scripts. It is triggered on
startup (contextInitialized) and then regularly during the day.

When the app server needs to be restarted and this process is running,
tomcat waits till the process finishes.

When tomcat is starting, it waits again till processing is finished and
after that it continues in loading.

My script is executed via ProcessBuilder with waitFor flag. 

Is it possible:
1) to kill this external process automatically when tomcat is shut down?
2) to execute the script for the first time in any post-init phase? By this
I mean - my app is initialized so I can access the corresponding JSF setting
page and in the same time long running script is running. Now the page
cannot be displayed until process finishes.

I expect it is rather OT here in tomcat dicussion, but it is quite unclear
to me what I can expect from the app server here (if it can control this
somehow or it is solely driven by my web app settings).

Thanks, Jan


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



Directory watcher app

2013-10-14 Thread honyk
Hello Everyone,

in my web app I use Java 7 directory watcher feature.

When the final war file is placed into Webapps folder and Tomcat is started,
it freezes as it waits forever for any directory changes (the app is loaded
on tomcat startup).

I use the following workaround - calling my watcher code in a new Thread (in
the context init phase).

It does the job, but I am not sure if this is the best solution. Couldn't be
the same effect achieved using specific tomcat options?

What do you think?

Thanks, Jan


package my.util.jobticketprocessor;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ContextListener implements ServletContextListener {

private static final Logger LOGGER =
LoggerFactory.getLogger(ContextListener.class.getName());
private Thread threadA;

@Override
public void contextInitialized(ServletContextEvent event) {
LOGGER.info("Watcher - right before the init.");

threadA = new Thread(new Runnable() {
@Override
public void run() {
LOGGER.info("Thread - right before the init.");
JobTicketWatcher.getInstance().initProcessor();
LOGGER.info("Thread - right after the init.");
}
}, "Thread A");

threadA.start();

LOGGER.info("Watcher has been initialized successfully.");
}

@Override
public void contextDestroyed(ServletContextEvent event) {
JobTicketWatcher.getInstance().terminateProcessor();
try {
threadA.join();
LOGGER.info("Thread has been terminated.");
} catch (InterruptedException e) {
LOGGER.error("Thread terminating has failed.");
}
LOGGER.info("Watcher has been terminated.");
}
}


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



RE: Local VisualVM connection to Tomcat

2013-07-24 Thread honyk
On 2013-06-28 Christopher Schultz wrote:
> On 6/27/13 5:17 PM, honyk wrote:
> > On 2013-06-27 Christopher Schultz wrote:
> >> On 6/27/13 4:31 PM, honyk wrote:
> >>> I am constantly encountering PermGen errors despite quite high
> >>> PermGen limit (even 512m) and many options set - approx once a
> >>> week under not heavy load.
> >>
> >> Like what kinds of options? What kind of load? What does the
> >> error look like? Are you re-deploying your webapp without
> >> restarting Tomcat, or do you bust PermGen even with a single
> >> deployment?
> >
> > Tomcat runs as service using these Java opts (tomcat7w.exe) -
> > single line
> >
> > -Duser.language=en -XX:MaxPermSize=512m -XX:+DisableExplicitGC
> > -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
> >
> > Originally I used Apache JkMount/Worker to hide that port number.
> > In that case there were listed these errors in the tomcat err log:
> > Exception in thread "ajp-bio-8009-exec-7"
> > java.lang.OutOfMemoryError: PermGen space
> 
> I recommend that you run with -XX:+HeapDumpOnOutOfMemoryError and
> possibly also with -XX:HeapDumpPath=[path to where you want your heap
> dumps to go].

All my options were specified on a single line and thus ignored.
This is the reason why I was getting PermGen errors constantly even when high 
values were specified...

My default value is approx. 85 MB and when all my web apps are invoked, cca 90 
MB is needed. 

Currently I use these settings (JDK 7):
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Duser.language=en
-XX:+DisableExplicitGC
-XX:MaxPermSize=128m
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=C:/DataStorage/tomcat-heap-dump
-XX:OnOutOfMemoryError=""C:\trunk\Tools\Macros\TomcatKiller\task.bat %p""

I removed following options as they seem to be obsolete (?) in JDK 7:
-XX:+CMSClassUnloadingEnabled 
-XX:+CMSPermGenSweepingEnabled

Now my tomcat instance works fine. When OOME occurs (I hope it will never 
happen :), dump is created and my script executed (taskkill /F /PID %1 + 
sending e-mail to me). The tomcat windows service is set to restart itself one 
minute after the first failure (which is triggered when process is killed). My 
apps are simple tools and reports, nothing critical, so I hope this autokilling 
doesn't harm.

I still cannot profile the JVM locally, but this is not an issue any more. For 
basic tomcat monitoring the JMX capabilities are sufficent. But my thread in 
VisualVM forum is still opened and in case of any update I'll let you know.

Thanks you guys for your hints, I learned a lot from your responses recently!

Regards, Jan


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



RE: Tomcat failure without apparent reason (PermGen?)

2013-07-24 Thread honyk
On 2013-07-23 Christopher Schultz wrote:
> On 7/22/13 3:11 PM, honyk wrote:
> > I am reusing my recent thread of not related subject with some
> > updates...
> >
> > On 2013-06-28 Christopher Schultz wrote:
> >> On 6/27/13 5:17 PM, honyk wrote:
> >>> On 2013-06-27 Christopher Schultz wrote:
> >>>> On 6/27/13 4:31 PM, honyk wrote:
> >>>>> I am constantly encountering PermGen errors despite quite
> >>>>> high PermGen limit (even 512m) and many options set -
> >>>>> approx once a week under not heavy load.
> >>>>
> >>>> Like what kinds of options? What kind of load? What does the
> >>>> error look like? Are you re-deploying your webapp without
> >>>> restarting Tomcat, or do you bust PermGen even with a single
> >>>> deployment?
> >>>
> >>> Tomcat runs as service using these Java opts (tomcat7w.exe) -
> >>> single line
> >>>
> >>> -Duser.language=en -XX:MaxPermSize=512m -XX:+DisableExplicitGC
> >>> -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
> >>>
> >>> Originally I used Apache JkMount/Worker to hide that port
> >>> number. In that case there were listed these errors in the
> >>> tomcat err log: Exception in thread "ajp-bio-8009-exec-7"
> >>> java.lang.OutOfMemoryError: PermGen space
> >>
> >> I recommend that you run with -XX:+HeapDumpOnOutOfMemoryError
> >> and possibly also with -XX:HeapDumpPath=[path to where you want
> >> your heap dumps to go]. If/when your service busts PermGen, you
> >> should be able to inspect the dump and see what all the
> >> java.lang.Class objects are. I suppose it's possible that you
> >> have a lot of intern'd String objects as well (if you are on Java
> >> 1.6 or lower... you didn't say), but it's usually java.lang.Class
> >> objects.
> >>
> >>> Now I use proxypass like this (hoping this is preffered way):
> >>> ProxyPass /my-app ajp://localhost:8009/my-app
> >>>
> >>> and in this case I can see just Exception in thread
> >>> "ajp-bio-8009-exec-4" without any details (but I suppose it is
> >>> the same PermGen one)
> >
> > I've set that recommended options, but when that
> > 'ajp-bio-8009-exec-NN' exception is thrown (recorded in the tomcat
> > err log), no heap dump is created in the specified (and existing)
> > folder: -XX:HeapDumpPath=C:\DataStorage\tomcat-heap-dump
> 
> What was the original thread's subject line? It's hard to get the
> context of your question from what you have included, here. Remember,
> nobody is paying as close attention to your problem as you are...

Sorry for this confusion. But this is rather a completely new topic.

Briefly, if there is just 'ajp-bio-8009-exec-4' exception without further 
details in the tomcat error log, can I somehow get those details? Should I 
change the log level somewhere?

Now I know it was really because of insufficient PermGen. Maybe in this case 
not all exceptions were 'written' to the log properly...

I am still curious. It could be useful for future reference.

Jan


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



RE: JMX monitoring of tomcat service

2013-07-24 Thread honyk
On 2013-07-23 honyk wrote:
> On 2013-07-23 Cédric Couralet wrote:
> > 2013/7/23 honyk :
> > > Dear All,
> > >
> > > I run tomcat as service on Windows Server 2008 R2. I am not able to
> > monitor
> > > it locally yet (discussed in another thread) so in the meantime I
> am
> > trying
> > > to establish JMX connection to it acc. to this guide:
> > > http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
> > >
> > > All params are changed using tomcat7w.exe (in the Java options text
> > field)
> > > and then the service is restarted.
> > >
> > > I am experiencing several weird issues:
> > > 1) Basic settings (single line):
> > > -Dcom.sun.management.jmxremote
> > > -Dcom.sun.management.jmxremote.port=9090
> > > -Dcom.sun.management.jmxremote.ssl=false
> > > -Dcom.sun.management.jmxremote.authenticate=false
> >
> > If these properties are on the same line in the java options tab, it
> > won't work they need to be on different lines.
> 
> Ooops...
> 
> What a shame. Looking into various sources it really seems to be my
> fatal mistake. I'll check tomorrow.

Yes. Using options on separate lines does the job. Now it works as expected.

> > > b) When credentials files were specified, there were still
> > 'FileNotFound'
> > > errors in the log (even when absolute paths were used):
> > > -Dcom.sun.management.jmxremote
> > > -Dcom.sun.management.jmxremote.port=9090
> > > -Dcom.sun.management.jmxremote.authenticate=true
> > > -
> >
> Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password
> > > -Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access
> > > -Dcom.sun.management.jmxremote.ssl=false
> >
> > When launching tomcat as a service, without changing the default
> > configuration, it will start in the system32 folder (or something
> else
> > on Win 2008) and not in the tomcat folder. So the path for password
> > file and acces file should be absolute
> 
> I tried absolute paths as well, but this result is most likely related
> to
> the above case - all my Java options were on the single line, thus most
> likely ignored completely.

Yes. The same problem as above. I prefer this method as it allows me
connecting the server remotely even through the firewall. Now only two ports
needs to be opened (those defined in the server.xml). In this case only the
following three options are required (if authentication is not needed - this
server runs in the local network only):

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Thanks a lot!
Jan


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



RE: JMX monitoring of tomcat service

2013-07-23 Thread honyk
On 2013-07-23 Cédric Couralet wrote:
> 2013/7/23 honyk :
> > Dear All,
> >
> > I run tomcat as service on Windows Server 2008 R2. I am not able to
> monitor
> > it locally yet (discussed in another thread) so in the meantime I am
> trying
> > to establish JMX connection to it acc. to this guide:
> > http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
> >
> > All params are changed using tomcat7w.exe (in the Java options text
> field)
> > and then the service is restarted.
> >
> > I am experiencing several weird issues:
> > 1) Basic settings (single line):
> > -Dcom.sun.management.jmxremote
> > -Dcom.sun.management.jmxremote.port=9090
> > -Dcom.sun.management.jmxremote.ssl=false
> > -Dcom.sun.management.jmxremote.authenticate=false
> 
> If these properties are on the same line in the java options tab, it
> won't work they need to be on different lines.

Ooops... 

What a shame. Looking into various sources it really seems to be my fatal
mistake. I'll check tomorrow.


> > b) When credentials files were specified, there were still
> 'FileNotFound'
> > errors in the log (even when absolute paths were used):
> > -Dcom.sun.management.jmxremote
> > -Dcom.sun.management.jmxremote.port=9090
> > -Dcom.sun.management.jmxremote.authenticate=true
> > -
> Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password
> > -Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access
> > -Dcom.sun.management.jmxremote.ssl=false
> 
> When launching tomcat as a service, without changing the default
> configuration, it will start in the system32 folder (or something else
> on Win 2008) and not in the tomcat folder. So the path for password
> file and acces file should be absolute

I tried absolute paths as well, but this result is most likely related to
the above case - all my Java options were on the single line, thus most
likely ignored completely.

Jan



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



JMX monitoring of tomcat service

2013-07-23 Thread honyk
Dear All,

I run tomcat as service on Windows Server 2008 R2. I am not able to monitor
it locally yet (discussed in another thread) so in the meantime I am trying
to establish JMX connection to it acc. to this guide:
http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html

All params are changed using tomcat7w.exe (in the Java options text field)
and then the service is restarted.

I am experiencing several weird issues:
1) Basic settings (single line):
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=9090 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

Firewal is deactivated, but I cannot access tomcat via VisualVM JMX
('remotely', but from the same PC) using the localhost:9090 path (could not
find the server). The same result for 127.0.0.1 or exact local IP address.

...seting the first otpion to true...
-Dcom.sun.management.jmxremote=true ... same result
... one extra option
-Djava.rmi.server.hostname= ...same result

2) Using listener
http://www.liferay.com/web/thiago.moreira/blog/-/blogs/how-to-monitor-lifera
y-tomcat-remotely-through-firewalls-using-visualvm

I downloaded extra jar file, placed it to /lib folder and edited server.xml
file.

a) From that moment on credentials were required regardless authentication
has been set to true or false.

b) When credentials files were specified, there were still 'FileNotFound'
errors in the log (even when absolute paths were used):
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=9090 
-Dcom.sun.management.jmxremote.authenticate=true 
-Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password 
-Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access 
-Dcom.sun.management.jmxremote.ssl=false

Any way, after many attempts I haven't found any solution how to monitor my
Tomcat instance yet :-(

Am I missing something?

Jan


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



RE: Local VisualVM connection to Tomcat

2013-07-23 Thread honyk
On 2013-07-23 Eugène Adell wrote:
> On Mon, Jul 22, 2013 at 3:10 PM, honyk  wrote: 
> > On 2013-06-28 Christopher Schultz wrote:
> > > On 6/27/13 5:17 PM, honyk wrote:
> > > > I realized that my tomcat runs as a service but I am logged as an
> > > > user and in this case the tomcat is not visible to me. 
> > >
> > > Try running VisualVM as an administrator.
> >
> > I've found the problem, but I have no remedy for it yet.
> > https://java.net/projects/visualvm/lists/users/archive/2013-
> 07/message/2
> >
> > Briefly, the service uses the TMP environment variable as it is
> specified
> > for the given user, but when that user is logged remotely, the suffix
> > \ is added at the end of this path so these both do
> not
> > match and VisualVM doesn't detect my tomcat/JVM as expected.
> >
>
> I had a similar problem when using jps/jstat and finally I found
> someone advising to use -J-Djava.io.tmpdir option. It worked for me,
> try adding -J-Djava.io.tmpdir when calling visualvm

This helped a bit. Now I can see two extra s, but
without any details. One pid belongs to tomcat. From this
http://visualvm.java.net/troubleshooting.html I suppose I changed only one
of two paths which should match: 
While 'java.io.tmpdir' is now %TMP%\hsperfdata_username, ?jvmstat? is still
looking for the content here: %TMP%\\hsperfdata_username

I'll consult this behaviour with VisualVM developers.

Jan



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



Tomcat failure without apparent reason (PermGen?)

2013-07-22 Thread honyk
I am reusing my recent thread of not related subject with some updates...

On 2013-06-28 Christopher Schultz wrote:
> On 6/27/13 5:17 PM, honyk wrote:
> > On 2013-06-27 Christopher Schultz wrote:
> >> On 6/27/13 4:31 PM, honyk wrote:
> >>> I am constantly encountering PermGen errors despite quite high
> >>> PermGen limit (even 512m) and many options set - approx once a
> >>> week under not heavy load.
> >>
> >> Like what kinds of options? What kind of load? What does the
> >> error look like? Are you re-deploying your webapp without
> >> restarting Tomcat, or do you bust PermGen even with a single
> >> deployment?
> >
> > Tomcat runs as service using these Java opts (tomcat7w.exe) -
> > single line
> >
> > -Duser.language=en -XX:MaxPermSize=512m -XX:+DisableExplicitGC
> > -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
> >
> > Originally I used Apache JkMount/Worker to hide that port number.
> > In that case there were listed these errors in the tomcat err log:
> > Exception in thread "ajp-bio-8009-exec-7"
> > java.lang.OutOfMemoryError: PermGen space
> 
> I recommend that you run with -XX:+HeapDumpOnOutOfMemoryError and
> possibly also with -XX:HeapDumpPath=[path to where you want your heap
> dumps to go].
> If/when your service busts PermGen, you should be able to inspect the
> dump and see what all the java.lang.Class objects are. I suppose it's
> possible that you have a lot of intern'd String objects as well (if
> you are on Java 1.6 or lower... you didn't say), but it's usually
> java.lang.Class objects.
>
> > Now I use proxypass like this (hoping this is preffered way):
> > ProxyPass /my-app ajp://localhost:8009/my-app
> >
> > and in this case I can see just Exception in thread
> > "ajp-bio-8009-exec-4" without any details (but I suppose it is the
> > same PermGen one)

I've set that recommended options, but when that 'ajp-bio-8009-exec-NN'
exception is thrown (recorded in the tomcat err log), no heap dump is
created in the specified (and existing) folder:
-XX:HeapDumpPath=C:\DataStorage\tomcat-heap-dump

In the Apache webserver log there are just consequences of the tomcat/thread
failure:

[Fri Jul 12 10:50:34 2013] [error] (OS 10060)A connection attempt failed
because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to
respond.  : ajp_ilink_receive() can't receive header
[Fri Jul 12 10:50:34 2013] [error] ajp_read_header: ajp_ilink_receive failed
[Fri Jul 12 10:50:34 2013] [error] (70007)The timeout specified has expired:
proxy: read response failed from 127.0.0.1:8009 (localhost)
...
and repeating
...

Is there any log from where that 'Exception in thread ajp-bio...' can be
analyzed?

Is is tomcat related or rather webserver/connector related problem?

Thanks, Jan




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



RE: Local VisualVM connection to Tomcat

2013-07-22 Thread honyk
On 2013-06-28 Christopher Schultz wrote:
> On 6/27/13 5:17 PM, honyk wrote:
> > I realized that my tomcat runs as a service but I am logged as an
> > user and in this case the tomcat is not visible to me. I'll test it
> > differently tomorrow.
> 
> Try running VisualVM as an administrator.

I've found the problem, but I have no remedy for it yet.
https://java.net/projects/visualvm/lists/users/archive/2013-07/message/2

Briefly, the service uses the TMP environment variable as it is specified for 
the given user, but when that user is logged remotely, the suffix 
\ is added at the end of this path so these both do not match 
and VisualVM doesn't detect my tomcat/JVM as expected.

Jan


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



RE: Local VisualVM connection to Tomcat

2013-06-27 Thread honyk
On 2013-06-27 Christopher Schultz wrote:
> On 6/27/13 4:31 PM, honyk wrote:
> > I am constantly encountering PermGen errors despite quite high
> > PermGen limit (even 512m) and many options set - approx once a week
> > under not heavy load.
> 
> Like what kinds of options? What kind of load? What does the error
> look like? Are you re-deploying your webapp without restarting Tomcat,
> or do you bust PermGen even with a single deployment?

Tomcat runs as service using these Java opts (tomcat7w.exe) - single line

-Duser.language=en 
-XX:MaxPermSize=512m 
-XX:+DisableExplicitGC 
-XX:+CMSClassUnloadingEnabled 
-XX:+CMSPermGenSweepingEnabled

Originally I used Apache JkMount/Worker to hide that port number. In that case 
there were listed these errors in the tomcat err log:
Exception in thread "ajp-bio-8009-exec-7" java.lang.OutOfMemoryError: PermGen 
space

Now I use proxypass like this (hoping this is preffered way):
ProxyPass /my-app ajp://localhost:8009/my-app

and in this case I can see just 
Exception in thread "ajp-bio-8009-exec-4"
without any details (but I suppose it is the same PermGen one)

I do not hot deploy my apps. They are JSF2.0/Mojarra powered, some of them 
access database a generate various reports.

 
> > I am trying to investigate what the app causes this, but I haven't
> > succeeded in reproducing it locally yet.
> >
> > I found several articles about VisualVM (I hope it could help me
> > to determine some PermGen issues) and connecting it to the Tomcat.
> > Remotely. But I have no clue how can I conect the local VisualVM to
> > tomcat that runs on localhost.
> >
> > Even here it is written:
> > http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html
> >
> > Enabling JMX Remote Note: This configuration is needed only if you
> > are going to monitor Tomcat remotely. It is not needed if you are
> > going to monitor it locally, using the same user that Tomcat runs
> > with.
> >
> > But there is no further description for that simpler (local)
> > method. If it is obvious, sorry, but I am lost here ;-)
> 
> Connecting to a Tomcat running on localhost is dead simple:
> 
> 1. Launch VisualVM
> 2. Once the main screen loads, double-click on "Tomcat" from the
> "Local" cluster of applications
> 3. Profit

Now I've found this interesting article:
https://blogs.oracle.com/nbprofiler/entry/monitoring_java_processes_running_as

I realized that my tomcat runs as a service but I am logged as an user and in 
this case the tomcat is not visible to me. I'll test it differently tomorrow.

Regards, Jan


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



Local VisualVM connection to Tomcat

2013-06-27 Thread honyk
Dear All,

I am constantly encountering PermGen errors despite quite high PermGen limit
(even 512m) and many options set - approx once a week under not heavy load.

I am trying to investigate what the app causes this, but I haven't succeeded
in reproducing it locally yet.

I found several articles about VisualVM (I hope it could help me to
determine some PermGen issues) and connecting it to the Tomcat. Remotely.
But I have no clue how can I conect the local VisualVM to tomcat that runs
on localhost.

Even here it is written:
http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html

Enabling JMX Remote
Note: This configuration is needed only if you are going to monitor Tomcat
remotely. It is not needed if you are going to monitor it locally, using the
same user that Tomcat runs with.

But there is no further description for that simpler (local) method. If it
is obvious, sorry, but I am lost here ;-)

Thanks, Jan


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



RE: Memory limits for children processes when running Tomcat as service?

2013-06-27 Thread honyk
On 2013-06-27 André Warnier wrote:
> honyk wrote:
> > On 2013-06-26 André Warnier wrote:
> >> honyk wrote:
> >>> Dear All,
> >>>
> >>> I have a JSF2.0 app that executes (via ProcessBuilder) an external
> >> script.
> >>> This script opens PPTX via PowerPoint ActiveX object, manipulate it
> >> and
> >>> save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.
> >>>
> >>> When tomcat 7 is launched using startup.bat (with original
> settings),
> >> it
> >>> works fine.
> >>>
> >>> When tomcat runs as a service, opening the PPTX in the PowerPoint
> >> fails
> >>> because of Out Of Memory error regardless Xmx settings
> >> (tomcat7w.exe).
> >>> I originally asked PowerPoint forum, but haven't get any
> explanation
> >> yet:
> >>> http://answers.microsoft.com/thread/37cbebf6-4003-4ab0-9295-
> >> 92413aaecc2e
> >>> But as the entry point is Tomcat and the only difference between
> >> problematic
> >>> and non problematic behavior is the 'service' mode, maybe there is
> >> something
> >>> related in the tomcat7.exe code base. Just guessing.
> >>>
> >>> Has anybody an idea why both modes behave differently?
> >>>
> >> Hi.
> >> The problem has nothing to do with Tomcat per se.
> >> It is due to running a Microsoft Office program (or library modules
> >> such as the "Interop"
> >> series) as a sub-process of a Windows Service (and thus in the same
> >> Service context) which
> >> is something that is not in the design of Microsoft Office, not
> >> supported by Microsoft,
> >> and even actively discouraged by Microsoft.
> >> See : http://support.microsoft.com/kb/257757
> >>
> >> The problem is basically that a Windows Service does not run in the
> >> same "environment" as
> >> a "user session" environment, and as they say in that article, you
> will
> >> certainly
> >> experience "unstable behavior and/or deadlock" somewhere, and will
> get
> >> no help for it.
> >
> > I read this article but because I do not need intraction and my code
> doesn't
> > run simultaneously and tomcat is launched using my credentials - I
> still
> > thought it could be possible.
> >
> > Now realizing that tomcat launched using my credentials do not
> necesarily
> > mean that Office use the same...
> >
> >> Personal experience : some things will work with one MS-Office
> program,
> >> and totally fail
> >> with another; even simple things like opening or saving a file.  It
> may
> >> work with one
> >> file, and fail with another, for no apparent reason.
> >> You get an OOM error in this case, but other cases may be "file not
> >> found" (although it's
> >> there) or whatever other bizarre failures.
> >> Ultimately it is unpredictable, frustrating and time-consuming.
> >
> > I was an optimist when everything worked in the user mode...
> >
> >> Solutions :
> >> 1) instead of MS-Office, use LibreOffice or OpenOffice.  Both can
> run
> >> in "headless" mode,
> >> and provide an API to have them "do things with documents". And both
> >> can open and
> >> manipulate MS-Office documents.  Depending on what you do, there may
> be
> >> some differences
> >> in the results, but it works fine for many things.
> >> Or try one of the other solutions suggested in the above article.
> >> (I have not tried them, I use OpenOffice/LibreOffice).
> >
> > I'll give it a try. I originaly tested Apache POI, but required
> > functionality is not implemented yet.
> >
> >> 2) do not run Tomcat as a Service. Create a virtual Windows machine,
> >> and run it in a user
> >> console (with startup.bat). You can restrict access to the VM, and
> >> since it is a VM, it
> >> can run unattended, just as a service would.
> >> (I am also using this scheme, when circumstances permit).
> >> But in that case, also pay attention to the licensing considerations
> at
> >> the end of the
> >> article.
> >
> > I am quite lost in this ;-) But I'll investigate further.
> >
> > Thanks a lot for your exhaustive analysis! Finally it looks my way is
> no way
> > :-)
> >
> 
> No problem. I went

RE: Memory limits for children processes when running Tomcat as service?

2013-06-26 Thread honyk
On 2013-06-26 André Warnier wrote:
> honyk wrote:
> > Dear All,
> >
> > I have a JSF2.0 app that executes (via ProcessBuilder) an external
> script.
> > This script opens PPTX via PowerPoint ActiveX object, manipulate it
> and
> > save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.
> >
> > When tomcat 7 is launched using startup.bat (with original settings),
> it
> > works fine.
> >
> > When tomcat runs as a service, opening the PPTX in the PowerPoint
> fails
> > because of Out Of Memory error regardless Xmx settings
> (tomcat7w.exe).
> 
> Note that the Xmx setting is probably irrelevant here. 

I suppose so, but I rather mentioned this.

> But the PPT process which you start will not use that memory area, it
> will use its own totally separate memory allocation.

Ok, thanks.


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



RE: Memory limits for children processes when running Tomcat as service?

2013-06-26 Thread honyk
On 2013-06-26 André Warnier wrote:
> honyk wrote:
> > Dear All,
> >
> > I have a JSF2.0 app that executes (via ProcessBuilder) an external
> script.
> > This script opens PPTX via PowerPoint ActiveX object, manipulate it
> and
> > save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.
> >
> > When tomcat 7 is launched using startup.bat (with original settings),
> it
> > works fine.
> >
> > When tomcat runs as a service, opening the PPTX in the PowerPoint
> fails
> > because of Out Of Memory error regardless Xmx settings
> (tomcat7w.exe).
> >
> > I originally asked PowerPoint forum, but haven't get any explanation
> yet:
> > http://answers.microsoft.com/thread/37cbebf6-4003-4ab0-9295-
> 92413aaecc2e
> >
> > But as the entry point is Tomcat and the only difference between
> problematic
> > and non problematic behavior is the 'service' mode, maybe there is
> something
> > related in the tomcat7.exe code base. Just guessing.
> >
> > Has anybody an idea why both modes behave differently?
> >
> 
> Hi.
> The problem has nothing to do with Tomcat per se.
> It is due to running a Microsoft Office program (or library modules
> such as the "Interop"
> series) as a sub-process of a Windows Service (and thus in the same
> Service context) which
> is something that is not in the design of Microsoft Office, not
> supported by Microsoft,
> and even actively discouraged by Microsoft.
> See : http://support.microsoft.com/kb/257757
> 
> The problem is basically that a Windows Service does not run in the
> same "environment" as
> a "user session" environment, and as they say in that article, you will
> certainly
> experience "unstable behavior and/or deadlock" somewhere, and will get
> no help for it.

I read this article but because I do not need intraction and my code doesn't
run simultaneously and tomcat is launched using my credentials - I still
thought it could be possible.

Now realizing that tomcat launched using my credentials do not necesarily
mean that Office use the same...

> Personal experience : some things will work with one MS-Office program,
> and totally fail
> with another; even simple things like opening or saving a file.  It may
> work with one
> file, and fail with another, for no apparent reason.
> You get an OOM error in this case, but other cases may be "file not
> found" (although it's
> there) or whatever other bizarre failures.
> Ultimately it is unpredictable, frustrating and time-consuming.

I was an optimist when everything worked in the user mode...

> Solutions :
> 1) instead of MS-Office, use LibreOffice or OpenOffice.  Both can run
> in "headless" mode,
> and provide an API to have them "do things with documents". And both
> can open and
> manipulate MS-Office documents.  Depending on what you do, there may be
> some differences
> in the results, but it works fine for many things.
> Or try one of the other solutions suggested in the above article.
> (I have not tried them, I use OpenOffice/LibreOffice).

I'll give it a try. I originaly tested Apache POI, but required
functionality is not implemented yet.

> 2) do not run Tomcat as a Service. Create a virtual Windows machine,
> and run it in a user
> console (with startup.bat). You can restrict access to the VM, and
> since it is a VM, it
> can run unattended, just as a service would.
> (I am also using this scheme, when circumstances permit).
> But in that case, also pay attention to the licensing considerations at
> the end of the
> article.

I am quite lost in this ;-) But I'll investigate further.

Thanks a lot for your exhaustive analysis! Finally it looks my way is no way
:-)

Regards, Jan

PS: And sorry for blaming the Tomcat. 


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



RE: Memory limits for children processes when running Tomcat as service?

2013-06-26 Thread honyk
On 2013-06-26 Jeffrey Janner wrote:
> > -Original Message-
> > From: honyk [mailto:j.tosov...@email.cz]
> > Sent: Wednesday, June 26, 2013 1:27 PM
> > To: 'Tomcat Users List'
> > Subject: Memory limits for children processes when running Tomcat as
> > service?
> >
> > Dear All,
> >
> > I have a JSF2.0 app that executes (via ProcessBuilder) an external
> > script.
> > This script opens PPTX via PowerPoint ActiveX object, manipulate it
> and
> > save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.
> >
> > When tomcat 7 is launched using startup.bat (with original settings),
> > it works fine.
> >
> > When tomcat runs as a service, opening the PPTX in the PowerPoint
> fails
> > because of Out Of Memory error regardless Xmx settings
> (tomcat7w.exe).
> >
> > I originally asked PowerPoint forum, but haven't get any explanation
> > yet:
> > http://answers.microsoft.com/thread/37cbebf6-4003-4ab0-9295-
> > 92413aaecc2e
> >
> > But as the entry point is Tomcat and the only difference between
> > problematic and non problematic behavior is the 'service' mode, maybe
> > there is something related in the tomcat7.exe code base. Just
> guessing.
> >
> > Has anybody an idea why both modes behave differently?
> >
> > Thanks, Jan
> 
> What user is the Tomcat service running under?
> What other differences could exist between a user session (running with
> startup.bat) and a background session?

I forgot to mention that the Tomcat service is launched using my credentials
(not as local admin). The same account I use for a remote access and hence
for launching the tomcat via startup.bat.

I really do not see any differences. The same commands (cmd.exe, csript.exe,
...) are executed (64-bit variants) with the same params, but in one case
there are memory limits.

Btw, could be there any memory differences between users? I'll rather double
check this. But I don't know how :-(

What else... antivirus, firewall? I'll try to disable it for a while.

AFAIK tomcat.exe is based on procrun wrapper. Is this wrapper memory safe?

I just think (aloud) I could write a custom wrapper and execute my script
directly from this new service... Quite complex to me... But I could check
if it behaves differently or not...

Jan


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



Memory limits for children processes when running Tomcat as service?

2013-06-26 Thread honyk
Dear All,

I have a JSF2.0 app that executes (via ProcessBuilder) an external script.
This script opens PPTX via PowerPoint ActiveX object, manipulate it and
save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.

When tomcat 7 is launched using startup.bat (with original settings), it
works fine.

When tomcat runs as a service, opening the PPTX in the PowerPoint fails
because of Out Of Memory error regardless Xmx settings (tomcat7w.exe).

I originally asked PowerPoint forum, but haven't get any explanation yet:
http://answers.microsoft.com/thread/37cbebf6-4003-4ab0-9295-92413aaecc2e

But as the entry point is Tomcat and the only difference between problematic
and non problematic behavior is the 'service' mode, maybe there is something
related in the tomcat7.exe code base. Just guessing.

Has anybody an idea why both modes behave differently?

Thanks, Jan





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



RE: Tomcat 7 faces servlet encoding issue

2011-07-30 Thread honyk
> > Thanks for that hint.
> > http://drifted.in/encoding/encoding.svg returns HTTP Content-type
> > image/svg+xml (according to Firebug)
> > but http://drifted.in/encoding/faces/encoding.svg returns
> > image/svg+xml;charset=ISO-8859-1
> >
> > In Tomcat 6 powered web I am getting just 'image/svg+xml' in both
> cases.
 
> 1) What encoding is specified in  header in the svg file?

UTF-8
 
> 2) I suspect that you are using getWriter() to write the file
> somewhere.  That will add encoding to the content type if you are
> running Tomcat 7,

I suspect Mojarra from that or Faces Servlet respectively. They process all
the requests with that 'faces' URL fragment.

> and IIRC  you wil also observe this if you are running Tomcat 6 with
> *.STRICT_SERVLET_COMPLIANCE system property set to "true".
 
You are right! So it explains the 6 vs. 7 difference !
 
> > I am just thinking where to specify that encoding for
> > standalone SVG files. In web.xml?
> 
> It can be done in mime type mapping in web.xml

I've tried to change the svg mime spec to 

svg
image/svg+xml;charset=UTF-8


and voila, it works! (not uploaded to the server yet)

So it is not definitely a Tomcat issue.

Thanks a lot for your help!

Regards,
Jan


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



RE: Tomcat 7 faces servlet encoding issue

2011-07-30 Thread honyk
> > In tomcat 6 there is no difference between these two links
> > http://drifted.in/encoding/encoding.svg
> > http://drifted.in/encoding/faces/encoding.svg
> >
> > but in Tomcat 7 I am getting different results. The first is Ok while
> > the second, processed by faces servlet, breaks the encoding.
 
> You have to examine what is actually is being sent to the browser.
> (The actual content of the stream and any HTTP headers that come with
> it).

Thanks for that hint.
http://drifted.in/encoding/encoding.svg returns HTTP Content-type
image/svg+xml (according to Firebug)
but http://drifted.in/encoding/faces/encoding.svg returns
image/svg+xml;charset=ISO-8859-1

In Tomcat 6 powered web I am getting just 'image/svg+xml' in both cases.
 
> There are many ways how the things might break, but you are not saying
> what is "break" for you - what you are actually observing.

http://drifted.in/encoding/faces/index.xhtml - both HTML and SVG texts
should match
Now I see the Content-type of that HTML page is text/html;charset=UTF-8
while that SVG in it is image/svg+xml;charset=ISO-8859-1

> Are both Tomcats on the same system? Maybe your system encoding is
> different?

It has been tested on my PC initially (Win7/64bit), but the same result I am
getting now on Linux Debian (hosted site).
 
> What component writes the svg file to the response stream, and how it
> does that?

In this test case the SVG file is static, just included in WAR.

So Tomcat 7 seem to be maybe too active with adding that encoding when not
it is not specified. I am just thinking where to specify that encoding for
standalone SVG files. In web.xml?

Jan


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



Tomcat 7 faces servlet encoding issue

2011-07-30 Thread honyk
Hello Everyone,

when migrating my JSF 2.0 app from tomcat 6.0.32 to the version 7.0.19 I've
encountered the following encoding issue. 

I have a simple JSF (xhtml) page with an embedded SVG image in it . In the web.xml file there is a
faces servlet mapping set to the '/faces' path fragment.

In tomcat 6 there is no difference between these two links
http://drifted.in/encoding/encoding.svg
http://drifted.in/encoding/faces/encoding.svg

but in Tomcat 7 I am getting different results. The first is Ok while the
second, processed by faces servlet, breaks the encoding.

Together with my app I ship JSTL 1.1 and Mojarra 2.0.6 (jsf-api & jsf-impl)
libraries.

Is there necessary to set something else in my app to get the same (correct)
result also in Tomcat 7?

I haven't found anything related here:
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

Any idea?

Regards,
Jan


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