Re: Cluster session failover question

2010-07-22 Thread Jon Brisbin

On Jul 22, 2010, at 9:19 AM, Darren Kukulka wrote:

> Another, more difficult scenario, is when one of the Tomcat cluster
> nodes begins to groan and become unresponsive, say when OldGen or
> PermGen becomes full...in this case the mod_jk connector does not
> identify the node as having failed and will continue to attempt to pass
> requests to it, rather than pass them to the more responsive node.

We had this problem often. mod_proxy_ajp seems to suffer from the same malady. 
I got fed up with it and wrote my own session manager and switched to using 
HAProxy. HAProxy will let you use a URL as a health checker.

My article on using HAProxy rather than mod_jk/mod_proxy_ajp:
http://www.tomcatexpert.com/blog/2010/07/12/trick-my-proxy-front-tomcat-haproxy-instead-apache

Jon Brisbin
Portal Webmaster
NPC International, Inc.

> 
> 
> 
> Are there any configuration settings to be mindful of with these
> scenarios?
> 
> 
> 
> Cheers,
> 
> Darren.
> 
> 
> 
> Connaught plc is a FTSE 250 company. We are the UK's leading provider of 
> integrated services operating in the compliance, environmental, social 
> housing and public sector markets.
> 
> Please visit our website to see a full list of Connaught's Registered 
> Companies www.connaught.plc.uk/group/aboutconnaught/registeredcompanies
> 
> Disclaimer:
> The information transmitted is intended only for the person or entity to 
> which it is addressed and may contain confidential and/or privileged 
> material. Any review, retransmission, dissemination or other use of, or 
> taking of any action in reliance upon, this information by persons or 
> entities other than the intended recipient is prohibited. If you received 
> this in error, please contact the sender and delete this message. Connaught 
> plc, Head Office 01392 444546


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



Re: Self-Contained Web Applications

2010-06-25 Thread Jon Brisbin

On Jun 25, 2010, at 3:59 PM, Pid wrote:

> Which part of the container hierarchy would the DataSource be attached to?

Wouldn't it make sense to scope it to the Context, since you'd be using the 
webapp's classloader?


Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



Re: question for sso session replication in tomcat 6.0.26

2010-06-22 Thread Jon Brisbin
Are you using a "jvmRoute" setting on your BalancerMember definition in 
mod_proxy config and on the  element in server.xml? Your cookie would 
have the jvmRoute property added to the end of it (e.g. ALONGMD5HASH.server1) 
if so.

From the Almighty Google: http://community.jboss.org/wiki/usingmodproxywithjboss

Jon Brisbin
Portal Webmaster
NPC International, Inc.



On Jun 22, 2010, at 3:48 PM, Okubo, Yasushi (TSD) wrote:

> Hi
> 
> I downloaded apache apache v2.2.15 and compiled and installed, but the
> result was the same.
> 
> Session sso replication looked like failed.  Upon shutting down the
> node, it kicked me out of password protected area and needed to re-loin
> on the second node.
> 
> On apache, I installed/enabled all modules including basic
> authentication etc.  Is there any requirement on apache side or how the
> virtual host should be set up in httpd.conf to make sso failover work?
> 
> Thanks,
> yasushi
> 
> -Original Message-
> From: Pid [mailto:p...@pidster.com] 
> Sent: Tuesday, June 22, 2010 8:04 AM
> To: Tomcat Users List
> Subject: Re: question for sso session replication in tomcat 6.0.26
> 
> On 22/06/2010 15:56, Okubo, Yasushi (TSD) wrote:
>> Hi Andrew
>> 
>> In case of no failover, SSO works for all web applications on the same
> host.  Upon failover [shutting down one node], a user is routed to the
> other node, and TC is asking for a user to re-login when he/she tried to
> access password protected area.  
>> 
>> I have checked many times on server.xml and session replication is
> working fine upon failover, so I cannot think any misconfiguration on
> server.xml
>> The issue is SSO failover is not working.  I think it might be related
> to my apache virtual host setup, but could not figure it out.
>> 
>> Thanks for your help,
>> yasushi
>> 
>> I am using mod_proxy_ajp, mod_proxy_balancer [v2.2.3]
> 
> mod_proxy_ajp appeared in 2.2.3 for the first time, it was functional
> but not perfect & there are many bugfixes and improvements since then,
> you should upgrade HTTPD.
> 
> 
> p
> 
>> OS : Redhat Linux 64bit  RHEL v5.5
>> JDK : 1.6.0.20 
>> 
>> === I created virtual host on port 9050 ==
>> Httpd.conf
>> 
>> 
>> ServerAdmin xyz
>> ServerName webclust1.xyz.com
>> ServerAlias webclust1
>> ErrorLog logs/webclust_cluster_error.log
>> CustomLog logs/webclust-cluster-access_log common
>> 
>> 
>> SetHandler balancer-manager
>> 
>> Order Deny,Allow
>> Deny from all
>> Allow from all
>> 
>> 
>> ProxyRequests off
>> 
>> BalancerMember ajp://10.250.200.57:9001 loadfactor=10 max=150 smax=145
> route=jvm1
>> BalancerMember ajp://10.250.200.57:9002 loadfactor=10 max=150 smax=145
> route=jvm2
>> BalancerMember ajp://10.250.200.57:9003 loadfactor=10 max=150 smax=145
> route=jvm3
>> Order Deny,Allow
>> Allow from all
>> 
>> 
>> #Do not proxy balancer-manager
>> ProxyPass /balancer-manager !
>> 
>> 
>> ProxyPass balancer://webclust/examples
> stickysession=JSESSIONID|jsessionid
>> ProxyPassReverse balancer://webclust/examples
>> Order Deny,Allow
>> Allow from all
>> 
>> 
>> 
>> ProxyPass balancer://webclust/ stickysession=JSESSIONID|jsessionid
>> ProxyPassReverse balancer://webclust/
>> Order Deny,Allow
>> Allow from all
>> 
>> 
>> 
>> === server.xml ===
>>
>>
>> 
>> 
>> 
>> >unpackWARs="true" autoDeploy="true"
>>xmlValidation="false" xmlNamespaceAware="false">
>> 
>> className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
>> channelSendOptions="4">
>> 
>>   className="org.apache.catalina.ha.session.DeltaManager"
>>   name="node2"
>>   expireSessionsOnShutdown="false"
>>   notifyListenersOnReplication="true"/>
>> 
>>   className="org.apache.catalina.tribes.group.GroupChannel">
>> className="org.apache.catalina.tribes.membership.McastService"
>>address="228.0.0.5"
>>port="45564"
>>frequency="500"
>>dropTime="3000"/>
>> className="org.apache.catalina.tribes.transport.nio.NioReceiver"
>>  address="auto&q

Re: Support multiple apache contexts via one tomcat webapp context

2010-06-15 Thread Jon Brisbin
below...

On Jun 15, 2010, at 9:06 AM, Hassan Schroeder wrote:

> On Mon, Jun 14, 2010 at 10:26 PM, Andrew Bruno  wrote:
>> I am trying to setup Apache with JkMount to tomcat to dynamically
>> handle different contexts in Apache, but always use the same context
>> in Tomcat.
> 
> That statement doesn't make sense to me, given your example, but...
> 
>> http://apachefrontenddomain.com.au/a/customer-1.com -> jk ajp to ->
>> http://tomcatserver:8009/webapp
>> http://apachefrontenddomain.com.au/a/customer-2.com -> jk ajp to ->
>> http://tomcatserver:8009/webapp
>> http://apachefrontenddomain.com.au/a/customer-3.com -> jk ajp to ->
>> http://tomcatserver:8019/webapp2
>> http://apachefrontenddomain.com.au/a/customer-4.com -> jk ajp to ->
>> http://tomcatserver:8039/webapp4
>> 
>> Doe anyone know how to do this?  Do I need to use Aliasing or Rewriting?
> 
> I would just use mod_proxy, but I'm a keep-it-simple kinda guy :-)

FWIW- I've moved away from Apache as a proxy entirely. I use HAProxy with ACLs. 
It's more efficient and flexible, IMHO, and the only thing I really need Apache 
for is serving PHP pages.

That said, it seems to me it would simpler to proxy "/a" and have a servlet 
look at PATH_INFO, then forward to whatever path or context you want.

Jon Brisbin
Portal Webmaster
NPC International, Inc.


> 
> FWIW,
> -- 
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan
> 
> -
> 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: Session clustering across different contexts

2010-06-15 Thread Jon Brisbin

On Jun 15, 2010, at 1:32 AM, Mark Thomas wrote:

> On 15/06/2010 06:21, Andrew Bruno wrote:
>> I am testing this on my laptop, windows 7 64bit, tomcat 6
>> 
>> If I use the same contexts, i.e.
>> 
>> localhost:8181/r2 and localhost:8080/r2 the sessions are replicated
>> across them no problem.
>> 
>> If I use a different context, e.g. r3 but same web app deployed, the
>> sessions are no replicated, and I get this warning:
>> 
>> org.apache.catalina.ha.session.ClusterSessionListener messageReceived
>> WARNING: Context manager doesn't exist:localhost#/r2
> 
> Correct. What you are trying to do is not supported. Tomcat has no mechanism 
> to map /r2 in one instance to /r3 in another.

As a shameless plug, the new session manager I wrote (which we're using 
internally in our Tomcat cloud) does this just fine because it doesn't care 
about contexts or IP addresses or anything like that. If the session manager is 
configured to connect to the same exchanges and RabbitMQ server as other Tomcat 
instances, the sessions will be shared.

I'm doing a write-up on it now for tomcatexpert.com 

Code is on GitHub: 
http://github.com/jbrisbin/vcloud/tree/master/session-manager/

Downside is it requires another component (RabbitMQ).


Jon Brisbin
Portal Webmaster
NPC International, Inc.


> 
> 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: Dynamic configuration of workers

2010-05-07 Thread Jon Brisbin

On May 7, 2010, at 1:16 PM, Smith, Mark wrote:

> I'm trying to re-architect our websites to work in EC2.  One of the biggest 
> problems I'm running into is the dynamic nature of hostnames and IPs.

I have the same problem on a VMware vSphere-based virtual private cloud...

> Is there a way to tell mod_jk that it has a new worker on a new hostname 
> without having to reload Apache?  Similarly, to remove an existing worker 
> that has gone away, or just to change the hostname of a worker.   I'm 
> picturing an API on the status worker, or something similar.
> 
> I don't want to just rewrite workers.properties and do a reload because we 
> have several long uploads happening at any given time that get interrupted.  
> Reload/graceful works most of the time, but occasionally locks up the entire 
> Apache instance, which is no good.
> 
> I can't imagine we're the first to run into this problem, but I've done a lot 
> of looking and can't find anything other than "rewrite workers.properties and 
> reload Apache."

Reconfig/reload is essentially what I'm doing too, though I use mod_proxy_ajp 
rather than mod_jk.

But the annoying thing is that you're absolutely right you're not the first and 
it's frustrating knowing it'll be a while until enough developers have a handle 
on cloud architectures to make meaningful contributions to projects to address 
these fundamental problems.

I'm having to write a lot of stuff myself because almost no software out there 
that's designed to run web applications addresses the real needs of 
heterogenous instances of servers that need to work together in a very 
loosely-coupled and dynamic environment. Tomcat and Apache both have serious 
shortcomings when it comes to cloud architectures. They're getting better 
(slowly), but it'll still be a year or more before there's a critical mass of 
software and experience that make deploying into the hybrid cloud easier.

At the bare minimum, I wish the Apache load balancer had a REST API that could 
add and remove balancer members on the fly, like what you've mentioned above. 
This single thing would solve the VAST majority of my load balancer problems. 
To be honest, I'm seriously looking at using ipchains or something to do NAT on 
the box and cut out Apache entirely. Or even writing my own proxy server from 
scratch. I hate that I keep coming back to that so often lately. I just get 
frustrated, throw up my hands, and resign myself to simply doing it myself. I 
lamented on this very topic yesterday to The 451 Group when we talked about 
cloud architectures etc...

Sort of related: I just put some serious updates into my vcloud session manager 
that uses RabbitMQ to do non-multicast session "clustering" in a cloud 
environment, which is the next problem I had to tackle after getting past my 
load balancer... :)

http://github.com/jbrisbin/vcloud/tree/master/session-manager/

Jon Brisbin
Portal Webmaster
NPC International, Inc.


> 
> Current versions:
> - Base system: RedHat EL4 (though we are not using their TomCat)
> - Apache: v2.0.63 (grabbed RedHat's EL4 2.0.52 SRPM and up-ported it to 
> 2.0.63, and added a couple patches of our own for various security reasons.)
> - tomcat-connectors: v1.2.25
> - tomcat: v5.5.17
> 
> I'm certainly willing to consider alternate versions if they'll get me the 
> functionality I'm looking for.
> 
> Thanks in advance for your help.
> 
> -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: How to force session replication per request in a Tomcat 6 cluster

2010-04-28 Thread Jon Brisbin


On Apr 28, 2010, at 9:57 AM, Kevin Jansz wrote:

> That is useful to know ... is the Valve in a state that it can be
> shared? Did you base any of the interaction with the manager/store on
> the SimpleTcpReplicationManager?

I actually use my own, from-scratch session replication manager. It's still 
alpha, but it uses RabbitMQ to replicate sessions (I'm adding ZooKeeper into 
the mix right now, as well, to coordinate session updates). The Valve is 
responsible for calling a method I added to my Store called "replicateSession" 
after the request is processed. This sounds like it's similar in functionality 
to what you're after. 

I just perused the guts of SimpleTcpReplicationManager and it looks like you 
could force a replication event by setting isDirty to true in the Valve, after 
the request is processed (this is untested pseudo-code, BTW):

public class ReplicationValve extends ValveBase {

  protected static final String info = "ReplicationValve/1.0";

  @Override
  public String getInfo() {
return info;
  }

  @Override
  public void invoke( Request request, Response response ) throws IOException, 
ServletException {

getNext().invoke( request, response );

Session session = null;
try {
  session = request.getSessionInternal();
} catch ( Throwable t ) {
  // IGNORED
}
if ( null != session ) {
  ((ReplicatedSession)session).setIsDirty(true);
}
  }
}

> I guess the dilemma for us is the
> org.apache.catalina.ha.session.SimpleTcpReplicationManager seems to
> have the functionality we require (ie from Tomcat 5.0) and there isn't
> anything much more we need above that. Just not sure if users are
> advised against using it for session replication. If so then I guess
> writing your own does sound like the only alternative but that does
> seem unusual when tomcat used to have replication "ignoring deltas"
> before and other app servers (I can actually only speak of websphere)
> seem to let you do this. Would the rationale be that you should only
> put immutable objects in the session and tomcat is trying to direct
> users to best practice?

I got to the point where, in my private, hybrid cloud environment, there aren't 
best practices, so I had to just do it myself.

Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



Re: How to force session replication per request in a Tomcat 6 cluster

2010-04-28 Thread Jon Brisbin
I don't know if this really answers your question or not, but I have written a 
custom Valve that calls my own replicateSession method. You could do something 
similar in maybe 10 minutes to call the requisite methods on the session 
Manager/Store.

Jon Brisbin
Portal Webmaster
NPC International, Inc.



On Apr 28, 2010, at 7:34 AM, Kevin Jansz wrote:

> In a Tomcat 6 cluster can you force session replication on every
> request? In Tomcat 5.0.x you had the ability to set
> useDirtyFlag="false" on the manager
> (org.apache.catalina.cluster.session.SimpleTcpReplicationManager) -
> meaning a mutable object in the session would always be
> "re-replicated".
> 
> Looking at the source I can see the old "SimpleTcpReplicationManager"
> manager implementation in the new "org.apache.catalina.ha.session"
> package - and it still has the useDirtyFlag but the javadoc comments
> in this state it's "Tomcat Session Replication for Tomcat 4.0" ... I
> don't know if this is ok to use - I'm guessing not as it's not
> mentioned in the main cluster configuration documentation.
> 
> aside: a similar question was posed on stackoverflow (with more detail
> and formatting) with no response:
> http://stackoverflow.com/questions/2680958 - I'd be happy with
> comments in either forum, and I'll share the advice.
> 
> Regards,
> Kevin
> 
> --
> Kevin Jansz
> kevin.ja...@exari.com
> Level 7, 10-16 Queen Street, Melbourne 3000 Australia
> Tel +61 3 9621 2773 | Fax +61 3 9621 2776
> Exari Systems
> Boston | London | Melbourne | Munich
> www.exari.com
> 
> -
> 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: Way to generate a "localhost.log" instead of "localhost-4-20-2010.log"?

2010-04-19 Thread Jon Brisbin

On Apr 19, 2010, at 3:42 PM, Pid wrote:

> On 19/04/2010 15:29, laredotornado wrote:
>> 
>> Hi,
>> 
>> I'm using Tomcat 6.0.26 on Mac 10.6.3.  Currently, in my $CATALINA_HOME/logs
>> directory, Tomcat produces a localhost*log file with the date in the file
>> name for each day, for example -- localhost.2010-04-19.  Is there a way to
>> get Tomcat to generate simply "localhost.log" for whatever day today is?  If
>> not, does anyone know a shell short cut where I can just type in something
>> like "vim ~/localhost.log" and see the most current log without having to
>> specify today's date?
> 
> You know about using the tab key in shell?
> Not being bothered to fill in the right filename seems a bit lame.
> 

I'm often frustrated by this convention as well. I end up having to hit tab 
multiple times because there are several months and many days of log files in 
these directories. Those keystrokes add up and it's often no faster to use tab 
than it is to just type the full filename. If, on the other hand, one could 
type "less lo/lo", I could work faster and more efficiently.

I don't find this question insignificant at all. I'd like to know the answer 
myself.

Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



Re: The question of automatic restart Tomcat

2010-04-13 Thread Jon Brisbin
comments below...

On Apr 13, 2010, at 3:40 PM, Bob Hall wrote:

> Gregor,
> 
> --- On Tue, 4/13/10 at 1:19 PM, Gregor Schneider  
> wrote:
> 
>>> 
>>> -XX:OnOutOfMemoryError=/usr/sbin/restart_tcserver
>>> 
>> I'm not aware of that option within my standard sun jdk
>> 1.6.x - what
>> Java-version are you running offering this really useful
>> feature?
>> 
> 
> I wasn't aware of it either.
> 
> From http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
> 
> -XX:OnOutOfMemoryError=";"
> 
> Run user-defined commands when an OutOfMemoryError is first thrown. 
> (Introduced in 1.4.2 update 12, 6)

There's also:

-XX:OnError=";" Run user-defined commands on fatal 
error. (Introduced in 1.4.2 update 9.)


Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



Re: The question of automatic restart Tomcat

2010-04-13 Thread Jon Brisbin
We use automatic restarts on OutOfMemory errors and it works fantastically. I 
don't do it the way described here, though. I use the JVM's 
-XX:OnOutOfMemoryError option. I add the following to CATALINA_OPTS:

-XX:OnOutOfMemoryError=/usr/sbin/restart_tcserver

...which restarts tcServer whenever an OOME occurs. Unfortunately, it doesn't 
produce a stacktrace (it calls your script instead). But that's okay in my 
case. I just want to make sure the server gets restarted.

We had one of these a while back, so I know it works fine (the restart script 
also sends me an email--including "top" output--letting me know what happened).

Thanks!

Jon Brisbin
Portal Webmaster
NPC International, Inc.

On Apr 13, 2010, at 11:37 AM, Christopher Schultz wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Eugene,
> 
> On 4/13/2010 7:18 AM, Mirgorodskiy Eugene wrote:
>> I apologise if this theme described in documentation Tomcat, I badly
>> understand English language.
>> 
>> Whether you could not answer me is in tomcat 6.0.X Service which
>> automatically would start Tomcat, at end of its work as a result of
>> an error or failure in software work.
> 
> Tomcat does not provide this service. There may be such services
> available elsewhere, but I am unaware of them.
> 
> You may be able to create your own, something like this:
> 
> #!/bin/sh
> 
> CATALINA_HOME=/opt/tomcat6
> CHECK_INTERVAL=30s
> RESTART_INTERVAL=10s
> 
> while true ; do
>  # Start TC in background
>  "${CATALINA_HOME}/bin/catalina.sh" start
> 
>  # Repeatedly check stdout for errors
>  while true ; do
>sleep ${CHECK_INTERVAL}
>grep OutOfMemoryError "${CATALINA_HOME}/logs/catalina.out"
> 
>result = $?
>if [ "0" == "${result}" ] ; then
>  break
>fi
>  done
> 
>  # Stop TC
>  "${CATALINA_HOME}/bin/catalina.sh" stop
>  sleep ${RESTART_INTERVAL}
> done
> 
> This will run Tomcat forever and restart it if any OutOfMemoryError
> messages are emitted to logs/catalina.out.
> 
> You can certainly customize this to meet whatever other needs you may
> have. You can even have your webapp dump something into stdout (or some
> other file) and check that, too.
> 
> Hope that helps,
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkvEndIACgkQ9CaO5/Lv0PDORQCfcTUbMHXMqiNFLPvRl7Spfnzg
> erAAoI1r5JnHFLVpmg0PereR4yBBzTAU
> =/1/r
> -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



Non-multicast session clustering with RabbitMQ

2010-04-09 Thread Jon Brisbin
I updated a new virtual cloud blog I started this week with a post describing 
how I approach the problem of maintaining active tomcat sessions within a 
"cloud" architecture of tcServer (tomcat 6.0) instances.

I tried to lay out, in excruciating detail, my thoughts on distributed 
membership and how I approached that particular sticky wicket. 

Non-multicast Tomcat Session Clustering with RabbitMQ:
http://jbrisbin.wordpress.com/

The project is hosted on GitHub, though it is sorely lacking documentation on 
building and installing. I'm working on that. I've tried to make it as simple 
to use as possible, even though the process is not terribly straightforward on 
the back end.

Some things I don't know yet but will need to include: how this system works 
under load; is it scalable (it would be a bummer to design a scalable solution 
and not have it scale...been there, done that, not interested in doing it again 
;). etc...

Concurrency might become an issue. As the number of workers increase, is the 
system stepping on its own toes trying to load user sessions?

This is about as alpha and "it might not even build or work" as it gets. The 
ink's not even dry on it yet. I guess that's my way of saying: if you try it 
out and it doesn't work, please don't swear at me. ;)

Patches welcome, of course...

Jon Brisbin
Portal Webmaster
NPC International, Inc.



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



Re: Problems with ImageIO

2010-04-07 Thread Jon Brisbin


On Apr 7, 2010, at 1:38 PM, Thad Humphries wrote:

> Today I installed Tomcat 6.0.26 on Linux and tried running my webapp.  Under
> this version of Tomcat, Iterator returned by
> ImageIO.getImageReadersByFormatName("tiff") returns false for hasNext().

I had a similar problem (though it's maybe not even related) setting up a new 
Tomcat server on a fresh Ubuntu Linux install. We also use tif images and I had 
to install a couple extra ImageMagick packages, as well as something in JAI to 
get it to recognize .tif as a format. Until I did that, I could not process 
tiff images.


Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



Re: RabbitMQ-based vcloud session clustering

2010-04-06 Thread Jon Brisbin

On Apr 6, 2010, at 4:26 AM, David Calavera wrote:

> Please open source it!! I never thought about that solucion but it could be
> pretty cool and I'll give a try for sure.

It's Apache 2.0 licensed. 

I'll post the github link when I get a working example created.

This is RabbitMQ-based because it uses tight integration between the session 
store and the RabbitMQ java API. I had originally thought I might make it a 
little more generic and make it JMS-specific, but I decided I had better work 
out the bugs using code I know works first. JMS (and maybe JMS/Spring) can be 
2.0.


Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



RabbitMQ-based vcloud session clustering

2010-04-05 Thread Jon Brisbin
Not sure there's anyone besides me on both these lists, but I'm x-posting just 
to save time.

I'm currently working on setting up a RabbitMQ-based session cluster using my 
own session manager and store. I had to write my own because I couldn't find 
anything out there that uses JMS or RabbitMQ to do session clustering (which 
actually surprised me a little) that had the virtual cloud awareness I need. 
Everything I've read about Tomcat clustering uses the Apache Tribes 
replication, which doesn't work for me under even moderate load testing (maybe 
I'm just not doing right...I don't know) or the centralized JDBCStore, which 
introduces a single point of failure. 

The basic idea here is to use RabbitMQ as the session clustering back-end and 
have a user's session available to any server currently subscribed to the 
clustering queue with no sticky sessions at all. This (cross your fingers) 
gives me a very, very scalable clustering architecture (my RabbitMQ servers are 
load-balanced and clustered using VMware vms so I can add capacity at will) 
that doesn't suffer from the single point of failure of a JDBCStore or the 
multicast limitations of Apache Tribes. Sessions are also shared across points 
of responsibility, too, as a single session object can be passed around from 
code running inside a webapp to code in a command-line client. I wanted my 
session handling to be a first-class virtual cloud citizen, rather than feel 
like I'm shoe-horning existing code into what I want to do.

I'm almost finished with the heavy lifting. I should have a functioning drop-in 
manager and store this week, which I'll put on my github account. What I'd like 
to know is if there's any interest in the community for something like this? If 
there's no interest, I won't bother writing documentation and what-not.

Does this sound like it would interest any other Tomcat/RabbitMQ users?

Jon Brisbin
Portal Webmaster
NPC International, Inc.




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



Re: how to configure log4j path to work both in Tomcat and from the CLI?

2010-03-02 Thread Jon Brisbin
On Mar 2, 2010, at 4:10 PM, fred basset wrote:

> Hi All,
> 
> I use log4j, I'm trying to configure it so that log4j uses a non
> hardcoded path, and it resolves the path both when running under
> tomcat and running my unit tests from the CLI with ant.
> 
> Here's the relevant line from log4j.properties:
> 
> log4j.appender.R.File=${catalina.home}/logs/myapp.log
> 
> 
> This works fine when I'm running my app. under Tomcat, but when I try
> to run my unit tests from ant, log4j tries to log to /logs/myapp.log
> (i.e. resolves ${catalina.home} to nothing).
> The CATALINA_HOME environment variable is set correctly.


Run your ant script with a "-D" defined for catalina.home (or any other 
properties that exist in your webapp's environment..."ant -h" is always helpful 
here ;). e.g.:

ant -Dcatalina.home=/opt/tomcat-6

Jon Brisbin
Portal Webmaster
NPC International, Inc.


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



Re: using my own LifecycleListener

2010-02-23 Thread Jon Brisbin

On Feb 23, 2010, at 12:32 PM, Caldarale, Charles R wrote:

> The servlet spec is required reading before you ever touch any servlet 
> container.

Oops. Guess I missed that memo.

Crap.

Now I'm going to have to resign! I'm living a lie.

;)

Jon Brisbin
Portal Webmaster
NPC International, Inc.

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Jon Brisbin

On Feb 23, 2010, at 7:31 AM, Simone Tripodi wrote:

> Hi Evgeny,
> thanks a lot for shared your experience, very interesting. I'd like to
> plug something magic that could avoid me configuring a filter, I
> started investigating about a possible use of AOP & HttpSession.
> If anyone is interested, I'll share my results when done.

This sound very interesting to me. I'd love to take a look at it when you're 
done. I'm still fighting load-balancing issues.

Jon Brisbin
Portal Webmaster
NPC International, Inc.


> Best regards!!!
> Simo
> 
> http://people.apache.org/~simonetripodi/
> 
> 
> 
> On Tue, Feb 23, 2010 at 7:51 AM, Tsirkin Evgeny  wrote:
>> Just in case somebody will google for a solution for "replacing session".
>> I have done this .
>> First of all ,why:
>> We have cluster of 2 machines .
>> Each have a separate db on it .
>> The machines are sharing information using nfs mounting fs.
>> Each machine runs it's own apache server ,(no apache balancer in front).
>> There IS a hardware load balancer in front of this but sometime it fails
>> to route already open sessions to same host.
>> So,we can't :
>> 1. share sessions using files ,because this would be same file for 2 tomcats
>>and because this would fail on nfs .
>> 2. we can't use tomcat cluster because there are cases when BOTH tomcat
>>would be shut down or restarted and session would be loosed.
>> 3. we can't use a db because there is no central db - each host has it's own
>> one.
>> 4. to complicate issue machines could be added/removed to the cluster.
>> 
>> What we did - override session object using filter.On each request start it
>> would
>> read it's info from db (any configured one ,but preferring the local one)
>> On each request end it would write itself into ALL dbs that are configured
>> to be
>> used.
>> Although the obvious problem here is the writing to more then 1 db and
>> reading
>> from a db on each request ,this really works good thanks for mysql to be
>> so fast on simple read/write.
>> I have even implemented a simple lock mechanism for session .
>> What more - this solution is portable ,it worked for us on SunONE server
>> and now on tomcat.
>> Thanks
>> Evgeny
>> On Tue, Feb 16, 2010 at 9:54 PM, Simone Tripodi 
>> wrote:
>> 
>>> Hi Martin,
>>> very interesting, thanks for share it!!! I did, more or less, the same
>>> on a project for a customer, but it was strictly related to the
>>> application, your stuff looks much much better of mine and it is a
>>> reusable module.
>>> All the best,
>>> Simo
>>> 
>>> http://people.apache.org/~simonetripodi/<http://people.apache.org/%7Esimonetripodi/>
>>> 
>>> 
>>> 
>>> On Tue, Feb 16, 2010 at 6:02 PM, Martin Grotzke
>>>  wrote:
>>>> Hi Jon,
>>>> 
>>>> On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
>>>>> I'm trying to figure out today how I can implement a Valve or something
>>> that can store a session to a backend DB and reload that session on another
>>> Tomcat instance similar to how the PersistentManager loads user's session
>>> after a restart.
>>>>> 
>>>>> Would a Valve based on PersistentValve allow me to implement a
>>> cluster-like solution such that a user login causes a write to a central
>>> database and a load balanced request to another server would see that user
>>> without forcing another login?
>>>> You might have a look at the
>>>> http://code.google.com/p/memcached-session-manager/ which is a session
>>>> failover solution storing sessions in memcached.
>>>> 
>>>> When the project was created I only thought of applications using sticky
>>>> sessions but it should also work with non-sticky sessions if sessions
>>>> are stored in memcached synchronously (sessionBackupAsync needs to be
>>>> set to false, see [1]).
>>>> 
>>>> The memcached-session-manager basically is a session manager
>>>> implemention, the most interesting part is the
>>>> MemcachedBackupSessionManager ([2]) if you want to have a look at the
>>>> code.
>>>> 
>>>> Cheers,
>>>> Martin
>>>> 
>>>> 
>>>> [1]
>>> http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
>>>> [2]
>>> http://github.com/magro/memcached-s

Re: VSphere4 and tomcat 6.0

2010-02-17 Thread Jon Brisbin
We're running a dozen tcServer instances (Tomcat 6.0) on a VMware ESXi cloud 
infrastructure. We haven't put vSphere in yet, but we're planning to. The only 
thing I can say here is that there ARE differences between running Tomcat on a 
VM and running it on dedicated hardware. I have problems with things I know I'm 
doing right, but they just don't work the same on a VM. I guess it has to do 
with the fact that the server is sometimes "swapped" out if it's not in use. I 
think this causes issues, particularly with clustering, which I have yet to 
make work in a way that I'm happy with.

The big one that I noticed right away is that anything that uses /dev/random 
will take forever to start. VMs have very little entropy in their pools because 
they don't have any real hardware. This means stuff that uses /dev/random for 
entropy (if it has security/SSL in it or is uses Random) will take several 
minutes to start (usually 3-5 in our tests).

When they run, they run great. We're seeing a great improvement in performance 
running on VMware. It's just there seem to be a lot of little issues that no 
one else seems to have. This means I either have no idea what I'm doing 
(possible :) or things just run differently on VMs than they do on real 
hardware.

Jon Brisbin
Portal Webmaster
NPC International, Inc.



On Feb 17, 2010, at 3:39 AM, Daniel Dreier wrote:

> Hello,
> 
> I want to use tomcat 6.0 on a vsphere4 based Server. Are there known issues?
> 
> best regards
> 
> Daniel Dreier
> -
> 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: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-15 Thread Jon Brisbin
I'm just getting ready to ask a question like this, as I have a similar need.

I'm using the built-in Tribes-based replication which works fine for short 
periods of time and under moderate to light load. Once the Tomcat server has 
been running for a day or two, though, this distributed session replication 
starts breaking unexpectedly. Once this happens, the apps start becoming 
unavailable until I restart everything.

I'm trying to figure out today how I can implement a Valve or something that 
can store a session to a backend DB and reload that session on another Tomcat 
instance similar to how the PersistentManager loads user's session after a 
restart.

Would a Valve based on PersistentValve allow me to implement a cluster-like 
solution such that a user login causes a write to a central database and a load 
balanced request to another server would see that user without forcing another 
login?

Jon Brisbin
Portal Webmaster
NPC International, Inc.



On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:

> Hi all guys and very nice to meet the Tomcat community,
> I've a web-application that needs to be replicated in more than one
> Tomcat, and since it is HttpSession based, I need to enable the
> session replication.
> Even if I work with very good sysadmins that know how to do it, I'm
> curious and would like to know if I could replace the HttpSession
> implementation with a my own one, I'd like to integrate Hazelcast[1]
> for data synchronization.
> Thanks in advance, every suggestion will be very appreciated.
> Simo
> 
> [1] http://www.hazelcast.com/
> 
> http://people.apache.org/~simonetripodi/
> 
> -
> 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