RE: List subscription problem

2004-09-22 Thread Endre Stølsvik
On Tue, 21 Sep 2004, Suzanne wrote:

| Along those same lines, I DID NOT subscribe to this list! I have sent a
| notice to the unsubscribe link more than once and yet I continue to get
| dozens of emails from your group. Any insight on how I may have become
| connected to this list or how to remove my address from your your email
| list

It might be that someone else in your company (or whatever) have
subscribed a company-internal list that you are on. You thus receive these
mails indirectly.

Check the headers of the mail (as Yoav suggested), then look for headers
like this:

Received: from mail.apache.org (hermes.apache.org [209.237.227.199])
by voyager.coretrek.no (Postfix) with SMTP id 4AEE7A8933
for [EMAIL PROTECTED]; Tue, 21 Sep 2004 20:35:15 +0200 (CEST)

The for part (last of those three lines) describes for whom the mail
system received the mail - and might reveal that it isn't to you at all,
but some internal (or external) mailing list.

Endre


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



Re: Tomcat vs BEA Weblogic?

2004-09-20 Thread Endre Stølsvik
On Mon, 20 Sep 2004, Bjørn T Johansen wrote:

| I am taking over a project that's running on Weblogic 8.1 SP3 today.. They are only 
using
| the jsp-container and it is time to renew the support agreement with BEA.

Kjoer med Tomcat! Serioest - hvis du vet hva det er snakk om, og vet hva
du gjoer, saa er jo Tomcat -vesentlig- bedre enn noe som helst
kommersielt.

Sjekk denne:
  http://www.webperformanceinc.com/library/ServletReport/
  (Selskap som hindrer en i aa publish performance benchmarks
simpelthe1n ber om aa -aldri- faa en dollar av meg - det er regelrett
forkastelig! )

Mvh,
Endre


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



Re: Tomcat vs BEA Weblogic?

2004-09-20 Thread Endre Stølsvik
Ehh, oops.  ;)

I was about to post personally to this dude, which obviously is a
Norwegian, when I hit the send button (ctrl+x, y) slightly early!

Endre!


On Mon, 20 Sep 2004, Endre Stølsvik wrote:

| On Mon, 20 Sep 2004, Bjørn T Johansen wrote:
|
| | I am taking over a project that's running on Weblogic 8.1 SP3 today.. They are 
only using
| | the jsp-container and it is time to renew the support agreement with BEA.
|
| Kjoer med Tomcat! Serioest - hvis du vet hva det er snakk om, og vet hva
| du gjoer, saa er jo Tomcat -vesentlig- bedre enn noe som helst
| kommersielt.
|
| Sjekk denne:
|   http://www.webperformanceinc.com/library/ServletReport/
|   (Selskap som hindrer en i aa publish performance benchmarks
| simpelthe1n ber om aa -aldri- faa en dollar av meg - det er regelrett
| forkastelig! )
|
| Mvh,
| Endre


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



RE: Why is Tomcat/Connector Installation So Incredibly Painful??

2004-09-09 Thread Endre Stølsvik
|
| Well, that's subjective, so I won't argue.  I find it not only elegant,
| but far better than one thread pool for the whole server, but it's a
| matter of stylistic preference.  I'm glad you found a good solution that
| works for you, and as I said before your other argument about the
| server-side redirects is strong and convincing.

As you already have to convince Apache of which server it is, it is just a
matter of stating to your connector which server it is, too (you can
override the connector's assumptions in your connector-definition,
right?).
  Well, for me both arguments are just as convincing. I will probably
stick with mod_jk, even though I always cringe when thinking about the
next installation of any such installation.
  It would, however, be great if mod_proxy was extended with some features
that made it compatible with Tomcat's requirements - so that both these
arguments vanished. These features would probably be great for many proxy
environments, in particular where the back-end system also is active.

Endre


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



Re: TLS-Enabled Connector Prevents Startup

2004-09-08 Thread Endre Stølsvik
On Tue, 7 Sep 2004, Igor Zlatkovic wrote:

| I have found the solution and will share it here incase someone
| encounters a similar problem in the future.
|
| The solution is:
|
|   # cd /dev
|   # mv random random-old
|   # ln -s urandom random
|
| however bizarre that may sound. It seems that the recent Linux kernel
| update wasn't up to Tomcat's liking. For whatever the reason, Tomcat's
| initialising of the TLS connector blocks in a read from /dev/random,
| always. Ensuring that it reads from /dev/urandom instead makes it happy
| again.

( Nothing very valuable in the following, really, I've just had the exact
same situation with a SecureRandom in my application that I seeded with
/dev/random.. )

/dev/random has an entropy pool that may get depleted, in which case
it'll block till it has gotten more bits of entropy. I've experienced that
on a server standing in a corner, w/o keyboard or other direct human
input, this might take forever (for example, it doesn't use ethernet
traffic, as this can become non-random at times..)

I guess the TLS Connector (where is that?) uses /dev/random for its
initialization for its instance of a java.security.SecureRandom. However,
I believe that on new VMs the default initialization (default == no
seeding on creation) of SecureRandom is pretty good, utilizing the OS's
native random mechanisms. I think that 1.3 has been like this on windows
for some time, while maybe 1.4 fixed this for Linux?
  However, if the linux-default init uses /dev/random (instead of
urandom), then this might be the problem? The TLS Connector might be
changed to use a configurable source for randomness for seeding, e.g.
either a file, or default init.

Endre


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



RE: Why is Tomcat/Connector Installation So Incredibly Painful??

2004-09-07 Thread Endre Stølsvik
On Tue, 7 Sep 2004, Shapira, Yoav wrote:

|
| Hi,
| I would point out a few things:

 [ - chop - ]

Do you really deny that mod_jk is somewhat hard to install? I mean,
probably 50% av the OH MY WHATEVER - I CAN'T GET THIS TO WORK!!! mails
are related to mod_jk..


| Moreover, as Tomcat as maturing the importance of the connectors in
| general is going down IMHO, with more and more standalone installations.

What if you run some PHP stuff and some Servlet stuff on the same
servername? Or simply many tomcats behind a front-end?
  Even if it isn't for anything else, a transparent forwarding mechanism
between a specific subset of the server's URL namespace (quote from
ServletContext) of the server holding the listen call at port 80, and
Tomcat, will always be needed, I believe.

The mod_jk approach of inventing a new binary protocol and whatnot is
maybe not the right solution for this. A simple raw forwarding of the
requests from Apache HTTPD to Apache Tomcat would be incredibly nice.

Others probably likes the enterprise features (a/k/a clustering) of
mod_jk better, and thus won't be happy with a simple forward..

One also have other HTTP servers than Apache, in particular IIS.

Endre

PS: Is it possible to get mod_proxy to do this raw forwarding perferctly?
(SSL? Client certificates? persistent connections, pipelining, ALL headers
and whatnots?) ..



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



RE: Why is Tomcat/Connector Installation So Incredibly Painful??

2004-09-07 Thread Endre Stølsvik
On Tue, 7 Sep 2004, Shapira, Yoav wrote:

|
|   Even if it isn't for anything else, a transparent forwarding
| mechanism
| between a specific subset of the server's URL namespace (quote from
| ServletContext) of the server holding the listen call at port 80, and
| Tomcat, will always be needed, I believe.
|
| Claiming that something will always be needed is beyond my clairvoyance
| abilities, but thankfully some people can apparently see the future ;)

My Crystal Ball tells me that there will be approx. 5000 more complaints
about mod_jk, and approx. 1000 replies from the developers stating fix it
yourself and DON'T complain anymore!!.
  At that point, everybody have begun using ASP.NET instead, on Mono.

I believe that the reason for these problems lay in the nature of the
WebServer/Tomcat bridge: it's rather complex C code being hacked together
to run on a heap of different OSes and Webservers. One need insight in two
rahter different worlds to be able to code this stuff - and these
abilities are not very common, as is plainly obvious.
  I don't posess them - if I did, I think even I would have scratched that
extreme itch a long time ago!

Endre.


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



RE: ASP.NET and Tomcat on same computer

2004-08-28 Thread Endre Stølsvik
On Sat, 28 Aug 2004, Nelson, Jerry W, Contractor 146CF, SCB wrote:

| The same computer and I don't know, all I know is I downloaded the Jakarta
| Apache-Tomcat version 5.0.27 zip file and unzipped it.

You gotta go down the mod_jk road..! You mount Tomcat using something
called mod_jk onto IIS - thus IIS acts as a frontend for both your
ASP.NET application (which it runs natively), and for Tomcat (which it
forwards requests to, using the JK protocol)..

Google it - and there's lots of info about this in the docs.

Endre


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



Re: Changing session-cookie(JSESSIONID) name in tomat

2004-08-23 Thread Endre Stølsvik
On Mon, 23 Aug 2004, Dineshram Villuri wrote:

| I have two applications running on different tomcats in the same physical
| box. Both applications use the same authentication mechanism (wherein when 2
| users are logged in with the same username the earlier one is kicked
| out/logged off). At any time there should be only one user logged in with
| the same user name. Though both these use the same mechanism they are 2
| independent application but for some weird reasons should run on the same
| box.
|
| Now we understand that the problem is with the cookie-name JSESSIONID. Since
| both the applications are having the same cookie name(JSESSIONID) if one
| user logs on into app1 and an other one is logged on to app2(diff tomcat)
| with the same username the earlier one is kicked out.
|
| We are facing this problem only when 2 tomcats are running on the same box.
| When they are running on different boxes it works fine but we have to run
| them on the same box for other reasons.
|
| Can someone please point me to a different solution (if available) in case
| JSESSIONID cannot be changed?

You could use virtual hosts - tell your users that the first application
is found at one.pinksheets.com, while the other application is found at
two.pinksheets.com. Then use DNS to configure these two names to be the
same IP, either using A records, or CNAMEs.

But I also have difficulties with understanding the problem, as the cookie
should also have the pathname of the application within its data. That
is, a browser sends different cookies to http://box.name/app1 than to
http://box.name/app2. But you have a problem if you have put your
application as the ROOT webapp, since you then get http://box.name/. The
cookie from this ROOT webapp will then override all the other cookies, I
believe.. Or was it the other way, that the most specific cookie is sent
along? See, I don't remember.. But check this out..

Endre



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



RE: Tomcat clustering without Apache

2004-08-17 Thread Endre Stølsvik
On Mon, 16 Aug 2004, Mitchell Teixeira wrote:

| Thanks for the responses so far on this topic.  Seems like I need to
| elaborate a little
|
| We are looking towards Tomcat clustering to solve a problem caused by
| so-called Megaproxy ISPs such as AOL, etc. These ISPs make it look as if
| the same client is coming from multiple IP addresses.

How nice of them..! ;)

| This breaks our app, quite simply.

I can't understand this, though. Do you sort/stick your sessions on ip??
  What about simple, commonday problems like NAT-LANs? Where 50 PCs from
the same office, company, houshold, office, whatever, seems to come from
the same IP?

You need cookies. And you need a loadbalancer that sticks the sessions
based on cookie. I know that Cisco LocalDirectory can do this, and
something called BigIP - both of which are cluster-boxes that uses
different style of stickyness, the cookie-based stickyness being the
most commonly used for things with sessions.
  (Note that the LocalDirector does not need to know of the
session-semantics, timeout or anything, of the app server (Tomcat) behind.
It just needs -anything- that is unique coming from the client every time
it connects - so to keep the stickyness. Whether Tomcat chooses to drop
the cookie, doesn't really matter, as LocalDirectory simply still would
route that client to this specific box - and your app would understand it
as a new client coming in).

| We're hoping that clustering, with its replicated session data will
| resolve the problem where a customer hitting one physical server and
| adding items to the cart (and therefore session data) then goes to
| checkout and at that moment they appear to be coming from a different IP
| address and end up on the other physical server and an empty cart!

Hmm - I can't seem to imagine that solving your problem in a nice way..
Remember that replicating the session data is rather expensive - and if
your problem is performance (why would you have multiple servers in the
first place?) - then you'll now have to replicate session data between
servers on every client access in addition to your earlier bottlenecks.

|
| Load balancing with stickiness helps some, but not completely. Add SSL
| requirements to the mix and you can imagine the headache.

No, I can't seem to imagine! ;) You should let LocalDirector do the
SLL'ing - and then you can use the SSL Session as stickyness too.

Note that there are some open source solutions to this problem, using a
specially configured Linux box as an imitation of the LocalDirector.

Note (2) that to achieve no-single-point-of-failure, you'd need -two-
LocalDirectors - they're then linked using some super-proprietary bridge,
and all state are replicated between the two - if one fails, the other
takes over immediately, incl. the TCP connections.
  This is also copied in the open source solution - but I haven't tested
it at all.

| There are lots of load balancing and hardware accellerator vendors
| professing to have a solution, but none of these are really addressing
| the root problem.

I must be missing something - what is the root problem, exactly?

|
| So, with all this said, is it possible to make two or more physical
| servers talk as a Tomcat cluster without Apache or IIS, etc.?  All
| references seem to rely on Apache to make clustering happen.  (just like
| some texts on JSP rely too much on using Struts to teach JSP! end rant).

Just out of curiousity, why can't you use Apache in front?

Endre


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



Re: Tomcat clustering without Apache

2004-08-17 Thread Endre Stølsvik
On Tue, 17 Aug 2004, QM wrote:

| On Tue, Aug 17, 2004 at 05:33:00AM -0700, Cott Lang wrote:
| : One problem with that is you can still have the session hop servers
| : since the Local Director can't match up cookie based mappings to SSL
| : session mappings, since it can't read the cookies from SSL connections,
| : and can't read non-existant SSL session IDs from non-SSL sessions.
|
| I may have dreamt this =) but I thought you could have the
| LocalDirector/F5/whatever handle SSL for you, then send plaintext
| traffic back to the Tomcat containers.   (This is effectively what
| people do when they put a web server in front of Tomcat using jk/jk2.)

That's exactly what I meant.

Have a good read on the LD and BigIP (or whatever it was) and the
Linux-based approach, I think you might find something in there that
magically solve those problems.

|
| That would grant the LD/F5/etc access to plant their own cookies and
| otherwise determine which client was bound to that Tomcat.

Yes.

That's also what I referred to when mentioning SSL Session - see, the
SSL layer in effect creates a session with the client, and one can thus
use this to do sessioning/sticking with - AT LEAST this works when you use
client certificates, but I'm not totally sure how this goes when there is
no client certificate. Still the browser and server has to do some
negotiation of what session key they'll use - and this is what I believed
was the key to session-keeping-aspect of SSL.

|
| -but again, this is all hazy in my memory, so I fear I may have dreamt
| it all...

I'm pretty sure of this. This is supposed to be one of the nice things
with these dedicated clustering boxes: HW SSL..

Endre


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



Re: SOLVED: How to get the context path for a web application?

2004-08-13 Thread Endre Stølsvik
On Thu, 12 Aug 2004, Jacob Kjome wrote:

| To get the context path at init time, try this

Thanks..! Good to see that others (log4j!!) have this problem!
  However, I have been thinking along these lines (the second idea
presented) already, but it then again boils down to that you really cannot
assume anything about what environment you're within. See, typically in
the development environements we use, the dirname of the webapp have
nothing in common with the mount name (you specify that in the tomcat
server config file, or these other xml-snippets outside of the file) -
thus I'm back to the starting point: no knowledge!

If only the SerlvetContext object would be so nice as to have a simple
method getContextPath(), we'd all be happy!

Endre


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



RE: SOLVED: How to get the context path for a web application?

2004-08-13 Thread Endre Stølsvik
On Fri, 13 Aug 2004, Shapira, Yoav wrote:

| Hi,
| And of course, since you can get the source for JSR154, there's nothing
| preventing you from adding this method and running with a custom servlet
| jar in your container.  (It's at
| http://cvs.apache.org/viewcvs.cgi/jakarta-servletapi-5/jsr154/, complete
| with a build file).

Hehe! Forking the JSR, that'd be a little hefty, don't you think? ;)
  Ask customers to dig up the servlet.jar from their chosen Servlet
Container, replace it with this special one, binary-patch the potentially
obfuscated class-files to implement this method, and -then- deploy the
application. Yeah, why not..!

I think I'd rather use one of the hacks suggested here, or simply
configure it in web.xml or similar, as you already suggested.

But, why wouldn't all be happy? And why isn't it simple?

Endre


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



Re: SOLVED: How to get the context path for a web application?

2004-08-12 Thread Endre Stølsvik
On Wed, 11 Aug 2004, David Wall wrote:

|  The cause for some of these specs is the fact servlet containers aren't
|  required to run on file systems.  For example, they may run entirely
|  inside a DBMS (and Oracle had such a container for a while), in which
|  case you must deploy in a packed WAR and the subset under a server's
|  URL name space is not a hard-drive path.

I do know this.

|
| Nobody cares if this maps to a file system or not.

Totally agree - it has nothing at all with filesystem, or whether the
webapp is stored on a read-only stone-tablet - I want to know what subset
of the webserver's URL namespace I'm mounted beneath, at init time. What
I'll do with that information is my business!
  As this is a static element; the webapp is, -per definition- (The
javadoc snippet) mounted beneath a subset of the URL namespace; there is
no reason I can fathom why this shouldn't be made available to us coders
that are making webapps, at init time. The point is that the webapp won't
change mount point from request to request, will it? So the web
container must know at init-time which sub-space it will mount the webapp
under.. Just please make that information available then, at init time!

IMO, that is.

 ( -My- use-case is, as mentioned, that I want to make it easy for
developers to override some (development-)settings of the framework. In
the webapp I'll check whether it is possible to do file-system access and
System-property-getting, and if so, then check for and read the files
$userdir/devel/develconfig.xml, and then
$userdir/devel/webappname/develconfig.xml.  It if it is not possible,
then I won't do that, and assume that I am in a production environment or
something. )

I'd just love to see this extra method added.

Endre.


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



RE: SOLVED: How to get the context path for a web application?

2004-08-11 Thread Endre Stølsvik
On Tue, 10 Aug 2004, Shapira, Yoav wrote:

|
| Hi,
|
| Agreed, but my follow-up question was if there was such a call to be
| done
| using a ServletContext/ServletConfig object so that you can get the
| context
| path in initialization servlets, etc., before a request comes in.
|
| No, and an archive search would reveal past discussions around this
| issue (though none recently).   Webapps are supposed to be independent
| of their server configuration including with regards to context path,
| and so the Servlet Spec actively discourages you from doing webapp
| initialization or configuration based on such data.  A lot of people
| debated for a long time what does and doesn't go into the
| ServletContext/ServletConfig objects as opposed to Request/Response
| objects.

I'm jumping in on this thread, since I just had the same problem: I wanted
to do some initing for developers on a particular setup, where I wanted to
be able to override init (development-)settings per user per webapp w/o
messing with any webapp-specific config files. Per user is OK, but per
webapp is impossible.

Look at this snippet from servlet JavaDocs..:

[ http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html ]

There is one context per web application per Java Virtual Machine.
(A web application is a collection of servlets and content installed
under a specific subset of the server's URL namespace such as /catalog and
possibly installed via a .war file.)  

Thus, there is a -clear- notion of a Webapp living under a specific
subset of the server's URL namespace. What is that subset, please?

I find it very non-coherent and non-consistent that you can get this on a
request, but not on startup. Now, why is that? The argument about
supposed to be independent doesn't do it for me: This independence isn't
more enforced by -taking away- the information that you nonetheless have
to, and are, given on a request. And it encourages, as you state in a
later mail, folks to duplicate information in config files, e.g. web.xml -
and at that point you most definately have ripped the independence of the
webapp to small pieces.


If anyone here will be on the next Servlet EG, then please ask these
questions again! I'm informed that this has had its fair share of
discussion before - but please either remove that JavaDoc, or -gimme the
information- via the ServletContext object!

Endre.


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



Re: JVM memory size changing dramatically

2004-07-29 Thread Endre Stølsvik
On Wed, 28 Jul 2004, Dennis Dai wrote:

| Can't remember where I read it but it's something like this on
| NT/2k/XP/2k3 family:
|
| Windows is using the physical memory as cache to cache the real app
| image in the swap file. So if your app has been idle for a while, it's
| very likely to be swap out of the physical memory. This is regardless of
| how much physical memory you have.
|
| Interesting approach but sometimes annoying.

Yes, this is called something progressive or aggressive swapping or
something: it swaps away idle physical memory even if it isn't short in
it, just to have max amount of physical memory ready at any time.

On windows, you'll often notice that it's a real drag to get your windows
desktop going in the morning (given that it is on 24/7, of course), like
every app is taking a long time to get its window up and such. This is
caused by this aggressive swapping scheme.

Regarding the initial question, have you turned on every column there is
on the task manager? There are lots other than the inital few ones. It
might be that you're looking at something like the memory actually mapped
physically-column, while the image size is the same.

When you get your 500 visitors, it won't go down to 5 MB - since
everything is active then. But do some testing.. (!) - your app might
crash for other reasons than memory.

Also, you apparently say that 256 MB should be the -inital- memory
allocated (-Xms256), it is actually a bit weird that it shows steadily 80,
when you've asked java to pre-allocate 256 MB. You could log, now and
then, the values reported by the all the Runtim.*Memory() methods (there
are one extra on 1.4 than 1.3) - they give you a clues to how much mem the
JVM has allocated for java.

As a side note, I'll heavily recommend swapping the bad task manager for
the MUCH better and information-rich process explorer from sysinternals:
  http://www.sysinternals.com/ntw2k/freeware/procexp.shtml
(One thing that is just amazing with this, is the feature of scanning
through the processes to find which process have opened/locked a file - MS
themselves haven't come up with this obvious feature yet (lsof on
unix).. )

Have fun!

One question from me: where do you get all those other options from? Where
do I get a listing of those extra-options, documentation?

-- 
Mvh,
Endre Stølsvik   M[+47 93054050] F[+47 51625182]
Developer @ CoreTrek AS -  http://www.coretrek.com/
CoreTrek corporate portal / EIP -  http://www.corelets.com/




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



RE: JVM memory size changing dramatically

2004-07-29 Thread Endre Stølsvik
On Thu, 29 Jul 2004, Shapira, Yoav wrote:

| One question from me: where do you get all those other options from?
| Where do I get a listing of those extra-options, documentation?
|
| The options for what?

These:

-
My JAVA_OPTS as follows


JAVA_OPTS=-server -Xms256m -Xmx768m -XX:NewSize=64m -XX:MaxNewSize=64m
-XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=5
-XX:TargetSurvivorRatio=75 -XX:PermSize=32m -XX:MaxPermSize=32m -Xss128k
-XX:+DisableExplicitGC
-

Endre


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



Re: No Java compiler was found to compile the generated source for the JSP

2004-07-13 Thread Endre Stølsvik
On Mon, 12 Jul 2004, Simone-dev wrote:

| I remember in tomcat 5.0.18 there was a java Home property, but now I've
| just a Java Virtual machine
| originally it was set to C:\Program
| Files\Java\j2re1.4.2_05\bin\client\jvm.dll (and didn't worked)
| then I changed it to C:\j2sdk1.4.2_05\jre\bin\client\jvm.dll but still
| doesn't work

I guess you most definately need the j2sdk (SW development kit) and not
the j2re (runtime environment), as you need the compiler..!!

But it still didn't work?!

Endre



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



RE: I've officially decided that JSTL is one of the worst things to ever happen to mankind

2004-07-12 Thread Endre Stølsvik
On Fri, 9 Jul 2004 [EMAIL PROTECTED] wrote:

| Would you guys take this conversation off the list please?
| Its heavy enough without your personal comments.

Aren't there room for any fun?! This is the most rewarding and interesting
thread in a while, in my opinion..! :)

;)

Endre


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



RE: Memory Settings On Tomcat

2004-06-17 Thread Endre Stølsvik
On Wed, 16 Jun 2004, Shapira, Yoav wrote:

|
| Hola ;)
|
| Okay? Expected? I don't get that. Can you point me to a email-subject
| of
| one of those threads? Or several?!
|
| There are a number of issues in this space.  For example, if your
| servlet class keep a static reference, that can't be garbage collected
| when the webapp is recycled.
| Therefore the old class definition itself can't be discarded and must be
| kept along with its classloader in the JVM.  A new classloader is
| created and loads new copies of your webapp classes, resulting in a
| total memory increase.
|

Why not? I don't think this is correct. See, if the class isn't referenced
anymore, by not having any referenced objects of that class (by any
reference), nor having the class object referenced, on the stack of any of
the JVM's created Threads, then the static fields of that class isn't
referenced either, and thus both will be gc'ed, and then the classloader
will be gc'ed..

| Eventually, we made a note of this in the release notes: see the section
| titled Web application reloading and static fields in shared
| libraries.

This concerns something else, but is a very good point. I didn't actually
know that any -shared- standard Java library will put references to my
objects in its internal structures. Know of any specific examples of this?

|
| That's one example.  There are other more insidious cases.  If you
| search the list archives (or even google) for things like tomcat webapp
| reload memory leak or tomcat reload OutOfMemoryError you'll see the
| threads and discussions, e.g.
| http://www.junlu.com/msg/38828.html and
| http://www.junlu.com/msg/13981.html.

I will do this - and thanks a LOT for your time and information so far!

Endre.


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



RE: Memory Settings On Tomcat

2004-06-16 Thread Endre Stølsvik
On Tue, 15 Jun 2004, Shapira, Yoav wrote:

|
| Hola,

Yo!

|
| I know - but Sun's VMs surely seems to follow your suggestions!
|
| They might, and they might not, that's the point.  Other VM
| implementations can choose to ignore System.gc(), or even Sun
| implementations on certain platforms (many J2ME installations ignore
| these calls).

Yes - and I suggested that one could try it out, just for kicks..! ;)

|
| That depends on your platform and settings.

Most definately - but Sun's VMs have been doing this for some time
(always?), and thus the gc() diff is interesting on this particular VM, at
least.

|
| I have to debug this now, it will be interesting to see if it is Tomcat
| code or my code that have the bug..! ;)
|
| It is expected that every reload will increase total memory usage,
| monotonically, it's not a bug, and there are numerous discussions about
| this and related issues in the arhicves.

Okay? Expected? I don't get that. Can you point me to a email-subject of
one of those threads? Or several?!

Thanks for info, anyway!

Endre.


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



RE: Memory Settings On Tomcat

2004-06-15 Thread Endre Stølsvik
On Mon, 14 Jun 2004, Woodchuck wrote:

| Runtime.getRuntime().maxMemory() will get you the
| maximum amount of memory for your jvm.

Yeah, check out maxMem, freeMem and totalMem.. Are those something along
the line of what you're looking for?

Endre


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



RE: Memory Settings On Tomcat

2004-06-15 Thread Endre Stølsvik
On Tue, 15 Jun 2004, Endre Stølsvik wrote:

| On Mon, 14 Jun 2004, Woodchuck wrote:
|
| | Runtime.getRuntime().maxMemory() will get you the
| | maximum amount of memory for your jvm.
|
| Yeah, check out maxMem, freeMem and totalMem.. Are those something along
| the line of what you're looking for?

You might also want to try .gc() (force Garbage Collection) - run
freeMemory() right before and right after .gc(), print out the diff too.

  Interesting numbers, these - I can stay up all night watching them
unfold over my screen.. growing, shrinking.. growing .. growing ..
GROWING?? ah..  shrinking.. shrinking..

  You get the point..

Endre.


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



RE: Memory Settings On Tomcat

2004-06-15 Thread Endre Stølsvik
On Tue, 15 Jun 2004, Shapira, Yoav wrote:

|
| Hi,
|
| You might also want to try .gc() (force Garbage Collection) - run
| freeMemory() right before and right after .gc(), print out the diff
| too.
|
| Man, I expect this error from novice posters, but not from you ;)

Oh, thanks..! ;)

| System.gc is ONLY A SUGGESTION.

I know - but Sun's VMs surely seems to follow your suggestions!

|  The more recent the JVM, the more likely it is to be ignored by the
| JVM, and moreover more and more admins/developers I know are setting
| -XX:+DisableExplicitGC as a Standard Operating Procedure.  Don't count
| on System.gc for anything.

Well, 1.5beta2 (that's rather recent, ai?) GC's like hell when I invoke
the method - it even seems to do it synchronous, as it (currentThread)
hangs while it does it..
  I only said this as an suggestion for seeing if you have tons of dead
objects lying around - you might be able to figure something out based on
the diff. On my system, I get a considerable diff after some time, but I
feel this is expected. A worse thing is that after each restart of my app
I get less memory free, and eventually I run out (it isn't much each time,
but after e.g. 40 reloads, there aren't many megs left of my initial 64).
I have to debug this now, it will be interesting to see if it is Tomcat
code or my code that have the bug..! ;)

Btw: you can turn on verbose gc on the JVM, this is cool:

-verbose:gc
Report on each garbage collection event.

And then, Yoav, you can se that your objects are killed -when you invoke
gc()-! ;)

Endre.


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



Re: maxThreads

2004-05-12 Thread Endre Stølsvik
On Mon, 10 May 2004, Hollerman Geralyn M wrote:

| Evidently, I'm misunderstanding something about the maxThreads attribute
| on the HTTP Connector; I saw from the docs that in Tomcat 5.0.19, this
| is the maximum number of request processing threads to be created by
| this connector. So, what that said to me was that if I wanted to allow
| lots of requests, I ought to make that number larger than the default,
| which the docs say is 200. I also assumed that this attribute,
| maxThreads, is similar to the maxProcessors attribute that was used
| in, for instance, Tomcat 4.0.4. When we were using Tomcat 4.0.4, we
| often got the message No processor available, rejecting this
| connection, and the way I was told to correct that error was to
| increase maxProcessors, and this worked fine. But to correct another
| problem, we were told to upgrade to 4.1.24, and then to 5.0.16.
|

The new tomcat code have (finally!) an idea of connection queues, so that
you can have 2 processors, but 1 queue-entries, and you won't get the
connection refused crap message, but instead the connectin will be
queued untill a processor is available.
  This is possible due to the way TCP works - one thread can keep on
receiving connections, but not handle them and instead stack them into a
queue - then there's another thread dispatching this queue to the
workers/processors as they become available. (Not that this is exactly as
tomcat have done it, but this is the general idea)

Endre.


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



RE: maxThreads

2004-05-12 Thread Endre Stølsvik
On Wed, 12 May 2004, Shapira, Yoav wrote:

|
| Hi,
|
| The new tomcat code have (finally!) an idea of connection queues, so
| that
|
| You just manage to hit a nerve with almost every post ;)

I don't have a trace of an idea of what you mean!

;)

|  This stuff has been in tomcat code for years, it's not new.

It wasn't there in earlier Tomcat 4s (-at least- not in 3.2), as Craig
didn't see the use for it. I rather clearly remember arguing rather
heavily for this some years ago, yes.

Endre.


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



RE: How to limit time for Connector threads?

2004-05-07 Thread Endre Stølsvik
On Fri, 7 May 2004, rlipi wrote:

| So, let's go back to my original question. I think that it is common
| situation that, due to the some mistake in source code, the execution of
| a request thread is very long or infinite. And the server should not to
| go down by this kind of mistakes.

You are coding in java. It is not possible to preemptively control a
Thread's execution cycle, in particular its termination. Trust me - check
it up - there are -no ways- to kill a Thread.

The reasons behind this are complex - but revolves around the problem of
leaving mutex-sections correctly (monitors) when terminating a Thread.

Thus: code correct!

(The JSR 121 will fix this proble:  http://jcp.org/en/jsr/detail?id=121.
The way they solve it, is that they in effect instantiate -an entirely new
JVM- for each thing that must be terminatable.)

Kind regards,
Endre


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



Re: What did I do to get an (Unknown source

2003-10-20 Thread Endre Stølsvik
On Mon, 20 Oct 2003, Shapira, Yoav wrote:

|
| Howdy,
| You compiled it without debug enabled in javac.

It usually show line# anyway, but actual debugging is pretty limited when
not compiled with debug.

I'd assume that it was JIT'ed away - the Just In Time compilation have
made the original line# unavailable - some JVM's write compiled code
instead for the Unknown source.

Also, if it have been obfuscated by some external program, the line#
information is removed, deliberatly.

Endre.

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



Re: Active Directory Single Sign-On

2003-09-10 Thread Endre Stølsvik
| Tim mentioned the use of the JCIFS library.  I don't think that'd work
| either since it'd need to run on the same machine as the browser, which
| doesn't seem right.  Or perhaps I'm missing something.  Now if Tomcat
| supported Windows SSO using JCIFS, then that's a different story.  I
| don't think it does though (and I'm sure someone will correct me if I'm
| wrong :)).

You're missing something. I'm correcting you! It works. We've done it with
our portal engine..!

There is a part of JCIFS that actually can be used as a Servlet 2.3
Servlet filter, doing the magic SSO thing. The magic SSO thing is called
something like NTLM over HTTP. Also, you don't need this servlet filter
to do it, jcifs provides a API for doing it yourself (we didn't want to
tie into the 2.3 spec just quite yet, so we had to do it ourself, using
the JCIFS package more directly)

Notice that NTLM negotiation over HTTP is one very sick and nonconformant
protocol, probably violating every RFC that has anything to do with Web.

It negotiates each and every -connection-, not any notion of a -session-,
using three back-and-forths over the same physical TCP connection.
This is, of course, totally insane, as HTTP is a -request-response-(and
quit connection) protocol (This is just as sick, of course, HTTP is
-really really- lame).

Pick a favourite packet dumper and analyzer before starting with this, as
you most probably will need it! ;)



--
Mvh,
Endre Stølsvik   M[+47 93054050] F[+47 51625182]
Developer @ CoreTrek AS -  http://www.coretrek.com/
CoreTrek corporate portal / EIP -  http://www.corelets.com/


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



Re: Tomcat 4.1 slower than Tomcat 3.3

2003-04-03 Thread Endre Stølsvik
On Thu, 3 Apr 2003, Bill Barker wrote:

| Since it seems that you aren't using JSP at all, it isn't surprising (to me
| at least :) that the extra over-head of supporting the 2.3 Servlet spec
| drags down TC4.1 vs. TC3.3.  For non-JSP sites that don't require
| Servlet-2.3 features, it is very hard to beat  TC3.3 for performance.

I actually thought that TC3.3 was refactored for performance, while TC4
was made for .. overviewability.. or whatever. TC4 is very rigid, while
TC3.3 is using straighter, faster lines of control.

TC5 is supposed to take the good-shit from both TC3.3 and TC4 and make
the very best Servlet Container in the universe.

.. is my understanding.

-- 
Mvh,
Endre Stølsvik   M[+47 93054050] F[+47 51625182]
Developer @ CoreTrek AS -  http://www.coretrek.com/
CoreTrek corporate portal / EIP -  http://www.corelets.com/

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



Re: NTLM / Connection: Keep-Alive / HTTP 1.0

2003-01-03 Thread Endre Stølsvik
On Thu, 2 Jan 2003, Bill Barker wrote:

| There is a problem with HTTP/1.0 Keep-Alive in 4.1.12.  See
| http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12783 for more
| information.  If this looks like your problem, then upgrading to 4.1.18
| should fix it.

Thanks a lot. I am actually using 4.1.18, but this still helped me get
further, I can now get directly in using the NTLM stuff with _Coyote_
and HTTP/1.1. But still, the HTTP/1.0 Keep-Alive is, in the thrid NTLM
round as described, still not honored, and the I get a Connection: close
(and indeed it is).

However, another problem is that I can't get through mod_jk (1.2.2)  with
persistent connections (Keep-Alives), even with HTTP/1.1. Do you (or
anyone) have any ideas here?


-- 
Mvh,
Endre Stølsvik   M[+47 93054050] F[+47 51625182]
Developer @ CoreTrek AS -  http://www.coretrek.com/
CoreTrek corporate portal / EIP -  http://www.corelets.com/



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




NTLM / Connection: Keep-Alive / HTTP 1.0

2003-01-02 Thread Endre Stølsvik
We're having a problem surrounding Tomcat when using NTLM authentication
(Windows NT/2000 single sign-on through IE), when Internet Explorer
decides that it should use HTTP 1.0.

The problem is that NTLM _must_ go three times back-and-forth on the
same connection. It is a connection-level authentication mechanism, rather
than a session-oriented mechanism, probably violating a dozen RFCs.
However, this requires that the server does Keep-Alive connections.

The whole system works like a charm with HTTP 1.1, where Tomcat is eager
to do keep-alive. But, if the browser is set up to do HTTP 1.0 only (as
you can with IE, also through the policy system for windows, as a company
here have done!), then Tomcat refuses to do keep-alive. A RFC out there
(http:1.0 2068) states that if the client adds the string Connection:
Keep-Alive, then the server should still do keep-alive, even on 1.0. This
is not the fact with Tomcat (4.1.12); it always and still closes the
connection if the client requests HTTP 1.0 _with_ Connection:
Keep-alive (as verified using telnet).

We've banged our heads against this for some time now, and would like to
know if anyone have any ideas for solutions.

One idea that haven't been exhausted yet is whether any of the connectors
available between apache httpd and tomcat will behave differently that
tomcat's native http connector? Is this an probable avenue?

Any help would be greatly apreciated!

PS: Check out the excellent jcifs project for more background on NTLM and
CIFS, http://jcifs.samba.org/

-- 
Mvh,
Endre Stølsvik   M[+47 93054050] F[+47 51625182]
Developer @ CoreTrek AS -  http://www.coretrek.com/
CoreTrek corporate portal / EIP -  http://www.corelets.com/


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




[TC403] Cannot find message associated with key 'responseStream.suspended'

2002-04-02 Thread Endre Stølsvik

[TC4.0.3, Jre 1.4.0, Linux 7.2]
If you after a redirect try to close the output stream as in:

try {
// Getting encoding
String encoding = res.getCharacterEncoding();
// Setting content type
res.setContentType(text/html; charset= + encoding);
// Getting the OutputStream (just to be able to close it)
OutputStream out = res.getOutputStream();
// Sending the redirect
res.sendRedirect(Configuration.getDEFAULT_MAINPAGE());
// close output stream
out.close();
}
catch (IOException e) {
throw new ServerException(Got IOException while trying to redirect user 
to [+Configuration.getDEFAULT_MAINPAGE()+]., e);
}


You get weird errors. I had to do this to be sure that the client exited,
a load tester package (loadsim, Java stuff, based on some Apache stuff,
using java.net.HttpConnection or whatever it's called) I used didn't let
go (but the web browsers did) unless I did this.


This is what I get:

[Nested Exception] this: com.corelets.api.ServerException: Got IOException while 
trying to redirect user to [Renderer]., nested: java.io.IOException: Cannot find 
message associated with key 'responseStream.suspended'
at com.corelets.servlets.Parameters.doCCSGet(Parameters.java:146)
at com.corelets.servlets.CCSServlet.callServiceMethod(CCSServlet.java:698)


This is the nested exception:

java.io.IOException: Cannot find message associated with key 'responseStream.suspended'
at 
org.apache.catalina.connector.http.HttpResponseStream.close(HttpResponseStream.java:202)
at com.corelets.servlets.Parameters.doCCSGet(Parameters.java:143)
at com.corelets.servlets.CCSServlet.callServiceMethod(CCSServlet.java:698)
at com.corelets.servlets.CCSServlet.showAppropriatePage(CCSServlet.java:581)
at com.corelets.servlets.CCSServlet.process2(CCSServlet.java:413)
at com.corelets.servlets.CCSServlet.process(CCSServlet.java:300)
at com.corelets.servlets.CCSServlet.doGet(CCSServlet.java:177)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

..



-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: mod_webapp config

2001-12-03 Thread Endre Stølsvik

On Tue, 4 Dec 2001, hanzo wrote:

|
| - Original Message -
| From: William Tansill [EMAIL PROTECTED]
| To: Tomcat Users List [EMAIL PROTECTED]
| Sent: Monday, December 03, 2001 1:15 AM
| Subject: RE: mod_webapp config
|
|
|  My guess is that if you want to create and run your own JSP's, you will need
|  to install them per the standard deployment mechanism, update server.xml to
|  reflect the new deployment context, and then restart Tomcat.  At least those
|  are the steps I'm planning on taking when I get an example up and running.
|  If you get your stuff working first, write back to the group and let me know
|  how you did it.  Thanks!
|
| I give up using mod_webapp.. mod_rewrite is -a lot easier-

That is just such a cool idea! :) Just f*** that whole stupid
mod_shitty_connectors_stuff_won't_ever_work_stable_anyway_because_noone_takes_-
responsibility_even_though_both_projects_are_apache_and_it's_such_a_-
blantantly_needed_piece_of_software.so and just go for something that'll
rewrite the whole URL!

Great idea! Really! ;)

But I guess you loose a bit functionality, e.g. the
Context|Request|Config.getSomeAttribute() returns the wrong values?


-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Realtime monitoring of Tomcat

2001-11-30 Thread Endre Stølsvik

On Fri, 30 Nov 2001, Jim Cheesman wrote:

| At 11:37 AM 30/11/01, you wrote:
| I'm actually looking for statistics like number of connections and requests
| per second. Possible to monitor those?
|
|
| The tomcat access logs gives some of this information - what more exactly
| do you need? Parsing this file shouldn't be too hard if it's statistical
| information you want.

Oh, there's tons of things that you can monitor, examples:

load, avg. execution time, rendertime vs. transfer time, bytes
transferred, current # of sessions, avg. bytes/session (serialize it to
check! ;), avg # of sessions. (all avgs could be done with exponential
decay, like unix load, 1, 5, 15 minutes), workers started, avg workers
present, connections/second, connections failed (not enough workers)..

You know, _things_..! ;)


-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Where IS mod_webapp ??

2001-11-21 Thread Endre Stølsvik

On Wed, 21 Nov 2001, Gerard van Enk wrote:

| Endre Stølsvik wrote:
|
|   On Tue, 20 Nov 2001, Chad Johnson wrote:
|  
|   | The WebApp Module has a little webpage.  Take a look here.
|   |
|   | http://nagoya.apache.org/~pier/
|  
|   Thanks!
|  
|   But I'd also like a more stable release. How do I get that?
|
|
| Take a look at
| http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.1/bin/
| Here you'll find a stable version of mod_webapp (in the linux, macosx,
| win32, solaris subdir).
|

But not for EAPI of Apache, as mentioned. I get this huge warning when
Apache start, saying that this will be unstable, will probably break,
almost certain, and remember Murphy's law or something similar.

|   - And this is *WAY* underdocumented!!
|
| Just search the mailinglist archives ;-)

That's userfriendliness for ya'! :)


-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Where IS mod_webapp ??

2001-11-20 Thread Endre Stølsvik

On Tue, 20 Nov 2001, Chad Johnson wrote:

| The WebApp Module has a little webpage.  Take a look here.
|
| http://nagoya.apache.org/~pier/

Thanks!

But I'd also like a more stable release. How do I get that?

- And this is *WAY* underdocumented!!


| - Original Message -
| From: Endre Stølsvik [EMAIL PROTECTED]
|
|  I've apparently missed out on something, because where is the mod_webapp
|  for the different OS'es and where is the source (because the one in the
|  tomcat 4.0 binary tree for linux is apparently using the wrong api, it
|  should be using EAPI..)
| 
|  I've understood that there is something called j-t-c, but where is their
|  webpage??
| 
|  Thanks a lot.. Getting way too late too sit at work over here..


-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




[TC4] How to know when tomcat is properly shut down?

2001-11-20 Thread Endre Stølsvik

The catalina.sh and related scripts all start the Bootstrap.java class and
asks it to shut down Catalina.

This script, if successful in connecting to the shutdown port of Catalina,
returns immediately. This whether or not there is 8953289527 pending
database commits or whatever that has to be done before things actually
are properly shut down.

This is highly undesirable, and I would love if it were possible to shut
down catalina and then chill untill it actually has shut down.

This is especially important when shutting down the entire physical
server, as the database shutdown might be the next in line, in which case
everything breaks..

Of course, it would also be very nice if one could know if Catalina has
properly come up. It could for example write a boolean file when the
server has initialized all webapps, and then delete the same file right
before the main method of Catalina exits on shutdown. Or one could use
Bootstrap with argument -waitForUp or something..


-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Where IS mod_webapp ??

2001-11-20 Thread Endre Stølsvik

I've apparently missed out on something, because where is the mod_webapp
for the different OS'es and where is the source (because the one in the
tomcat 4.0 binary tree for linux is apparently using the wrong api, it
should be using EAPI..)

I've understood that there is something called j-t-c, but where is their
webpage??

Thanks a lot.. Getting way too late too sit at work over here..

-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Got him...

2001-11-14 Thread Endre Stølsvik

On Wed, 14 Nov 2001, Pier Fumagalli wrote:

| On 14/11/2001 01:01 am, Pier Fumagalli [EMAIL PROTECTED] wrote:
|
|  On 14/11/2001 12:42 am, Martin van den Bemt [EMAIL PROTECTED] wrote:
| 
|  nice job ;))
|  Why don't you put the subcriber email address in by default (in the text
|  footer of the mail or something).. Saves you working late ;))
| 
|  I don't think it's possible with EZMLM to modify the content per each
|  subscriber... I'll see, though!
|
| Oh... One more thing... That's kinda impossible also because messages are
| prepared once and then sent to the email delivery service with one message
| copy and a list of addresses... Changing this behavior would mean greatly
| increasing the size of the queue, adding a bunch of overhead (since for
| every subscriber, the message needs to be parsed and prepared individually),
| and so on... Not a good idea...

Patch that sending part of the program to just include the address at the
bottom? Or as a extra header? Just chuck it in there, kind of.. It already
have to handle the address anyways, since it talks to the MTA.


-- 
Mvh,
Endre


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: [TC4] Sending redirect fails if OutputStream isn't closed ..

2001-11-13 Thread Endre Stølsvik

On Mon, 12 Nov 2001, Remy Maucherat wrote:

|  I'm using this program called loadsim to get a simulation of a bunch of
|  users using my webapp. This is a java program utilizing the
|  java.net.HttpConnection to simulate the clients, built using large parts
|  of a apache loadsimulation system, right?

Make that java.net.HttpURLConnection (as the client).

|  Why is that? Why do I have to get the outputstream, and then just close it
|  to get the sendRedirect away? Why isn't the stream closed on exit of the
|  doGet/Post method? Or whatever?
|
| The default servlet doesn't use the output stream at all, and appears to
| behave correctly (verified using a telnet session). This looks like a
| problem with the HTTP client you're using.

I also mentioned this in the first post (Mozilla behaves properly), but
why does it then work when I get and close the output stream as described?

Here's the code from loadsim that does the sampling, just if you don't
have much other to do today! (It's not that long, actually)..

It seems to close both its output to the server, and the input from the
server..
  Extra-info: that page which sends the redirects is just a poster-page;
this is where the browser does GETs with parameters and POSTs: it just
takes all the parameters from the browser, and then sends a blank
redirect to the browser. This fools the (most) browsers to not store this
as a separate history event, and you don't get that reposting stuff on
back and reload going.

--

/**
 * Send the link to the webserver using the codeVirtualUser/code's
 * codeCookieManager/code.
 *
 * @param  cookieManager  The codeVirtualUser/code's
codeCookieManager/code.
 * @param  logThe log file to log information/errors to.
 *
 * @return The codeSampleResult/code object.
 *
 * @exception IOException if an error occurs reading from or writing
to the
 *webserver.
 */
public SampleResult sample(CookieManager cookieManager, ILog log)
throws IOException {
long then;
URL url = null;
HttpURLConnection connection = null;
BufferedInputStream input = null;
SampleResult sample = null;
byte [] buf = null;
int bytesread = 0;
ByteArrayOutputStream outbuf = null;

// Init the sample result

sample = new SampleResult();
sample.setLabel(id_);

// Create the HTTP connection
then = System.currentTimeMillis();

url = new URL(linkStr_);
connection = (HttpURLConnection) url.openConnection();
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setInstanceFollowRedirects(false);   //  ***
[EMAIL PROTECTED]: if followredirects is true we miss out on the cookies
set by the first page!

// Setup cookies

if (cookieManager != null) {
String cookieHeader =
cookieManager.getCookieHeaderForURL(url);
if (cookieHeader != null) {
connection.setRequestProperty(Cookie, cookieHeader);
}
}

if (formDataStr_ == null) {
connection.connect();
sample.setTTOpen(System.currentTimeMillis() - then);
log.log(ILog.INFORMATION, ' url =  + linkStr_);
} else {
try {
DataOutputStream output = null;

connection.setRequestProperty(Content-Type,
application/x-www-form-urlencoded);
connection.setDoOutput(true);
connection.setRequestMethod(POST);
connection.connect();
sample.setTTOpen(System.currentTimeMillis() - then);

output = new
DataOutputStream(connection.getOutputStream());
output.writeBytes(formDataStr_);
output.flush();
output.close();
log.log(ILog.INFORMATION, ' url =  + linkStr_ +  POST =
 + formDataStr_ +  ( +
formDataStr_.length() + ));
} catch (Exception e) {
log.log(ILog.ERROR, Caught exception:  + e.getMessage()
+  ignoring sample);
sample.setTTLB(-1);
sample.setTTFB(-1);
sample.setSize(-1);
sample.setLastPage(null);
return sample;
}
}

// this is where 'then = currentTime' used to be.
sample.setTTReq(System.currentTimeMillis() - then);

// Check for cookies coming back

try {
if (cookieManager != null) {

// check for Set-Cookie headers from server (index 0 is
the
// HTTP repsonse code), which does not use header: value
format

for (int i = 1;; i++) {
try {
if
(connection.getHeaderFieldKey(i).equals(Set-Cookie)) {

cookieManager.addCookieFromHeader(connection.getHeaderField(i), url);
}
 

[TC4] Sending redirect fails if OutputStream isn't closed ..

2001-11-12 Thread Endre Stølsvik

I'm using this program called loadsim to get a simulation of a bunch of
users using my webapp. This is a java program utilizing the
java.net.HttpConnection to simulate the clients, built using large parts
of a apache loadsimulation system, right?

I just installed the webapp on TC4, and are experiencing some weird
behaviour with the sendRedirect() stuff.

If I don't get and close the output stream, the loadsim-clients wont ever
shut down the Connection, and then, after the timeout of 6 millis, TC4
closes it. It then says 0 bytes received in the loadsim log.

If I on the other hand go in to the server using a normal browser
(Mozilla) during the test, I can browse it happily (The load-clients are
of course still experiencing the same problem)..

Basically, I have to do this to get it working:

try {
// Getting encoding
String encoding = res.getCharacterEncoding();
// Setting content type
res.setContentType(text/html; charset= + encoding);
// Getting the OutputStream (just to be able to close it)
OutputStream out = res.getOutputStream();
// Sending the redirect
res.sendRedirect(Configuration.getDEFAULT_MAINPAGE());
// close output stream
out.close();
}
catch (IOException e) {
throw new ServerException(Got IOException while trying to
redirect user to [+Configuration.getDEFAULT_MAINPAGE()+]., e);
}


Why is that? Why do I have to get the outputstream, and then just close it
to get the sendRedirect away? Why isn't the stream closed on exit of the
doGet/Post method? Or whatever?

-- 
Mvh,
Endre



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: getSession takes more than 10 seconds

2001-08-29 Thread Endre Stølsvik

On Wed, 29 Aug 2001 [EMAIL PROTECTED] wrote:

| Hi,
|
| We use tomcat 3.2.3. Our method getSession takes more than 10 seconds to
| create a new session. Has anyone else the same problem?

It's because of the randomClass attribute in the server.xml or what it's
called again. Look it up. Set it to java.util.Random instead of
SecureRandom (which takes _a lot of time_ the _first_ time it's invoked).
You'll find that subsequent new Sessions don't take this long.

SecureRandom is more unpredictable, which is needed in production envs.

-- 
Mvh,
Endre




Re: ClassLoader Reloading issues: static values

2001-08-20 Thread Endre Stølsvik

On Mon, 20 Aug 2001, Miles Daffin wrote:

| This is an interesting one.
|
| I had assumed that statics were a nono in webapps
| because they broke Context encapsulation.

Easiest way to create e.g. Connection pools and the like.

| I declared a public static String in a Base servlet
| and built the host webapp twice, with two different
| values in this String into 2 war files with different
| names. After starting TC I could see that the same
| static String had different values in the 2 Contexts.

Why not, they're living in different classloaders..?

|
| I have just reread the 2.2 spec and do not recall seeing
| anything that suggested that compliant containers must
| behave like this. Did I miss something?

Probably something about ClassLoaders.. The two classes (instances of
them) are loaded with different ClassLoaders, and are therefore two
entirely different classes, try to for example to cast between them! (This
one was kind of hard to understand, I couldn't cast my object to the User
class, even if object.getClass().getName() returned User!!).


-- 
Mvh,
Endre




Re: Does Tomcat usually run so SLOW?

2001-08-10 Thread Endre Stølsvik

On Fri, 10 Aug 2001, [EMAIL PROTECTED] wrote:

| Hi!
|
| I've got Tomcat 3.2.3 on HP-UX 10.20, and answer responses are -in my
| opinion- very slow (5-6 secs.).
|
| Is it normal?

If you create a HttpSession, this is a really slow task _the first time_
you do it (for the first user). This because of a SecureRandom class which
is used to make the JSESSION id.

You can configure this in the tomcat config file, so that under devel
settings you can use the normal Random class.


-- 
Mvh,
Endre




Re: Code Red Worm virus

2001-08-03 Thread Endre Stølsvik

On Thu, 2 Aug 2001, David Domenico wrote:

| I am running Tomcat 3.2.1 standalone for development purposes, as a web
| server using port 80. Yesterday I noticed the message, see below, on my
| Tomcat console window. This is identified as the Code Red virus as noted
| in the http://www.cert.org/advisories/CA-2001-19.html. The advisory states
| that the system may not have been compromised, but I am still concerned.
|
| I notified our network administrator and he applied the neccessary patchs
| from MS. However I am not running IIS. Does anyone know of a problem with
| Tomcat and the code red virus? I will download the latest release build,
| Tomcat 3.2.3. and install it.

It's a binary virus, affects ONLY IIS. All binary viruses works like
this, they are highly targeted towars one specific platform. Java is a
totally different platform, and won't get affected by IIS' i386 binary
viruses..


-- 
Mvh,
Endre




Re: howto fast ssl

2001-07-31 Thread Endre Stølsvik

On Tue, 31 Jul 2001, Bernhard Wraase wrote:

| We are serving jsp + servlets  always with ssl
| It seems to me that without ssl its much faster.
|
| So I ask myself...
| What is faster:
| tomcat standalone with ssl or

This would make tomcat do all the crypting, which is quite a job for Java.

| apache with mod_ssl + connector(i.e. mod_jk) + tomcat

While this configuration will make a pure C compiled code (apache) do the
SSL'ing and serving of static webpages, while tomcat only serves the
active servlets and jsp's.

I don't have much experience with the two configurations, this is just a
educated guess..

-- 
Mvh,
Endre




Re: Class reloading

2001-07-19 Thread Endre Stølsvik

On Thu, 19 Jul 2001, Paul Foxton wrote:

| AFAIK tomcat doesn't support automatic reloading of classes. You do have to
| restart.

AFAIK all tomcats does support automatic reload, but it (at least 3.2)
sucks. If you have very plain servlets, which doesn't put many real
objects into the HttpSession (just Strings, Longs and the like), then it
works pretty good. But if you try to use selfmade objects, you get hit by
severe ClassLoader issues (You'll get ClassCastExceptions all the time).

Tomcat 4 should work, but I haven't tested it yet. It uses a funky scheme
of serializing the whole Sessions stuff, and restarting the whole webapp,
and then booting it up again. What happens with singletons, I ask, but
haven't tested it yet, as mentioned.

Look at tomcat's xml configure file, it's a auto-reload'ish parameter,
turn it to true..

-- 
Mvh,
Endre




Re: getSession(true) takes more than 20 seconds????

2001-07-18 Thread Endre Stølsvik

On Tue, 17 Jul 2001, psalazar wrote:

| How can it be?? 20 seconds to get (create) a session object?? The first
| time I create a session object it takes 20 seconds!!

bcoz it uses SecureRandom. It only happens the first time (first
getSession()), when the secure stuff initializes. God knows what it's
doing, but the next calls to random goes much faster, just try to log in
another user, and you'll see.

You can, for development sake, use another random class, you set this in
tomcat-conf.xml thingy.

|
| I really, really appreciate any help on this

Happy? ;)


-- 
Mvh,
Endre




Re: Killing endless loop servlet - howto ? killing JVM or unloadclass ?

2001-07-12 Thread Endre Stølsvik

On Thu, 12 Jul 2001, Dmitri Colebatch wrote:

| Does it intentionally loop forever?  If so, creating a new thread and having
| that do the work (hence returning tomcat's thread to the server) should do
| the trick.

How would you do that?

I thought the problem with threads was that you actually _cannot_ kill
them, even in Java. I find this stupid, and hope I'm wrong! But
apparently you can only ask the thread to interrupt and check for status
by using the thread.interrupt(), and isInterrupted() inside the thread.

-- 
Mvh,
Endre




Re: Tomcat memory-leak problem

2001-07-12 Thread Endre Stølsvik

On Wed, 11 Jul 2001, Boris Niyazov wrote:

| You should probably look at your code for possible memoey leaks: not closed db
| objects (statements, result sets, connections) not closed file descriptors, etc.

More important, I think, is stuff you shove inside Collections.

The RS'es, Files and all that stuff will eventually be GC'ed when they go
out of scope, that is, no reference is left for them. (IF they do, of
course).

Only way to have leaks in Java is to make objects that are in your
working set (reachable set) of objects and that never goes out of scope.
-- Like some caching mechanism where the only thing you do is to _add_
objects to the cache, and never release them.

-- 
Mvh,
Endre




Re: Killing endless loop servlet - howto ? killing JVM or unloadclass ?

2001-07-12 Thread Endre Stølsvik

On Thu, 12 Jul 2001, Dmitri Colebatch wrote:

| On Thu, 12 Jul 2001 16:28, you wrote:
|  I thought the problem with threads was that you actually _cannot_ kill
|  them, even in Java. I find this stupid, and hope I'm wrong! But
|  apparently you can only ask the thread to interrupt and check for status
|  by using the thread.interrupt(), and isInterrupted() inside the thread.
| The purpose of this is to force a two-phase termination, and give the thread
| a chance to clean up... its up to the thread programmer to be aware of any
| requests for interruption.  When you say you can only ask, you are correct.
|  I dont see why this prohibits my earlier suggestion though...

How would you stop this thread?

while(true);


-- 
Mvh,
Endre




Re: How to disable Backspace Button in the Keyboard

2001-06-01 Thread Endre Stølsvik

On Thu, 31 May 2001, Mike Haberman wrote:

| 
|  Whenever the user presses backspace key in the keyboard the browser goes to
|  the previous page, which crashes our site when the user tries to save its
|  contents once again or he loses data which have been typed.
| 
|  I think its remedy is to disable backspace button by JavaScript, but how
|  should I do it ?
|  If anybody know this code snippet please let me to know
|
| The remedy is to fix your site.  Even if you could capture the key stroke
| events,  ignoring the backspace is not the solution.  This advice falls in
| the same category as NEVER rely on javascript for something that is
| critical to your site.

A cool solution for this that actually works is that you use a Controller
and a Renderer servlet, the Controller taking all the parameters, and then
response.sendRedirect the user to the Renderer, storing whatever state is
neccessary in the user's session.

The nice thing is that you skip the Controller in the browser's history,
and (at least on Netscape), the history actually realizes that multiple
loadings of the same page is just one event, and you end up with only
one history entry for your whole application. If you press back after
clicking 589 times in your application, you immediately exits back out of
your application to the page you were before those 589 clicks.

But of course, you have to put the state in the session too. A state
variable as in a state-machine (state diagram, whatever, you know the
circles with arrows pointing back and forth, each circle having a letter
or digit in it. ;), telling the system where you are, so that the user
can't f... up the routes in your application.

These two approaches together is an excellent solution, I feel. Some will
argue that the sendRedirect is more network traffic and what not, but in
reality you solve two pretty annoying issues by it, and that's worth it.

-- 
Mvh,
Endre





Re: Why does Internet Explorer think it is offline?

2001-05-08 Thread Endre Stølsvik

On Mon, 7 May 2001, Anthony W.Marino wrote:

| My experiences with server push are that 4.76 works fine, however, it crashes
| NN6 and Mozilla .8.  What that tells me is that server push isn't too
| reliable.

What is server push?

As far as I know, you cannot push any info to a user.

-- 
Mvh,
Endre




Re: Objects in Vector are loosing type

2001-05-04 Thread Endre Stølsvik

On Thu, 3 May 2001, Milt Epstein wrote:

| Maybe your app could use some reorganizing.

Yeah, maybe, Milt.

Why don't you ask the developers, then? I actually believe that all things
I said in those mails about reloading in TC3.x and TC4 are correct.

And the reason for me having to restart every time is that I basically
have made a server running on top of tomcat, and there's basically
only 3 servlets running, but with lots of helper classes and stuff around.

The reason for _always_ getting a ClassCastException is that I have all my
user information stored in a User object. This won't ever reload (that is,
serialize/deserialize, or in some other way being cast over to the new
classloader), and when i retrieve it from the HttpSession, it's _always_
ClassCastException'ing.

I'm not the only one making such complicated apps. The exact same story
about the User object have been mentioned a couple of times on this
list.

And that's how it is.

;)


-- 
Mvh,
Endre




Re: Objects in Vector are loosing type

2001-05-03 Thread Endre Stølsvik

On Wed, 2 May 2001, Joel Parramore wrote:

|
| Well, Endre, comments such as classloading is totally fucked, while having
| a nice kewl sound-bite quality, really don't explain what is going on too
| well to someone who hasn't encountered the problem before.

It's just that it kind of annoys me. It's definately an huge itch, but I
don't have the time to scratch it. Stupid thing to say, but what's
annoying is that it's not quite recongized by the developers as a problem,
which truly puzzles me..

I have to restart tomcat each and every time I make one single change to
_anyting_ of my code. This is the most time consuming part of developing
on Tomcat, I feel. (How's Jetty doing, btw??)

Also, forgot to mention, the reloader doesn't notice if any _other_
classes have changed, e.g. your User object or whatever. Only the directly
affected Servlet, and only the first one hit, will get reloaded.

If not totally fucked, it's definately pretty messed up..!

;)

Endre




Re: Memory usage

2001-05-03 Thread Endre Stølsvik

On Thu, 3 May 2001, Garry De Toffoli wrote:

| What do you think about this?

How's the long run behaviour? It might be that tomcat is initializing
itself (creates servlets and the like) as you go along, and that after
some time things will even out and go up and down just a little...

-- 
Mvh,
Endre




Re: Objects in Vector are loosing type

2001-05-02 Thread Endre Stølsvik

On Mon, 30 Apr 2001, Joel Parramore wrote:

|
| Can or has or will someone work up a slightly more technical explanation
| than
|
|  It's because tomcat's reloading are totally fucked.

Well, Joel, it's because tomcat3x doesn't do this:

a) stop the webapp
b) destroys all servlets
c) serializes all the Sessions
d) throws away the ClassLoader for this webapp
e) cleans away the webapp from all caches in the system
f) restarts the whole webapp, as if for the first time, making a new
ClassLoader for it.
g) deserializes all the Sessions (now with the new ClassLoader)
h) lets the users use the system again

(Which is apparently how tomcat 4 should do it, but it never did for me.
But I am doing a very weird ting according to the developers, I am running
tomcat away from it's installation directory, and this is _not_
supported.)

What tomcat3x does, is to just ditches the ClassLoader and reloads the
_first_ servlet you hit after a refresh of the .class-files timestamps.
Even if you recompile your whole webapp, tomcat just reloads the first
servlet a user hits. This means that all the other Servlets are still
cached using the old ClassLoader, and you actually get two instanses of
your webapp, all the old Session objects and all the other Servlets loaded
with the old ClassLoader, while all the new Session objects and the one,
first hit Servlet with the new ClassLoader.
  It doesn't, as mentioned, do anything about the Session variables, and
therefore you often get ClassCastExceptions when you try to handle and
cast objects gotten from the Session within the one, new reloaded servlet.
This because _it's_ version of the Class you try to cast the object gotten
from the Session to, is loaded with the new ClassLoader, while the object
you try to cast is loaded with the old. This is not considered the same
Classes, and you get ClassCastException.

This is so very, very wrong, and therefore I'd say it's totally fucked..
This has been pointed out a whole bunch of times.

Better? I'm not that fantastic with English, hope you excuse that, Joel.

Endre.




Re: Objects in Vector are loosing type

2001-04-30 Thread Endre Stølsvik

On Fri, 27 Apr 2001, Ivan wrote:

| thank you very much for your reply
|
| I turned off my computer and tried it again a few hours later and it seemed
| to work, then i made changes and then the second servlet wasnt able to cast
| back to CHyperlink again.  after putting the code back the way I had it, it
| still wouldnt work.

You're having the reload problem, and each time you restart tomcat,
everything will work for you.

It's because tomcat's reloading are totally fucked. This goes for all
versions, but 4 should apparently have som new stuff, which basically
reboots the whole webapp and serializes/deserializes everything in users'
sessions if anything changes..



-- 
Mvh,
Endre




Re: Tomcat as standalone HTTP server

2001-04-25 Thread Endre Stølsvik

On Wed, 25 Apr 2001, Olivier LAUDREN wrote:

| Hi,
|
| Is there somebody using Jakarta Tomcat as standalone HTTP server?
| Witch (is/are) the most important difference(s) between this
| configuration and Apache + Tomcat?

Speed on static documents. Apache is written in some C, while Tomcat is
written in the considerably slower Java.

Also you can load-balance via the apache, having one front-end apache
server, and 49 backend Tomcats. The apache can then do sticky session
load balancing between those tomcats.

It's a more messy config using both, but it works!

-- 
Mvh,
Endre




Re: Timeout issue

2001-04-23 Thread Endre Stølsvik

On Mon, 23 Apr 2001, Shravan Shashikant wrote:

| I had a doubt over here.How do you handle multiple users accessing the
| same servlet of yours.I mean,at the same time if 2/more users access
| your servlet and consider for a moment that,what one person requires
| to be done from the servlet is different from what the other person
| wants.basically if the parameters are different,i dont see how you can
| handle multiple users accessing the servlet and being provided the
| results they asked for.

Basically different threads, differnt stacks.. Each thread is executing
the function with it's own little memory-space, and thus each users have
their own rendering of the servlet. But if you use class fields
(variables) you'll get that problem (or feature, depends on what you
want)..

-- 
Mvh,
Endre





[tc3.2] Connection fails?

2001-03-26 Thread Endre Stølsvik

I have a frameset with two frames which is a servlet which loads a servlet
into each fram, which in turn triggers the load of a stylesheet which is a
servlet. And then there's static files; images. This implies that there is
at least 5 connections, and these _might_ be simultaneous (I guess
browsers don't open more than 4 anyway, but..)

This is done through Apache and mod_jk over ajp12.

The problem I'm experienceing is that sometimes the stylesheet doesn't get
loaded. It's just "sometimes", and that's makes me wonder. If I click
furisously on reload, it seems to happen a lot.. note: I only have a few
handlers specified..

What I'm wondering, is if the connection handler in tc3.2 is similar to
the one in 4.0, that is, does it just _drop_ a connection if there isn't
any "workers" left to do that request? And if this is so, doesn't anything
get logged about this??


[ If this IS true, I still think that it would be very interesting to
check out how a queue of connections would handle this problem. It would
go something like this: A handler is listening. For each connection that
arrives, it checks the workerstack for a available worker. If there is
one, dispatch it (and log something!!). If there isn't, put it in a synced
connection queue. When a worker is about to put itself back on the stack,
it first checks the connection queue whether there is connection waiting
there to be handled. If there is, handle it (and log something!!), if
there isn't, put yourself back on the stack. If the queue gets to big (a
limit), the server would have to reject connections (and DEFINATELY log
something!!).
  The point here is that this would at least handle surges in connections
pretty good. Also, there are people who believe that a "event queue" uses
available CPU better than having a large bunch of threads hanging around,
which gets preemtped up and down. Let one thread finish what it's doing
before you start doing something else. But of course, you have database
access and that stuff going on too..
  Just a thought.. ]

-- 
Mvh,
Endre




[tc4 vs. tc3.x] Cannot read file, java.io.FileNotFoundException

2001-03-25 Thread Endre Stølsvik

I have a problem reading a file that I've put in the WEB-INF/classes dir.
It works on tc3.2 and tc3.3, but doesn't work in tc4.0. Could someone shed
some light on why, and how I could manage to read it on all servlet
servers, and whether I should put it somewhere else.

The file is called "logconfig.xml", and the Settings.getLOG_CONFIG_FILE()
is just a String with that content.

This code:

private static boolean logConfig() throws ConfigException {
URL dtdURL = DOMConfigurator.class.getResource("log4j.dtd");
if(dtdURL == null)
throw new IllegalArgumentException("CT: Couldn't find 
log4j.dtd. Bad stuff.");

FileInputStream configFileIS;
try {
URL configURL = 
DOMConfigurator.class.getClassLoader().getResource(Settings.getLOG_CONFIG_FILE());
System.out.println("This is the config URL: "+configURL);
System.out.println("This is the config URL.getFile(): 
"+configURL.getFile());
File configFile = new File(configURL.getFile());
System.out.println("This is the config file: "+configFile);
configFileIS = new FileInputStream(configFile);
}
catch (FileNotFoundException e) {
throw new ConfigException("CT: Configfile not found: "+e);
}

[ -- cut -- ]

}

produces different results of tc4 vs tc3.2 and tc3.3

On tc3.3m2:
This is the config URL: 
file:/devel/endre/active/SERVER/webapps/CAF/WEB-INF/classes/logconfig.xml
This is the config URL.getFile(): 
/devel/endre/active/SERVER/webapps/CAF/WEB-INF/classes/logconfig.xml
This is the config file: 
/devel/endre/active/SERVER/webapps/CAF/WEB-INF/classes/logconfig.xml
- and it works fine.

Excat the same with tc3.2.2b2:
This is the config URL: 
file:/devel/endre/active/SERVER/webapps/CAF/WEB-INF/classes/logconfig.xml
This is the config URL.getFile(): 
/devel/endre/active/SERVER/webapps/CAF/WEB-INF/classes/logconfig.xml
This is the config file: 
/devel/endre/active/SERVER/webapps/CAF/WEB-INF/classes/logconfig.xml
- still fine

But On tc4.0b1:
This is the config URL: jndi:/WEB-INF/classes/logconfig.xml
This is the config URL.getFile(): /WEB-INF/classes/logconfig.xml
This is the config file: /WEB-INF/classes/logconfig.xml
com.corelets.settings.ConfigException: CT: Configfile not found: 
java.io.FileNotFoundException: /WEB-INF/classes/logconfig.xml (No such
file or directory)
at com.corelets.server.Startup.logConfig(Startup.java:234)
at com.corelets.server.Startup.init(Startup.java:46)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:779)
 ...
- and here it breaks, of course.

What's that "jndi:" stuff instead of "file:" ??

-- 
Mvh,
Endre




Re: [tc4 vs. tc3.x] Cannot read file, java.io.FileNotFoundException

2001-03-25 Thread Endre Stølsvik


Thanks for fast reply!

On Sun, 25 Mar 2001, Craig R. McClanahan wrote:

| Could you try this with a recent nightly build?  There have been lots of
| bug fixes since 4.0b1 (we're about to roll a 4.0b2 if you want to wait a
| couple of days).

I'll do that, sometime later today, I hope..

|
| However, your code is making an assumption that is not portable.  Servlet
| containers are *not* required to unpack your application into a directory
| structure, so there is no guarantee that there will be such a thing as a
| File that you can read.  The portable way to open this resource would be:
|
|   InputStream is =
| DOMConfigurator.class.getResourceAsStream("log4j.dtd");

This file is already within a jar, it's the apache log4j package, still in
a jar. As I remember, this is just ripped from Ceki's "man pages" for
log4j..
  Is that what you meant, that you cannot load from the jar (war)? Why
will it work better if you get it as a Stream? What will happen when I
package a bunch of jars inside a war, will it still be possible to get to
this log4j.dtd whcih is within the jar which is within the war?

Also, I have to do this .. :

URL configURL =
DOMConfigurator.class.getClassLoader().getResource(Settings.getLOG_CONFIG_FILE());

.. with the getClassLoader() in place there. If not, I don't get the URL,
it returns null. Why is that? I thought that the Class would itself just
do exactly that, do a "getClassLoader().getResource()" .. This works out
the same way if I instead of DOMConfigurator put Startup, which is the
"residing class" itself..


-- 
Mvh,
Endre





Re: [tc33] randomClass not honoured?

2001-03-23 Thread Endre Stølsvik

On Thu, 22 Mar 2001, Larry Isaacs wrote:

Thanks.. but ..

| For Tomcat 3.3m2, see SessionIdGenerator ... / in server.xml.

 (oops.. m2, yes.. not b2 :)

How would I use this? class="..." didn't work. In the server.xml it says:

!-- You can add a "home" attribute to represent the "base" for
 all relative paths. If none is set, the TOMCAT_HOME property
 will be used, and if not set "." will be used.
 webapps/, work/ and log/ will be relative to this ( unless
 set explicitely to absolute paths ).
 You can also specify a "randomClass" attribute, which determines
 a subclass of java.util.Random will be used for generating  session IDs.
 By default this is "java.security.SecureRandom".
 Specifying "java.util.Random" will speed up Tomcat startup,
 but it will cause sessions to be less secure.
  --
ContextManager debug="0" workDir="work" 

That's a "typo" in the docs, then! ;)


-- 
Mvh,
Endre






Re: disbale sessions in Tomcat

2001-03-06 Thread Endre Stølsvik

On Tue, 6 Mar 2001, William Au wrote:

| Is there a way to disable sessions in Tomcat?

Just don't ever ask the HttpServletRequest for a HttpSession? ;)

| Do I just remove the entries for the request.SessionInterceptor and
| session.StandardSessionInterceptor from server.xml?

This I don't know the implications of..


-- 
Mvh,
Endre


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




tc4: logfiles date postfix..

2001-03-05 Thread Endre Stølsvik

Is it possible to turn of that dating stuff of the logfiles? I don't like
the date-turning now in the development environment. Of course, it's very
good to have in production environments, but I get a bit annoyed of having
to break my tails and finding the most current of a whole bunch of log
files each morning..

-- 
Mvh,
Endre


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




Re: Tomcat usability as a WebServer?

2001-03-05 Thread Endre Stølsvik

On Mon, 5 Mar 2001, Brett W . McCoy wrote:

| On 2001.03.05 12:36 Manish Shahdadpuri wrote:
|
|  I am a new Tomcat user. As far as I understand, tomcat is also a  web
|  server in itself. Is it possible to use tomcat alone as a web server
|  without using any other WebServer e.g Apache etc.
|
| Only if you are serving JSP and servlets and no static pages or standard CGI
| programs.  For that you will need Apache, iPlanet, IIS, etc.

This is not entirely correct, I believe..

All tomcats can be used as fully functioning stand alone webservers. But
whether you'd want that or not is another question. Apache is faster on
serving static webpages. So you can tie them together..

CGI programs I'm not quite sure about.. But I guess you could make an
invoker or whatever it's called to do that too..


-- 
Mvh,
Endre


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




tc4: No processor available, rejecting this connection

2001-02-25 Thread Endre Stølsvik

My config is like this:

Connector  className="org.apache.catalina.connector.http.HttpConnector"
   port="##HTTPPORT##" minProcessors="1" maxProcessors="3"
   acceptCount="100" debug="99" connectionTimeout="6"/

This gives me lots of left out small gifs, maybe a leftout stylesheet, or
the whole document.. or whatever.

I realize that there's not many processors configured here, but why does
it start to reject connections? It should stack them in a queue, shouldn't
it? What am I doing wrong?

2001-02-25 12:49:21 HttpProcessor[10080][2]  An incoming request is being assigned
2001-02-25 12:49:21 HttpProcessor[10080][2]   The incoming request has been awaited
2001-02-25 12:49:21 HttpConnector[10080] No processor available, rejecting this 
connection
2001-02-25 12:49:21 HttpProcessor[10080][2]   parseConnection:  
address=endresin.intra.coretrek.com/10.0.0.14, port=10080

Does the HttpConnector have any relation to the three other lines here,
HttpProcessor? Could anyone just give me the briefest explanation of
what's going on in theese four lines?

Thanks a lot! Looking forward to both the 3.3 and 4.0! Especially the
promised proper reloading of webapps in 4!


-- 
Mvh,
Endre


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




tc4: catalina.home vs catalina.install

2001-02-25 Thread Endre Stølsvik

Hi!

It kind of seems to me that there is some "inconsistency" between the
catalina.home and where you actually want tomcat4 to _run_.

I have a bunch of "installations" for my gang of developers, and each
developer have a complete env. to develop in.

But how do I configure, "say to", catalina that "this is where you're
installed, and thus where you can find your code and stuff", and "this is
where you're supposed to run, this is your _home_"..

Now, when I start up tomcat4, it starts to configure a lot of webapps
coming from the installation area's "webapps" folder, and tell me that
work directories are not existing, cannot be created or whatever (the
installation is made as root, I run it as me).

Typical error line if I try to set catalina.home to where I want it to be
run from:

Directory /devel/endre/active/SERVER/tomcat4.0-home/common/lib does not exist


-- 
Mvh,
Endre


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




Re: [tc3.3] Shutting down doesn't seem to honor the config file

2001-02-21 Thread Endre Stølsvik

On Tue, 20 Feb 2001, Endre Stlsvik wrote:

| How do I shut down my Tomcat 3.3 when I have set the ajp12 port to
| something else thatn 8007? I supply -f configfile, but it doesn't seem to
| do anything about it.

Ok, found it!

I think there might be some inconsistency when it comes to the
"tomcat.home".

The org.apache.tomcat.startup.StopTomcat looks for a file called
"ajp12.id" in the tomcat home dir. This is where it stores the portnumber,
and apparently also "the secret" and the address that tomcat is supposed
to have bound to. It expects this to be the tomcat "root", the proper
tomcat home. But org.apache.tomcat.startup.Main seems to expect the
tomcat.home to be set to the install dir. If not, the URLClassLoader won't
find Tomcat:
 java.lang.ClassNotFoundException: org.apache.tomcat.startup.Tomcat
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

So it works when I supply my tomcat install dir as the -Dtomcat.home for
the startup.Main, and the dir where ajp12.id ends up as the -Dtomcat.home
for the StopTomcat.

..or am I doing something else wrong?

(I wondering though why one couldn't read the config file again, which
seems a bit more robust..)

-- 
Mvh,
Endre


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




[tc3.3] Shutting down doesn't seem to honor the config file

2001-02-20 Thread Endre Stølsvik

How do I shut down my Tomcat 3.3 when I have set the ajp12 port to
something else thatn 8007? I supply -f configfile, but it doesn't seem to
do anything about it.

Are there any instructions for how the server.xml file works now,
basically, how the whole thing works?! Or is such stuff in the works?

Thanks.

-- 
Mvh,
Endre


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




Re: dtd for Tomcat 3.2.1's server.xml

2001-01-24 Thread Endre Stølsvik

On Wed, 24 Jan 2001, Craig R. McClanahan wrote:

| Try to write the DTD entry for a RequestInterceptor element (Tomcat 3.2) or a
| Valve element (Tomcat 4.0) and you will see what I mean.  In either case, the Java
| class that gets instantiated can be *anything*, with any set of JavaBeans properties.
| The initialization logic uses Java reflection to match up XML attributes to JavaBeans
| property names at runtime, in the same way that the following JSP statement works:
|
| jsp:setProperty name="beanname" property="*"/
|
| Since the set of all possible meaningful property names is infinite, it *cannot* be
| enumerated in a DTD, which requires you to list *all* valid attributes of every
| element.

Isn't the attribute here the "name" and "property", NOT the "beanname" and
"*"? If so, couldn't you write a DTD for that? A "setProperty" element can
have to attributes, "name" and "property". You could also have several
parameters, like parameter name="some" value="thing" /, there's room for
that in DTDs?

If that is true, you could validate all the required elements in a
requestInterceptor (or whatever, I have no clue here), but leave the
other, introspected stuff, for those parameter /'s

-- 
Mvh,
Endre


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




Re: Session creation speed

2001-01-23 Thread Endre Stølsvik

On Tue, 23 Jan 2001, Steve Smale wrote:

|
| Thanks for that, its steaming along at a good ol' speed now!
|
| What is to gain by using the secure random generator?

I guess it's more secure?! It initializes a better random number
generator, which isn't that predictable. If you can predict a session
cookie, you don't have any client security anymore. Another person can
supply that id, and place an order or whatever as that user.

It's only the first hit after a restart that gets the problem. Just try to
make a new session (with another browser), and you'll see that it's not
slow anymore.


-- 
Mvh,
Endre


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




Re: Tomcat threads..

2000-12-24 Thread Endre Stølsvik

On Sun, 24 Dec 2000, Kief Morris wrote:

| Endre Stølsvik typed the following on 09:23 PM 12/23/2000 +0100
| |  I'm trying desperately to get tomcat to use only ONE thread. But I always
| |  seem to end up with 10 or so..
| 
| Yes, this is only for development purposes. I have a bunch of separate
| server setups on one box, one for each developer (because of the not
| working at all reload issue on tomcat 3.2).
|   Only one guy is using each tomcat, so the whole point is that I don't
| want a bunch of threads doing nothing.
| 
| Why not?

Because it annoys me?!

| It seems to me you're spending a lot of effort chasing a red herring.
| Are you worried about the performance impact of unnecessary threads?
| What makes you think reducing it down to a single thread would make
| a noticeable difference on your box? I'm skeptical that it would.

OK, ok, I'll let it go, then.. :-)

(Linux "process-threads" DO use resources though. I'm now trying green
threads! :)

The main reason is that I kind of wondered if my configuration really was
working, me specifying max 3 threads, while getting 10-12. So, again,
Tomcat really uses about 10 "background threads"? If so, I'm OK with that.


Merry christmas! Just taking a slight break from all the Christmas fat!

Endre.




Re: Tomcat threads..

2000-12-23 Thread Endre Stølsvik

On Fri, 22 Dec 2000, Craig R. McClanahan wrote:

| Endre Stølsvik wrote:
| 
|  I'm trying desperately to get tomcat to use only ONE thread. But I always
|  seem to end up with 10 or so..
| 
|  I guess this is because of tomcat internals, but just how many threads
|  does tomcat really need?
| 
| 
| Tomcat needs one thread for each simultaneous request you want it to be able to
| handle, plus a few assorted background threads (such as checking for expired
| sessions).
| 
| Even if you modified Tomcat to use only one thread, you would be terribly
| disappointed with the performance.  Consider that most browsers (by default)
| will initiate multiple requests, even for a single user, to retrieve images on
| that page.

Yes, this is only for development purposes. I have a bunch of separate
server setups on one box, one for each developer (because of the not
working at all reload issue on tomcat 3.2).
  Only one guy is using each tomcat, so the whole point is that I don't
want a bunch of threads doing nothing.

I'm wondering about how that threadpool is working (I set it up with max
3, 0 min_spare and 1 max_spare. But I still got around 10-12 threads
(Linux ps shows this because of the hack linux uses for threads)). Just
how many background threads is tomcat actually using?

Thanks!

-- 
Mvh,
Endre




Re: How to design a application context servlet

2000-12-07 Thread Endre Stølsvik

On Thu, 7 Dec 2000, Thomas Eitzenberger wrote:

| For this to work we would need a servlet that is started in the startup
| of the Servlet engine and will stay in memory (so not
| serialized/passivated) and active all the time. It will create a pool of
| threads that will listen on different ports for incoming messages from
| external systems and will forward this info via JMS to the
| EJB container.

You can get a servlet to start up on startup of tomcat. This could fork
off a (couple of) thread(s) that kept your threadpool running. If the
servlet container decides that it doesn't need the servlet anymore, I
don't think it would kill the threads.


-- 
Mvh,
Endre





SessionSerializer

2000-12-07 Thread Endre Stølsvik

Can someone tell me a little bit about something called SessionSerializer?
Apparently something happens on reload, and SessionSerializer says (on
stdout) that one of my objects doesn't serialize. I guess the point is
that it should serialize the Session on it's way "down", and then
deserilalize on it's way up again. Why do you get ClassCastExceptions
anyway?


-- 
Mvh,
Endre




Reloading - again..

2000-12-07 Thread Endre Stølsvik

Sorry for going on and on with this, but I cannot stop being puzzled by
it.

It seems like Tomcat only really reloads the one class that you hit
first. I do a full recompile (deleting all class files just to be sure!),
and look at the tomcat log while clicking reload.

These logs are both right after a full recompile, but hitting different
servlets first:

Here I hit "Initialize" first, and then "design.Topbar" and then
"Workbench".

2000-12-07 07:04:38 - ContextManager: Host = endre.devel.coretrek.com
2000-12-07 07:04:38 - ContextManager: SM: Prefix match /itraks/servlet/Initialize - 
/servlet/Initialize/* Initialize(Initialize/null) null
2000-12-07 07:04:38 - ContextManager: SimpleMapper1: Adjust for prefix map 
/servlet/Initialize 
2000-12-07 07:04:38 - ContextManager: SimpleMapper1: SM: After mapping R( /itraks + 
/servlet/Initialize + null) Initialize(Initialize/null)
2000-12-07 07:04:38 - Ctx( /itraks ): Pre servlet destroy Initialize(Initialize/null)
2000-12-07 07:04:39 - Ctx( /itraks ): Post servlet destroy Initialize(Initialize/null)
2000-12-07 07:04:39 - ContextManager: Reloading context Ctx( /itraks )
2000-12-07 07:04:39 - Ctx( /itraks ): Pre servlet init Initialize(Initialize/null)
2000-12-07 07:04:39 - Ctx( /itraks ): Post servlet init Initialize(Initialize/null)
2000-12-07 07:04:39 - ContextManager: Host = endre.devel.coretrek.com
2000-12-07 07:04:39 - ContextManager: SM: Prefix match /itraks/servlet/design.Topbar 
- /servlet/design.Topbar/* design.Topbar(design.Topbar/null) null
2000-12-07 07:04:39 - ContextManager: SimpleMapper1: Adjust for prefix map 
/servlet/design.Topbar 
2000-12-07 07:04:39 - ContextManager: SimpleMapper1: SM: After mapping R( /itraks + 
/servlet/design.Topbar + null) design.Topbar(design.Topbar/null)
2000-12-07 07:04:39 - ContextManager: Host = endre.devel.coretrek.com
2000-12-07 07:04:39 - ContextManager: SM: Prefix match /itraks/servlet/Workbench - 
/servlet/Workbench/* Workbench(Workbench/null) null
2000-12-07 07:04:39 - ContextManager: SimpleMapper1: Adjust for prefix map 
/servlet/Workbench 
2000-12-07 07:04:39 - ContextManager: SimpleMapper1: SM: After mapping R( /itraks + 
/servlet/Workbench + null) Workbench(Workbench/null)

This is strange right away, because why aren't all the servlets destroyed
right away? I mean, they're all ditched right away, since a context reload
actually puts the whole ClassLoader out of scope and makes a new one to be
able to reload the classes. So why aren't they all destroyed too?


Then this is if I hit Workbench first, and then hit the "design.Topbar".

2000-12-07 07:08:43 - ContextManager: Host = endre.devel.coretrek.com
2000-12-07 07:08:43 - ContextManager: SM: Prefix match /itraks/servlet/Workbench - 
/servlet/Workbench/* Workbench(Workbench/null) null
2000-12-07 07:08:43 - ContextManager: SimpleMapper1: Adjust for prefix map 
/servlet/Workbench 
2000-12-07 07:08:43 - ContextManager: SimpleMapper1: SM: After mapping R( /itraks + 
/servlet/Workbench + null) Workbench(Workbench/null)
2000-12-07 07:08:43 - Ctx( /itraks ): Pre servlet destroy Workbench(Workbench/null)
2000-12-07 07:08:43 - Ctx( /itraks ): Post servlet destroy Workbench(Workbench/null)
2000-12-07 07:08:43 - ContextManager: Reloading context Ctx( /itraks )
2000-12-07 07:08:43 - Ctx( /itraks ): Pre servlet init Workbench(Workbench/null)
2000-12-07 07:08:43 - Ctx( /itraks ): Post servlet init Workbench(Workbench/null)
2000-12-07 07:08:49 - ContextManager: Host = endre.devel.coretrek.com
2000-12-07 07:08:49 - ContextManager: SM: Prefix match /itraks/servlet/design.Topbar 
- /servlet/design.Topbar/* design.Topbar(design.Topbar/null) null
2000-12-07 07:08:49 - ContextManager: SimpleMapper1: Adjust for prefix map 
/servlet/design.Topbar 
2000-12-07 07:08:49 - ContextManager: SimpleMapper1: SM: After mapping R( /itraks + 
/servlet/design.Topbar + null) design.Topbar(design.Topbar/null)

Why is this so?

One more thing: Shouldn't the "load-on-startup" servlets also be started
up again on a context-reload?

btw; I'm using tomcat 3.2 final.

-- 
Mvh,
Endre




mod_jk auto-conf omission?

2000-12-04 Thread Endre Stølsvik

The auto generated file "uriworkers.properties-auto" appears in my conf
directory when I start Tomcat. I just made a symlink from it to
workers.properties, and this worked. Great.

But I'm having a bunch of tomcats running in our development environment,
each running on a different port. This doesn't work that great. The
problem is that the uriworkers-thing doesn't specify the portnumber
automatically. If I just add one line specifying it, it works.

Is this how it's supposed to be? Seems to me that it would be nice if this
got picked up from server.xml (where I do specify the port)..

Also, the auto generated files specify the ajp12. Isn't ajp13 one of the
"nice things" about mod_jk? Is there a easy way to use ajp13 instead?

Thanks!

-- 
Mvh,
Endre




Re: More Tomcat problems.

2000-12-03 Thread Endre Stølsvik

On Mon, 2 Oct 2000, Dave Smith wrote:

| More Tomcat problems.Panagiotis,
| 
| Are you using a try block around the code to catch SQLExceptions
| in your development setup?
| 
| This is what is happening: you are throwing an exception without
| a handler. The jvm just unwinds to the top and drops you out. 

I'm just curious; isn't this strange behaviour? Could a "bad" servlet
crash Tomcat totally, then? I'm thinking of virtual servers, several
domains sharing a Tomcat.


-- 
Mvh,
Endre




Re: reloading..

2000-11-28 Thread Endre Stølsvik

On Mon, 27 Nov 2000, Alistair Hopkins wrote:

| give up, restart tomcat.
| 
| i found that to be the only sureproof way :-(

Hmm.. This isn't exactly the solution I wanted!

Isn't there any other way, or anyone that can give me any clues of where
to _start_ looking for a solution?!

Thanks!

-- 
Mvh,
Endre




Re: reloading..

2000-11-28 Thread Endre Stølsvik

On Tue, 28 Nov 2000, David Molloy wrote:

| I was very happy when I got this all working but as it happens I still
| need to restart Tomcat after I make changes.  You'll find if you use
| sessions to store classes (in my case I store the User class in a
| session variable called theUser) there seems to be a problem with
| reloading.  If anyone has anything to add to this I'd be grateful
| but I'd asked it before.  Seemingly when you cause a class reload
| the classes reload but the sessions don't invalidate - so when you
| do a req.getSession(true) you'll find that it grabs the old one and
| when you try to grab theUser it will give a ClassCastException.
| As another person commented before - it seems like a feature but
| it's more like a bug.

Thanks! Seems like we have exactly the same problems, I also have this
UserSession object in the session, and get ClassCast all the time.

Isn't this such a needed feature for developing in Tomcat that it should
be included as a option for a webapp? "reloadable=true" and
"on-reload;invalidate-the-session,ditch-all-the-classes,basically-do-a-
complete-restart,but-somewhat-transparently-for-the-developer=true"

It wouldn't be a problem to reinitialize the UserSession if it came back
from the Session as "null". Especially if it was invalidated before it got
shut down, because I could then store the state. And then Tomcat started
to load all classes "on demand" again. Maybe it even had to run through
the "load-on-startup" servlets.. But it would be the new, fresh classes,
not any stale, loaded-with-the-old-classloader stuff.


-- 
Mvh,
Endre




reloading..

2000-11-27 Thread Endre Stølsvik

I'm going a bit crazy soon, so any help here would be much appreciated!

I have a DB pool. I instantiate this class as a "connection holder", and
the pool is a static field in this class. I also have a static int that I
increase each time I make a new of these connection holders, and decrease
each time they get garbage collected.
  I Initialize this from a servlet (Startup.java) that I've defined as
"load-on-startup". This goes just fine, and everything is merry.

When I recompile my servlets, beans and helpers (rm all .class files, and
jikes the whole thing), I apparently have "lost" this pool somewhere. I
get a nullpointer exception at the point where I try to reference it. The
counter I was talking about has also been reset to zero.

I then tried to put a call to the initialization in the "doGet()" of the
Startup.java, so that I can call it when I need it. This is when things
get annyoing.
  I now (sometimes!) apparently get two different "contexts" of servlets.
This because the call to Startup.java and this other servlet gives me
_different_ values from this counter. So the Startup.java is happy,
because the pool is working fine there, but my main servlet hasn't got the
same class or whatever.

As I've understood it, this is because I now have two different
classloaders loading these classes, and in reality, two enirely different
contexts. Is this really the way it's meant to be, or am I totally doing
something wrong?

Is there _anything_ I can do from within the servlets to just get rid of
ALL classes and start all over if tomcat notices a "reload-situation"? If
I have to go to the tomcat source, where should I start?!

Any help would much appreciated.

-- 
Mvh,
Endre




Re: ClassCastException

2000-11-25 Thread Endre Stølsvik

On Sat, 25 Nov 2000, Kurt Bernhard Pruenner wrote:

| I guess a solution would be to invalidate the session when such a
| ClassCastException occurs, but of course the exception is likely to happen in
| your own code and not at a point where Tomcat can do this for you; maybe an
| option per context for "invalidating all sessions on reload" (which shouldn't
| be too tragic in a development environment, which servlet reloading is really
| meant for) would be helpful...

An option that, on noticing that a class had changed, just invalidated all
the sessions so that my session-objects could store themself to dB, then
discarded ALL classes (so that they would reload) would be so _extremely_
helpful!

My session handling basically revolves around one "large" UserSession
object. I often end up with ClassCastException when I'm trying to cast the
Object I'm getting out of the HttpSession to UserSession. Is this the
problem you described here? What I do is to just make a new UserSession,
but then I end up with a bunch of usersessions after a while..

I get ClassCastException, but I'm also having some problems with
reloading. I'm dynamically loading (forName(..).newInstance()) a set of
classes, what happens with these?

My servlets all extend a "super-servlet". It seems to me that when I
recompile, just the first servlet (extending this super servlet) I hit
actually gets reloaded, the other ones doesn't. Is this true in any way,
or am I totally off here?

-- 
Mvh,
Endre