Re: More helpful reporting of exceptions in JSPs

2005-10-11 Thread Leon Rosenberg
could you post your patch for download anywhere? If you need webspace,
I can provide you some. I would find the patch extremely helpful, and
would love to have it in my development tomcat, as soon as possible.

thanx
leon

On 10/11/05, Tim Fennell [EMAIL PROTECTED] wrote:
 Apologies in advance for cross-posting this, but I sent this email
 out to the tomcat-dev list a couple of days ago and have received no
 replies at all...  I think this is quite  a useful feature, and I'm
 wondering how best to go about contributing it.
 Thanks

 -Tim Fennell
 http://stripes.mc4j.org

 Begin forwarded message:

  From: Tim Fennell [EMAIL PROTECTED]
  Date: October 9, 2005 5:50:11 PM EDT
  To: tomcat-dev@jakarta.apache.org
  Subject: More helpful reporting of exceptions in JSPs
  Reply-To: Tomcat Developers List tomcat-dev@jakarta.apache.org
 
 
  Hi,
 
  I'll apologize in advance if this is the wrong place to post this,
  or if this has been covered before.  I had a good read through the
  Tomcat docs and faqs, searched the bug database, and googled around
  on the topic, but could not really find anything.
 
  I've been using Tomcat for a while, and in general have found it as
  good a servlet/JSP container as any I've used.  With one exception
  (no pun intended).  A long time ago I started out using WebLogic,
  and the one thing that I loved about WebLogic, that is missing from
  Tomcat, is that when an Exception occurred in a JSP it would tell
  you what line number *in the JSP* generated the exception, and show
  you a snippet of code around the offending line.
 
  For quite a while I'd figured that the way Tomcat was built
  prevented this from being easy/possible, but I didn't look.  Well,
  I finally got around to looking, and it only took me a couple of
  hours to implement it.  Which makes me wonder if there is some
  other reason that this isn't done in Tomcat/Jasper?
 
  At any rate, I have code that will do this now, and I think it'd be
  a great productivity boost for anyone else developing JSPs on
  Tomcat.  It amounts to small patches to two files.  The first is
  org.apache.jasper.compiler.Compiler to make it hang on to the parse
  tree (pageNodes) if in development mode, and a getter to make this
  accessible.  The second is to
  org.apache.jasper.servlet.JspServletWrapper to do the grunt work of
  mapping a stack frame from the exception back to the line in the
  JSP that it came from.
 
  It's all coded up to function only when in development mode, and is
  reasonably well commented.  Would any of the committers be
  interested in taking a look at this if I put together a patch and
  posted it here?  Cheers,
 
  -Tim Fennell
  http://stripes.mc4j.org
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5.12 and user-agent header

2005-10-09 Thread Leon Rosenberg
Hmm, I downloaded 5.5.12 and tried the agent-header specific code with it:

public void processLogin(User user, HttpServletRequest req,
HttpServletResponse res) {
StringBuffer info = new StringBuffer();
info.append(login );
info.append(user.getUserName());
info.append( [);
info.append(user.getUserId().getPlainPresentation());
info.append(] );
info.append(user.getEmail());
info.append( );
info.append(UserHelper.getGenderDescription(user.getGender()));
info.append( );

info.append(UserHelper.getStatusDescription(user.getMembershipStatus()));
info.append( );
info.append(req.getRemoteAddr());
info.append( / );
info.append(req.getRemoteHost());
info.append( Agent: );
info.append(req.getHeader(user-agent));
log.info(info); 
}

outcome was:

2005-10-08 15:36:50,453 INFO  - login leon [6] [EMAIL PROTECTED] male premium
127.0.0.1 / 127.0.0.1 Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US; rv:1.7) Gecko/20040626 Firefox/0.8

which I think was same behaviour as before.

I took tomcat out of the box (5.5.12 tar.gz) and only changed the http port.

regards
leon


On 10/8/05, Richard Mixon [EMAIL PROTECTED] wrote:
 I am just using the standard HTTP connector. This is on my development
 workstation so I don't normally run JK and Apache, except for final testing.

 On the developer list I did see one mention of user-agent header, but on
 closer inspection it appeared to be for a completely different issue.

 Thanks - Richard

 -Original Message-
 From: news [mailto:[EMAIL PROTECTED] On Behalf Of Bill Barker
 Sent: Friday, October 07, 2005 10:13 PM
 To: tomcat-user@jakarta.apache.org
 Subject: Re: Tomcat 5.5.12 and user-agent header


 Richard Mixon [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 I tested out my application on 5.5.12 yesterday and noticed one small
 anomally. I had a JSP in my sitemesh decorator default.jsp that ends
 up  wrapping the login page for container managed authentication. This
 page  had  a statement
 String  _userAgent = request.getHeader(user-agent).toLowerCase();
 
  It gets a null-pointer exception in 5.5.12, but under 5.5.9 it runs fine.
  In
  5.5.12, after the login succeeds then the user-agent headers appear to
  be there just fine, but not on the initial login page.
 
  Is this a known issue?
 

 It's certainly not a known issue.  It would help a lot if you could tell us
 which Connector you are using at the time (e.g. HTTP/1.1, HTTP/1.1-APR,
 AJP/1.3, AJP/1.3-APR).

  Thank you - Richard
 




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryException in Tomcat 5.0.28 (when using Thread / ThreadLocal)

2005-10-09 Thread Leon Rosenberg
I'm not the expert but...

On 10/9/05, Binildas C [EMAIL PROTECTED] wrote:
 Hi,

 We are building a high volume site in Tomcat5.0.28.
 Our single Tomcat5.0.28 instance in the Web Farm is
 having 10 HTTP Threads. Each HTTP Thread collects
 request events in a ThreadLocal. At every 1000
 requests (in a particular HTTP Thread) the HTTP Thread
 will collect events from the ThreadLocal, sets them in
 it's deamon thread (There is one-to-one
 correspondance between the number of Tomcat HTTP
 Threads and Deamon threads, hence we have 10 Deamon
 threads), notifies the deamon thread, and clears the
 ThreadLocal. The Deamon thread will pushes the events
 to a seperate single process through RMI.

What exactly is the goal of all this? Why do you gather information in
the HTTP Thread, and not in the daemon thread? It seems obvious to me
to hold the data there (if at all).
Btw, what do you mean by high volume?


 Everything works fine (functional and otherwise) for
 the first 1 or 2 hours or so, and then we can see the
 Tomcat 5.0.28 Process taking lot of memory and
 ultimately we are getting either an
 OutOfMemoryException or The Tomcat process stalls!

 Our Question is:
 1. Is Tomcat 5.0.28 having a memory problem?

Search Bugzilla (http://issues.apache.org). We have tomcat 5.0.25 and
28 in a high traffic site (approx. 100 requests per server per second)
and not having any memory problems.

 2. If so, what about other versions of Tomcat?

Probably the same, unless you'd like to try the new garbage collector
in jdk1.5 and test it with 5.5.12

 3. Is this memory problem somehow related to Thread
 and/or ThreadLocal Usage?

Are you sure your code is actually freeing the objects? If you keep a
reference to the object somewhere, you'd never have your gc utilize
them. How much memory do you give tomcat/jvm at startup? Have your
tried a verbose mode for gc (or simply print out memory stats all 10
minutes) to see if it's a continous leak, or something cause it out
of nowhere by chance? Are you creating new Threads? File handles? You
must know that OutOfMemoryError in java can mean nearly anything.

 4. Any work around for this.

Besides, I don't like your solution, and would advice you to rewrite
it in more conventional way, there is a simple workaround, if you can
afford to loose some of your requests - use SoftReferences for
holding your data, they are guaranteed to be freed before an
OutOfMemory can occur.


 Reference:
 http://forum.java.sun.com/thread.jspa?messageID=3900219

 Thankx in advance

 Regards
 Binildas C. A.

Leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sending mail with JavaMail

2005-10-07 Thread Leon Rosenberg
On 10/7/05, Andrés Reyes [EMAIL PROTECTED] wrote:
 activation.jar and mail.jar are placed both in /common/lib, and in
 /WEB-INF/lib (and also in JAVA_HOME/lib)

 ¿Any other place?
 ;)

 ¿Maybe the error be in activation.jar itself? ( I want to believe that
 it isn't  :( ).


Hmm... unlikely... but check whether the activation.jar you are using
to compile your classes is the same as the one you are using in
tomcat.

are there other dependencies, that you could be missing? xmlparser or
something?

Btw, common/lib isn't my favorite place to place jars, common/endorsed
is better; if you have an older version of the activation.jar in
common/endorsed, you can place as many activations.jar in the
common/lib as you like, they will be ignored...

regards
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RTE - Meridian Club [EMAIL PROTECTED]

2005-10-07 Thread Leon Rosenberg
can someone please remove this email from the list? It's kindof nerving...

thanx
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RTE - Meridian Club [EMAIL PROTECTED]

2005-10-07 Thread Leon Rosenberg
On 10/7/05, Arup Vidyerthy [EMAIL PROTECTED] wrote:
 Why don't you use your eyes and read the bottom of the email. Or is that too
 difficult?

Hae?
Leon


 -Original Message-
 From: Leon Rosenberg [mailto:[EMAIL PROTECTED]
 Sent: 07 October 2005 15:39
 To: Tomcat Users List
 Subject: RTE - Meridian Club [EMAIL PROTECTED]

 can someone please remove this email from the list? It's kindof nerving...

 thanx
 leon

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 ___
 To help you stay safe and secure online, we've developed the all new Yahoo! 
 Security Centre. http://uk.security.yahoo.com

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RTE - Meridian Club [EMAIL PROTECTED]

2005-10-07 Thread Leon Rosenberg
However, back to the original point, is there a way to remove
autoresponders from the list? I think the list is owned (among
others?) by Mark Thomas  [EMAIL PROTECTED], so he, or whoever owns
the list should be able to remove autoresponders from the list.
It's just annoying to adjust the filters twice a week.

thanx and regards
leon


On 10/7/05, Glen Mazza [EMAIL PROTECTED] wrote:
 Arup misunderstood Leon's message and thought he lazily wanted others to
 unsubscribe him.  That was his main error.  But in fairness to Arup,
 flames can be called for when people ask to be unsubscribed from a
 technical mailing list that 1000's of other people are subscribed to.

 People making such requests are usually either newbies who need to be
 jolted (and also thereby jolting/informing other newbies about to make
 the same request, keeping the ML free of additional requests), or by
 rather lazy people who know how to unsubscribe but don't want to bother.
   The latter type might actually feed on the kid glove approach that
 David may be inclined to recommend.

 Glen


 David Short wrote:
 
  Arup needs to work on his social skills.  We're all here trying to help each
  other, not to attack each other.
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom session manager

2005-10-06 Thread Leon Rosenberg
On 10/6/05, Tobias Meyer [EMAIL PROTECTED] wrote:

 Or, cou could add a static hashmap to your Servlet (or a bean if using JSPs)
 where you simply add the sessions with every request. You would have to put
 an attribute implementing javax.servlet.http.HttpSessionActivationListener
 in each session though, that removes the session from your hashmap when the
 session is expired or you will end up with having many invalid entries in
 your hashmap. (And I don't even know what happens if you keep the references
 to those Session objects when they are recycled by tomcat)
 We do this to keep track of our sessions within the application.

If you keep your sessions in a hashmap forever they will never be
freed by the garbage collector and you will end with an outofmemory
error one day.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom session manager

2005-10-06 Thread Leon Rosenberg
Sorry, aber how exactly does it solves the problem of having one
session per user? :-)



On 10/6/05, Tobias Meyer [EMAIL PROTECTED] wrote:
  -Ursprüngliche Nachricht-
  Von: Leon Rosenberg [mailto:[EMAIL PROTECTED]
  Gesendet: Donnerstag, 6. Oktober 2005 11:20
  An: Tomcat Users List
  Betreff: Re: custom session manager
 
 
  On 10/6/05, Tobias Meyer [EMAIL PROTECTED] wrote:
  
   Or, cou could add a static hashmap to your Servlet (or a
  bean if using JSPs)
   where you simply add the sessions with every request. You
  would have to put
   an attribute implementing
  javax.servlet.http.HttpSessionActivationListener
   in each session though, that removes the session from your
  hashmap when the
   session is expired or you will end up with having many
  invalid entries in
   your hashmap. (And I don't even know what happens if you
  keep the references
   to those Session objects when they are recycled by tomcat)
   We do this to keep track of our sessions within the application.
 
  If you keep your sessions in a hashmap forever they will never be
  freed by the garbage collector and you will end with an outofmemory
  error one day.

 That's why I said you need one Attribute that implements the
 HttpSessionActivationListener, which, on second thought , was wrong - you
 need to implement HttpSessionBindingListener.

 The Method

 public void valueUnbound(HttpSessionBindingEvent event)

 will get called automatically when the session expires, and you can add code
 that removes the session from the hashmap.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom session manager

2005-10-06 Thread Leon Rosenberg
On 10/6/05, Tobias Meyer [EMAIL PROTECTED] wrote:
 The problem is AFAIK, that you cannot access the list of all sessions
 through the servlet-api.
 That feature was in the servlet-api at some time, but was removed, IIRC due
 to security issues.

 If you have a list of all sessions, you can easily iterate over them at
 login and manually expire all old sessions for the same user. = Max. one
 active session per user.

ok, got you, yes that's feasible
thanx for explanations
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[OT] How much RAM can java use

2005-10-06 Thread Leon Rosenberg
Sorry for off-topic, but there are so many experts here! :-)

Does anyone know for sure how much RAM I can use with JAVA 1.4 or 1.5?
It seems to me, that the VM don't use more than 1.2 GB RAM even I gave
it more (with mx/ms settings). We are planning to go to 16GB RAM
machines to have a better caching, but I started to doubt that I can
use 16GB Ram in a single JVM.

Any thoughts, anyone?

thanx
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] How much RAM can java use

2005-10-06 Thread Leon Rosenberg
On 10/6/05, Caldarale, Charles R [EMAIL PROTECTED] wrote:
  From: Leon Rosenberg [mailto:[EMAIL PROTECTED]
  Subject: [OT] How much RAM can java use
 
  Does anyone know for sure how much RAM I can use with JAVA 1.4 or 1.5?

 The answer is very platform specific.  For example, on a normal 32-bit
 Windows system, each process has a maximum of 2 GB to play with, but
 some of that is taken up by various .dlls.  (And unfortunately, these
 are scattered throughout the range, and the Sun JVM insists on having
 contiguous space for the heap.)  There is a boot option for some
 versions of Windows Server that changes the process virtual space to 3
 GB, at the expense of some kernel capacity.

 I've seen 64-bit Sparc systems with Java heaps sized at hundreds of
 megabytes...

Ok, I'll try to be more specific:

Debian 3.1, kernel 2.6.x-smp (32 bit)
or
Debian 3.1, kernel 2.6.x-smp-emt64 (64 bit)

Hardware: AMD Opteron and Xeon64 (both 64 bit)

SUN jdk1.5 and/or jdk1.4.2

4 GB total RAM for 32-bit linux, with 3/1 memory partitioning
16GB total RAM for 64-bit linux.

thanx
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] How much RAM can java use

2005-10-06 Thread Leon Rosenberg
Chuck, Ryan,

thanx, you were extremely helpful!

regards
Leon

On 10/6/05, J. Ryan Earl [EMAIL PROTECTED] wrote:
 Leon Rosenberg wrote:

 Debian 3.1, kernel 2.6.x-smp (32 bit)
 or
 Debian 3.1, kernel 2.6.x-smp-emt64 (64 bit)
 
 Hardware: AMD Opteron and Xeon64 (both 64 bit)
 
 SUN jdk1.5 and/or jdk1.4.2
 
 4 GB total RAM for 32-bit linux, with 3/1 memory partitioning
 16GB total RAM for 64-bit linux.
 
 
 I've tested 32/64 bit JVMs extensively and done considerable amount of
 JAVA_OPTS tuning for my company's application.  On a 32-bit machine you
 can't reliably go above a -Xms=1600m without getting OOM errors.  With a
 3/1 split your virtual page table size for the entire JVM process must
 be below 3GB total virtual memory.  That's 3GB allocated, not commited.
 The JVM allocates a lot more memory besides the heap.

 With the 64-bit JVMs, the sky's the limit, however the 64-bit address
 also make your application take up more space relative to a 32-bit JVM.
 A 3.2GB 64-bit heap space isn't going to double the amount of identical
 objects you can create as compared to a 32-bit 1.6GB heap space because
 all pointer references will occupy twice the space.

 -ryan

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: java.lang.ClassCircularityError

2005-10-05 Thread Leon Rosenberg
Just some thoughts...

if you write two classes A and B
B extends A
then compile
then put B into deployment
change B to not extend A and A to extend B, compile A
put A into deployment
Then you'll probably have your runtime circularity.

Try to delete all your class files and recompile your application from scratch.

regards
Leon

On 10/5/05, Jagadeesha T [EMAIL PROTECTED] wrote:
 HI  Andoni,
 Thanks for the reply, It uses association that too unidirectional, I 
 have seen the option in sun forum as have you explained to me. I tried to 
 compile classes like this for just to get that error. This scenario won't 
 compile, It gave me a error saying cycling inheritence.
 Do you know any other scenarios which could cause this problem.

 Thanks,
 Jagadish

 Andoni [EMAIL PROTECTED] wrote:
 Hi Jagadish,

 Do you have a drawing of all your inheritance relationships? This error seems 
 to be caused by a circular inheritance relationship i.e.:

 class ClassOne extends ClassTwo {
 ...
 }

 class ClassTwo extends ClassOne {
 ...
 }

 Obviously there could be many more than two classes involved so it may be 
 best to draw out the class tree. Specially if it is complicated.

 Hope that helps.

 Andoni.

 - Original Message -
 From: Jagadeesha T
 To: tomcat-user@jakarta.apache.org
 Sent: Wednesday, October 05, 2005 9:01 AM
 Subject: java.lang.ClassCircularityError


 Hi all,
 I am using Tomcat 5.0 with JBoss 3.2.6. In a very rare cases I got the error 
 as
 java.lang.ClassCircularityError(myclass). Does anybody know wahy this error 
 is coming.

 Thanks,
 Jagadish


 -
 Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort.


 -
 Yahoo! for Good
  Click here to donate to the Hurricane Katrina relief effort.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom session manager

2005-10-05 Thread Leon Rosenberg
I have never seen that the getRemoteUser method you are referring to
returned something userful, or just something other then null. Taken
in account different browsers, proxies, internet-cafes... I don't
think it's possible.
On the other hand, why do you need that? As a matter of security this
will not work, because an intruder will simply use a patched browser
and a proxy. Maybe if you  tell us what you trying to achieve, we can
provide you a better solution.

regards
leon

On 10/5/05, Mark [EMAIL PROTECTED] wrote:
 This is about 90% of what I want.  One of the features I want to put
 into my session manager is the ability to only have one open session
 per user.  What I would like is to have a createSession method that
 takes in user and host.  This way I could be relatively sure that the
 user could only have one session at a time.
 The way the API looks is I have no way of passing this information
 into the createSession method.  Is this true?  Or do I have to extend
 some of the low-level tomcat code in order to make this work?

 TIA for any help you can provide.

 On 9/29/05, Leon Rosenberg [EMAIL PROTECTED] wrote:
  check this out:
 
  http://www.niallp.pwp.blueyonder.co.uk/TomcatBug36541.html
 
  The link itself handles a bug, but one of the solutions is to replace
  the std. manager with custom manager with all info you need to
  actually do this. I thin kthis fits your question.
 
  regards
  leon
 
  On 9/29/05, Mark [EMAIL PROTECTED] wrote:
   After using tomcat since the 3.x days, I have been very impressed with
   the amount of flexibility and configuration options that I have
   available to me.
  
   One part of the tomcat design that I do not believe is very flexible
   is the ability to set up a custom session manager.  So maybe I am
   missing something, but how would I go about writing this for tomcat?
   I know I am being very vague, but how much work am I potentially
   signing myself up for here if I wanted to create a custom session
   manager?
  
  
   Thank you.
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom session manager

2005-10-05 Thread Leon Rosenberg
On 10/6/05, Mark [EMAIL PROTECTED] wrote:
 basically, I want to prevent users from logging in and creating a
 second session if a valid session for that user already exists.

 For instance.

 1. Log in to my web app, session is created
 2. browse around in my web app
 3. close browser, do not logout
 4. Start browser up again
 5. try and log in
 6. Do not allow login, have user 'reconnect' to the old session
 created in step 1.

 I have written quite a few web based apps, and I know of no way to
 kill the session at step 3.

pretty easy, set session timeout to 1 minute and integrate a hidden
frame or javascript-loaded-image in your application that reloads all
30 seconds. 60-99 seconds after the user closed his browser the
session would be killed.


 Hope this clears things up.

 Thanks again!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: log4j log viewer for tomcat

2005-10-02 Thread Leon Rosenberg
lf5

regards
Leon

On 10/2/05, matador [EMAIL PROTECTED] wrote:
 win200x
 tomcat 5.5.9
 jdk 1.5.x
 log4j 1.2.9 (i think)

 standard log4j setup with logs going into logs dir under tomcat install.

 does anyone have any recommendations for a webapp or workaround that allows
 me to view these files.  the obvious ways (e.g. ftp, ssh, etc) are not an
 option.

 thx


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat Alone or tomcat+IIS/Apache

2005-09-30 Thread Leon Rosenberg
We had the same discussion a year ago, as we switched to tomcat 5 and
was testing whether we do need apache in front of it. Actually the
only advantage for this solution left were apache mods like
url-rewriting -
http://mydomain - http://mydomain/myapp/mypath - better for some
search engines and so on.
mod_gzip - now supported by tomcat directly.

 But this isn't worth installing an apache.

The real problem with serving static content that tomcat has is the
thread-model - one thread per connection is a bit messy if you have
http 1.1 (keep-alives) on. But apache has the same issue. So if you
have a log of static content to serve I'd strongly suggest you put a
squid in front of your tomcats instead of apache (iis is a joke
anyway).

regards
leon

On 9/30/05, Mladen Turk [EMAIL PROTECTED] wrote:
 Peddireddy Srikanth wrote:
  And they argue that as Tomcat it self runs inside  a JVM, which inturn
  is a single process all the threads etc wil be simulted ones (and not
  the native threads) and hence it will not scale up well under high
  loads.
 
  Is this argument a valid one or just a misunderstanding??
 

 The statement for threads is probably valid if you read some
 Java 1.1 book. From version 1.2 Java uses platform native threads.

 Regards,
 Mladen.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Installing Tomcat 5.5 on Fedora 4 via Yum

2005-09-30 Thread Leon Rosenberg
On 9/30/05, Caldarale, Charles R [EMAIL PROTECTED] wrote:
  From: Rob Hills [mailto:[EMAIL PROTECTED]
  Subject: Installing Tomcat 5.5 on Fedora 4 via Yum
 
  However, I've so far been unsuccessful in finding any way to upgrade
  Tomcat beyond 5.0 using Yum.  Has anyone else achieved this?

 I've never understood this fascination for fooling around with 3rd-party
 packaged versions of Tomcat, rather than using the unadulterated
 originals directly from the Tomcat download site.  The process couldn't
 be much simpler: download, unzip/untar, run.  What am I missing?

The fun of having your tomcat split in 6 different directories and
linked together.  More jobs for BOTHs.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Jsps

2005-09-29 Thread Leon Rosenberg
if you haven't reconfigured your resin - actually nothing.
just drop your war file in webapps.

if you did, you have to do the same you did in httpd.sh now in
catalina.sh. More or less.

leon


On 9/29/05, Prema Kumar [EMAIL PROTECTED] wrote:

 Hi,

 I have an Application which is J2EE Architecture and working with Resin
 2.1.6

 Now we are trying to bring up my application using Tomcat.

 What necessary modifications needs to be done in Tomcat web.xml file and
 server.xml

 Prem



 

 The information in this mail is confidential and is intended solely for the
 addressee. Access to this mail by anyone else is unauthorized. Any copying
 or further distribution beyond the original recipient is not intended and
 may be unlawful. The opinion expressed in this mail is that of the sender
 and does not necessarily reflect that of Titan.

 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Flexible way of defining application variables in text format?

2005-09-29 Thread Leon Rosenberg
On 9/29/05, matador [EMAIL PROTECTED] wrote:
 Leon Rosenberg [EMAIL PROTECTED] wrote in
 news:[EMAIL PROTECTED]:


 
  now how exactly writing a thread which polls the db is less messy,
  than writing a thread that polls a file?
 
  regards
  leon


 no need for threads with db.  change the val in the db then the next time
 the page loads, the new value is there.  one can get the val from the db
 however they wish (presentation layer, service, dao, etc)


First: you can load your property files on each request as well.

Second: you ever tried to request same value from db on each request,
which would mean in our case 100 times per second per webserver? Which
db is able to serve it?


regards
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom session manager

2005-09-29 Thread Leon Rosenberg
check this out:

http://www.niallp.pwp.blueyonder.co.uk/TomcatBug36541.html

The link itself handles a bug, but one of the solutions is to replace
the std. manager with custom manager with all info you need to
actually do this. I thin kthis fits your question.

regards
leon

On 9/29/05, Mark [EMAIL PROTECTED] wrote:
 After using tomcat since the 3.x days, I have been very impressed with
 the amount of flexibility and configuration options that I have
 available to me.

 One part of the tomcat design that I do not believe is very flexible
 is the ability to set up a custom session manager.  So maybe I am
 missing something, but how would I go about writing this for tomcat?
 I know I am being very vague, but how much work am I potentially
 signing myself up for here if I wanted to create a custom session
 manager?


 Thank you.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: saving files in webapp folder from deletion?

2005-09-28 Thread Leon Rosenberg
I think in the time you invested in this thread you could easily have
written a servlet which delivers the data from anywhere, so you don't
need to save it in the context.

:-)
regards
Leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedded Tomcat and shared objects...

2005-09-28 Thread Leon Rosenberg
still, spring can use the same factory.
If not, use a container that can use factories :-)

If nothing works, the hack would be:

class MyObjectInstanceHolder{
  private static MyObject instance;

  public set/getInstance...
}

?
regards
leon

On 9/28/05, Darryl L. Pierce [EMAIL PROTECTED] wrote:
 Leon Rosenberg wrote:
  Aehm, without looking deeper into context initialization, just a short 
  guess:
  what about making your configuration objects a singleton with
  public static CLASSNAME getInstance()
  or
  provide a factory for them?

 Because the class in question is created by Spring's application context.

 --
 Darryl L. Pierce [EMAIL PROTECTED]
 Homepage: http://mcpierce.multiply.com/
 Bury me next to my wife. Nothing too fancy... - Ulysses S. Grant

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Flexible way of defining application variables in text format?

2005-09-28 Thread Leon Rosenberg

 database.  using props files you have to bounce the app to get changes to
 take effect unless you write your own properties loader that runs as a
 thread, or checks file timestamps, etc.

 imo, its all too messy, db based config is far superior

now how exactly writing a thread which polls the db is less messy,
than writing a thread that polls a file?

regards
leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: saving files in webapp folder from deletion?

2005-09-28 Thread Leon Rosenberg
On 9/28/05, Thomas Corte [EMAIL PROTECTED] wrote:
 Hi,

 Leon Rosenberg wrote:

  I think in the time you invested in this thread you could easily have
  written a servlet which delivers the data from anywhere, so you don't
  need to save it in the context.

 You are absolutely right, however I don't like to reinvent the wheel and
 therefore tend to look for existing solutions before introducing my own.

Sometimes reinventing the wheel is simplier and faster then bringing
someone else's wheel to roll in your cart.

:-)

Regards
Leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: (WAS) Generic Types support in Tomcat?

2005-09-27 Thread Leon Rosenberg
  C] Sometime when the tomcat is started it spwans more than one processes.
 And then during shudown it creates problems. Also sometimes the list of open
 files goes beyond 1024. that is he ulimit. due to which he tomcat doesnot
 respond.
 
 

 Linux kernel 2.4 emulates threads through lightweight processes/tasks.
 There is nothing fundamentally wrong about it (perhaps internal resource
 ecconomics are misused), AFAIK, but the ps output is going to confuse
 you, showing each thread as a separate process. Nothing problematic
 about it.

 The number of 1024 processes/threads is alarming, however. TC will
 normally wpawn idle worker threads to prepare for future requests, but
 the parameter is usually less than 100. I'd say your application is
 launching threads for some reason. Either that or there is a serious bug
 in your system.

On older system, kernel 2.4.x, there is indeed a problem with that
many threads.
After creating more then X thread, where X was about 500 for tomcat,
tomcat will not be able to create more threads and throw an
(confusing) OutOfMemoryError. If this occures it stops answering and
refuses futher service. You will then be able to monitor that tomcat
halfs its threads all 3-5 minutes, until it dies silently with ~40
threads. However, this is only partially tomcats problem (it shouldn't
die on OutOfMemoryErrors), but more of the JVM and the underlying
thread library. However with NPTL (which is default for 2.6.x
distributions) you can spawn enough threads (I think about 3500).

Anyway, ulimit of 1024 is very low, since tomcat watches all jsp files
for changes (unless you switched reloading off).

So my advice, upgrade to 2.6.x kernel (sarge under debian), set ulimit
to 8192, rethink your threading settings.  The only reason you could
actually need 1000 threads is having http 1.1 with keep-alives on and
users with slow connections.

regards
Leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: saving files in webapp folder from deletion?

2005-09-27 Thread Leon Rosenberg
setup X as context/webapp (incl. an empty WEB-INF) and probably a
web.xml. this should be sufficent, unless you have something else
badly broken :-)

lg
leon

On 9/27/05, Thomas Corte [EMAIL PROTECTED] wrote:
 Hi there,

 I have a setup in which certain trusted users of a web application X may
 upload new content files which are then put into webapps/X/content to be
 served from there.
 The problem is that everything unter /webapps/X is *deleted* by Tomcat
 upon undeploy, including the uploaded stuff.

 My question is: what would be the best way to deal with this?
 Of course, I'd love to put the uploaded files into directories *outside*
 of webapps/X, but there seems to be no way to let Tomcat serve them then
 as part of webapp X.
 A possibility I'm currently considering is to backup the files by an
 Application Listener prior the the undeployment and to restore them upon
 re-deploy.

 Any thoughts?

 --
 Thomas Corte
 [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedded Tomcat and shared objects...

2005-09-27 Thread Leon Rosenberg
Aehm, without looking deeper into context initialization, just a short guess:
what about making your configuration objects a singleton with
public static CLASSNAME getInstance()
or
provide a factory for them?

regards
leon

On 9/27/05, Darryl L. Pierce [EMAIL PROTECTED] wrote:
 I have embedded Tomcat 5.0.28 into an application I'm writing. Tomcat is
 being used primarily as the configuration system. I would like to, from
 the servlet running within Tomcat, access objects that are a part of the
 main application itself, specific some configuration objects. Is there a
 way, while I'm created the instance of
 org.apache.catalina.startup.Embedded and all of the related objects, to
 set a reference to some objects? I tried setting it in the servlet
 context as I created the instance of org.apache.catalina.Context for my
 servlet's context but getServletContext() returns null at that point...
 --
 Darryl L. Pierce [EMAIL PROTECTED]
 Homepage: http://mcpierce.multiply.com/
 Bury me next to my wife. Nothing too fancy... - Ulysses S. Grant

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Synchronize wrapper for session obj attrib get/set

2005-09-25 Thread Leon Rosenberg
 Possibly the easiest thing to do is edit the StandardSession.java file
 and change the type of the attributes field to HashTable rather than
 HashMap, then rebuild the associated jar.  The places that already
 synchronize on attributes can be left alone, since redundant synchs are
 allowed and have minimal performance impact.

  - Chuck

Or, you take one of existing patches, see also:
http://www.niallp.pwp.blueyonder.co.uk/TomcatBug36541.html

or, you just get the last StandartSession version out of CVS ( sorry
SVN since this weekend) ,
and compile it.

regards
Leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: What to put into JAVA_HOME on Windows XP

2005-09-25 Thread Leon Rosenberg
can you compile classes?
I mean just normal java classes out of the command prompt.
Do you start tomcat as service or with bin\catalina.bat run / bin\startup.bat?

On 9/25/05, Markus Hapke [EMAIL PROTECTED] wrote:
 Hello,

 I just installed tomcat 5.0.28 successfully.

 Then tested the samples in
 C:\TOMCAT\webapps\jsp-examples\jsp2 - they worked.

 Thed tried to test a .jsp of my own- getting the error msg in the
 MS Internet-Explorer:
 === BEGIN of error Msg 
 HTTP Status 500 -

 type Exception report

 message

 description The server encountered an internal error () that prevented it
 from fulfilling this request.

 exception

 org.apache.jasper.JasperException: Unable to compile class
 for
 JSP
 
 org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
 
 org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
 org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
 
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
 
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


 root cause

 Unable to find a javac compiler;
 com.sun.tools.javac.Main is not on the classpath.
 Perhaps JAVA_HOME does not point to
 the
 JDK
 
 org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
 org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
 org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
 org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
 
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
 
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


 note The full stack trace of the root cause is available in the Apache
 Tomcat/5.0.28 logs.
 === END of error Msg= ==

 I set the environment entry of JAVA_HOME to
 C:\JDK1.4\AppServer\jdk\bin

 Is that correct?

 OK, nobody of you could know where I have my J2EE (1.4) :
 it is 'mounted' under:
 C:\JDK1.4\AppServer
 and i can find the javac.exe under: C:\JDK1.4\AppServer\jdk\bin

 Is my entry of the JAVA_HOME correct?

 Is there another error?

 Thanx in advance, Markus


 --
 GMX DSL = Maximale Leistung zum minimalen Preis!
 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: heap size in tomcat 5.0

2005-09-24 Thread Leon Rosenberg
bin\catalina.bat

actually in all versions of tomcat :-)

regards
Leon

On 9/24/05, matador [EMAIL PROTECTED] wrote:
 win2k server
 tomcat 5.0.x

 how to set heap size (min  max)?

 i know how to do it in tomcat 5.5, but wasnt sure which script controlled
 the JAVA_OPTS in 5.0

 thx


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: force reload of individual class files

2005-09-24 Thread Leon Rosenberg
I think this is best solution. Imagine you have class A and class B. B
holds an instance of A. Now you force B to be reloaded. Should A be
reloaded too? What happens with the instance of A in B? Is it
duplicated? C is holding an instance of B, so must C be reloaded (and
all existing objects which refer to B reinstantiated) now?

You don't need to restart the server to get your changes live, you can
force it to reload the whole application, which, in case of tomcat,
your users wouldn't even notice (as long as ALL your beans in session
are serializable).

On the other hand, for major fixes on large production systems, you
can't afford to deploy a class and relay on servers reloading
behaviour, you have then a release process with testing and quality
management, so it's not an issue.

regards
Leon

P.S. the JSPs are reloaded intime. If you really need to
hot-redeploy your classes, you can patch tomcat and supply your own
classloader policy, using a separate class loader for each and every
servlet / component / class will allow you to reload the classes but
will also lead to abovementioned inconsistences.

On 9/24/05, jimbo-black [EMAIL PROTECTED] wrote:
 Leon Rosenberg [EMAIL PROTECTED] wrote in
 news:[EMAIL PROTECTED]:

  On 9/23/05, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:

  I think it's forbidden by the spec.
 
  SRV.3.7 Reloading Considerations
  Although a Container Provider implementation of a class reloading
  scheme for ease
  of development is not required, any such implementation must ensure
  that all servlets, and classes that they may use, are loaded in the
  scope of a single class
  loader. This requirement is needed to guarantee that the application
  will behave as expected by the Developer.
 
 


 ah i see, that would make sense.  but it seems strange that this sort of
 thing is accepted as the norm.  i would think that its a common requirement
 and that a lot of developers would get sick of restarting the server to get
 some minor bug fix into production.

 does anyone have a workaround?

 btw, i moved to storing my name-value pairs (used to be props files) in the
 db for this very reason.



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Registering my own protocol in Tomcat

2005-09-24 Thread Leon Rosenberg
What you need is a connector. I never looked how tomcat finds the
proper connector, but it's surely configurable or, if not, easy
patchable. Look at the server.xml connector configuration part and
take a look at the source code :-)

regards
Leon

On 9/22/05, Martin Peter [EMAIL PROTECTED] wrote:
 Hi,



 Is there a possibility to get tomcat working with my own ASCII based
 protocol (instead of HTTP). Is there a possibility to register a
 protocol-handler or something similar to handle the requests of my
 protocol with a servlet?



 Thanks,


 Martin Peter







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat JVM using 99.9% cpu

2005-09-23 Thread Leon Rosenberg
It looks more like an infinite loop.
There are issues with tomcat, which causes infinite loops (see
http://issues.apache.org/bugzilla/show_bug.cgi?id=36541) , but there
are also chances that you simply programmed one yourself in your code.
To check this, next time you tomcat has 99% cpu time, don't shut it down
but kill -quit tomcats_pid. It will then print a complete
stack-trace in the catalina.out (this isn't tomcat's feature, but
jvm's). Use the stacktrace to detect infinite loops.

regards
Leon

On 9/23/05, Azariah Jeyakumar [EMAIL PROTECTED] wrote:
 Hi,

 Has anyone seen Tomcat JVM using 99.9% cpu when there is no HTTP load at all? 
 The JSP pages are accessible fine without any loss in functionality, but the 
 machine is sluggish (expectedly, as the JVM is using all the CPU). If tomcat 
 is restarted, the problem goes away and the CPU usage returns to normal.

 I have not been able to reproduce the problem at will. It has been noticed 
 only twice or so in the past week, out of hundreds of attempts.

 I have seen other posts asking to tweak the settings like socket_* in 
 workers.properties files. But since I have not been able to reproduce the 
 problem at will, I am hesitant to change the parameters, not knowing which 
 change will fix the problem.

 Thanks for any input or pointers on:
 - the nature of the problem that causes this 99.9% CPU usage
 - how to reproduce the problem
 - what parameters should be set in workers.properties file or elsewhere to 
 avoid this problem in the future.

 I am using Tomcat 5.0.28, Apache 2.x, jk2, Sun JRE 1.4.2_08  on Suse Linux 
 Enterprise Server (SLES 9 SP2).

 Thanks
 Azariah




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to limit the size of TOMCATs stdout file

2005-09-23 Thread Leon Rosenberg
actually tomcat spams a lot in the catalina.out, this is my favorite:
[EMAIL PROTECTED]: Exception Processing ErrorPa
ge[errorCode=404, location=/down/404.html]
ClientAbortException:  java.net.SocketException: Connection reset
at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:331)
at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:297)
at org.apache.coyote.tomcat5.CoyoteResponse.flushBuffer(CoyoteResponse.j
ava:537)
at org.apache.coyote.tomcat5.CoyoteResponseFacade.flushBuffer(CoyoteResp
onseFacade.java:238)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.j
ava:303)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:147)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)

(20 more lines and the page is actually there)

another cool log output: when you manage to throw an uncaught
exception in a jsp under some circumstances, each and every request
gets: response already commited with 30-40 lines of stacktraces. The
server itself dies in this scenario btw.

Also quite funny: configure tomcat to use 600 threads. Start on an old
linux distribution with 2.4.x kernel (no nptl). Start 600 test http1.1
threads. Watch the logfile.
(For even more fun watch the number of threads tomcat actually uses in
another window) :-)

But number one spammer in catalina.out are struts-taglibs!

regards
Leon



On 9/23/05, Tim Funk [EMAIL PROTECTED] wrote:
 See http://jakarta.apache.org/tomcat/faq/logging.html#catalina.out

 ClientAbortExceptions are thrown by tomcat when the client presses stop
 before the page is downloaded but does not log the exception. If there is
 custom code trapping exception - it might be logging it. In this case - the
 custom code is too agressive in catching exceptions and should let the
 container handle them correctly. (And probably incorrectly using
 error.printStackTrace() instead of a logger)

 -Tim

 [EMAIL PROTECTED] wrote:

  How do you limit the size of Tomcats stdout file.
 
  If you look at version 5.5, the dialog for the service lets you put in
  default or some path for the stdout file.
 
  But there is no option to set the limiting size or other parameters as you
  would with log4j.
 
  This is the stdout log file which tomcat logs to if it gets something like a
  network connection reset error.
 
  This is not really the applications log file per se.
 
  I tried asking this to the tomcat team via bugzilla and they were not
  helpful.
 
  thanks
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: No Timestamp in catalina.out

2005-09-23 Thread Leon Rosenberg
catalina.out contents are actually system.out-s so you shouldn't
expect any timestamps there, unless you have a logkit like log4j and
configured your logger to go for standard out (which is bad :-))

However, we had same problem and have a workaround for this:
We are starting a Thread in our configuration servlet which just does following:
private static long startupTime;
static {
startupTime=System.currentTimeMillis();
}



private  void log() {
System.out.println((System.currentTimeMillis()-startupTime)+  
+new
Date().toString()+ -MARK-);
}

public run(){
while(true){
   try{
sleep(5000);
   }catch(InterruptedException ignored){}
   log();
}
}

if you set the thread to daemon you will have no problems with
container app. reloading.

regards
leon


On 9/23/05, Partheeban Boopathy [EMAIL PROTECTED] wrote:
 Common guys i need help on this ,since its effecting our support to
 production.
 I dont have any clue what to do on this
 I am using Tomcat5.0.27

 The Logging Pattern in Catalina.out is missing with Timestamp .
 I am getting blank instead of TimeStamp.
 I was using same Tomcat version in my local machine and i can able to see
 the timestamp in Catalina.out.The only difference is we changed
 server.xmlport of 8080 to
 8015.Will that cause any problem.Or is that i am missing any thing???

 Here is my catalina.out
 - Initializing Coyote HTTP/1.1 on http-8014
 - Initialization processed in 3938 ms
 - Starting service Catalina
 - Starting Servlet Engine: Apache Tomcat/5.0.27
 - XML validation disabled
 - Create Host deployer for direct deployment ( non-jmx )
 - Processing Context configuration file URL
 file:/opt/tomcat-strata/conf/Catalin
 a/localhost/admin.xml
 - Processing Context configuration file URL
 file:/opt/tomcat-strata/conf/Catalin
 a/localhost/balancer.xml
 - Processing Context configuration file URL
 file:/opt/tomcat-strata/conf/Catalin
 a/localhost/manager.xml
 - Installing web application at context path from URL
 file:/opt/tomcat-strata/w
 ebapps/ROOT
 - Installing web application at context path /strata from URL
 file:/opt/tomcat-s
 trata/webapps/strata
 - Installing web application at context path /tomcat-docs from URL
 file:/opt/tom
 cat-strata/webapps/tomcat-docs
 - Starting Coyote HTTP/1.1 on http-8014
 - Port busy 8009 java.net.BindException: Address already in use
 - JK2: ajp13 listening on /0.0.0.0:8010
 - Jk running ID=1 time=2/101 config=/opt/tomcat-strata/conf/jk2.properties
 - Server startup in 6990 ms

   Badly looking for response.

 Parthi



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: force reload of individual class files

2005-09-23 Thread Leon Rosenberg
On 9/23/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 given a change to class file(s), does anyone know a
 hack workaround to
 force tomcat to reload * just those files *.  I know
 about restarting the
 app from the console and context.xml.  but i cannot
 afford to knock users
 off in the middle of their sessions just to reload a
 few minor class files.
I think it's forbidden by the spec.

SRV.3.7 Reloading Considerations
Although a Container Provider implementation of a class reloading
scheme for ease
of development is not required, any such implementation must ensure that all
servlets, and classes that they may use, are loaded in the scope of a
single class
loader. This requirement is needed to guarantee that the application
will behave as expected by the Developer.



 btw, i think bea has this feature.

Previous generations of containers created new class loaders to load a servlet,
distinct from class loaders used to load other servlets or classes
used in the servlet
context. This could cause object references within a servlet context to point at
unexpected classes or objects, and cause unexpected behavior. The requirement is
needed to prevent problems caused by demand generation of new class loaders.

So probably an old BEA weblogic or something, but not if it's confirm with 2.3.

Btw, Java WebServer 2.0 (the sun thing that was reference
implementation before tomcat 3) had this functionality too.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



someone familar with this error?

2005-09-22 Thread Leon Rosenberg
starting tomcat:

22.09.2005 12:41:27 org.apache.coyote.tomcat5.MapperListener init
WARNUNG: Error registering contexts
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
at java.util.HashMap$EntryIterator.next(HashMap.java:824)
at java.util.HashMap.putAllForCreate(HashMap.java:424)
at java.util.HashMap.clone(HashMap.java:656)
at 
mx4j.server.DefaultMBeanRepository.clone(DefaultMBeanRepository.java:56)
at 
mx4j.server.MBeanServerImpl.findMBeansByPattern(MBeanServerImpl.java:1603)
at 
mx4j.server.MBeanServerImpl.queryObjectNames(MBeanServerImpl.java:1568)
at mx4j.server.MBeanServerImpl.queryMBeans(MBeanServerImpl.java:1512)
at 
org.apache.coyote.tomcat5.MapperListener.init(MapperListener.java:115)
at 
org.apache.coyote.tomcat5.CoyoteConnector.start(CoyoteConnector.java:1510)

tomcat 5.0.25, jdk1.4, winxp

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: session tracking in a context that contains JSP and servlets

2005-09-22 Thread Leon Rosenberg
On 9/22/05, Mark [EMAIL PROTECTED] wrote:
 I would think that this is possible.  I have been writing servlets for
 over a year, but have not written a single line of JSP.

Technically speaking each JSP is actually a servlet... more or less.
Everything that works in the server works in the jsp too.

regards
Leon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: someone familar with this error?

2005-09-22 Thread Leon Rosenberg
Thanx Jilles.

On 9/22/05, Jilles van Gurp [EMAIL PROTECTED] wrote:
 Leon Rosenberg wrote:
  starting tomcat:
 
  22.09.2005 12:41:27 org.apache.coyote.tomcat5.MapperListener init
  WARNUNG: Error registering contexts
  java.util.ConcurrentModificationException
  at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
  at java.util.HashMap$EntryIterator.next(HashMap.java:824)
  at java.util.HashMap.putAllForCreate(HashMap.java:424)
  at java.util.HashMap.clone(HashMap.java:656)
  at 
  mx4j.server.DefaultMBeanRepository.clone(DefaultMBeanRepository.java:56)
  at 
  mx4j.server.MBeanServerImpl.findMBeansByPattern(MBeanServerImpl.java:1603)
  at 
  mx4j.server.MBeanServerImpl.queryObjectNames(MBeanServerImpl.java:1568)
  at 
  mx4j.server.MBeanServerImpl.queryMBeans(MBeanServerImpl.java:1512)
  at 
  org.apache.coyote.tomcat5.MapperListener.init(MapperListener.java:115)
  at 
  org.apache.coyote.tomcat5.CoyoteConnector.start(CoyoteConnector.java:1510)
 
  tomcat 5.0.25, jdk1.4, winxp
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 Yes, the jmx.jar shipped with tomcat 5.0.2x has a bug that has been
 fixed by the mx4j people. Later tomcat releases (5.0.31? and 5.5.9)
 include a newer version. The jar file is located in the tomcat bin
 directory and the solution is to download an updated version from

 http://mx4j.sourceforge.net/

 I think you need the latest 2.x version, not the 3.x version.

 BTW. I'd really appreciate a stable 5.0.x release with this fix. This
 little issue has been driving me nuts since I need to fix this manually
 on all deployments of our product on tomcat 5.0.28.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat cant see my application folder HELP!!!

2005-09-21 Thread Leon Rosenberg
you need a WEB-INF directory in your webapp if you want the webapp to be loaded.

On 9/21/05, Mbah Tenjoh-Okwen [EMAIL PROTECTED] wrote:
 hello

 Im using tomcat 5.5.9 and when i create a
 folder(mine)under
 webbaps (tomcat/webapps/mine)i cant even get to its
 index.html file by typing http://localhost:8080/mine;
 in my browser.The container says The requested
 resource (/kopie/) is not available (ie i get a 404
 http error report).

 on the other hand  accessing the index.html file and
 servlet examples in the  servlets-examples folder does
 not pose a problem. i could even duplicate this
 folder, reanme it and access its index.html file
 without anyproblem but as soon as i modify  the DD
 (deployment descriptor) i cant view the index.html
 file, let alone  access the servlets.

 thanks





 ___
 Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
 voicemail http://uk.messenger.yahoo.com

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problems delivering images / tomcat 5

2005-09-12 Thread Leon Rosenberg
Hi,

I have a strange behaviour with delivering images from our tomcats. 
I've just checked the manager on all machines and was quite surprised to see
following entries:

S 130223 ms 104 KB 0 KB xxx.xxx.xxx.xxx www.xxx.de GET
/dating/img/be2/be2Logout.gif HTTP/1.1 

I mean 130 seconds is a lot for a small image, isn't it?

We have a loadbalancer in front of our machines, so it shouldn't be a slow
client. I also don't see any other urls lasting so long, 
(similar images yes, but no dynamical urls).


Any idea anyone?

The hanging images are 75/105K large. We are using zip mode.

Regards
Leon

P.S. tomcat5.0.25, jdk1.4_08, linux/debian/3.1.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: empty lines in HTML output

2005-09-10 Thread Leon Rosenberg
Check for trimSpaces parameter in to the jsp servlet in conf/web.xml

But beware, combined with genStrAsCharArray option it can crash your tomcat
(at least it does with mine, at 5.0.25)


  !--   trimSpaces  Should white spaces in template text between
--
  !--   actions or directives be trimmed?  [false]
--

Then you have to change it to something like this:
servlet
servlet-namejsp/servlet-name
servlet-classorg.apache.jasper.servlet.JspServlet/servlet-class
init-param
param-namefork/param-name
param-valuefalse/param-value
/init-param

init-param
param-nametrimSpaces/param-name
param-valuetrue/param-value
/init-param
...
   /servlet
 

The other option you have is to close tags on next lines:
Instead of:
logic:equal ...
  bean:write ...
/logic:equal

Use:
logic:equal ...
 bean:write 
/logic:equal
Same applies to the jsp declaration and taglib import.

Regards
Leon



 -Ursprüngliche Nachricht-
 Von: Eugeny N Dzhurinsky [mailto:[EMAIL PROTECTED] 
 Gesendet: Samstag, 10. September 2005 19:27
 An: tomcat-user@jakarta.apache.org
 Betreff: JSP: empty lines in HTML output
 
 Hello! Is there any way to suppress the empty lines in JSPs 
 at the scriplet positions/JSP tags?
 
 --
 Eugene N Dzhurinsky
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How do you default an application to http://servername/

2005-09-09 Thread Leon Rosenberg
heh... there is a VERY simple but surely not spec-conform way: 
call your webapp ROOT
and add a mapping for /

regards
leon

On Fri, 2005-09-09 at 08:23 -0700, Aaron Pederson wrote:
 How do you default an application to come up when you hit the server on
 the port tomcat is running on? For my case Im running it as
 http://localhost:8080/.  Is it a server.xml setting?
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



re: Does Tomcat work on dual processor systems?

2005-09-08 Thread Leon Rosenberg
We have tomcat (5.0.x) on both intel xeon and amd two-processor systems, it
works (under linux / jdk 1.4). 
Maybe you should provide more details, but it doesn't sounds like a
multiprocessor problem.

Regards
Leon

 -Ursprüngliche Nachricht-
 Von: Asha Nallana [mailto:[EMAIL PROTECTED] 
 Gesendet: Donnerstag, 8. September 2005 23:00
 An: tomcat-user@jakarta.apache.org
 Betreff: Does Tomcat work on dual processor systems?
 
 I am having problem with Tomcat running on a dual processor 
 system? Has anyone tried this?
 Does it work?
 
 The server sockets from my application are not being created 
 or accepting connections. I don't know the exact cause. But 
 the symptom is that all client connections are not being 
 refused with the cause Connection Refused.  The creation of 
 these server sockets is random. 
 It works 50% of the time. I have tried changing the start up 
 sequence of Tomcat, Apache and my software but still no luck.
 
 Thanks.
 
 --
 Asha Nallana
 Director - Austin R  D
 Interact Incorporated
 9390 Research Blvd. Kaleido II, Suite 100 Austin, TX 78759
 (512)502-9969 x 113
 [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-07 Thread Leon Rosenberg
Check the bug:

http://issues.apache.org/bugzilla/show_bug.cgi?id=36541


And yes, the HashMap explicitely prohibits the way it's been used by tomcat
5 StandardSession in it's javadoc.




 -Ursprüngliche Nachricht-
 Von: Wade Chandler [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 7. September 2005 21:11
 An: Tomcat Users List
 Betreff: Re: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
 
 --- Remy Maucherat [EMAIL PROTECTED] wrote:
 
  On 9/7/05, GB Developer
  [EMAIL PROTECTED] wrote:
   coming late to the party with:
   
  
 
 http://blogs.opensymphony.com/plightbo/archives/000175.html
  
  I had read your blog when you originally posted it, and 
 thought it was 
  the most interesting blog I had read in months. IMO, given 
 the average 
  size of the array in a typical hashmap (very small), they 
 should have 
  added a robstness check (typically, e != e.next).
  
  --
  x
  Rémy Maucherat
  Developer  Consultant
  JBoss Group (Europe) SàRL
  x
  
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
  
 Nothing shocking about HashMap.  It becomes very hard to rely 
 on complex Objects if they are not being synchronized when 
 modified especially something like thismultiple lines of 
 code not being synchronized  Any map which is being put 
 from multiple threads should be synchronized and anything in 
 an inconsistant state is a bad idea period.  The hashtable 
 shouldn't be resizing anything when simply calling get..and 
 per the code it doesn't.  A put must be called for a resize 
 to take place no if and or but about it, so it's not just a 
 getAttribute call or even 50 million of them alone going to 
 cause HashMap to lock, but rather the Object being in an 
 intermediate step when get is called.  If you can use a 
 synchronized HashMap and the problem not occur then the 
 problem certainly comes from modifying the map and reading 
 from different threads at the same time which makes sense 
 when looking at the code and the javadoc statement(Directly 
 from the javadocs):
 
 Note that this implementation is not synchronized. If 
 multiple threads access this map concurrently, and at least 
 one of the threads modifies the map structurally, it must be 
 synchronized externally. (A structural modification is any 
 operation that adds or deletes one or more mappings; merely 
 changing the value associated with a key that an instance 
 already contains is not a structural modification.) This is 
 typically accomplished by synchronizing on some object that 
 naturally encapsulates the map. If no such object exists, the 
 map should be wrapped using the Collections.synchronizedMap 
 method. This is best done at creation time, to prevent 
 accidental unsynchronized access to the map: 
 
  Map m = Collections.synchronizedMap(new HashMap(...));
 
 Should be enough to explain the issue and why synchronization 
 should be used.  I haven't looked at the Tomcat code, but why 
 would a Session not use synchronized maps?  In my opinion 
 it's not a bug in HashMap as it's up front about it not being 
 synchronized.  To fix the original posters current situation 
 they should be able to synchronize on an object when 
 accessing the session...you'll just have to track down all of 
 your calls which are setting and getting attributes and 
 synchronize the code.
 
 My 2 cents
 
 Wade
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-07 Thread Leon Rosenberg
 

 -Ursprüngliche Nachricht-
 Von: Wade Chandler [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 7. September 2005 21:11
 An: Tomcat Users List
 Betreff: Re: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
 
 
 Should be enough to explain the issue and why synchronization 
 should be used.  I haven't looked at the Tomcat code, but why 
 would a Session not use synchronized maps?  In my opinion 
 it's not a bug in HashMap as it's up front about it not being 
 synchronized.  To fix the original posters current situation 
 they should be able to synchronize on an object when 
 accessing the session...you'll just have to track down all of 
 your calls which are setting and getting attributes and 
 synchronize the code.
 

Unfortunately no. Not only you have to rewrite all your calls to the
session, you also have to rewrite all 3rd-party taglibs like struts,
tapestry, pager, jstl or whatever you are using. Each getAttribute must
become synchronized.
It is simply not possible to fix it, without patching tomcat.

Regards
Leon



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Bug votes needed..you really should read this..Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-07 Thread Leon Rosenberg
I've send a similar mail to the struts-users mailing list. Maybe other
affected jakarta projects should be notified too.

Leon
 

 -Ursprüngliche Nachricht-
 Von: Wade Chandler [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 7. September 2005 23:05
 An: Tomcat Users List
 Betreff: Re: Bug votes needed..you really should read 
 this..Tomcat/JVM hangs in session.getAttribute / HashMap.get() 
 
 This bug doesn't only affect code where you access the 
 session using session.getAttribute() or 
 session.setAttribute(,), but also affects jsp tags such 
 as jsp:useBean with scope=session.  I'm guessing that pages 
 using EL and accessing the session are going to be broken as 
 well I didn't look that far, but if you are using the jsp 
 page context and using the methods 
 JspContext.get/setAttribute and using SESSION_SCOPE you will 
 be affected by the bug.
 
 The big picture here is that we can't control the users, and 
 if they make multiple threads access the session they can and 
 more than likely crash your server.  Remember if you access 
 the session from your application they can hit reload a few 
 times and cause this or if you use frames.  They could even 
 have more than one browser instance opened.  One the CPU will 
 start to get used up, and two your Tomcat threads will run out.
 
 Affected versions:
 Tomcat 5.0.x
 Tomcat 5.5.x
 
 If you don't have a bugzilla account maybe you can set one up 
 and vote for the bug.  It helps all of us to vote for bugs.  
 So, read up on it, and make a decision.  Don't read only a 
 few comments about the bug as the entire picture isn't 
 discussed.  Read them all and know what the issue is.  Here 
 is the bug:
 
 http://issues.apache.org/bugzilla/show_bug.cgi?id=36541
 
 Again, setup a bugzilla account and vote for this bug.
  If an application doesn't use the session at all it won't be 
 affected, but remember if you use sessions and notice your 
 Tomcat crashing or hanging then this is probably your issue.
 
 Wade
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Leon Rosenberg
Hi,

This is quite ugly but we are running out of ideas.

We are currently experiencing stange behaviour of tomcat (or the VM).

Our tomcat hangs (not reproduceable, but probably on parallel requests
to similar methods) in session.getAttibute():

We checked the source code of the HashMap, StandardSession and
StandardSessionFacade but couldn't find any synchronized methods. 
The manager shows the 4 threads hanging since 400 millis (more than
an hour). 

we created a stacktrace with kill - QUIT, here the threads are:


http-8580-Processor3 daemon prio=1 tid=0x7cdf11d0 nid=0x3269 runnable
[7d7fe000..7d7ff8bc]
at java.util.HashMap.get(HashMap.java:325)
at
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:975)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
at
de.friendscout.datingr4.shared.presentation.action.BaseAction.getUserId(BaseAction.java:653)
at
de.friendscout.datingr4.onlinearea.presentation.action.BaseOnlineAreaAction.getSettings(BaseOnlineAreaAction.java:89)
at
de.friendscout.datingr4.onlinearea.presentation.action.GetOnlineUsersAction.doExecute(GetOnlineUsersAction.java:49)


http-8580-Processor1 daemon prio=1 tid=0x7d3fa078 nid=0x3269 runnable
[7ce7f000..7ce7f8bc]
at java.util.HashMap.get(HashMap.java:325)
at
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:975)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
at
de.friendscout.datingr4.shared.presentation.action.BaseAction.getUserId(BaseAction.java:653)
at
de.friendscout.datingr4.onlinearea.presentation.action.ShowFiltersAction.doExecute(ShowFiltersAction.java:42)
at
de.friendscout.datingr4.shared.presentation.action.BaseAction.execute(BaseAction.java:316)



http-8580-Processor24 daemon prio=1 tid=0x7d430200 nid=0x3269 runnable
[7e77f000..7e77f8bc]
at java.util.HashMap.get(HashMap.java:325)
at
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:975)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
at
de.friendscout.datingr4.shared.presentation.util.RealmUtility.initRealm(RealmUtility.java:66)
at
de.friendscout.datingr4.shared.presentation.util.RealmUtility.initRealm(RealmUtility.java:61)
at
de.friendscout.datingr4.shared.presentation.controller.ControllerServlet.doGet(ControllerServlet.java:139)


My Java knowledge isn't sufficent to explain how something can hang in
HashMap.get() since its not synchronized. Neither are
the .getAttribute() methods of the StandardSession or
StandardSessionFacade. 

We are using jdk 1.4.2_08-b03, tomcat 5.0.25, struts 1.1, jacorb 2.2
(night build) on linux/debian/sarge - 3.1 stable.

any ideas? anybody?

regards
Leon



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Leon Rosenberg
On Tue, 2005-09-06 at 08:47 -0400, Larry Isaacs wrote:
 I have seen instances of a HashMap whose entries got circularly
 linked, I assume, due to updates which where not thread safe.
 Any thread using a get() on such a HashMap will spin forever
 chasing its tail.
 
 Cheers,
 Larry

Could be possible since we also have increasing load (until idle time
goes to zero) on those machines but...
we are putting only pretty simple objects like Locale or an userId
object. 
If I understand you correctly your scenario is:
HashMap Entry has a linked list of X entries at one position
and entry[Y] is poiting to the first entry instead of next or null?
But how can that happen? a JVM / Core Api bug?


public abstract class UserId  implements Serializable{

public abstract String getPlainPresentation();

public boolean equals(Object anotherObject){
return anotherObject instanceof UserId ? 

((UserId)anotherObject).getPlainPresentation().equals(getPlainPresentation()):
false;
}

public abstract String[] getFragmentation(int fragementationDepth, int
fragmentLength);

public String toString(){
return getPlainPresentation();
}
}

public class LongUserId extends UserId implements Serializable{

private long value;
private transient String cachedStringPresentation; 

private static final long serialVersionUID = 451670268366493765L;

public LongUserId(long aValue){
this.value = aValue;
}
  
public int hashCode(){
return (int)value;
}


public boolean equals(Object o){
return (o instanceof LongUserId) ? 
((LongUserId)o).value == value : false;
}


public String[] getFragmentation(int fragmentationDepth, int
fragmentLength) {
String s = getPlainPresentation();
//first ensure our string is long enough.
while (s.length()fragmentationDepth*fragmentLength)
s = 0+s;

int singleLength = fragmentLength;
String ret[] = new String[fragmentationDepth];
for (int i=0; ifragmentationDepth; i++){
String fragment = s.substring(i*singleLength, 
i*singleLength
+singleLength);
ret[i] = fragment;
}
 
return ret;
}

public String getPlainPresentation() {
if (cachedStringPresentation==null)
cachedStringPresentation = +value;
return cachedStringPresentation;
}


thanx
Leon


 
  -Original Message-
  From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
  Sent: Tuesday, September 06, 2005 8:31 AM
  To: tomcat-user@jakarta.apache.org
  Subject: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
  
  Hi,
  
  This is quite ugly but we are running out of ideas.
  
  We are currently experiencing stange behaviour of tomcat (or the VM).
  
  Our tomcat hangs (not reproduceable, but probably on parallel 
  requests to similar methods) in session.getAttibute():
  
  We checked the source code of the HashMap, StandardSession 
  and StandardSessionFacade but couldn't find any synchronized methods. 
  The manager shows the 4 threads hanging since 400 millis 
  (more than an hour). 
  
  we created a stacktrace with kill - QUIT, here the threads are:
  
  
  http-8580-Processor3 daemon prio=1 tid=0x7cdf11d0 
  nid=0x3269 runnable [7d7fe000..7d7ff8bc]
  at java.util.HashMap.get(HashMap.java:325)
  at
  org.apache.catalina.session.StandardSession.getAttribute(Stand
  ardSession.java:975)
  at
  org.apache.catalina.session.StandardSessionFacade.getAttribute
  (StandardSessionFacade.java:109)
  at
  de.friendscout.datingr4.shared.presentation.action.BaseAction.
  getUserId(BaseAction.java:653)
  at
  de.friendscout.datingr4.onlinearea.presentation.action.BaseOnl
  ineAreaAction.getSettings(BaseOnlineAreaAction.java:89)
  at
  de.friendscout.datingr4.onlinearea.presentation.action.GetOnli
  neUsersAction.doExecute(GetOnlineUsersAction.java:49)
  
  
  http-8580-Processor1 daemon prio=1 tid=0x7d3fa078 
  nid=0x3269 runnable [7ce7f000..7ce7f8bc]
  at java.util.HashMap.get(HashMap.java:325)
  at
  org.apache.catalina.session.StandardSession.getAttribute(Stand
  ardSession.java:975)
  at
  org.apache.catalina.session.StandardSessionFacade.getAttribute
  (StandardSessionFacade.java:109)
  at
  de.friendscout.datingr4.shared.presentation.action.BaseAction.
  getUserId(BaseAction.java:653)
  at
  de.friendscout.datingr4.onlinearea.presentation.action.ShowFil
  tersAction.doExecute(ShowFiltersAction.java:42)
  at
  de.friendscout.datingr4

RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Leon Rosenberg

  If I understand you correctly your scenario is:
  HashMap Entry has a linked list of X entries at one position 
  and entry[Y] is poiting to the first entry instead of next or null?
 
 Correct.
 
  But how can that happen? a JVM / Core Api bug?
 
 The error is likely in webapp code, since the Servlet spec leaves
 it up to the webapp to implement thread safe setting and update of
 session objects.  I haven't researched the HashMap source code to
 see exactly how this situation can come about, so I can't say
 exactly what to look for.  Thus, the not terribly helpful advice
 is to examine for thread safety each location where the session is
 written.
 

Ok understood, just to be sure. In a util class I do following:

public void addBeanToSession(HttpServletRequest req, String beanName,
Object beanValue){
  HttpSession session = req.getSession();
  synchronized(session){
 session.setAttribute(beanName, beanValue);
  }
}

and replace all req.getSession().setAttribute(beanName, beanValue) in
code with the call to this method (same for remove) and I've solved my
problem?

thanx for your help
regards
Leon



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SOLVED] Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Leon Rosenberg
Chuck, Larry thanx.

regards
Leon



On Tue, 2005-09-06 at 09:53 -0500, Caldarale, Charles R wrote:
  From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
  Subject: RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
  
  and replace all req.getSession().setAttribute(beanName, beanValue) in
  code with the call to this method (same for remove) and I've solved my
  problem?
 
 Unfortunately, you also need to change the places that retrieve
 attributes from the Session, since the hash map is in a state of flux
 during the setAttribute() invocations.
 
  - 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Leon Rosenberg
 :
request.getSession().removeAttribute(key);
break;

case PageContext.REQUEST_SCOPE :
request.removeAttribute(key);
break;

default :
throw new RuntimeException(Unknown scope: + 
scope);
}
}

public static void addBeanToSessionSafe(HttpServletRequest request,
String key, Object value) {
HttpSession session = request.getSession();
if (logger!=null)
logger.debug(addBean  + key +  to SESSION_SCOPE, 
value= + value);
synchronized(session){
session.setAttribute(key, value);
}
}

public static void removeBeanFromSessionSafe(HttpServletRequest
request, String key){
HttpSession session = request.getSession();
if (logger!=null)
logger.debug(removeBean  + key +  from 
SESSION_SCOPE);
synchronized(session){
session.removeAttribute(key);
}
}

public static Object getBeanFromSessionSafe(HttpServletRequest request,
String key) {
HttpSession session = request.getSession();
Object value = null;
synchronized(session){
value = session.getAttribute(key);
}

if (logger!=null)
logger.debug(getBean  + key +  from SESSION_SCOPE: 
+value);
return value;
}


}


On Tue, 2005-09-06 at 16:41 +0100, Arup Vidyerthy wrote:
 Guys,
 
 I have been watching this thread with interest.
 
 Does this mean that all session.setAttribute() and session.getAttribute()
 should always be synchronised (for instance, inside a servlet or struts
 action) provided the same hashmap is accessed by say more than one
 servlet/struts action?
 
 Kind regards...
 Arup Vidyerthy. 
 
 -Original Message-
 From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
 Sent: 06 September 2005 15:54
 To: Tomcat Users List
 Subject: RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
 
  From: Leon Rosenberg [mailto:[EMAIL PROTECTED]
  Subject: RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
  
  and replace all req.getSession().setAttribute(beanName, beanValue) in 
  code with the call to this method (same for remove) and I've solved my 
  problem?
 
 Unfortunately, you also need to change the places that retrieve attributes
 from the Session, since the hash map is in a state of flux during the
 setAttribute() invocations.
 
  - 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
   
 ___ 
 To help you stay safe and secure online, we've developed the all new Yahoo! 
 Security Centre. http://uk.security.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Leon Rosenberg
On Tue, 2005-09-06 at 11:00 -0500, Caldarale, Charles R wrote:
  From: Arup Vidyerthy [mailto:[EMAIL PROTECTED] 
  Subject: RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
  
  Does this mean that all session.setAttribute() and 
  session.getAttribute() should always be synchronised
 
 That's the conclusion I'm reluctantly coming to, if there is the
 possibility of multiple threads updating the same session
 simultaneously.  Luckily, you would think that most operations would
 really be request, not session, related.
 

clearly, 90% are in the request or even page scope, but 10% you have in
session (like locale, user related info like authentification or granted
permissions) are needed on each request (at least we do :-))

on the other hand it encourages me to work sessionless in the future...
(*dreaming*)

regards
Leon


  - 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]