mod_jk load balancing to Tomcats or SonicWall NetScaler?

2016-05-09 Thread Jason Britton
Hello Good People -

I'm trying to determine the best route in which to load balance multiple
tomcats, what should I be taking into consideration when choosing between
SonicWall's NetScaler or in continuing to use mod_jk?  This question isn't
meant to fuel a purchase decision as we have already acquired NetScaler for
other purposes.  mod_jk seems quite robust in its load balancing options.
Would really appreciate details I should be taking into consideration one
way or the other.  To simply this discussion just assume we are using the
latest version of mod_jk, apache and tomcat.  Thanks for any insight,

Jason


Re: Zero downtime deployments

2015-12-22 Thread Jason Britton
On Tue, Dec 22, 2015 at 4:01 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Jason,
>
> On 12/21/15 12:22 PM, Jason Britton wrote:
> > Following back up after perusing Chris' very helpful presentation (
> >
> http://people.apache.org/~schultz/ApacheCon%20NA%202015/Load-balancing%20Tomcat%20with%20mod_jk.pdf
> )
> > on
> > load balancing tomcats with mod_jk.
> >
> > One part not mentioned was session fail over.
>
> Correct. I lump that in with "clustering", which was explicitly
> out-of-score for the 50-minute presentation at ApacheCon. Mark covered
> it a bit in his 3-part presentation at the same conference.
>
>
Understandable


> Have a look at the 2015-04-15* presentations here:
> http://home.apache.org/~markt/presentations/
>
> Also possibly here:
>
> http://home.apache.org/~markt/presentations/2014-11-20-Tomcat-load-balancing-and-clustering/
>
>
Thanks for these links.


> > Which my current plan is to
> > use JDBCStore for persisting to a database table shared by all tomcats
> > powering apps.  But this has brought up a couple concerns...  If while a
> > tomcat node is being shut down and triggered by this shut down tomcat is
> in
> > the middle of writing out session data to the JDBCStore, a request from a
> > client that was using that node comes in, mod_jk tries to route the
> request
> > to the node that is shutting down but mod_jk's configured connect_timeout
> > times out waiting and mod_jk then routes to another node (hopefully
> that's
> > how this works).
>
> So mod_jk routes a request to the node which is going down, and then
> decides to re-route because the connection times-out? Just making sure I
> have that all in my head (it's an awfully long sentence).
>
>
my understanding, could be wrong, that if the connect_timeout is reached by
mod_jk that it would try a different node.



> > A different active tomcat node now receives the request
> > and tries to reconstitute the user's session from the same shared
> > JDBCStore, but what if the first tomcat node is not finished shutting
> down
> > and has not finished writing out this particular user's session data yet?
> > How can we ensure that session data will be there?
>
> Although I'm not entirely sure of the behavior of Tomcat's clustering
> features in that particular case, you are mostly asking the following:
> "what happens if two nodes are essentially sharing a session? how do I
> make sure their view of the session is consistent?"
>

I should have clarified the environment I was envisioning was one with
sticky sessions, no clustering.  And the situation I'm looking to wrap my
brain around is one where the once active node is triggered to write out
session data due to the impending shut down of the particular node.

At about the same time this shutdown is occurring a request comes in for a
client that has a session cookie value routing it to the node being shut
down.  mod_jk times out trying to connect to this node and reroutes the
request to an active node.  I see a race condition where depending on how
long it takes the first tomcat being shutdown to write out session data to
the JDBCStore, that the subsequent tomcat node trying to service the
request may not find this user's session data in the shared JDBCStore.  I'd
really like to know if this is truly something to be concerned about, and
if so, how to account for it.



> I think the answer is: you can't. Make your requests as idempotent as
> possible and, when possible, execute the other kinds of requestssuch a
> way that the first one to execute "wins" and the others fail gracefully.
>
>
> > From looking at the config of the Manager, there is a maxIdleBackup
> > parameter that I imagine could be set to 0 but I'm a little wary of the
> > possible performance implications.  Its description: The time interval
> (in
> > seconds) since the last access to a session before it is eligible for
> being
> > persisted to the session store, or -1 to disable this feature. By
> default,
> > this feature is disabled.  Even if this was ok from a performance
> > perspective, once a session was initially persisted, would its session
> data
> > be updated in the session store on subsequent changes/requests?
>
> Even if you update every time the background thread runs, that thread is
> doing a handful of different things and you might not get that real-time
> feeling you are looking for.
>
> Session data will be updated if you call session.setAttribute() or
> session.removeAttribute (or equivalent) during the request. If you have
> a HashMap in the session and you call
> ((Map)session.getAttribute("myMap")).pu

handling tomcat failover - session transition to new node

2015-12-22 Thread Jason Britton
Questions on particulars of session fail over in my on going quest for zero
downtime deployments -

My current plan is to use JDBCStore for persisting to a database table
shared by all tomcats powering apps.  But this has brought up a couple
concerns...  If while a tomcat node is being shut down and triggered by
this shut down, tomcat starts writing out session data to the JDBCStore, a
request from a client that was using that node comes in, mod_jk tries to
route the request to the node that is shutting down but mod_jk's configured
connect_timeout times out waiting and mod_jk then routes to another node
(hopefully that's how this works).  A different active tomcat node now
receives the request and tries to reconstitute the user's session from the
same shared JDBCStore, but what if the first tomcat node is not finished
shutting down and has not finished writing out this particular user's
session data yet?  How can we ensure that session data will be there?

>From looking at the config of the Manager, there is a maxIdleBackup
parameter that I imagine could be set to 0 but I'm a little wary of the
possible performance implications.  Its description: The time interval (in
seconds) since the last access to a session before it is eligible for being
persisted to the session store, or -1 to disable this feature. By default,
this feature is disabled.  Even if this was ok from a performance
perspective, once a session was initially persisted, would its session data
be updated in the session store on subsequent changes/requests?

I've read about some folks configuring valves for shared in-memory caches
(redis), I'm not sure I want to go that route at this point.

Any thoughts would be much appreciated, happy holidays!

Jason


Re: Zero downtime deployments

2015-12-21 Thread Jason Britton
Following back up after perusing Chris' very helpful presentation (
http://people.apache.org/~schultz/ApacheCon%20NA%202015/Load-balancing%20Tomcat%20with%20mod_jk.pdf)
on
load balancing tomcats with mod_jk.

One part not mentioned was session fail over.  Which my current plan is to
use JDBCStore for persisting to a database table shared by all tomcats
powering apps.  But this has brought up a couple concerns...  If while a
tomcat node is being shut down and triggered by this shut down tomcat is in
the middle of writing out session data to the JDBCStore, a request from a
client that was using that node comes in, mod_jk tries to route the request
to the node that is shutting down but mod_jk's configured connect_timeout
times out waiting and mod_jk then routes to another node (hopefully that's
how this works).  A different active tomcat node now receives the request
and tries to reconstitute the user's session from the same shared
JDBCStore, but what if the first tomcat node is not finished shutting down
and has not finished writing out this particular user's session data yet?
How can we ensure that session data will be there?

>From looking at the config of the Manager, there is a maxIdleBackup
parameter that I imagine could be set to 0 but I'm a little wary of the
possible performance implications.  Its description: The time interval (in
seconds) since the last access to a session before it is eligible for being
persisted to the session store, or -1 to disable this feature. By default,
this feature is disabled.  Even if this was ok from a performance
perspective, once a session was initially persisted, would its session data
be updated in the session store on subsequent changes/requests?

I've read about some folks configuring valves for shared in-memory caches
(redis), I'm not sure I want to go that route at this point.

Any thoughts would be much appreciated,

Jason


On Tue, Dec 8, 2015 at 10:43 AM, Kevin Hale Boyes  wrote:

> On 4 December 2015 at 11:19, Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> > Kevin,
> >
> > On 12/3/15 2:21 PM, Kevin Hale Boyes wrote:
> > > Thanks for this link to the presentation.
> > > How do you all deal with some of the other dependencies that the web
> > > application has?
> > >
> > > For example, if v2 of my application needs new database columns or
> > worse, a
> > > change to an existing column how can I have v1 and v2 running at the
> same
> > > time?  We use Oracle as our database though the problem exists for many
> > > database servers.
> >
> > That's not a deployment problem. That's a design problem.
> >
> > In short, you need to make sure that your web application is both
> > forward-compatible and backward-compatible at the same time.
> >
> > That's rubbish, or course. Here's a more concrete suggestion, and it
> > requires a LOT of work, but it's worth it.
> >
> > First of all, you can't think of a release as a single event any more.
> > Instead, there are 4 events.
> >
>
>
> We already do this sort of development when needed.  In particular, when we
> have database changes that will take a long time like back populating new
> columns or creating new indexes on large tables, we run then in a
> pre-release phase against live production.  We time the activities to
> finish just before our release window.  Sometimes we also have post-release
> database activities as well that follow shortly after our release outage.
>
> I guess I hadn't extended my thoughts far enough and seen the full
> potential of the idea so thanks.
> One drawback for us when we use this mechanism is related to our release
> schedule.  We release on a quarterly basis so having a process that spans
> four releases pushes it out for an entire year.  But that's our problem and
> we're making headway there too.
>
> Thanks Christopher
> Kevin.
>


Zero downtime deployments

2015-12-02 Thread Jason Britton
Hello Good People -

I was looking for information for how those on the list achieve zero
downtime deployments of their tomcat hosted web applications.  I imagine
this can be achieved in a variety of ways, but would love to hear what
works for you.  In our current environment we front multiple tomcat
instances with apache httpd, each tomcat instance hosting one or more
unique web apps.  In order to support this effort we do have the resources
where we could spin up multiple tomcat instances to serve requests for a
single application.  I know there is mod_proxy_balancer available for
httpd, and I understand starting with tomcat 7 there is support for
parallel deployment of versioned wars, and tomcat also supports
clustering.  I'm just unsure of what approach I should start digging into
and would very much appreciate any of your experiences.  The servers we'll
be rolling out will be using the latest versions of tomcat 8 and apache
httpd 2.4.  Thanks for any insights!

Jason


Re: Zero downtime deployments

2015-12-02 Thread Jason Britton
Thank you Christopher, reading now and we'll see if I can swing the
conference :)

On Wed, Dec 2, 2015 at 4:00 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Jason,
>
> On 12/2/15 4:07 PM, Jason Britton wrote:
> > I was looking for information for how those on the list achieve zero
> > downtime deployments of their tomcat hosted web applications.  I imagine
> > this can be achieved in a variety of ways, but would love to hear what
> > works for you.  In our current environment we front multiple tomcat
> > instances with apache httpd, each tomcat instance hosting one or more
> > unique web apps.  In order to support this effort we do have the
> resources
> > where we could spin up multiple tomcat instances to serve requests for a
> > single application.  I know there is mod_proxy_balancer available for
> > httpd, and I understand starting with tomcat 7 there is support for
> > parallel deployment of versioned wars, and tomcat also supports
> > clustering.  I'm just unsure of what approach I should start digging into
> > and would very much appreciate any of your experiences.  The servers
> we'll
> > be rolling out will be using the latest versions of tomcat 8 and apache
> > httpd 2.4.  Thanks for any insights!
>
> Check this out:
>
> http://people.apache.org/~schultz/ApacheCon%20NA%202015/Load-balancing%20Tomcat%20with%20mod_jk.pdf
>
> Start on slide/page 41.
>
> Then come to ApacheCon NA 2016 and discuss it!
>
> -chris
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: SSL and Virtual Hosting

2015-10-21 Thread Jason Britton
Hi Björn -
Look in tomcat/conf at the server.xml, you'd just define multiple host
entries, one host entry would have a name of "alice.example.com" the other
with "bob.example.com".  Each host entry would also have its own appBase
(alice-webapps & bob-webapps), meaning both sites could be deployed using
ROOT.war.  Update the DNS for alice and bob to point at the server your
consolidated tomcat is on.  Inside tomcat/conf/Catalina/ I'm pretty sure
you're going to need a directory for each host with that hosts config
ROOT.xml etc).  We use Apache HTTPD to proxy to our Tomcats and we
terminate SSL at HTTPD so I'm not exactly sure on your SSL questions.  Our
SSL is configured through Apache HTTPD Virtual Hosts.  Maybe you want to
look into the cost for a wildcard SSL cert that would cover *.example.com
rather than specific hosts?

Jason

On Wed, Oct 21, 2015 at 8:27 AM, Björn Raupach  wrote:

> Dear group,
>
> it would be nice if anyone knows, if my planned setup is going to work.
>
> At the moment we are having two services (web apps) at two different
> machines and hostnames. Lets say bob.example.com and alice.example.com
>
> bob.example.com runs without SSL and deploys the web app at the root
> context. We just throw a ROOT.war in /webapps.
>
> alice.example.com needs SSL at all times. It currently does not run with
> the root context but we would like to. So another ROOT.war. We have an SSL
> cert for alice.example.com
>
> I want both applications to run on a single Tomcat instance with Virtual
> Hosting. Virtual Hosting with Tomcat that is. I am comfortable with setting
> up Virtual Hosting, but I am just not sure about the SSL part. Does the
> choice between IP-based or Hostname matter? bob.example.com might need
> SSL support in the future.
>
> We are using Amazon AWS if that is important. So I could get another
> Elastic IP. We are working with the latest Apache Tomcat 8 and the latest
> JDK on the server machines.
>
> Sorry if this is not 100% Tomcat related.
>
> Thanks for taking the time!
>
>
> with kind regards,
> Björn
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 8 reliability/performance on Windows 2008 R2 Server vs. RHEL/CentOS

2015-10-01 Thread Jason Britton
OP here.

I really appreciate the objective well thought out responses, this
community has never disappointed me.  A more qualified list of respondents
I will not find elsewhere.  George I should have said Windows Server 2012
R2.  A lot of our Windows servers are still 2008 R2 but any new ones that
are spun up are 2012 R2.  Our server environment is entirely virtualized
(VMware) so the hardware​ either OS would be sitting on would be
equivalent.  André I really appreciate the detail, holy war indeed :)  I
have sheathed my sword at work and am at least considering the possibility
of migration to Windows 2012 R2, it'll be more work short term but easier
maintenance, enforcement of security and compliance for our sys admins in
the long run considering their skill set. And if Mark says there shouldn't
be problems, I think that is some implicit guarantee of free support from
him ;)

I have a lot of convenience shell scripts here and there but nothing I
couldn't replicate in powershell I imagine.  I would miss grep and find and
all the other super useful Linux command line operations.  I'm not sure
I've ever been able to successfully search for text in files on a windows
machine server or otherwise (except when using notepad++).  We do have
Apache HTTPD proxying to our six different Tomcat instances but I'm fairly
certain this would be able to be replicated in Windows as well without too
much trouble.

My biggest reluctance at this point would be the loss of the possibility of
containerization (Docker).  I love the ability to build a war and create a
container running Tomcat around it, with the configuration of the server
entirely scripted and versioned.  Passing that built image between dev, qa
and production environments is so appealing.  We are a ways away from that
promise and workflow but I hate to remove the possibility.  Boot2Docker on
Windows is not a production option, would work adequately well enough for
development/qa perhaps.

@Christopher Schultz - Love the enthusiasm, who wouldn't love that welcome,
you must think I'm someone else, I know it's been 5/6/7 years since I
posted here last, my few posts must have had an effect :)  Money isn't an
issue, even though I work for a non-profit.  The change is entirely
motivated what's best for the organization as a whole from support,
maintenance, policy compliance, etc, a lot of the big picture items André
mentioned.  Our sys admins are quite a bit more comfortable in Windows.

Very much appreciate the dialog.

On Thu, Oct 1, 2015 at 1:54 PM, Aurélien Terrestris 
wrote:

> Howard,
>
> I didn't say this was not running well on Windows, but that it seems
> easier (less work) on Linux for the same result.
>
> If you're expecting "secured" Tomcats, you'll run your windows service
> with a service account. This means that you will have to set up
> properly the rights for this account to TOMCAT_BASE, TOMCAT_HOME, and
> even (if I remember well) giving write access to the conf folder (EVIL
> !)  because the context deploying creates a temporary file and then
> needs write access. You need to break rights inheritance, and if
> you're unsure of your XCACLS script, you're going to break your server
> security. Setting up these rights take less than 5 minutes on Linux,
> and I would like know how much time for writing a correct XCACLS
> script. Every time you will right-clic to check the rights, you will
> be warned that inheritance was broken and you will have more doubt
> every day about what was done.
>
> Most of Tomcat admins need to search GOOGLE to know how to make a
> thread-dump. On Linux, kill -3 pid, it takes 5 seconds to learn :)
>
> When dealing with uploaded files (particularly Office), I would take
> no risk to get my server infected by a virus. A Linux running an
> antivirus sounds better to me.
>
> What you're saying sounds good, but I have been deploying Tomcat since
> version 3 and it has brought me to Linux choice.
>
> best regards,
> A.T.
>
>
>
>
>
> 2015-10-01 19:22 GMT+02:00 Howard W. Smith, Jr. :
> > On Thu, Oct 1, 2015 at 11:46 AM, Aurélien Terrestris <
> aterrest...@gmail.com>
> > wrote:
> >
> >> I recommend Linux for 2 reasons :
> >>  - easier to install and maintain a secured Tomcat (especially when
> >> using different TOMCAT_HOME & TOMCAT_BASE, on Windows it's pretty
> >> difficult to know how to secure all directories correctly) ; if you
> >> have to deal with file uploading, you don't want a system which could
> >> launch any exe,..
> >>  - doesn't need to reboot every 3 days because of the memory
> >> fragmentation or anything else
> >>
> >
> > Multiple tomcat/tomee instances are running well on Windows 2008 R2
> Server
> > for me.
> >
> > - does 'not' reboot every 3 days at all
> > - only reboots automatically at 3am when there is a Windows update for
> the
> > Windows 2008 R2 Server
> > - my apps shut down with no issues and restart (via Windows Service for
> > each tomcat/tomee 

Tomcat 8 reliability/performance on Windows 2008 R2 Server vs. RHEL/CentOS

2015-09-30 Thread Jason Britton
Hello Good People -
We currently have multiple Tomcat instances deployed on RHEL in production
with no issues but I am getting asked why we shouldn't migrate everything
to run on Windows 2008 R2 Server instead.  My stomach churns at the thought
but I am looking for more concrete information about why this could be
problematic vs. running Tomcat on RHEL/CentOS.  My gut says far more Tomcat
deployments in production are done on top of Linux based OS's vs. Windows.
Any thoughts on making an argument for one OS vs another in deploying
Tomcat 8?  Thanks for your thoughts,

Jason


Re: Connection Leak

2010-11-03 Thread Jason Britton
Since you're using an Oracle database - another way to identify areas in
your code that aren't closing connections.  In the sql below substitute
YOURDBUSER with the name of the database user your connections connect to
your database with and YOURWEBSERVER with the name of your webserver.  The
results of the sql query will give you the last executed sql for each of the
open connections.  Then search your code for where this sql is being
executed and double check you are closing the connection appropriately.

SELECT username, machine, oc.sql_text, COUNT(*) open_statements FROM
v$session vs, v$open_cursor oc WHERE username = 'YOURDBUSER' AND machine =
'YOURWEBSERVER' AND oc.sid = vs.sid GROUP BY username, machine, oc.sql_text
ORDER BY open_statements DESC



On Wed, Nov 3, 2010 at 6:44 AM, Ziggy zigg...@gmail.com wrote:

 Hi All,

 Resource name=myConn auth=Container
  type=javax.sql.DataSource
 driverClassName=oracle.jdbc.driver.OracleDriver
  url=jdbc:oracle:thin:@10.10.10.10.:1521:mydb
  username=username password=password maxActive=500
 maxIdle=50
  maxWait=-1 removeAbandoned=true
 removeAbandonedTimeout=60 logAbandoned=true
 accessToUnderlyingConnectionAllowed=true
 /

 I am trying to find out areas of the application where connections are NOT
 being closed. I added the removeAbandoned and logAbandoned clauses in my
 context file but if i check v$session on oracle it is still showing the
 same
 number of connections active even after 60 seconds. Is there something
 wrong
 in the configuration above?


 How exactly does it abandone the connections? what triggers it?



Re: tomcat 6.0.29 hung

2010-10-26 Thread Jason Britton
 I've further traced the root cause of my problems with threads sitting on
socket read, never timing out, never throwing an exception and sometimes
causing application deadlock (depending on where the socket read occurs)
down to the network.  By comparing the output of lsof -i :1521 | grep 
on the webserver with the lsof -i :1521 | grep  on the database server I
can see the webserver thinks it has more connections to the database than
the database actually has from the webserver and using the source port#
which shows up in the output of lsof on both machines I can even narrow down
to exactly what processes are missing the connections.  We've made a policy
change on one of our firewalls to hopefully alleviate the problem but only
more testing will tell.


Re: Login page timeout

2010-10-22 Thread Jason Britton
Top result doing google search
http://www.mindspill.org/kiwiThread$msgnum=207

See Mark's response bottom of page:
https://issues.apache.org/bugzilla/show_bug.cgi?id=3839#c14




On Fri, Oct 22, 2010 at 3:15 AM, Gabriele Bulfon gbul...@sonicle.comwrote:

 Hello, I'm trying to figure out how to solve a very stupid problem.
 I have a solution, but I want to know if there is some other better ways.

 I have a webapp configured with jaas security.
 The login form page is configured and the security check works perfectly.
 But, if a user starts the browser and goes to the login page, then leaves
 the browser there
 for some reason, when he/she gets back later and try to login, it's like
 the login form has expired,
 and TomCat fails with the Invalid direct reference to form login page.
 The only way I've seen so far to avoid this, is to have a javascript
 function to reload the login form
 every n seconds if the user does not enter.
 It's as if TomCat creates a session for the login form, and this session
 expires.

 How can I avoid this?
 Gabriele.

 -= Mail sent through WebTop2 =-


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



Re: tomcat 6.0.29 hung

2010-10-22 Thread Jason Britton
So while working on reproducing tomcat webapp hang as earlier discussed, a
different tomcat serving up a single webapp on same box also stopped
responding, jvm for this tomcat is still running but when trying to reach it
via browser I get error page of unable to connect.

Thread dumps for both problem tomcats seem to exhibit same core problem, at
least in my analysis.  I would really appreciate your feedback on my
analysis of the situation and things anyone thinks I may be over looking.

On both tomcat jvms when they get to the point of locking up, thread dumps
show that almost all ajp/exec threads are blocked and there are either one
or two ajp/exec threads runnable.  The blocked threads are waiting for locks
on an object held by one of the threads in runnable state.  The commonality
between the two that really has to be the root of the problem, in my
estimation, is that on both tomcats the runnable threads are sitting on
socketRead0 to our database and not budging, just stuck in runnable and
never getting to the point of releasing their locks...  Potential networking
issue with that socket read?  Take a look at the thread dump below, I've
shortened a lot of the stacktraces - Thanks for any thoughts on the matter



AJP Threads 3, 5, 7,12
   java.lang.Thread.State: BLOCKED (on object monitor)
at
com.acompany.view.backing.cact.product.ProductsView.setCustomerData(ProductsView.java:57)
- waiting to lock 0x2aaad303cad0 (a
com.acompany.model.customer.CustomerData)
at
com.acompany.view.backing.cact.product.Products.init(Products.java:101)

AJP Threads 9,10,11
   java.lang.Thread.State: BLOCKED (on object monitor)
at
com.acompany.view.backing.cact.membership.MembershipsView.setCustomerData(MembershipsView.java:58)
- waiting to lock 0x2aaad303cad0 (a
com.acompany.model.customer.CustomerData)
at
com.acompany.view.backing.cact.membership.Memberships.init(Memberships.java:99)

AJP Threads 4, 6, 8
   java.lang.Thread.State: BLOCKED (on object monitor)
at
com.acompany.view.backing.cact.meeting.MeetingsView.setCustomerData(MeetingsView.java:66)
- waiting to lock 0x2aaad303cad0 (a
com.acompany.model.customer.CustomerData)
at
com.acompany.view.backing.cact.meeting.Meetings.init(Meetings.java:135)

AJP threads 13, 14, 15, 16 - WAITING on object monitor - probably what
they're supposed to be doing
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on 0x2aaad34cdbd8 (a
org.apache.tomcat.util.net.AprEndpoint$Worker)
at java.lang.Object.wait(Object.java:485)
at
org.apache.tomcat.util.net.AprEndpoint$Worker.await(AprEndpoint.java:1540)
- locked 0x2aaad34cdbd8 (a
org.apache.tomcat.util.net.AprEndpoint$Worker)
at
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1565)
at java.lang.Thread.run(Thread.java:619)


AJP thread 2 - RUNNABLE - sitting on socketRead0
ajp-9011-2 daemon prio=10 tid=0x5e342800 nid=0x3f0a runnable
[0x40f07000]
   java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at oracle.net.ns.Packet.receive(Packet.java:293)
at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:174)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:119)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:94)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:79)
at
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:112)
at
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:73)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1040)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1016)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:588)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at
oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
at
oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1187)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3386)
at
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3430)
- locked 0x2aaacf0584b0 (a oracle.jdbc.driver.T4CConnection)
at
oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at 

Re: tomcat 6.0.29 hung

2010-10-22 Thread Jason Britton
(JspRuntimeLibrary.java:968)
at 
org.apache.jsp.templates.home.home_005ftemplate_jsp._jspService(home_005ftemplate_jsp.java:149)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
at 
com.mycompany.servlet.filters.NavigationFilter.retrieveTemplate(NavigationFilter.java:381)
at 
com.mycompany.servlet.filters.NavigationFilter.doFilter(NavigationFilter.java:185)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at 
org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:427)
at 
org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384)
at 
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2087)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)





On Fri, Oct 22, 2010 at 6:34 AM, Caldarale, Charles R
chuck.caldar...@unisys.com wrote:

 From: Jason Britton [mailto:jbritto...@gmail.com]
  Subject: Re: tomcat 6.0.29 hung


  My thoughts are this is the thread causing all the backup
  AJP Thread 1 RUNNABLE, sitting on socketRead0, Has locked
  0x2aaad303cad0 (a com.acompany.model.customer.CustomerData)
  which almost all other threads are blocked waiting for lock on

 Which means you have an extremely poor application design.  The webapp should 
 never set a global lock and then make a database request.  Either the lock 
 must be of much finer granularity, or not set until after the DB request is 
 responded to.

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you received 
 this in error, please contact the sender and delete the e-mail and its 
 attachments from all computers.


 -
 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: tomcat 6.0.29 hung

2010-10-22 Thread Jason Britton
one of two of the hanging applications are doing db connection validation.

The application using DBCP configures it's SharedPoolDataSource using

setValidationQuery(select 'validationQuery' from dual);
setTestOnBorrow(true);

Funny enough, thread stacktrace below shows thread hung when doing
validation query sitting on socket read.  Other application not using
DBCP and not using connection validation query hangs on socket read
just the same.  Web server lives in DMZ crosses firewall to get to
database, I'm going to start accusing the network guys of crushing my
connections on firewall.  Not sure why validation query is not saving
me in this instance.

Thread stacktrace showing runnable thread sitting on socket read while
trying to do connection validation query
catalina-exec-company1-2 daemon prio=10 tid=0x4bf5b800
nid=0x41a2 runnable [0x42be1000]
   java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at oracle.net.ns.Packet.receive(Packet.java:293)
at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:174)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:119)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:94)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:79)
at 
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:112)
at 
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:73)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1040)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1016)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:588)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)
at 
oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:780)
at 
oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:855)
at 
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1187)
at 
oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1378)
- locked 0x2aaad1f64df8 (a oracle.jdbc.driver.T4CConnection)
at 
oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:387)
at 
org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory.validateObject(KeyedCPDSConnectionFactory.java:163)
at 
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:837)
- locked 0x2aaace878d18 (a
org.apache.commons.pool.impl.GenericKeyedObjectPool)
at 
org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:165)
- locked 0x2aaaced306f8 (a
org.apache.commons.dbcp.datasources.SharedPoolDataSource)
at 
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:631)
at 
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:615)
at 
com.mycompany.db.ConnectionHandler.getConnection(ConnectionHandler.java:150)

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



Re: tomcat 6.0.29 hung

2010-10-22 Thread Jason Britton
Thanks for the insight Dave.  I have several threads sitting spinning
on socket read at the moment and dba reports zero database locks of
any kind on database they're trying to read from (a qa database).
Quite baffled as to what's happening to these database connections and
why every now and then thread sits on socket read while trying to read
from database.  Situation becomes serious and app completely dead
locks when the socket read hang happens inside synchronized block.



On Fri, Oct 22, 2010 at 10:36 AM, Dave Mansfield
dmansfi...@sbcglobal.net wrote:


 Well, here's an oversight:  The threads below show concurrent execution of a
 prepared statement.  The fact that a thread own the lock, is buried well
 into executing that statement, and is waiting for a read from a socket
 doesn't mean it's an issue with the AJP - it could well be a DB locking
 problem.
 You need to examine the Oracle side of things in parallel and start looking
 at database lock contention.  I don't know the semantics of Oracle's JDBC
 driver when managing a prepared statement - especially if it's done
 concurrently, so I can't give you any trails to follow...

 I'd focus on forcing the thread holding the lock to abort on the Oracle side
 of things - if it frees up the other threads, you have a new point to start
 diagnosing...

 -- D Mansfield


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



Re: [OT] VisualVM, (was Re: tomcat 6.0.29 hung)

2010-10-21 Thread Jason Britton
I'll definitely will take a look at the standalone release.  Thanks for the
info.  I'm going to throw Cygwin/X on my desktop machine to hopefully be
able to pull up jvisualvm remotely and/or just use standalone version.
Perhaps Cygwin/X would also allow you to pull up VisualGC remotely?



On Thu, Oct 21, 2010 at 2:25 AM, Pid p...@pidster.com wrote:

 On 21/10/2010 00:11, Jason Britton wrote:

  Highly recommend trying out jvisualvm (it's in your jdk bin) if you're
  running 1.6.

 There's a standalone release - 1.3.1 - with more plugins  some slightly
 shinier toys.

  https://visualvm.dev.java.net/

 Even if you can't run it on the same machine as the Tomcat process
 you're inspecting, it's still pretty handy.  If there was just a way to
 get VisualGC to work remotely...


 p





Re: tomcat 6.0.29 hung

2010-10-21 Thread Jason Britton
Hi Martin,
In researching my jstack not working issue I too came across the make sure
you run jstack as the same user that tomcat is running as.  So I did try
su'ing to my tomcat user and issuing the jstack -F -l -m pid command to no
avail.  After I reproduce my application deadlock again this morning
(hopefully) I'll try jstack again without the -F and I'll also try the kill
-QUIT.  I did not have to enable JMX on this particular tomcat instance in
order to use jvisualvm.  I don't think jmx comes in to play when using
jvisualvm.  I just went into our server room and pulled up a terminal window
right off the server's desktop in order to launch jvisualvm (going to hookup
cygwin/x instead shortly).

Even though jvisualvm was unable to retrieve stacktraces for the threaddumps
and pull them into it's GUI for display (exception while walking
stacktrace) every time I issued a thread dump command through jvisualvm it
did indeed dump all my thread info + stacktraces into my tomcat logs, it
just couldn't pull it into the GUI for some reason.

Wesley: I now do think my initial kill -QUIT worked as well, I just didn't
check the right log or for some reason was expecting it to dump to the
command line rather than in my tomcat logs where it did go.

Mark: Definitely going to update those dbcp libs.  First step for me is to
try and find a way to reliably reproduce hangup so I'll have a test case to
come back to in order to verify any subsequent fixes actually did the job.

Thanks for the input -   Jason






On Thu, Oct 21, 2010 at 6:02 AM, Martin Kuen martin.k...@gmail.com wrote:

 jason,

 Out of personal interest I have a question about the way you use jstack. I
 came across this jstack cannot take dump of hung process problem before.
 I
 once witnessed the same exceptions when chasing a deadlock.

 This happened to me on ubuntu 10.4.0 (and 10.4.1) 64-bit using sun's jdk
 1.6.0_21

 My mistake was to invoke jstack as a different user, that is, not the user
 which is running the given java application (e.g. root instead of tomcat6).
 Invoking jstack with the -F option as root showed these exceptions, whereas
 kill -QUIT didn't produce anything and jstack without -F failed as well.

 As a quick workaround I changed /etc/passwd to allow the user tomcat6 to
 use
 a shell. Issuing a su tomcat6 as root I was able to get jstack (and kill
 -QUIT) working. Disclaimer: I don't know how tomcat is packaged for Red
 Hat.

 I tried to check this with so. who actually claimed that his jvm was hung
 when he tried to get a stack-trace. However, I was told that the problem no
 longer exists (no hung jvm anymore) and the investigation ceased.

 This is were you come into play :)

 It appears to me that hung application alone does not imply that -F is
 required. So, if my application enters a infinite loop or gets stuck in a
 deadlock my application is unresponsive and will most likely be referred to
 as hung, but the vm is actually functioning perfectly. It's just my
 application, that, well, . . . .

 In my case I was able to get a stacktrace from an application which was
 stuck in a deadlock (log4j with multiple appenders, multiple threads using
 the same Logger instance) without using -F at all.

 When you use jvisualvm you most likely do so by enabling (and connecting
 through) jmx (true?). I believe it's correct to claim that this is at least
 a different way of attaching to the vm, than using jstack from the
 comandline. Could be the reason why you were suddenly able to get a
 thread
 dump.

 Could you give it a shot?


 Best Regards,

 Martin



Re: Problems with logging.properties

2010-10-20 Thread Jason Britton
Have you tried being less than class specific in your log level assignment?
Instead of

org.springframework.beans.factory.config.FieldRetrievingFactoryBean.level =
WARNING
org.springframework.beans.factory.support.DefaultListableBeanFactory.level =
WARNING
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.level =
WARNING

try
org.springframework.beans.factory.level=WARNING

of course that may not be desired, but worth a shot.

If that has no affect, try moving those three class level assignments or
single package log level assignment to right after this line
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter

Just things I would try.




On Wed, Oct 20, 2010 at 7:40 AM, Edson Carlos Ericksson Richter 
edsonrich...@hotmail.com wrote:


  By It works I want to mean, some changes works (like the filename), but
 the specific filters does not.

 Please advise.


 Edson.


 Em 19/10/2010 21:04, Edson Carlos Ericksson Richter escreveu:


  It works:

 file:///C:/Users/Edson/.netbeans/6.9/apache-tomcat-6.0.26_base/logs/somethingelse.2010-10-19.log


 (I'm running Tomcat from inside NetBeans, in Windows platform - I have
 also similar configuration in Ubuntu Server 10.10 with Tomcat alone).


 Edson.


 Em 19/10/2010 20:43, Jason Britton escreveu:

 Just for your sanity, to make sure there are no other logging.properties
 files in your classpath, change the prefix for your FileHandler to
 something
 other than catalina so you can be sure this logging.properties file is
 the
 one being used for your logging config.  If your prefix remains
 catalina...
 do a find and hunt down the other logging.properties being picked up.

 1catalina.org.apache.juli.FileHandler.prefix = catalina.
 to
 1catalina.org.apache.juli.FileHandler.prefix=somethingdifferent.




 On Tue, Oct 19, 2010 at 3:30 PM, Edson Carlos Ericksson Richter
 edsonrich...@hotmail.com  wrote:

   Dear all,

 I've already spent lot's of time trying to make some Spring Framework
 messages go away from my log, without success. My last configuration is:
 /** Begin of file **/
 handlers = 1catalina.org.apache.juli.FileHandler,
 2localhost.org.apache.juli.FileHandler,
 3manager.org.apache.juli.FileHandler,
 4host-manager.org.apache.juli.FileHandler,
 java.util.logging.ConsoleHandler
 .handlers = 1catalina.org.apache.juli.FileHandler,
 java.util.logging.ConsoleHandler
 1catalina.org.apache.juli.FileHandler.level = INFO
 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
 1catalina.org.apache.juli.FileHandler.prefix = catalina.
 2localhost.org.apache.juli.FileHandler.level = INFO
 2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
 2localhost.org.apache.juli.FileHandler.prefix = localhost.
 3manager.org.apache.juli.FileHandler.level = INFO
 3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
 3manager.org.apache.juli.FileHandler.prefix = manager.
 4host-manager.org.apache.juli.FileHandler.level = INFO
 4host-manager.org.apache.juli.FileHandler.directory =
 ${catalina.base}/logs
 4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
 java.util.logging.ConsoleHandler.level = INFO
 java.util.logging.ConsoleHandler.formatter =
 java.util.logging.SimpleFormatter
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level =
 FINE
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
 2localhost.org.apache.juli.FileHandler
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level

 = FINE
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers

 = 3manager.org.apache.juli.FileHandler
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level

 = FINE
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers

 = 4host-manager.org.apache.juli.FileHandler
 org.springframework.beans.factory.config.FieldRetrievingFactoryBean.level
 =
 WARNING
 org.springframework.beans.factory.support.DefaultListableBeanFactory.level

 = WARNING
 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.level =
 WARNING
 /** End of file **/

 The last 3 lines just does makes no effect at all, see the log output
 (more
 than 100 lines like that):
 /** Begin of Log **/
 19/10/2010 20:19:49
 org.springframework.beans.factory.support.DefaultListableBeanFactory
 registerBeanDefinition
 INFO: Overriding bean definition for bean 'thermometerType': replacing
 [Generic bean: class
 [org.springframework.beans.factory.config.FieldRetrievingFactoryBean];
 scope=singleton; abstract=false; lazyInit=false; autowireMode=0;
 dependencyCheck=0; autowireCandidate=true; primary=false;
 factoryBeanName=null; factoryMethodName=null; initMethodName=null;
 destroyMethodName=null] with [Generic bean: class
 [org.springframework.beans.factory.config.FieldRetrievingFactoryBean];
 scope=singleton; abstract=false; lazyInit=false; autowireMode=0;
 dependencyCheck=0

tomcat 6.0.29 hung

2010-10-20 Thread Jason Britton
I have a tomcat instance hanging up (and currently still hung up) and would
really appreciate pointers on how to debug further.
A belated thanks to Konstantin for the info on kill -QUIT pid to retrieve
thread dumps But I was only able to pull thread dumps on the hung process
using jvisualvm.  Process failed to respond to kill -QUIT for unknown
reasons.

Environment:
Tomcat 6.0.29 - using native APR, running on 64-bit RHEL 5.5 - 32 GB ram
java version 1.6.0_21
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)

I pulled 4 thread dumps in a 10 minute span on hung tomcat process after it
was reported to be non-responsive.  Unfortunately not any differences
between thread dumps and to my great dismay jstack is unable to retrieve any
stacktraces on any of the threads reporting the following error:

Error occurred during stack walking:
sun.jvm.hotspot.debugger.DebuggerException:
sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at
sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:152)
at
sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:466)
at
sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:65)
at
sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess.getCurrentFrameGuess(LinuxAMD64JavaThreadPDAccess.java:92)


From my googling this appears to be an unfixed bug with jstack, I sure would
like to be wrong about that so I could get some stacktrace info on the
threads of my hung process.

Any thoughts on how to possibly get stacktrace info on these threads with
jstack broken(?) on my environment and any ideas on how to proceed with
debugging this situation would be greatly appreciated.  Thanks -  Jason

Thread dump from hung tomcat process
Thread 27817 catalina-exec-foo-20: (state = BLOCKED)
Thread 27267 catalina-exec-foo-19: (state = BLOCKED)
Thread 27082 catalina-exec-foo-18: (state = BLOCKED)
Thread 26591 catalina-exec-foo-17: (state = BLOCKED)
Thread 25899 catalina-exec-foo-16: (state = BLOCKED)
Thread 25590 catalina-exec-foo-15: (state = BLOCKED)
Thread 25589 catalina-exec-foo-14: (state = BLOCKED)
Thread 25586 catalina-exec-foo-13: (state = BLOCKED)
Thread 25578 catalina-exec-foo-12: (state = BLOCKED)
Thread 25565 catalina-exec-foo-11: (state = BLOCKED)
Thread 17427 Thread-40: (state = BLOCKED)
Thread 9128 Thread-39: (state = IN_NATIVE)
Thread 16811 catalina-exec-foo-10: (state = BLOCKED)
Thread 16810 catalina-exec-foo-9: (state = BLOCKED)
Thread 16809 catalina-exec-foo-8: (state = IN_NATIVE)
Thread 16808 catalina-exec-foo-7: (state = BLOCKED)
Thread 16807 catalina-exec-foo-6: (state = IN_NATIVE)
Thread 16806 catalina-exec-foo-5: (state = BLOCKED)
Thread 16805 Thread-8: (state = BLOCKED)
Thread 16804 catalina-exec-foo-4: (state = BLOCKED)
Thread 16803 catalina-exec-foo-3: (state = BLOCKED)
Thread 16802 catalina-exec-foo-2: (state = IN_NATIVE)
Thread 16801 catalina-exec-foo-1: (state = IN_NATIVE)
Thread 16791 ajp-9009-Acceptor-0: (state = IN_NATIVE)
Thread 16790 ajp-9009-CometPoller-0: (state = BLOCKED)
Thread 16789 ajp-9009-Poller-0: (state = IN_NATIVE)
Thread 16788 http-8080-Acceptor-0: (state = IN_NATIVE)
Thread 16787 http-8080-Sendfile-0: (state = BLOCKED)
Thread 16786 http-8080-CometPoller-0: (state = BLOCKED)
Thread 16785 http-8080-Poller-0: (state = BLOCKED)
Thread 16784 ContainerBackgroundProcessor[StandardEngine[Catalina]]:
(state = BLOCKED)
Thread 16783 Thread-6: (state = BLOCKED)
Thread 16782 Thread-5: (state = BLOCKED)
Thread 16781 Thread-4: (state = BLOCKED)
Thread 16780 Thread-3: (state = BLOCKED)
Thread 16778 Thread-2: (state = BLOCKED)
Thread 16777 GC Daemon: (state = BLOCKED)
VM Thread 16775 Low Memory Detector: (state = BLOCKED)
VM Thread 16774 CompilerThread1: (state = BLOCKED)
VM Thread 16773 CompilerThread0: (state = BLOCKED)
Thread 16772 Signal Dispatcher: (state = BLOCKED)
Thread 16771 Finalizer: (state = BLOCKED)
Thread 16770 Reference Handler: (state = BLOCKED)
Thread 16764 main: (state = IN_NATIVE)


Re: tomcat 6.0.29 hung

2010-10-20 Thread Jason Britton
commons-dbcp-1.2.1.jar
and
commons-pool-1.3.jar

I have a connection handler class that I wrote around a static instance of
SharedPoolDataSource.  SharedPoolDataSource gets initialized in static
block.  Locking shown in stacktrace is occurring within
aSharedPoolDataSource.getConnection() call.  The lock on
aSharedPoolDataSource is never given up, all other threads back up waiting
to get db connection.  I'll start by updating my those jars, I'm certain
this is self inflicted wound and not a bug in either library.

catalina-exec-foo1-2 daemon prio=10 tid=0x4bf5b800 nid=0x41a2
runnable [0x42be1000]
   java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at oracle.net.ns.Packet.receive(Packet.java:293)
at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:174)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:119)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:94)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:79)
at
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:112)
at
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:73)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1040)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1016)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:588)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)
at
oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:780)
at
oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:855)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1187)
at
oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1378)
- locked 0x2aaad1f64df8 (a oracle.jdbc.driver.T4CConnection)
at
oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:387)
at
org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory.validateObject(KeyedCPDSConnectionFactory.java:163)
at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:837)
- locked 0x2aaace878d18 (a
org.apache.commons.pool.impl.GenericKeyedObjectPool)
at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:165)
- locked 0x2aaaced306f8 (a
org.apache.commons.dbcp.datasources.SharedPoolDataSource)
at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:631)
at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:615)
at
mycompany.db.ConnectionHandler.getConnection(ConnectionHandler.java:150)


Re: Struts 2 help with Tomcat 6

2010-10-18 Thread Jason Britton
This gives a little more detail than whatever you're currently looking at

http://struts.apache.org/2.2.1/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html



On Mon, Oct 18, 2010 at 7:07 PM, Josh Gooding josh.good...@gmail.comwrote:

 Hello all,

 I'm trying to get Struts 2.2.1 working with Tomcat 6.0.29.  I'm a total
 newbie to struts.  Apache's documentation says copy the struts.jar file
 into
 the /lib directory.  Since Struts 2.2.1 has no struts.jar file, does anyone
 happen to know which file(s) is/are supposed to be moved to get Struts 2 to
 work?

 Thanks in advance

 - Josh



Tomcat hung - still processing a request that has yet to finish

2010-10-12 Thread Jason Britton
Hi all,
Tomcat 6.0.29 on 64bit RHEL 5.5.  This particular tomcat instance had been
running fine for several days, today hung, stopped responding to requests,
no interesting log messages appeared until calling shutdown.sh.  Then the
following appeared:

(appears multiple times at end of log)
ERROR 10/12/2010 10:49:49:225 AM main
apache.catalina.loader.WebappClassLoader
The web application [] is still processing a request that has yet to finish.
This is very likely to create a memory leak. You can control the time
allowed for requests to finish by using the unloadDelay attribute of the
standard Context implementation.

ERROR 10/12/2010 10:49:49:247 AM main
apache.catalina.loader.WebappClassLoader
The web application [] appears to have started a thread named [Thread-35]
but has failed to stop it. This is very likely to create a memory leak.

ERROR 10/12/2010 10:49:49:248 AM main
apache.catalina.loader.WebappClassLoader
The web application [] appears to have started a thread named [Thread-46]
but has failed to stop it. This is very likely to create a memory leak.

The shutdown.sh script did not stop Tomcat and the process lives on.  I can
kill -9 it but didn't know if there was any additional information I could
gather before stopping it.  Suggestions on how best to debug and figure out
exactly what requests are hanging up tomcat would be greatly appreciated.
Thanks a lot for any suggestions,

Jason


Re: Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe

2010-10-06 Thread Jason Britton
To your mysql Resource definition below I would add
validationQuery=SELECT 1

That should prevent your application from getting handed stale db
connections from your pool.  Take a look at the testOnBorrow and
validationQuery definitions here
http://commons.apache.org/dbcp/configuration.html

Jason



On Wed, Oct 6, 2010 at 8:18 PM, Steve Ryder sry...@jsrsys.com wrote:

 I am getting this during mysql connection (about once a week).
 I have read the thread on MySQL forum, which has a solution, but the link
 to the solution is broken and points back to the same page.
 Suggestions have been use autoconnect=true
 Another was that the server timeout was shorter than the connection
 time-out.
 I have the following:
 In server.xml:
 Connector port=80 maxHttpHeaderSize=8192
  maxThreads=192 minSpareThreads=32 maxSpareThreads=128
  enableLookups=false redirectPort=8443 acceptCount=128
  connectionTimeout=2 disableUploadTimeout=true /
 In context.xml
 Resource name=jdbc/MySql auth=Container type=javax.sql.DataSource
  url=jdbc:mysql://localhost.localdomain/rsa?autoReconnect=true
factory=org.apache.commons.dbcp.BasicDataSourceFactory
  driverClassName=com.mysql.jdbc.Driver
  password=jsrsys username=jsrsys
maxWait=1   maxActive=200  maxIdle=5
  removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true
 /
 Note that maxWait is 1/2 of connectionTimeout and I have
 autoReconnect=true.
 Any ideas.   This is low priority as users are able to reconnect by just
 pressing Refresh, but I would like this to go away.

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




Re: conf/Catalina/HOST/contextname.xml being removed

2010-09-22 Thread Jason Britton
Glad you brought this back up P - was cursing this problem again yesterday.
So if tomcat 6.0.29 is running and my foo webapp is deployed, if I dare copy
in foo.war for auto re-deployment tomcat nukes my foo.xml context definition
in conf/Catalina/HOST/ directory.  Absolutely maddening.  Is this expected
behavior?  It seems that you wouldn't want external configuration files
removed on a redeployment.  Of course I'm just testing out a new system and
in production I'm not sure I'd be just copying in a new war file and calling
that a redeployment...  I'll change permissions on that file and see what
happens.  Thanks for your insights.

Jason


On Wed, Sep 22, 2010 at 10:54 AM, Pid p...@pidster.com wrote:

 On 10/09/2010 01:03, Jason Britton wrote:
  Could anyone give me an explanation what might cause my webapp's context
  configuration to be deleted out of the tomcat/conf/Catalina/[HOST]/
  directory?  I've got a foo.war file in the webapps directory, it gets
  exploded upon startup. It has its context definition residing in the file
  conf/Catalina/[HOST]/foo.xml.  Every now and then foo.xml just gets up
 and
  blown away from the tomcat/conf/Catalina/[HOST]/ directory, usually upon
 a
  tomcat shutdown and startup.  Any suggestions on what might be causing
 this
  deletion and how to prevent it from occurring would be greatly
 appreciated.

 Check the exact date of the file and system time.

 Make it readonly and look out for a stack trace.

 Seems like a weird issue for 6.0.29 - does it only occur during
 shutdown, or startup as well (even weirder), any other time?

  Running tomcat 6.0.29 on 64-bit RHEL 5.5.

 Much obliged.


 p




Re: context.xml being deleted out of conf/Catalina/[HOST]/ directory

2010-09-11 Thread Jason Britton
So even if my context still exists in exploded form in the webapps directory
and I remove the .war form of the context, it'll remove the associated
context.xml from the conf/Catalina/HOST/ directory?


On Sat, Sep 11, 2010 at 8:12 AM, Wesley Acheson wesley.ache...@gmail.comwrote:

 On Fri, Sep 10, 2010 at 6:36 PM, Jason Britton jbritto...@gmail.com
 wrote:
  Could anyone give me an explanation what might cause my webapp's context
  configuration to be deleted out of the tomcat/conf/Catalina/[HOST]/
  directory?  I've got a foo.war file in the webapps directory, it gets
  exploded upon startup. It has its context definition residing in the file
  conf/Catalina/[HOST]/foo.xml.  Every now and then foo.xml just gets up
 and
  blown away from the tomcat/conf/Catalina/[HOST]/ directory, usually upon
 a
  tomcat shutdown and startup.  Any suggestions on what might be causing
 this
  deletion and how to prevent it from occurring would be greatly
 appreciated.
  Running tomcat 6.0.29 on 64-bit RHEL 5.5.  Thanks a lot for your help,
 
  Jason
 

 Hi Jason,

 If you remove the war file your assoiated context files will be
 deleted. Do you think this may be related?

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




context.xml being deleted out of conf/Catalina/[HOST]/ directory

2010-09-10 Thread Jason Britton
Could anyone give me an explanation what might cause my webapp's context
configuration to be deleted out of the tomcat/conf/Catalina/[HOST]/
directory?  I've got a foo.war file in the webapps directory, it gets
exploded upon startup. It has its context definition residing in the file
conf/Catalina/[HOST]/foo.xml.  Every now and then foo.xml just gets up and
blown away from the tomcat/conf/Catalina/[HOST]/ directory, usually upon a
tomcat shutdown and startup.  Any suggestions on what might be causing this
deletion and how to prevent it from occurring would be greatly appreciated.
Running tomcat 6.0.29 on 64-bit RHEL 5.5.  Thanks a lot for your help,

Jason


conf/Catalina/HOST/contextname.xml being removed

2010-09-09 Thread Jason Britton
Could anyone give me an explanation what might cause my webapp's context
configuration to be deleted out of the tomcat/conf/Catalina/[HOST]/
directory?  I've got a foo.war file in the webapps directory, it gets
exploded upon startup. It has its context definition residing in the file
conf/Catalina/[HOST]/foo.xml.  Every now and then foo.xml just gets up and
blown away from the tomcat/conf/Catalina/[HOST]/ directory, usually upon a
tomcat shutdown and startup.  Any suggestions on what might be causing this
deletion and how to prevent it from occurring would be greatly appreciated.
Running tomcat 6.0.29 on 64-bit RHEL 5.5.

Jason


Re: interaction between .forward() and security-constraint

2010-09-04 Thread Jason Britton
I would look at a servlet filter to provide this sort of dynamic access
control.  Map urls of your choosing to pass through this servlet filter, the
servlet filter could look up potentially changing list of access control
rules and route request to login page or whatever page you'd like if user is
not allowed to access resource.

Jason


On Sat, Sep 4, 2010 at 1:28 AM, Brian McBride
bwm.topmea...@googlemail.comwrote:


  Hi,

 I want to implement discretionary access control in an app running in
 Tomcat - i.e. access controls on URLs served by Tomcat can be changed by
 users.  I expect to have a 1M resources each with its own ACL.  Some
 resources have 'public' access.  No authentication should be required to
 access them.  Access to some resources is constrained and does require
 authentication.  The same resource may be access controlled one minute and
 public the next.  The URL of a resource may not change when its ACL changes.

 I have been approaching this by trying to use the built in Tomcat
 authentication and creating my own authorization filter.  The problem I'm
 hitting is that getRemoteUser is returning null.  I believe the reason it is
 returning null is that I have no auth-constraint element in my security
 constraint:

 security-constraint
 display-nameAuthenticate/display-name
 web-resource-collection
 web-resource-nameresources/web-resource-name
 description/description
 url-pattern/*/url-pattern
 http-methodGET/http-method
 http-methodPOST/http-method
 http-methodHEAD/http-method
 http-methodPUT/http-method
 http-methodOPTIONS/http-method
 http-methodTRACE/http-method
 http-methodDELETE/http-method
 /web-resource-collection
 /security-constraint

 Despite the fact that I have arranged for the incoming request to have an
 Authorization header (I send my own 401 responses), Tomcat does not process
 it unless the there is an auth-constraint that applies to the requested
 resource.  This is consistent with what the servlet spec says:

 [[An authorization constraint establishes a requirement for authentication
 ...]]

 I want to have no authorization constraint because some resources have
 public access and no authentication is required for access to those
 resources.

 I have tried using getRequestDispatcher(...).forward(...) to forward
 requests for resources that require authentication to a different URL and
 defining a different security constraint for those URLs:

 security-constraint
 display-nameAuthenticate/display-name
 web-resource-collection
 web-resource-nameauthenticated resources/web-resource-name
 description/description
 url-pattern/authenticated/*/url-pattern
 http-methodGET/http-method
 http-methodPOST/http-method
 http-methodHEAD/http-method
 http-methodPUT/http-method
 http-methodOPTIONS/http-method
 http-methodTRACE/http-method
 http-methodDELETE/http-method
 /web-resource-collection
 auth-constraint
 role-nameREGISTERED/role-name
 /auth-constraint
 /security-constraint

 getRemoteUser() still returns null.  .forward() does not seem to be subject
 to security checks.  I have found nothing in the Servlet spec that tells me
 what the behaviour should be.

 I have three questions:

 1) Is there a way I can programatically cause the authentication check?

 [Currently I send my own 401 response if authentication is required.   If a
 call to getRemoteUser() were to cause the processing of a present
 Authorization header, if that processing had not been done already,  that
 would support my approach.  I don't yet know if/how I could compute an
 appropriate challenge for the 401 responses I generate for digest
 authentication, which I would want to use preference to Basic
 authentication.]

 2) Is there another way to implement discretionary access control, other
 than implementing my own authentication mechanism?  Has anyone else solved
 this problem?

 3) Is Tomcat's behaviour 'correct'?  There may be good reason for the
 current interpretation of the spec, but from my point of view allowing
 .forward() to circumvent declared security constraints is questionable.

 I am using Tomcat 6.0.29.  Sorry its such a long winded mail.

 Brian






Re: OFFTOPIC: Java String problem - possible VM bug

2010-08-30 Thread Jason Britton
What version tomcat?


On Mon, Aug 30, 2010 at 3:38 PM, Steffen Heil li...@steffen-heil.de wrote:

 Hi

 I am sorry, I am asking something not really related to tomcat here.
 While this may sound like a beginners question, I think I really what I am
 doing in java, but this time I suspect I have found a scenario where the
 sun/oracle VM exposes a bug with pure String handling.

 So anyone who can find a bug in the procedure posted below is very welcome.
 So is everyone who can direct me to some place better suited to ask this
 question.

 Finding bugs in a static method that only takes immutable arguments usually
 seems easy... Turns out, it is not.

 However, please note that I already tried to debug this in various ways and
 the exception does NOT occur, as soon as a debugger is attached. The
 exception is only thrown under 64bit Linux Server-VM, within tomcat. It is
 neither thrown under 64bit Windows, nor on the very same Linux VM as
 standalone testcase, nor when a debugger is remotely attached. The JREs
 testest are 1.6u20 and 1.6u21.

 The code in question is the following:


@SuppressWarnings( null )
public final static String replaceAll( String stack, String ...
 replacements )
{
try {
if ( stack == null )
return stack;
int index, pos;
String niddle = null, string;
int niddleLength, stringLength;
for ( index = 0; true; index += 2 ) {
if ( index = replacements.length )
return stack;
niddle = replacements[ index ];
pos = stack.indexOf( niddle );
if ( pos != - 1 )
break;
}
StringBuilder buffer = new StringBuilder( stack );
niddleLength = niddle.length();
string = replacements[ index + 1 ];
if ( string == null )
do
buffer.delete( pos, pos +
 niddleLength );
while ( ( pos = buffer.indexOf( niddle, pos
 ) ) != - 1 );
else {
stringLength = string.length();
do {
 /*331*/ buffer.replace( pos, pos + niddleLength,
 string );
pos += stringLength;
} while ( ( pos = buffer.indexOf( niddle,
 pos ) ) != - 1 );
}
index += 2;
for ( ; index  replacements.length; index += 2 ) {
niddle = replacements[ index ];
string = replacements[ index + 1 ];
niddleLength = niddle.length();
if ( string == null )
for ( pos = 0; ( pos =
 buffer.indexOf( niddle, pos ) ) != - 1; )
buffer.delete( pos, pos +
 niddleLength );
else {
stringLength = string.length();
for ( pos = 0; ( pos =
 buffer.indexOf( niddle, pos ) ) != - 1; pos += stringLength )
buffer.replace( pos, pos +
 niddleLength, string );
}
}
return buffer.toString();
} catch ( Throwable t ) {
  (code to dump the arguments and the stack trace) ...
}
}


 Note, that when the method is called, there are two arguments: one String
 and a String[] with a length of 1004 Strings (I guarantee that this
 String array is NOT modified during execution, not even afterwards.)
 The execption is (it is thrown indirectly in the marked line 331):

 java.lang.StringIndexOutOfBoundsException: start  length()
at
 java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:799)
at java.lang.StringBuilder.replace(StringBuilder.java:271)
at
 com.osiris4.core.utils.StringUtils.replaceAll(StringUtils.java:331)



 I can provide real arguments that lead to this exception, however, as there
 are more than 1000 Strings (partially large ones) involved, I will skip
 them
 here.
 Anyone interested will get them by mail. I have various samples.


 Currently this prevents loading my web application in about one of three
 times. (And it also happens during internal computations which prevents
 further work.) Sometimes this error can be reproduced (by restarting
 tomcat) 10 times in a row, sometimes it does not 

Re: OFFTOPIC: Java String problem - possible VM bug

2010-08-30 Thread Jason Britton
From your original post
The exception is only thrown under 64bit Linux Server-VM, within tomcat. It
is neither thrown under 64bit Windows, nor on the very same Linux VM as
standalone testcase, nor when a debugger is remotely attached.


Sounds like you're saying it only happens within Tomcat, sooo. kinda
would seem version(s) of tomcat this has manifested itself within would be
helpful for those debugging to have exact same environment from which to try
and replicate the *bug.  Either you misposted or I'm misunderstanding.
Either way, I have same environment, I'll try and reproduce.




On Mon, Aug 30, 2010 at 4:01 PM, Steffen Heil li...@steffen-heil.de wrote:

 Hi

  What version tomcat?

 I see this under 6.0.29 [and I think under 6.0.18 before, but I am not
 sure], but as this is pure java code, not calling any tomcat code and not
 probably affected by tomcat code, I don't think that matters. (That's why I
 labeled that off-topic.)

 However, if it even could be of any help solving this mystery, I will
 provide any information needed.

 Regards,
   Steffen

 
 
  On Mon, Aug 30, 2010 at 3:38 PM, Steffen Heil li...@steffen-heil.de
 wrote:
 
   Hi
  
   I am sorry, I am asking something not really related to tomcat here.
   While this may sound like a beginners question, I think I really what
   I am doing in java, but this time I suspect I have found a scenario
   where the sun/oracle VM exposes a bug with pure String handling.
  
   So anyone who can find a bug in the procedure posted below is very
  welcome.
   So is everyone who can direct me to some place better suited to ask
   this question.
  
   Finding bugs in a static method that only takes immutable arguments
   usually seems easy... Turns out, it is not.
  
   However, please note that I already tried to debug this in various
   ways and the exception does NOT occur, as soon as a debugger is
   attached. The exception is only thrown under 64bit Linux Server-VM,
   within tomcat. It is neither thrown under 64bit Windows, nor on the
   very same Linux VM as standalone testcase, nor when a debugger is
   remotely attached. The JREs testest are 1.6u20 and 1.6u21.
  
   The code in question is the following:
  
  
  @SuppressWarnings( null )
  public final static String replaceAll( String stack, String ...
   replacements )
  {
  try {
  if ( stack == null )
  return stack;
  int index, pos;
  String niddle = null, string;
  int niddleLength, stringLength;
  for ( index = 0; true; index += 2 ) {
  if ( index = replacements.length )
  return stack;
  niddle = replacements[ index ];
  pos = stack.indexOf( niddle );
  if ( pos != - 1 )
  break;
  }
  StringBuilder buffer = new StringBuilder( stack
 );
  niddleLength = niddle.length();
  string = replacements[ index + 1 ];
  if ( string == null )
  do
  buffer.delete( pos, pos +
   niddleLength );
  while ( ( pos = buffer.indexOf( niddle,
   pos
   ) ) != - 1 );
  else {
  stringLength = string.length();
  do {
   /*331*/ buffer.replace( pos, pos +
 niddleLength,
   string );
  pos += stringLength;
  } while ( ( pos = buffer.indexOf(
   niddle, pos ) ) != - 1 );
  }
  index += 2;
  for ( ; index  replacements.length; index += 2
 )
 {
  niddle = replacements[ index ];
  string = replacements[ index + 1 ];
  niddleLength = niddle.length();
  if ( string == null )
  for ( pos = 0; ( pos =
   buffer.indexOf( niddle, pos ) ) != - 1; )
  buffer.delete( pos, pos
   + niddleLength );
  else {
  stringLength = string.length();
  for ( pos = 0; ( pos =
   buffer.indexOf( niddle, pos ) ) != - 1; pos += stringLength )
  buffer.replace( pos,
   pos + niddleLength, string );
  }
  }
  return 

Re: separating deployment of classes/lib/config from web content (jsp's/html)

2010-08-25 Thread Jason Britton
:)  I got a good laugh out of your response Christopher and I
appreciate you taking the time to guide a possibly astray developer
but let me hopefully put your mind somewhat at ease in regards to our
development practices/environment.  Not claiming we have anything
resembling a perfect process either.  We have a separate department
that is more marketing/static content than it is anything, they'll put
their own stuff up on the website that for the most part is not under
revision control, but backed up and they each have their own local
copies, heavy dreamweaver users and we'll give them tag libraries to
use for some dynamic content here and there.  All our tag libraries,
main web workflows (ecommerce), search functionality, page templates
etc. are under revision control, we are happy subversion users after
escaping from starteam some time ago.  Our classes, web.xml, libs are
deployed in one war file for our main site, deployment configuration
*managed by JDeveloper project, I'm not proud of this but we are
migrating off of Oracle app server and I plan to take a look at
Eclipse for ide and change our project builds to use maven or ant.  We
have other traditional web apps whose content/config/classes/libs are
all traditionally packed up and deployed in a war.

As for my previous problem separating config/lib/classes from content.
 I ended up using a symlink on WEB-INF directory on ROOT context, I've
got app called foo, ROOT/WEB-INF is symlinked to FOO's WEB-INF
directory.  I can redeploy FOO and ROOT gets new config/classes/lib
via symlink and I don't have to worry about docBase of ROOT getting
undeployed.  Tried aliases context attribute in 7.0, just couldn't get
it to provide same separation symlink did, or I just wasn't using it
correctly.

Jason


 I would have to resort to hand copying in
 class file/config and lib changes into the WEB-INF so as not to risk losing
 any content files on a redeployment.

 This also sounds completely insane.

 You need to have a sane deployment process. Generally, when developing a
 web application, you can feel free to have all your .java files, .jsps,
 static content, etc. scattered all over the place. Once it's time to
 deploy, though, it's time to sew everything up into a WAR (whether it's
 actually a .war file or just on the disk with the same directory/file
 structure). I highly recommend using Apache ant for this sort of thing:
 there's a war command that you can use where you can specify all the
 places where source files should come from. Boom: instant .war file.


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



Re: separating deployment of classes/lib/config from web content (jsp's/html)

2010-08-24 Thread Jason Britton


 The short answer is: you can't separate the components of a webapp out
 into separate locations.



Thanks for the response P.  Understood and agreed as to the function and
purpose of .war file.  The reasoning for the separation is that in our
current environment we have users from 3 or so other departments accustomed
to being able to drag html and jsp files up to our web server (good bad or
otherwise).  With a change to tomcat as our app server, I could provide that
same sort of access where jsp and html docs are just moved into the docBase
directory at will by multiple individuals, but I would never be able to
undeploy that directory without fear of losing all the jsp and html files
they may have tossed in there.  I would have to resort to hand copying in
class file/config and lib changes into the WEB-INF so as not to risk losing
any content files on a redeployment.

We rigged our current application server (Oracle OAS 10.1.3.4) to allow this
separation of content from configuration/classes/lib but that is neither
here nor there.

Thanks for your input.

Jason


Re: separating deployment of classes/lib/config from web content (jsp's/html)

2010-08-24 Thread Jason Britton
 In Tomcat 7 you could use an alias.

 Mark


Definitely interested.  Is there a time frame on when 7 will have a non-beta
release? Thanks for the heads up.


Jason


Re: separating deployment of classes/lib/config from web content (jsp's/html)

2010-08-24 Thread Jason Britton
I'll put tomcat 7 on our dev environment and have a go at it.  I'm
excited about the alias functionality, thanks so much for pointing it
out Mark, from the 7.0 docs:

aliases attribute of the context element:

This attribute provides a list of external locations from which to
load resources for this context. The list of aliases should be of the
form /aliasPath1=docBase1,/aliasPath2=docBase2 where aliasPathN must
include a leading '/' and docBaseN must be an absolute path to either
a .war file or a directory.

A resource will be searched for in the first docBaseN for which
aliasPathN is a leading path segment of the resource. If there is no
such alias, then the resource will be searched in the usual way.

Using '/' as an aliasPath is not allowed. Consider using docBase instead.

**These external locations will not be emptied if the context is un-deployed.**



On Tue, Aug 24, 2010 at 1:19 PM, Mark Thomas ma...@apache.org wrote:

 On 24/08/2010 20:00, Jason Britton wrote:
  In Tomcat 7 you could use an alias.
 
  Mark
 
 
  Definitely interested.  Is there a time frame on when 7 will have a non-beta
  release? Thanks for the heads up.

 The more people that test it and report problems, the sooner it will be
 out of beta. Hint, hint :)

 Some *very* rough download stats from the middle of last month suggest
 that the split for downloads was:
 5.5.x - 60%
 6.0.x - 30%
 7.0.x - 10%

 Given that those figures would are for 7.0.0 and the bug fixes that went
 into 7.0.2, that is actually quite encouraging.

 There is no fixed time-scale but the signs are encouraging for it being
 relatively soon.

 Mark

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



Re: Session problem

2010-08-24 Thread Jason Britton
Stephen - your statement doesn't really make sense in context to the
problem he described or how I replied.  From Hisham's first post I
believe he's describing tabs within the context of a single web page
interface, when he clicks on any of the three tabs a request is made
(asynchronous or otherwise), request passes through a servlet filter
that checks for existence of session attribute etc..  I was suggesting
he check that he hadn't, for some unknown reason, hardcoded a
different domain for the Messages link, if that were the case that
domain (eg. localhost instead of dev2) would not have the same session
as the other links and the session attribute value he was looking for
might not be there, which would fit with what he's describing.

Jason


On Tue, Aug 24, 2010 at 3:37 PM, Stephen Caine step...@commongrnd.com wrote:
 Jason,

 As each window shares the same session, a change to the session value in one 
 window will effect the session value in the others.

 Stephen Caine

 On Aug 24, 2010, at 5:21 PM, Jason Britton wrote:

 I would make sure that the link for your Messages tab is going to the same
 domain as that your session was established under and is hitting the same
 domain as your Home and Admin links.  This doesn't seem to have anything
 to do with Tomcat though.


 On Tue, Aug 24, 2010 at 1:53 PM, Hisham mohis...@gmail.com wrote:

 Hello all,

 I have a problem that is driving me crazy.  I don't even know if its a
 Tomcat issue but maybe someone out there can help me out.

 I have a webapp that I first developed locally.  I tested this on my
 local environment (windows) and had no issues.  I then deployed the
 same app to our QA environment (linux).  There i am seeing something
 strange.  There are three main tabs, Home, Messages and Admin.
 I can go between home and admin, no probs.  But once i click on
 Messages, somehow the session on the server gets messed up.  The way i
 check whether session is valid is not is that I have a filter that
 will check if a certain attribute is present in the session or not.
 If its not, i assume the session is invalid and forward to login page.
 As soon as i click on the Messages link, i cannot do anything else;
 anywhere else i click it takes me to the login page.  I put print
 statements in my filter and verified that it is not able to find the
 attribute in the session.  Which is strange because the session id is
 the same (i have verified by printing it out, and also seeing what is
 sent in the actual request headers via firebug).  I am not removing
 the attribute from the session in any place; and in any case it works
 fine locally as i said before.

 Does any one have any clue as to what could be happening?  I can post
 code if needed, but i don't know where to begin :)

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