RE: tomcat 5.5.9 does not read context.xml

2005-06-02 Thread Steve Kirk

yes context.xml is fine in META-INF.  in fact it is preferred over having it
in server.xml.  your alternative is to put it in
conf/enginename/hostname/yourwebappname.xml (which is in fact what TC will
do for you when it unpacks the war).

I don't know that you can have the context path name different to the war
file.  I'm not 100% sure, but can't see how to do it.  in fact I can see it
being a source of potential confusion.  can you explain why you want to do
that?

> OK, I am totally confused. Is or is it not best practice to provide a 
> context.xml in META-INF. I thought this was required for hot 
> deployment 
> to work. If I want my context path to have a different name to my war 
> file, how do I achieve this?
> 
> thank you
> 



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



Repeated logging problem on 5.5

2005-06-02 Thread Steve Kirk

I have a double-logging problem, by which I mean that 
some of my log messages get logged to two logfiles.  I have only one 
logfile configured using java.util.logging, but in some cases, the 
same log message gets logged to the TC stdout log as well, which I don't 
want.  It's not the end of the world, but I'd like to understand what's 
happening in case I've misunderstood something.

This problem only happens when there is a java.util.logging call 
from either: 
- the init() method of my own servlet
- a class created during that init() method, that persists in the VM after 
  the init() method has returned, through a static field reference.

I asked about this approx 1 days ago, but got no replies, probably because 
my original post was too wordy.  More detail, incl my versions and config 
setup, are in my original post here: 
http://article.gmane.org/gmane.comp.jakarta.tomcat.user/113877 

Does anyone have any ideas what the cause might be, please?



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



RE: invoking Thread.Sleep() from a servlet instance

2005-06-01 Thread Steve Kirk

I have used Thread.sleep() in a webapp, but not within a servlet as such.  I
wrote Runnable classes that were started in their own thread of execution
when the webapp started up.  This worked fine.

> -Original Message-
> From: Tim Funk [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 31 May 2005 18:50
> To: Tomcat Users List
> Subject: Re: invoking Thread.Sleep() from a servlet instance
> 
> 
> It's allowed and typically a bad idea.
> 
> 
> -Tim
> 
> Clark O'Brien wrote:
> 
> > I am looking for insight on invoking Thread.sleep()
> > from a Tomcat Servlet. I understand it is explicitly
> > prohibited in the J2EE spec and it is not hard to 
> > comprehend that invoking sleep on a thread that is
> > processing multiple requests could cause serious side
> > effects. Still I hear rumors that Tomcat allows sleep
> > invocations and I occasionally see it done.
> >clark
> > 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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



RE: Where is the compatibility package to download?

2005-05-31 Thread Steve Kirk
Main downloads page 
http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi 
See links at bottom of 5.5.9 section

> -Original Message-
> From: Dave Guzda [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 31 May 2005 15:42
> To: tomcat-user@jakarta.apache.org
> Subject: Where is the compatibility package to download?
> 
> 
> Hello, 
> 
> I'm trying to get Tomcat 5.5 running and I need to use Java 
> 1.4.2. It seems I require the 'compatibility package' to make 
> this happen. Exactly where is this available to download, i 
> can't seem to find it.
> 
> Thanks
> Dave
> 



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



RE: Adding content/JSPs on the fly

2005-05-27 Thread Steve Kirk

OK glad you've got that off yr chest ;)

I can sort of see yr point, but these are not issues that have troubled me
personally.  I tend to look at TC from the point of view of "I'm just
pleased that someone else wrote TC for me for free and it works v well at
what it is designed for".  Every product has limitations, and can't cover
every feature that we would all like, and I find it amazing that TC has so
few limitations given that it is produced on the backs of volunteer
contributions.  I'd rather have one TC that 2 IIS's ;)

If you're serious about pursuing a solution for this, Maybe there's an
alternative, how about this. (It's not pretty but saves some of the
reinvention that you describe).

Let's say it's an acceptable limitatio to create all your new JSPs to a
separate webapp folder.  This webapp only has a single servlet initially,
which is a type of "Invoker" that you write yourself, eg
/dynamicWebApp/JspInvoker, which could be mapped to serve all request URIs
of the form /dynamicWebApp/*.jsp

Now, when /dynamicWebApp/dnynamicFile.jsp is invoked, the JspInvoker looks
to see if a JSP called dynamicFile.jsp exists under that special folder.  If
it does, then your code translates/compiles/instantiates it (if not done
already) and the request is forwarded to it's doPost method.

I'm not saying this is easy, but it could be done.  You'd be reinventing the
classloading and service methods rather than all the other stuff.  You might
be forced to use SingleSignOn depending on your app, which could be a
negative.  Perhaps my answer is worse than yours ;)

If its any consolation, one of the annoyances I have encountered in the last
few months is that I have a particular webapp feature that I can't code well
because Java does not provide multiple inheritance.  I've done it, but the
code is ugly.  I've tried 99 ways of doing it different but don't have a
better one.  However, I realise that full multiple inheritance was
deliberately excluded from Java for specific reasons, so I have to decide
whether to stop using Java or accept it as good at what it is designed for.
And that's an easy choice to make :)

> -Original Message-
> From: Will Hartung [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 20:38
> To: Tomcat Users List
> Subject: Re: Adding content/JSPs on the fly
> 
> 
> > From: "Steve Kirk" <[EMAIL PROTECTED]>
> > Sent: Friday, May 27, 2005 11:44 AM
> 
> > It sounds reasonable, but probably isn't tested or "by design", so
> probably
> > best to just have a go.  Re portability, the best advice I 
> can offer is an
> > old chestnut: read the servlet spec.  This is particularly 
> relevant in
> this
> > case.  The spec is generally pretty good at telling you you pretty
> > accurately if (a) what you want to do should/must be 
> supported or (b) what
> > you want do do is forbidden.  Of course there are some 
> areas that it does
> > not have a view either way on, but I find it to be an invaluable
> document -
> > I have it on shortcut from my taskbar and consult it often. 
>  It's at least
> > as useful as the javadocs or TC docs.
> >
> > For those of you that don't know where to find it, it's here, under
> > "specifications".
> > http://java.sun.com/products/servlet/reference/api/index.html
> >
> > Choose the servlet spec version appropriate to your TC version as
> described
> > in the table on the tomcat home page:
> > http://jakarta.apache.org/tomcat/index.html
> 
> I'm reasonably familiar with the specification. One of the 
> notable bits
> about it is simply the fact that within the spec, you're 
> pretty much not
> guaranteed writeable access to the file system at all (save 
> for a temporary
> area, and it's simply that -- temporary). But the reality is that most
> engines give you access to the disk that way.
> 
> > Just one more specific point on your note Will - I would 
> have thought if
> > anything that you want it to be a precondition that the 
> webapp NOT be
> > deployed as a war.  I've a feeling that if TC explodes the 
> war, then it
> > might not check the exploded FS for changes.  Don't take 
> this as gospel
> > though, this is a hazy half-remembered bit of info.
> 
> As far as I know, the Servlet spec doesn't have a deployment 
> method outside
> of a WAR. It's pretty much a container behavior to actually 
> explode the WAR
> on to the file system, yet, most obviously do for performance reasons.
> 
> But it does bring up a basic problem, for example, if by some 
> fluke the app
> is redeployed, all of tha

RE: Question: Steve Kirk

2005-05-27 Thread Steve Kirk

Thanks for saying that LOL :) but I'm afraid that you flatter me ;-)

I've been using TC on and off for about 4 years, I have a working knowledge
of the features that I actually use in my webapps, and answer Qs on those
when I can, but that really is about it - there are many others on this list
who are far more knowledgeable than I am about TC.  Perhaps I'm talking too
much at the moment and the volume is giving a false impression of quality ;)

I did read your post, but unfortunately precomp JSPs are not something I
use, I'm just aware of what the general benefits are, as I've worked on a
project where someone else set up the precomp code for our production
environment.  It's on the list of things I want to learn about next, because
it is good practice for production servers, and I have to set one up very
soon.

However I bet that someone will be along soon who can help you.

I have no role in the project - I am just another web developer, the same as
most people on the list.  I am quite active at the moment, mainly because I
just rejoined after a few months' absence, and I've just done upgrades to
the latest versions of JDK/TC/NetBeans, so have read a lot of docs, and
received help from list members, so have some fairly current knowledge to
share.  When on the list, and I have a few mins to spare, I try to help
people if I know anything relevant.  I think this is in the spirit of the
community - give some help where you can, and what goes around comes around.

Most of the real expertise and hard work in TC is provided by the team of
volunteers behind the scenes.

> -Original Message-
> From: Mike Baliel [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 19:58
> To: Tomcat Users List
> Subject: Question: Steve Kirk
> 
> 
> Hi Steve,
> 
>   You seem to be one of the more experienced users of the 
> Tomcat  user 
> mail-list.  Any thoughts on my precompiled JSP problem?
> 
> Any feedback is welcomed.
> 
> Best,
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.322 / Virus Database: 267.1.0 - Release Date: 5/27/2005
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Adding content/JSPs on the fly

2005-05-27 Thread Steve Kirk

It sounds reasonable, but probably isn't tested or "by design", so probably
best to just have a go.  Re portability, the best advice I can offer is an
old chestnut: read the servlet spec.  This is particularly relevant in this
case.  The spec is generally pretty good at telling you you pretty
accurately if (a) what you want to do should/must be supported or (b) what
you want do do is forbidden.  Of course there are some areas that it does
not have a view either way on, but I find it to be an invaluable document -
I have it on shortcut from my taskbar and consult it often.  It's at least
as useful as the javadocs or TC docs.

For those of you that don't know where to find it, it's here, under
"specifications".  
http://java.sun.com/products/servlet/reference/api/index.html 

Choose the servlet spec version appropriate to your TC version as described
in the table on the tomcat home page: 
http://jakarta.apache.org/tomcat/index.html

Just one more specific point on your note Will - I would have thought if
anything that you want it to be a precondition that the webapp NOT be
deployed as a war.  I've a feeling that if TC explodes the war, then it
might not check the exploded FS for changes.  Don't take this as gospel
though, this is a hazy half-remembered bit of info.

> -Original Message-
> From: Will Hartung [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 18:31
> To: Tomcat Users List
> Subject: Adding content/JSPs on the fly
> 
> 
> I'm scheming on a little project, and one of the things I 
> want to be able to
> do is simply add content to the application.
> 
> The typical way to add content is also rather static -- add 
> it to the WAR
> and redeploy.
> 
> That's not particularly dynamic tho, and doesn't really 
> facilitate changing
> content from the web app.
> 
> One of the things I'd like to be able to create on the fly 
> are JSPs that are
> then served by the container.
> 
> Now, Kenneth Jensen may have answered my question for me by 
> providing this
> snippet:
> 
> ServletContext context = getServletConfig().getServletContext();
> String slash = System.getProperty("file.separator");
> keystore = context.getRealPath("/") + "WEB-INF" + slash +
> getInitParameter("keystorefile");
> 
> The key being the "getRealPath("/")" code.
> 
> So, my question is do you think that it's reasonable and 
> fairly portable to
> leverage that technique to find where on the system a webapp 
> is deployed and
> use that as a base path to create new resources to be served by the
> container?
> 
> I'm aware that it is possible for a web app to be deployed in 
> an unexploded
> WAR, and I would simply make it a precondition that this not 
> be the case
> (and for 99% of most systems, it simply isn't an issue).
> 
> But, shouldn't this pretty much work with most common servlet 
> containers?
> 
> Thanx for any insight...
> 
> Regards,
> 
> Will Hartung
> ([EMAIL PROTECTED])
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: my build "structure"..opinions wanted

2005-05-27 Thread Steve Kirk

Precompiled JSPs do 2 steps - JSP to Java, then Java to pcode, which can
then be run by TC.  The compiled JSPs end up as class files, mine end up in
in the
%catalina_home%\work\[enginename]\[hostname]\[webappname]\org\apache\jsp\WEB
_INF\jsp directory (because the source JSP files are in WEB-INF\jsp).

Without precomp, TC compiles each JSP on the fly, the first time that it is
accessed, which slows down execution.

I've never used Eclipse so was just interested.  NetBeans does not by
default do precomp, or even auto compile of servlets on save, although
because it is based on Ant, most things are possible with a little
scripting.

> -Original Message-
> From: gabor [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 15:12
> To: Tomcat Users List
> Subject: Re: my build "structure"..opinions wanted
> 
> 
> On Fri, May 27, 2005 at 01:29:50PM +0100, Steve Kirk wrote:
> > 
> > 
> > Your approach that sounds a quite practical solution to me. 
>  Does eclipse
> > precompile JSPs for you too?
> 
> no.. well, i don't know.. where should the compiled jsp files? be 
> (so i can check :)..
> 
> but anyway, as long as tomcat recompiles them on change, it's ok :)
> 
> gabor
> 
>  
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: jspServlet runs out of memory while compiling some jsp files using fork=true

2005-05-27 Thread Steve Kirk
When you say this: 

> > The jsp pages are quite large, 5000-1 rows and there are
> > many of them.

I take it that you mean that the page can display 5-10k rows of data from a
database, rather than the JSP has 10k lines of code in it.  I hope so.  If
not, it's no wonder that the compiler is struggling!!

If you do mean DB rows rather than lines of code, I still don't see a
particular reason why compiling the JSPs should present such a heavy load
if, as you say, you are only changing a few at a time.  It sounds more
likely to me that it is the processing of the request by the JSPs that is
probably eating up the server resources.  If compilation is happening in
parallel with this, maybe the two together are enough to push the
performance off the edge?

> -Original Message-
> From: Vesa Varimo [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 14:16
> To: Tomcat Users List
> Subject: Re: jspServlet runs out of memory while compiling 
> some jsp files using fork=true
> 
> 
> 
> Hmh.. how does you deployment script work? Do you compile jsp 
> pages in some 
> other server than the live server?
> 
> Well, I didn't write those pages :), I just have to live with 
> legacy code :D
> 
> 
> Vesa
> 
> - Original Message - 
> From: "Bernhard Slominski" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" 
> Sent: Friday, May 27, 2005 4:02 PM
> Subject: AW: jspServlet runs out of memory while compiling 
> some jsp files 
> using fork=true
> 
> 
> Hi,
> 
> I think it happens randomly because it depends on the actual 
> load on the
> server.
> Where there is not much traffic it's OK, but with more 
> traffic the server
> runs out of memomry.
> I see your point that you cannot "control" the webmasters.
> But still with the problems you have and the obvious very big 
> application
> with 1 lines in a JSP (this must we a horror to maintain 
> the code) and
> hundreds of jars you should have a proper deployment process 
> and not just
> copying JSPs across.
> It does not mean that it's more complicated, I implemented this in my
> company with an ant script and it's really simple, stable and 
> secure. Nobody
> want's to go back to the old copy "solution".
> 
> Cheers
> 
> Bernhard
> 
> > -Ursprüngliche Nachricht-
> > Von: Vesa Varimo [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 27. Mai 2005 14:59
> > An: Tomcat Users List
> > Betreff: Re: jspServlet runs out of memory while compiling some jsp
> > files using fork=true
> >
> >
> >
> > Hi,
> >
> > no the webapp is running whole time without redeployments.
> > The jsp pages are quite large, 5000-1 rows and there are
> > many of them.
> > Can this affect to memory usage of javac compiler?
> > This is a strange problem, because sometimes these same pages
> > compile just
> > fine, sometimes they don't.
> >
> >
> > Thx,
> >
> > Vesa
> >
> > - Original Message - 
> > From: "Steve Kirk" <[EMAIL PROTECTED]>
> > To: "'Tomcat Users List'" 
> > Sent: Friday, May 27, 2005 3:32 PM
> > Subject: RE: jspServlet runs out of memory while compiling
> > some jsp files
> > using fork=true
> >
> >
> > Is the problem caused because you redeploy the whole webapp 
> each time?
> > Could you just deploy only those files that have changed?  I
> > can't imagine
> > that this leads to overloading unless the numbers are massive...?
> >
> > > -Original Message-
> > > From: Vesa Varimo [mailto:[EMAIL PROTECTED]
> > > Sent: Friday 27 May 2005 13:34
> > > To: Tomcat Users List
> > > Subject: Re: jspServlet runs out of memory while compiling
> > > some jsp files using fork=true
> > >
> > >
> > >
> > > Yes, that would be one solution, but not suitable for our
> > > case because our
> > > webmasters are constantly updating jsp pages on our
> > > production servers.
> > > Btw. I'm using tomcat 5.0.28.
> > >
> > > Thx,
> > >
> > > Vesa
> > >
> > > - Original Message - 
> > > From: "Bernhard Slominski" <[EMAIL PROTECTED]>
> > > To: "'Tomcat Users List'" 
> > > Sent: Friday, May 27, 2005 3:25 PM
> > > Subject: AW: jspServlet runs out of memory while compiling
> > > some jsp files
> > > using fork=true
> > >
> > >
> > > Hi,
>

RE: jspServlet runs out of memory while compiling some jsp files using fork=true

2005-05-27 Thread Steve Kirk
Is the problem caused because you redeploy the whole webapp each time?
Could you just deploy only those files that have changed?  I can't imagine
that this leads to overloading unless the numbers are massive...?

> -Original Message-
> From: Vesa Varimo [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 13:34
> To: Tomcat Users List
> Subject: Re: jspServlet runs out of memory while compiling 
> some jsp files using fork=true
> 
> 
> 
> Yes, that would be one solution, but not suitable for our 
> case because our 
> webmasters are constantly updating jsp pages on our 
> production servers.
> Btw. I'm using tomcat 5.0.28.
> 
> Thx,
> 
> Vesa
> 
> - Original Message - 
> From: "Bernhard Slominski" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" 
> Sent: Friday, May 27, 2005 3:25 PM
> Subject: AW: jspServlet runs out of memory while compiling 
> some jsp files 
> using fork=true
> 
> 
> Hi,
> 
> I would suggest that you do a precompilation of your jsps on 
> a deployment
> machine which is separate from the live machine.
> So your compilation is not done on the live server, which 
> might be on heavy
> load.
> Also you don't have the problem that the first visitor has to 
> wait an awful
> long time until the page get's displayed.
> 
> Cheers
> 
> Bernhard
> 
> > -Ursprüngliche Nachricht-
> > Von: Vesa Varimo [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 27. Mai 2005 12:45
> > An: tomcat-user@jakarta.apache.org
> > Betreff: jspServlet runs out of memory while compiling some 
> jsp files
> > using fork=true
> >
> >
> > Hi,
> >
> > I'm having OutOfMemory error while Tomcat tries to compile
> > jsp files. The problem occures few times in day so it's quite
> > hard to repeat.
> > Tomcat is configured to run javac in separate JVM with
> > fork=true option. I tried to give more memory for ant using
> > ANT_OPTS, but it didn't help.
> > I read source code for the jasper compiler and there are
> > variables that configure how much memory is given to ant, but
> > I'm not able to configure them
> > with jspServlet init parameters.
> >
> > How should I resolved this? Is the Jikes compiler a solution
> > worth of trying?
> >
> > Stacktrace included below. I have hundreds of jars in
> > classpath... so I can't paste the whole compiler output.
> >
> > BR,
> >
> > Vesa Varimo
> > [EMAIL PROTECTED]
> >
> > --
> > --
> >
> > 2005-05-26 21:42:53 StandardWrapperValve[jsp]:
> > Servlet.service() for servlet jsp threw exception
> > java.lang.OutOfMemoryError
> >
> > May 7, 2005 12:21:42 PM org.apache.jasper.compiler.Compiler
> > generateClass
> > SEVERE: Javac exception
> > Compile failed; see the compiler error output for details.
> > at 
> org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:944)
> > at 
> org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
> > at
> > org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:379)
> > at
> > org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
> > at
> > org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
> > at
> > org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
> > at
> > org.apache.jasper.JspCompilationContext.compile(JspCompilation
> > Context.java:511)
> > at
> > org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
> > Wrapper.java:295)
> > at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> > .java:292)
> > at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
> > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(ApplicationFilterChain.java:237)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilterChain.java:157)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValve.java:214)
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: my build "structure"..opinions wanted

2005-05-27 Thread Steve Kirk

Don't leave the source on the production server, but it's fine in
development.  Strictly speaking your source files are inaccessible by web
clients if they are under WEB-INF, but better safe than sorry.  Why not
store the src in another folder altogether - eclipse won't care where it is
presumably, and this is slightly better practice.

The other approach is to build a jarfile from a build script (e.g. using
ant), then copy the jar to the webapps/ directory, TC will auto-deply it.
Some would say this is the only way to do it.  However it does slow things
down when you are making frequent small changes to code.  For my money, the
value of a jar is ease of portability, which is a factor if you are writing
for true cross-container support.

I built classes direct to classes/ for a long time, then made the effort to
switch to jar deployment in development, after being persuaded by people on
this list.  I'm glad I've done both, but to be honest I think I do prefer
building to classes, as it's quicker and I can't see a disadvantage to it
during dev.

Your approach that sounds a quite practical solution to me.  Does eclipse
precompile JSPs for you too?

One other thing to watch is that logging.properties and properties files go
in the classes/ folder, so if you use these, be careful that eclipse does
not delete them when rebuilding your classes.

> -Original Message-
> From: gabor [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 13:16
> To: tomcat-user@jakarta.apache.org
> Subject: my build "structure"..opinions wanted
> 
> 
> 
> hi,
> 
> i'm starting a project using jsp + javaBeans..
> i've worked with java a lot, but i have not much experience with web
> applications..
> 
> for now my idea is that the application will be using 
> javabeans, and jsp
> for displaying the data...
> 
> i use eclipse for the development, which nicely compiles every source
> file automatically when i edit them.
> 
> that's why i came up with the following idea:
> 
> i'll create a directory in tomcat/webapps (let's call it 'mywebapp').
> put my source files into mywebapp/WEB-INF/src, and instruct eclipse to
> put the compiled .class files into mywebapp/WEB-INF/classes.
> 
> this way, i simply edit the files, press ctrl-s (to save them),
> switch to the browser window, and press refresh, and already i get the
> new results (because eclipse already compiled the file, and tomcat
> detected the change).
> 
> i tested this approach, and it works ok.
> 
> is this a suitable approach? are there any dangers with this approach?
> 
> gabor
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Logging into rational database....

2005-05-27 Thread Steve Kirk

I think there is a DBCP logger, but this is for the Java code logging
statements, rather than for the access log AFAIK.

Can't remember where I read this.  Probably on the TC site, try starting
here: 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/index.html 

> -Original Message-
> From: David [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 12:14
> To: tomcat-user@jakarta.apache.org
> Subject: Logging into rational database
> 
> 
> Hallo,
> 
>  
> 
> I have sent this question yesterday but nobody responded. It's a short
> question so please send me some information.
> 
>  
> 
> Is it possible to configure tomcat to log the access log into 
> a rational
> database? Is there an existing tutorial?
> 
>  
> 
> Thanks
> 
>  
> 
> David
> 
> 



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



RE: Error filterStart in org.apache.catalina.core.StandardContext start

2005-05-27 Thread Steve Kirk

Are you by any chance running on a server that has no video card/monitor?  A
few years ago a colleague mentioned that the headless=true is required in
this situation, something to do with whether the AWT classes need to be
loaded, my memory is a bit vague on it.

You have 4 forward slashes but then only single slashes afterwards, is that
right?  Looks odd, / cannot be an escape if used alone, so why 4?

> -Original Message-
> From: Strauss, Alexandra [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 12:07
> To: 'tomcat-user@jakarta.apache.org'
> Subject: Error filterStart in 
> org.apache.catalina.core.StandardContext start
> 
> 
> Hi,
> 
> I'm getting This Error while starting Tomcat. I searched the 
> web an found
> out that this error can occur if starting Tomcat misses this param in
> CATALINA_OPTS:  -Djava.awt.headless=true
> I checked the starting procedure and found out, that this param is set
> properly in the call looking like this:
> 
> CATALINA_OPTS="-Xmx1024m -Xms256m -Djava.awt.headless=true 
> -DTomcat_hale
> -Dlog4j.configuration=file:opt/jakarta-tomcat-5.0.28_hale/
> log4j.lcf
> -server"; export CATALINA_OPTS
> 
> Not having much experience with tomcat I have no idea what 
> else could be the
> reason for this error. Could anyone help me? Thank you.
> 
> 
> Greetings
> Alexandra Strauß
> 
> Oberlandesgericht München
> Gemeinsame IT-Stelle der bayerischen Justiz
> Referat IT-4 Serverbetrieb/Rechenzentrum SG4.3
> Infanteriestr. 5
> 80797 München
> 
> 
> 
> 
> --
> --
> --
> --
> --
> 
> Catalina-out
> --
> --
> --
> --
> --
> 
> 27.05.2005 11:04:52 org.apache.catalina.core.StandardContext start
> SCHWERWIEGEND: Error filterStart
> 27.05.2005 11:04:52 org.apache.catalina.core.StandardContext start
> SCHWERWIEGEND: Context startup failed due to previous errors
> 27.05.2005 11:04:52 
> org.apache.catalina.core.StandardHostDeployer install
> INFO: Installing web application at context path 
> /servlets-examples from URL
> file:/opt/jakarta-tomcat-5.0.28_hale/webapps/servlets-examples
> 27.05.2005 11:04:52 org.apache.catalina.core.StandardContext start
> SCHWERWIEGEND: Error filterStart
> 27.05.2005 11:04:52 org.apache.catalina.core.StandardContext start
> SCHWERWIEGEND: Context startup failed due to previous errors
> 27.05.2005 11:04:52 
> org.apache.catalina.core.StandardHostDeployer install
> INFO: Installing web application at context path /tomcat-docs from URL
> file:/opt/jakarta-tomcat-5.0.28_hale/webapps/tomcat-docs
> 27.05.2005 11:04:52 
> org.apache.catalina.core.StandardHostDeployer install
> INFO: Installing web application at context path /webdav from URL
> file:/opt/jakarta-tomcat-5.0.28_hale/webapps/webdav
> 27.05.2005 11:04:52 
> org.apache.catalina.core.StandardHostDeployer install
> INFO: Installing web application at context path 
> /archive_sich from URL
> file:/opt/jakarta-tomcat-5.0.28_hale/webapps/archive_sich
> 27.05.2005 11:04:52 org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-8090
> 27.05.2005 11:04:52 org.apache.jk.common.ChannelSocket init
> INFO: Port busy 8009 java.net.BindException: Adresse wird 
> bereits benutzt
> 27.05.2005 11:04:52 org.apache.jk.common.ChannelSocket init
> INFO: Port busy 8010 java.net.BindException: Adresse wird 
> bereits benutzt
> 27.05.2005 11:04:52 org.apache.jk.common.ChannelSocket init
> INFO: Port busy 8011 java.net.BindException: Adresse wird 
> bereits benutzt
> 27.05.2005 11:04:52 org.apache.jk.common.ChannelSocket init
> INFO: Port busy 8012 java.net.BindException: Adresse wird 
> bereits benutzt
> 27.05.2005 11:04:52 org.apache.jk.common.ChannelSocket init
> INFO: JK2: ajp13 listening on /0.0.0.0:8013
> 27.05.2005 11:04:52 org.apache.jk.server.JkMain start
> INFO: Jk running ID=4 time=0/39
> config=/opt/jakarta-tomcat-5.0.28_hale/conf/jk2.properties
> 27.05.2005 11:04:53 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 6516 ms
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Are we required to move to Tomcat 5.5 in order to move to JDK 1.5

2005-05-27 Thread Steve Kirk

I think these are both in the release/changes notes that I posted a link to
earlier in this thread - so yes these are real issues.

> -Original Message-
> From: Mark Leone [mailto:[EMAIL PROTECTED] 
> Sent: Friday 27 May 2005 02:14
> To: Tomcat Users List
> Subject: Re: Are we required to move to Tomcat 5.5 in order 
> to move to JDK 1.5
> 
> 
> Sounds like the consensus is that Tomcat 5.0.x will work with 
> jdk 1.5. 
> FWIW I found the following two problems trying to run code 
> built for jre 
> 1.4 in a 1.5 jvm.
> 
> 1. A couple DOM classes (don't remember which ones, but 
> you'll know it 
> if you run in to them) had some methods added in jdk 1.5. If 
> you try to 
> load an implementation class for one of these that was 
> developed in jdk 
> 1.4, you'll get missing method implementation errors. To resolve, you 
> can add empty method specifications for the classes that 
> require them, 
> or upgrade to an XML parser that was written for jdk 1.5.
> 
> 2. JDK 1.5 uses the symbol "enum" as a reserved keyword. 
> You'll have to 
> change any and all occurrences of this symbol in your code 
> (where it is 
> used as a variable name) to something else, e.g. "enumer."
> 
> There may be other backward compatibility issues, but these 
> are the two 
> that I've run into.
> 
> -Mark
> 
> Tim Diggins wrote:
> 
> > And, oops, I'm sorry for spreading the original FUD - 
> Following this 
> > thread, I've just tried again to get everything working on 
> > tc5.0/jdk1.5 and hey-presto, everything ok - guess I must've had TC 
> > running on jdk1.4 after all...
> >
> > But planning to migrate to 5.5 anyway.
> >
> > thanks everyone
> >
> > T
> >
> >
> > Steve Kirk wrote:
> >
> >> Yes sorry, david is correct, I got it backwards.
> >>
> >>
> >>> -Original Message-
> >>> From: David Smith [mailto:[EMAIL PROTECTED] Sent: Thursday 26 May 
> >>> 2005 12:59
> >>> To: Tomcat Users List
> >>> Subject: Re: Are we required to move to Tomcat 5.5 in 
> order to move 
> >>> to JDK 1.5
> >>>
> >>>
> >>> Small correction -- 5.5 needs the compat package to work 
> on jdk l.4, 
> >>> not 5.0 needs it to work on jdk 1.5. I've used TC 5.0 & jdk 1.5 
> >>> together no problem.
> >>>
> >>> --David
> >>>
> >>> Steve Kirk wrote:
> >>>
> >>>
> >>>> You can run 5.0.28 on jdk1.5 but you need to add a 
> >>>
> >>>
> >>> compatibility package
> >>>
> >>>> which is available from the tc downloads page.  Basically it 
> >>>
> >>>
> >>> adds 3 jars to
> >>>
> >>>> fix issues with xml compatibility with the 1.4 vm.
> >>>>
> >>>> I haven't done it myself (I upgraded both at once) but 
> >>>
> >>>
> >>> google some of these
> >>>
> >>>> words and you can read all about it.
> >>>>
> >>>> PS if you do go to 5.5 and have DBCP, be sure to change your 
> >>>
> >>>
> >>> context.xml to
> >>>
> >>>> the new format required by TC5.5.  I spent nearly 3 days 
> >>>
> >>>
> >>> working that out.
> >>>
> >>>>
> >>>>
> >>>>
> >>>>> -Original Message-
> >>>>> From: Raverkar, Sachin (Sachin) 
> [mailto:[EMAIL PROTECTED] Sent: 
> >>>>> Thursday 26 May 2005 08:58
> >>>>> To: tomcat-user@jakarta.apache.org
> >>>>> Subject: Are we required to move to Tomcat 5.5 in order 
> to move to 
> >>>>> JDK 1.5
> >>>>>
> >>>>>
> >>>>> Hi all,
> >>>>> We are currently using Tomcat-5.0.28 and JDK 1.4.2_03.
> >>>>> We need to move onto JDK 1.5. We would build our war file using 
> >>>>> JDK 1.5.
> >>>>> Can we continue to use Tomcat-5.0.28 with  JDK 1.5? Do 
> you see any 
> >>>>> problem? Are there any known issues?
> >>>>> Since Tomcat 5.5 is designed to run on J2SE 5.0 [JDK 
> 1.5] and later,
> >>>>> are we required to move to Tomcat 5.5 in order to move 
> to JDK 1.5?
> >>>>>
> >>>>> - Sachin
> >>>>>



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



RE: servlet request time out ?!

2005-05-26 Thread Steve Kirk
Sorry Ross, got yr name wrong :)

Would be interested to know how to do it though, if you find out could you
please post, thanks.

> -Original Message-
> From: Angelov, Rossen [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 21:20
> To: 'Tomcat Users List'; [EMAIL PROTECTED]
> Subject: RE: servlet request time out ?!
> 
> 
> That's exactly how I understood it too. The request will be 
> dropped if after
> certain number of milliseconds the request's URI hasn't been received.
> 
> In my case the URI comes directly with the request and based 
> on my log I can
> see the request is being processed but there is no response 
> after the doPost
> method is finished.
> 
> I can still give it try with connectionTimeout="0", but don't 
> expect it to
> help.
> 
> Ross
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 26, 2005 3:09 PM
> To: 'Tomcat Users List'; [EMAIL PROTECTED]
> Subject: RE: servlet request time out ?!
> 
> 
> 
> I haven't tested this myself, so I'm only going on what the 
> docs say (5.5): 
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html 
> 
> If I've understood correctly, this doc seems to say that the
> connectionTimeout param doesn't have the effect Angelov is 
> looking for - it
> sets the max time between a connection (socket) being opened 
> by the client,
> and the client sending a request url to TC.
> 
> > -Original Message-
> > From: Mike Baliel [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday 26 May 2005 19:49
> > To: Tomcat Users List
> > Subject: Re: servlet request time out ?!
> > 
> > 
> > Hi Angelov,
> > 
> > I am new to Tomcat (Just started using Tomcat5.0 
> > yesterday), but the 
> > problem you mentioned sounds like a typical connnection timout.
> > 
> > Have you tried to setting the connectionTimeout value to 0 in the 
> > server.xml?
> > 
> > Here is to location in server.xml.  Where there is currently 
> > a value of 
> > [connectionTimeout="2"] change to [connectionTimeout="0"].
> > 
> > 
> > 
> >   
> > 
> >  
> > 
> >  
> >   > port="8080"   maxThreads="150" minSpareThreads="25" 
> > maxSpareThreads="75"
> > enableLookups="false" redirectPort="8443" 
> > acceptCount="100"
> > debug="0" connectionTimeout="2"
> > disableUploadTimeout="true" />
> >  
> > 
> > 
> > Mike
> > 
> > Angelov, Rossen wrote:
> > > Hi,
> > > Does anybody know about a time out on a servlet request 
> > with Tomcat 5?
> > > 
> > > The problem is that I have a request that takes about 30 
> > minutes but the
> > > browser keeps waiting for the response forever. I tried 
> > different browsers
> > > but it's the same behavior.
> > > 
> > > I put debug statements in the doPost method and it's 
> > finishing correctly.
> > > The last debug statement is printed out but the browser is 
> > still waiting for
> > > the response.
> > > 
> > > Ross
> > > 
> > > "This communication is intended solely for the addressee and is
> > > confidential and not for third party unauthorized distribution."
> > > 
> > > 
> > > 
> > > 
> > > 
> > --
> > --
> > > 
> > > No virus found in this incoming message.
> > > Checked by AVG Anti-Virus.
> > > Version: 7.0.322 / Virus Database: 266.11.17 - Release 
> > Date: 5/25/2005
> > 
> > 
> > -- 
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.322 / Virus Database: 266.11.17 - Release 
> Date: 5/25/2005
> > 
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> "This communication is intended solely for the addressee and is
> confidential and not for third party unauthorized distribution."
> 
> 



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



RE: servlet request time out ?!

2005-05-26 Thread Steve Kirk

I haven't tested this myself, so I'm only going on what the docs say (5.5): 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html 

If I've understood correctly, this doc seems to say that the
connectionTimeout param doesn't have the effect Angelov is looking for - it
sets the max time between a connection (socket) being opened by the client,
and the client sending a request url to TC.

> -Original Message-
> From: Mike Baliel [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 19:49
> To: Tomcat Users List
> Subject: Re: servlet request time out ?!
> 
> 
> Hi Angelov,
> 
>   I am new to Tomcat (Just started using Tomcat5.0 
> yesterday), but the 
> problem you mentioned sounds like a typical connnection timout.
> 
> Have you tried to setting the connectionTimeout value to 0 in the 
> server.xml?
> 
> Here is to location in server.xml.  Where there is currently 
> a value of 
> [connectionTimeout="2"] change to [connectionTimeout="0"].
> 
> 
> 
>   
> 
>  
> 
>  
>   port="8080"   maxThreads="150" minSpareThreads="25" 
> maxSpareThreads="75"
> enableLookups="false" redirectPort="8443" 
> acceptCount="100"
> debug="0" connectionTimeout="2"
> disableUploadTimeout="true" />
>  
> 
> 
> Mike
> 
> Angelov, Rossen wrote:
> > Hi,
> > Does anybody know about a time out on a servlet request 
> with Tomcat 5?
> > 
> > The problem is that I have a request that takes about 30 
> minutes but the
> > browser keeps waiting for the response forever. I tried 
> different browsers
> > but it's the same behavior.
> > 
> > I put debug statements in the doPost method and it's 
> finishing correctly.
> > The last debug statement is printed out but the browser is 
> still waiting for
> > the response.
> > 
> > Ross
> > 
> > "This communication is intended solely for the addressee and is
> > confidential and not for third party unauthorized distribution."
> > 
> > 
> > 
> > 
> > 
> --
> --
> > 
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.322 / Virus Database: 266.11.17 - Release 
> Date: 5/25/2005
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.322 / Virus Database: 266.11.17 - Release Date: 5/25/2005
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Implementing custom session expiration rule

2005-05-26 Thread Steve Kirk
You could implement a filter that checked the time since last visit, and if
the session had expired according to your custom rule, invalidate the
session and redirect to appropriate page such as login.  You'd have to make
sure that the "default" session time set in server.xml was longer than the
max session time you wanted in your custom method, otherwise the browser
would time out the session for you if based on cookies.

I haven't used Filters, but as far as I understand the principles, I don't
think a redirect from within the filter code would upset anything.  I think
you can break out of the filter chain like this without problems.

> -Original Message-
> From: Marc Vaillancourt [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 17:29
> To: tomcat-user@jakarta.apache.org
> Subject: Implementing custom session expiration rule
> 
> 
> I have a requirement to implement different session timeout values for
> different user roles. What would be the most straightforward way to
> accomplish this?
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Tomcat/Personal Web Server Problem

2005-05-26 Thread Steve Kirk
Sorry, my mistake - you said that clearly the first time but I misread it.
I'm struggling to make any further suggestions I'm afraid.

You could try the bood old fashioned reboot.  Is the problem persists,
verify that 8080/8081 are still in "LISTENING" state.

Then maybe can you install TC on another port (by stopping it, changing it's
config settings, reboot the PC so that you are sure you've cleared any
network ports, then restating it).  Again repeat the netstat -a command to
see if that new port is open and there is nothing on 8080/8081.  This at
least gives you the clue that TC is starting and running on the ports that
you think it is.

What version OS are you on?

> -Original Message-
> From: Robin Rembish [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 15:21
> To: Tomcat Users List
> Subject: Re: Tomcat/Personal Web Server Problem
> 
> 
> Steve,
> 
> After uninstalling Personal Web Server, I was not getting PWS 
> when typing
> http://localhost:8080 in the address window of Internet Explorer.
> 
> I got the following error message:
> 
> Page cannot be displayed
> The page you are looking for is currently unavailable
> 
> Above Address Window:
> res://C:\WINNT\System32\shdoclc.dll/dnserror.htm#http://localh
> ost:8080/
> 
> I checked the jwsdp-1_1 logs and didn't find any errors.  The 
> output from
> the launcher server log is below.
> 
> Robin
> 
> Launcher.server.log
> 
> [INFO] Registry - -Loading registry information
> [INFO] Registry - -Creating new Registry instance
> [INFO] Registry - -Creating MBeanServer
> [INFO] Http11Protocol - -Attribute port: 8081
> [INFO] Http11Protocol - -Attribute maxThreads: 75
> [INFO] Http11Protocol - -Attribute backlog: 10
> [INFO] Http11Protocol - -Attribute tcpNoDelay: true
> [INFO] Http11Protocol - -Attribute soTimeout: 6
> [INFO] Http11Protocol - -Attribute timeout: 6
> [INFO] Http11Protocol - -Attribute secure: false
> [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 
> protocol handler on
> port 8081
> [INFO] Http11Protocol - -Attribute port: 8080
> [INFO] Http11Protocol - -Attribute maxThreads: 75
> [INFO] Http11Protocol - -Attribute backlog: 10
> [INFO] Http11Protocol - -Attribute tcpNoDelay: true
> [INFO] Http11Protocol - -Attribute soTimeout: 6
> [INFO] Http11Protocol - -Attribute timeout: 6
> [INFO] Http11Protocol - -Attribute secure: false
> [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 
> protocol handler on
> port 8080
> Starting service Internal Services
> Java Web Services Developer Pack/1.1-fcs
> [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 protocol 
> handler on port
> 8081
> Starting service Java Web Services Developer Pack
> Java Web Services Developer Pack/1.1-fcs
> [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 protocol 
> handler on port
> 8080
> 
> 
> - Original Message -
> From: "Steve Kirk" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" 
> Sent: Thursday, May 26, 2005 9:17 AM
> Subject: RE: Tomcat/Personal Web Server Problem
> 
> 
> Well based on your netstat output below, this proves that 
> "something" is
> listening on 8080 and 8081.  It doesn't indicate what is (not 
> sure if there
> is a way to find out).
> 
> If you are accessing http://localhost:8080 and still getting 
> PWS, then it is
> still starting on 8080, before TC is, so TC is probably 
> failing to start.
> If TC cannot start for this reasons, it will say so in its 
> logs - look at
> any files under the "logs" directory under your tomcat 
> install directory.
> Read carefully for any error logged.
> 
> I realise that you have repeated that PWS is uninstalled, but 
> you do also
> say that you can still access it at 8080.  Perhaps it would 
> help if you said
> why you think you are accessing PWS not TC.  Do they serve completely
> different pages?  If they serve the same pages is it possible 
> that you just
> think you are seeing PWS?
> 
> PS I should point out that I have not run JWS myself so am 
> best-guessing
> based on TC experience.
> 
> > -Original Message-
> > From: Robin Rembish [mailto:[EMAIL PROTECTED]
> > Sent: Thursday 26 May 2005 12:59
> > To: Tomcat Users List
> > Subject: Re: Tomcat/Personal Web Server Problem
> >
> >
> > Steve,
> >
> > Thanks for responding.  The results of netstat -a include the
> > following:
> >
> > Active Connections
> >
> >   Proto  Local Address  Foreign AddressState
> >   TCP4e317:8080 0.0.0.0:0  LISTENING
> >   TCP

RE: Showing Tomcat Icon rather than DOS icon

2005-05-26 Thread Steve Kirk
Jack, You accidentally replied direct to me rather than to the list.  It's
best to reply to the list so that everyone gets to see the answer.  I'm
replying to you via the list now.

If you mean by the "run bar"/"pc bar" the bar at the top of the window that
TC runs in, then I think what you are trying to do is what used to be done
via a "PIF" file.  These no longer exist in more recent versions of windows
AFAIK.  Sorry, not sure how to do it.

> -Original Message-
> From: Dakota Jack [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 13:43
> To: Steve Kirk
> Subject: Re: Showing Tomcat Icon rather than DOS icon
> 
> 
> I perhaps should say that I have the Tomcat icon on the Start menu
> with no difficulties.  The problem is the run bar.  Thanks, again.
> 
> On 5/26/05, Dakota Jack <[EMAIL PROTECTED]> wrote:
> > That works if you are talking about changing the icon for a 
> file.  How
> > does that work here.  What file are you talking about right clicking
> > on?  Right clicking on the bar on the window won't do this.  Thanks
> > for helping.
> > 
> > On 5/26/05, Steve Kirk <[EMAIL PROTECTED]> wrote:
> > > Right click, choose properties, click change icon, browse 
> to tc dir, choose
> > > tomcat.exe.
> > >
> > > > -Original Message-
> > > > From: Dakota Jack [mailto:[EMAIL PROTECTED]
> > > > Sent: Thursday 26 May 2005 08:47
> > > > To: Tomcat Users List
> > > > Subject: Showing Tomcat Icon rather than DOS icon
> > > >
> > > >
> > > > How can I write my Tomcat startup script to show the 
> Tomcat icon on a
> > > > PC bar rather than the DOS icon?  Thanks
> > > >
> > > > --
> > > > "You can lead a horse to water but you cannot make it float
> > > > on its back."
> > > > ~Dakota Jack~
> > > >
> > > > 
> -
> > > > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > >
> > 
> > 
> > --
> > "You can lead a horse to water but you cannot make it float 
> on its back."
> > ~Dakota Jack~
> > 
> 
> 
> -- 
> "You can lead a horse to water but you cannot make it float 
> on its back."
> ~Dakota Jack~
> 



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



RE: Tomcat/Personal Web Server Problem

2005-05-26 Thread Steve Kirk
Well based on your netstat output below, this proves that "something" is
listening on 8080 and 8081.  It doesn't indicate what is (not sure if there
is a way to find out).

If you are accessing http://localhost:8080 and still getting PWS, then it is
still starting on 8080, before TC is, so TC is probably failing to start.
If TC cannot start for this reasons, it will say so in its logs - look at
any files under the "logs" directory under your tomcat install directory.
Read carefully for any error logged.

I realise that you have repeated that PWS is uninstalled, but you do also
say that you can still access it at 8080.  Perhaps it would help if you said
why you think you are accessing PWS not TC.  Do they serve completely
different pages?  If they serve the same pages is it possible that you just
think you are seeing PWS?

PS I should point out that I have not run JWS myself so am best-guessing
based on TC experience.

> -Original Message-
> From: Robin Rembish [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 12:59
> To: Tomcat Users List
> Subject: Re: Tomcat/Personal Web Server Problem
> 
> 
> Steve,
> 
> Thanks for responding.  The results of netstat -a include the 
> following:
> 
> Active Connections
> 
>   Proto  Local Address  Foreign AddressState
>   TCP4e317:8080 0.0.0.0:0  LISTENING
>   TCP4e317:8081 0.0.0.0:0  LISTENING
> 
> According to the jwsdp launcher server log, Tomcat is using 
> ports 8080 and
> 8081.
> How would I change the port that Personal Web Server runs on? 
>  Please keep
> in mind that PWS was uninstalled.  However, when this problem 
> is resolved, I
> want to re-install it.  So what is the best plan of attack 
> and how do I
> accomplish it?
> 
> Clearly, I know nothing about technical support.  So I need a 
> step-by-step
> process.
> 
> Thanks,
> 
> Robin
> 
> 
> 
> - Original Message -
> From: "Steve Kirk" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" 
> Sent: Thursday, May 26, 2005 5:06 AM
> Subject: RE: Tomcat/Personal Web Server Problem
> 
> 
> 
> Looks like TC cannot start.  If you have fresh installed it, 
> then hazarding
> a guess, I'd say it might be because the port might be in 
> use.  You can't
> have 2 servers on the same port. Did you have them configured 
> to run on the
> same port (8080)?
> 
> One thing to check is to open a dos window then type "netstat 
> -a", this will
> list all ports in use on your machine.  Give it a while to 
> run, this can
> sometimes take up to a minute depending on what's running on 
> your machine.
> If 8080 is listed there and tomcat is not started, you know 
> that the old
> config of PWS still has the port.  You need to take further steps to
> uninstall it.
> 
> Or, change the port that either TC or PWS runs on.  Then you 
> can run both at
> once if you like.
> 
> > -Original Message-
> > From: Robin Rembish [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday 25 May 2005 23:03
> > To: tomcat-user@jakarta.apache.org
> > Subject: Tomcat/Personal Web Server Problem
> >
> >
> > I had both Tomcat 4.1 and Microsoft Personal Web Server
> > installed on my laptop ( an IBM Thinkpad - Windows NT
> > operating system). It had been several months since I used Tomcat.
> >
> > When I started the Tomcat server and typed in localhost:8080
> > in the Internet Explorer address window, it brought me to
> > Personal Web Server rather than bringing up the Tomcat page.
> >
> > I then decided to uninstall both Personal Web Server and the
> > Java Web Services Developers Pack. But after reinstalling the
> > latter, I am getting a page not found condition. (Details 
> are below).
> >
> > On the advice of someone at a technical forum, I started
> > Tomcat (Start/Programs/Java Web Services Developer Pack
> > 1.1/Start Tomcat)
> >
> > and then checked
> >
> > Start/Programs/Administrative Tools/Windows NT Diagnostics/Services
> >
> > It had:
> >
> > JavaWebServer Stopped
> >
> > although the services log file (and all other log files)
> > under jwsdp-1_1 indicated Tomcat was running
> >
> > If anyone can help, I'd really appreciate it.
> >
> > Robin
> > 
> > Type in Address Window:
> > http://localhost:8080
> >
> > Error message:
> >
> > Page cannot be displayed
> > The page you are looking for is currently unavailable
> >
> >
> > In Intern

Logging to two logfiles by classes instantiated by init

2005-05-26 Thread Steve Kirk

I have always used 2 ways of logging.  Mainly I use java.util.logging
classes, including a custom Formatter that I wrote myself.  I do not use
log4j.  When my webapp first starts, the init() method of my own custom
Invoker servlet loads the config for my main logging code is loaded from
web.xml using getInitParameter(), so if for any reason that config is bad,
or some other exception happens during init(), I use the bogstandard
javax.servlet.GenericServlet#log() method to log any problems to TC's own
loggers.  All of this works fine.

Once initialised, my main logging code works by providing a static method
that any servlet in the webapp inherits.

Now, here is the weird thing.  When Invoker.writeToLog is called by a class
that was instantiated during Invoker#init(), it writes the log message to
both its own logfile and the TC stdout log.  These two files have quite
different formatters, and the message appears in the appropriate format in
each file.  When double-logging happens, the TC log clearly shows that
Invoker.writeToLog was the calling method, so it's not just that my code is
calling both methods.  Servlets and classes loaded/instantiated later log
correctly to my main log only.

Can anyone suggest what might be causing this please?  More details on setup
below.

I have been running TC5.0.x on JDK1.4.x for about a year, and previous
versions before that.  I just upgraded to TC5.5.9/jdk1.5.0_02.  Have made
the config changes required and it all works swimmingly.  Only one problem
persists, a small logging issue, which in fact was there before, but I
ignored it.  Basically some of my log statements get written to two files at
the same time.

However, given that logging has moved on a bit in 5.5, this is a chance to
clean things up, so I have decided to take a look at it.  I have removed the
 that used to be in conf/server.xml in TC5.0.  I therefore have the
bogstandard logging that ships in a standard 5.5 TC install.  (I do have a
FastCommonAccessLogValve and a RequestDumperValve configured but I'm
assuming that those are separate issues).



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



RE: Context Class with Tomcat 5.5.7

2005-05-26 Thread Steve Kirk

You might not need code/docs to do that, you might be OK just reading the
JNDI how-to:
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html 

See also this page. 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html 

If you do need the docs, you could maybe use the docs for
javax.servlet.ServletContext which is the interface that
org.apache.tomcat.core.Context implements.  Docs here: 
http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContex
t.html 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 13:41
> To: tomcat-user@jakarta.apache.org
> Subject: Context Class with Tomcat 5.5.7
> 
> 
> I'm developping on Tomcat 5.5.7 and I want to use the 
> Environment Entries with my servers.
> 
>  
> 
> To access those entries, it seems like I need to use the 
> Context class located in the package org.apache.tomcat.core.Context.
> 
>  
> 
> I cannot find this package or the source code for this class. 
> Is there :
> 
>  
> 
> 1.Another way to access the entrie's value; 
> 2.A precompiled package available; 
> 3.Source code available; 
> 
>  
> 
> Thanks !
> 
>  
> 
> Luc Boudreau
> 
> Université du Québec
> 
> Canada
> 
>  
> 
> 



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



RE: [OT] RE: DNS Request distribution and TCP NAT distribution For Tomcat Cluster

2005-05-26 Thread Steve Kirk

> Yup.  So anyone using your ISP's DNS servers will get one of 
> two IPs for
> www.microsoft.com at present, out of the however many they 
> have.  Lumpy
> load balancing in action :-).

Yes true, hadn't thought of it like that.  Where a site has more Ips for a
host than an ISP has DNS servers, this is going to lead to lumpiness.

I guess this is one of the key reasons why RR DNS is only ever a poor man's
load balancer.  OK-ish if you have 2 Ips, gets worse if you have more.

> You likely haven't set up your own caching DNS to forward requests to
> your ISP's DNS servers; otherwise you'd have had one of the same
> answers.

Funnily enough I have, and I use Demon too.  I think my local DNS has maybe
kept an MS entry cached and it's refresh TTL is out of sync with the demon
DNS caches.  But what you say is right - if I restart that local DNS, it
will then get a fresh MS entry from one of the 2 cached at the Demon
servers.  In fact I just have, and it did.

Thanks again, that's clarified a few things I was a bit fuzzy on.

Sorry John for the slight off-topic diversion but I hope this diversion on
RR DNS might have been of interest to you too.



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



RE: Are we required to move to Tomcat 5.5 in order to move to JDK 1.5

2005-05-26 Thread Steve Kirk
Yes sorry, david is correct, I got it backwards.

> -Original Message-
> From: David Smith [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 12:59
> To: Tomcat Users List
> Subject: Re: Are we required to move to Tomcat 5.5 in order 
> to move to JDK 1.5
> 
> 
> Small correction -- 5.5 needs the compat package to work on 
> jdk l.4, not 
> 5.0 needs it to work on jdk 1.5. I've used TC 5.0 & jdk 1.5 
> together no 
> problem.
> 
>  --David
> 
> Steve Kirk wrote:
> 
> >You can run 5.0.28 on jdk1.5 but you need to add a 
> compatibility package
> >which is available from the tc downloads page.  Basically it 
> adds 3 jars to
> >fix issues with xml compatibility with the 1.4 vm.
> >
> >I haven't done it myself (I upgraded both at once) but 
> google some of these
> >words and you can read all about it.
> >
> >PS if you do go to 5.5 and have DBCP, be sure to change your 
> context.xml to
> >the new format required by TC5.5.  I spent nearly 3 days 
> working that out.
> >
> >  
> >
> >>-Original Message-
> >>From: Raverkar, Sachin (Sachin) [mailto:[EMAIL PROTECTED] 
> >>Sent: Thursday 26 May 2005 08:58
> >>To: tomcat-user@jakarta.apache.org
> >>Subject: Are we required to move to Tomcat 5.5 in order to 
> >>move to JDK 1.5
> >>
> >>
> >>Hi all, 
> >> 
> >>We are currently using Tomcat-5.0.28 and JDK 1.4.2_03.
> >>We need to move onto JDK 1.5. We would build our war file 
> >>using JDK 1.5.
> >>Can we continue to use Tomcat-5.0.28 with  JDK 1.5? 
> >>Do you see any problem? Are there any known issues?
> >>Since Tomcat 5.5 is designed to run on J2SE 5.0 [JDK 1.5] and later,
> >>are we required to move to Tomcat 5.5 in order to move to JDK 1.5?
> >> 
> >>- Sachin
> >>
> >>
> >>
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >  
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Are we required to move to Tomcat 5.5 in order to move to JDK 1.5

2005-05-26 Thread Steve Kirk

I was not looking forward to reconfiguring logging, as it'd always been an
area that generated some confusion, but if anything logging is easier on 5.5
than 5.0 IMHO.

I had s configured in 5.0, but these are redundant in 5.5, so I have
no logging config at all now - I just use the java.util.logging classes in
my servlet code (no changes at all since it ran on 5.0), and it works
perfectly for my needs without any config file at all.

> -Original Message-
> From: Tim Diggins [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 10:28
> To: Tomcat Users List
> Subject: Re: Are we required to move to Tomcat 5.5 in order 
> to move to JDK 1.5
> 
> 
> I'm not an expert, but I believe (from experience & previous 
> googling) 
> that tomcat 5.0.x will respond with an exception 
> (IncorrectClassFileFormat or something) when it encounters 
> class files 
> compiled with jdk1.5, and that thus yes you need 5.5.
> 
> There are some recent threads about migrating from 5.0 to 5.5, in 
> particular I recall discussion of change of default logging library.
> 
> -- Tim
> 
> Raverkar, Sachin (Sachin) wrote:
> > Hi all, 
> >  
> > We are currently using Tomcat-5.0.28 and JDK 1.4.2_03.
> > We need to move onto JDK 1.5. We would build our war file 
> using JDK 1.5.
> > Can we continue to use Tomcat-5.0.28 with  JDK 1.5? 
> > Do you see any problem? Are there any known issues?
> > Since Tomcat 5.5 is designed to run on J2SE 5.0 [JDK 1.5] and later,
> > are we required to move to Tomcat 5.5 in order to move to JDK 1.5?
> >  
> > - Sachin
> > 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: JPDA and Tomcat 5.5.9 Service on Windows

2005-05-26 Thread Steve Kirk

I've been running tomcat on windows for 5 years, as a service for 2 years,
and I didn't know that screen existed !!  What a revelation.  :)

> -Original Message-
> From: Philippe Johan [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 08:09
> To: tomcat-user@jakarta.apache.org
> Cc: cam r
> Subject: RE: JPDA and Tomcat 5.5.9 Service on Windows
> 
> 
> Hi cam,
> 
> When running tomcat as a windows service, there is also a 
> configuration
> screen.  If you do not yet have the small icon in the 
> notification area,
> you can use the "Configure Tomcat" option from the Start menu (or
> "tomcat5w.exe //ES//Tomcat5").
> In this screen you can add the parameters on the Java tab 
> (see attached
> image)
> 
> Regards,
> 
> Johan
> 
> -Original Message-
> From: cam r [mailto:[EMAIL PROTECTED] 
> Sent: dinsdag 24 mei 2005 16:04
> To: Tomcat Users List
> Subject: JPDA and Tomcat 5.5.9 Service on Windows
> 
> Hi all,
> 
>   I am trying to set up debugging on Tomcat while it is running as a
> Windows service. The requirements of the project negate me from being
> able to run it as a script.
> 
>   I have tried adding;
> 
>-Xdebug 
> -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
> 
>   to the Java Options in the Java tab of the Apache Tomcat Properties
> gui screen. I have also added;
> 
>jpda start
> 
>   to the Arguments in the Startup tab of the Apache Tomcat Proeprties
> gui screen. But have had no luck getting Tomcat to run.
> 
>  I have also tried setting the arguments for Tomcat through
> environment variablesin;
> 
>My Computer > Properties > Environment Variables > System Variables
> > CATALINA_OPTS
> 
>  but this has not worked either.
> 
>  Has anyone set up debugging for Tomcat 5.5.9 while it is running as a
> service? Any tips would be most welcome.
> 
> 
> cam
> 
> 
> 



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



RE: Are we required to move to Tomcat 5.5 in order to move to JDK 1.5

2005-05-26 Thread Steve Kirk
You can run 5.0.28 on jdk1.5 but you need to add a compatibility package
which is available from the tc downloads page.  Basically it adds 3 jars to
fix issues with xml compatibility with the 1.4 vm.

I haven't done it myself (I upgraded both at once) but google some of these
words and you can read all about it.

PS if you do go to 5.5 and have DBCP, be sure to change your context.xml to
the new format required by TC5.5.  I spent nearly 3 days working that out.

> -Original Message-
> From: Raverkar, Sachin (Sachin) [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 08:58
> To: tomcat-user@jakarta.apache.org
> Subject: Are we required to move to Tomcat 5.5 in order to 
> move to JDK 1.5
> 
> 
> Hi all, 
>  
> We are currently using Tomcat-5.0.28 and JDK 1.4.2_03.
> We need to move onto JDK 1.5. We would build our war file 
> using JDK 1.5.
> Can we continue to use Tomcat-5.0.28 with  JDK 1.5? 
> Do you see any problem? Are there any known issues?
> Since Tomcat 5.5 is designed to run on J2SE 5.0 [JDK 1.5] and later,
> are we required to move to Tomcat 5.5 in order to move to JDK 1.5?
>  
> - Sachin
> 



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



RE: [OT] RE: DNS Request distribution and TCP NAT distribution For Tomcat Cluster

2005-05-26 Thread Steve Kirk

Thanks Peter, interesting.  Your experience of it sounds similar to other
experiences I've had when changing from one ISP to another (there seems to
be a cutover time of up to 3 days where some 3rd party ISPs clearly still
cached and served the old IP for our domain name).  It was because of this
that I investigated more at the time, but as you say, it's each ISP to their
own practice.

> > I would expect any DNS server run by an ISP
> > (such as AOL) to receive the zone records from SOA intact, 
> > i.e. these
> > "major" dns servers should know about all rr Ips for a given 
> > dns name, and
> > would therefore be able to RR distribute them to lower-tier 
> > DNS servers.
> 
> Your expectation is incorrect, I think - even the large DNS 
> servers make
> standard requests for A records for the given FQDN, and cache the
> result.  

Yes you're probably right there now I think about it.  I think these are
referred to as "caching" servers as opposed to "secondary".  It's the
secondaries that receive the zone transfers.

Having said that, I'd have thought that a large ISP such as AOL would have
secondaries, (inaccesible by joe public), but would also have caching
servers, which are the ones they make public.  Since they typically have
several caching DNS servers, in theory there is a good chance that each of
them will get a different one of the RR Ips from their secondary server, so
in theory the RR goal is often achieved?  For example I just used DOS
nslookup to query my ISPs 2 main dns servers for www.microsoft.com - they
each returned a different address, although repeatedly querying each one
returns the same answer every time.  If I go through a local caching DNS on
my LAN, that returns a third address for MS - again, the same one every
time.

> If the result contains a set of IP addresses in a particular
> order, then that's what is obtained.  To my knowledge (my reasoning
> falls down if this is not the case, so this is the bit to check!)
> neither the returned A records themselves nor the returned SOA record
> contain any indication that they should be handed out in a round-robin
> fashion; and the SOA record would not typically be requested 
> by another
> server.

AFAIK that is correct, the DNS protocol does not say anything about how DNS
servers should respond to clients when there are multiple Ips registered in
DNS for a host.  Likewise if the DNS server only returns one IP all the
time, the client protocol provides no way for the client to say "give me the
next one" or "give me number 3" or "give me them all".  So some caching DNS
servers will always return the first one in the list, others will order Ips
according to their own rule (which meets the spec) but then always serve the
first one in that order.  And others will cycle through them in turn (which
is RR).  Basically, it's "internal feature" of the DNS server to decide how
it treats hostnames for which is has more than one IP.  

Of these 3 basic approaches, the first gives no RR, the second is slightly
better, the 3rd is the best.  Of course they are all only rudimentary load
balancing methods, and of course even the 3rd falls down if ISPs with
millions of users happen to cache a single IP for a site, as you say. 

Someone please correct me if any of this is wrong, as I'd like to understand
this area better :)

PS this has rekindled my interest so I just googled to refresh my mind on
the basics, this seems a useful page that explains what we are talking about
above.
http://www.onjava.com/pub/a/onjava/2001/09/26/load.html 



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



RE: Are we required to move to Tomcat 5.5 in order to move to JDK 1.5

2005-05-26 Thread Steve Kirk

> The main problem which could arise is if tomcat 5.0.x uses a 
> java class or 
> method which disappeared on jvm1.5

This would be doc'd in 1.5 release notes, didn't notice anything relevant
when I upgraded: 
http://java.sun.com/j2se/1.5.0/compatibility.html 

Also, why would the TC team release a compatibility package for 5.5 on 1.4
if they thought it wouldn't run anyway?

As delbd says, give it a try.



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



RE: Tomcat/Personal Web Server Problem

2005-05-26 Thread Steve Kirk

Looks like TC cannot start.  If you have fresh installed it, then hazarding
a guess, I'd say it might be because the port might be in use.  You can't
have 2 servers on the same port. Did you have them configured to run on the
same port (8080)?

One thing to check is to open a dos window then type "netstat -a", this will
list all ports in use on your machine.  Give it a while to run, this can
sometimes take up to a minute depending on what's running on your machine.
If 8080 is listed there and tomcat is not started, you know that the old
config of PWS still has the port.  You need to take further steps to
uninstall it.

Or, change the port that either TC or PWS runs on.  Then you can run both at
once if you like.

> -Original Message-
> From: Robin Rembish [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 23:03
> To: tomcat-user@jakarta.apache.org
> Subject: Tomcat/Personal Web Server Problem
> 
> 
> I had both Tomcat 4.1 and Microsoft Personal Web Server 
> installed on my laptop ( an IBM Thinkpad - Windows NT 
> operating system). It had been several months since I used Tomcat. 
> 
> When I started the Tomcat server and typed in localhost:8080 
> in the Internet Explorer address window, it brought me to 
> Personal Web Server rather than bringing up the Tomcat page.
> 
> I then decided to uninstall both Personal Web Server and the 
> Java Web Services Developers Pack. But after reinstalling the 
> latter, I am getting a page not found condition. (Details are below).
> 
> On the advice of someone at a technical forum, I started 
> Tomcat (Start/Programs/Java Web Services Developer Pack 
> 1.1/Start Tomcat)
> 
> and then checked 
> 
> Start/Programs/Administrative Tools/Windows NT Diagnostics/Services
> 
> It had:
> 
> JavaWebServer Stopped
> 
> although the services log file (and all other log files) 
> under jwsdp-1_1 indicated Tomcat was running
> 
> If anyone can help, I'd really appreciate it.
> 
> Robin
> 
> Type in Address Window:
> http://localhost:8080
> 
> Error message:
> 
> Page cannot be displayed
> The page you are looking for is currently unavailable
> 
> 
> In Internet Explorer
> Above Address Window:
> res://C:\WINNT\System32\shdoclc.dll/dnserror.htm#http://localh
> ost:8080/
> 
> 
> 
> 
> 
> 



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



RE: Force Non-SSL

2005-05-26 Thread Steve Kirk

Not dreaming for a second of contradicting Tim ;) but wouldn't this work? 

Switch on SingleSignOn. Install two hosts on the same engine.  First host
has non-ssl connector only, second has ssl only. Install main webapp on
non-ssl host, without the login code.  Install just the login code on a
simplified webapp on the other host, and add a simple invoker servlet (or
similar) to redirect all other requests to urls on the main host.

It's not exactly trivial or elegant, and having to switch on SingleSignOn
might be a problem in some apps, but could it work?

I have been advised by a trusted friend experienced in these matters that
these sorts of config are better tackled by fronting your site with apache,
and using mod_rewrite to enforce the ssl vs no-ssl requirements.

> -Original Message-
> From: August Detlefsen [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 01:43
> To: Tomcat Users List
> Subject: Re: Force Non-SSL
> 
> 
> Is there no way to do it? SSL creates a lot of overhead for a 
> site that
> is serving up 100MB image files. 
> 
> 
> 
> 
> --- Tim Funk <[EMAIL PROTECTED]> wrote:
> > no
> > 
> > -Tim
> > 
> > August Detlefsen wrote:
> > > In my webapp I force clients to use SSL encryption for logins with
> > a
> > > security constraint and transport-guarantee elements like this: 
> > > 
> > > 
> > >   
> > > Login
> > > /login/*
> > >   
> > > 
> > >   
> > > CONFIDENTIAL
> > >   
> > > 
> > > 
> > > However, once a user hits the login page, every subsequent page
> > also
> > > uses https. Is there a way to force them back to regular http once
> > they
> > > leave the login section? 
> > 
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Showing Tomcat Icon rather than DOS icon

2005-05-26 Thread Steve Kirk
Right click, choose properties, click change icon, browse to tc dir, choose
tomcat.exe.

> -Original Message-
> From: Dakota Jack [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 26 May 2005 08:47
> To: Tomcat Users List
> Subject: Showing Tomcat Icon rather than DOS icon
> 
> 
> How can I write my Tomcat startup script to show the Tomcat icon on a
> PC bar rather than the DOS icon?  Thanks
> 
> -- 
> "You can lead a horse to water but you cannot make it float 
> on its back."
> ~Dakota Jack~
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: DNS Request distribution and TCP NAT distribution For Tomcat Cluster

2005-05-25 Thread Steve Kirk
Peter,

I agree that

> DNS is a very lumpy way of doing load balancing. 

But your comments interested me.  Can I ask how sure you felt of what you
say here please: 

> No standard way afaik.  Worse, downstream DNS servers may (often do)
> cache the returned IPs for up to a day despite any cache expiry you put
> on them.  If (say) the AOL DNS servers all get the same IP address in
> their cache, all your AOL visitors will visit the same IP address.

I'm not for a minute suggesting that it is wrong :) and wouldn't dream of
doing so, because I don't know all the facts myself.  I tried to research it
but could not get to the bottom of it with any real info from ISPs (the
problem is that they seem to do their own thing to various extents).  I'm
just interested in comparing experiences/opinions.

I have set up roundrobin DNS for an ecommerce site in the past without any
complaints from users, and the  balance of load between a pair of clustered
servers seemed pretty even.  I would expect any DNS server run by an ISP
(such as AOL) to receive the zone records from SOA intact, i.e. these
"major" dns servers should know about all rr Ips for a given dns name, and
would therefore be able to RR distribute them to lower-tier DNS servers.  I
would have thought that the level at which DNS servers do not pick up the
fact that there is a RR DNS entry is where they do not do a zone transfer
from a primary DNS server - they simply act as a client and cache what they
get as a response, so they are unaware that there even are more than one IP.
I'm speculating that these "minor" DNS servers belong to small ISPs, or
private companies running their own DNS in-house?

So overall I guess I'm saying I'd be surprised if AOL's DNS servers only
cached one entry of a RR set for a DNS name.  What are your thoughts?

> -Original Message-
> From: Peter Crowther [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 17:15
> To: Tomcat Users List; [EMAIL PROTECTED]
> Subject: RE: DNS Request distribution and TCP NAT 
> distribution For Tomcat Cluster
> 
> 
> > From: John MccLain [mailto:[EMAIL PROTECTED] 
> > 1) for DNS Request Distribution - I dont understand. The 
> > browser sends a URL
> > to the DNS, the DNS responds back with an IP address. But 
> > what if at that IP
> > address, you have a web server listening on port 80?
> 
> The browser talks to that Web server.
> 
> > If 
> > Tomcat is at that
> > address also, Tomcat would have to listen on another port. 
> Can the DNS
> > distribute back to the browser the IP Address AND  the Tomcat 
> > port so the
> > browser connects to Tomcat on a non port 80 port?
> 
> Only if your original URL uses the name:port notation - there 
> is nothing
> in this scheme to prevent that.
> 
> > Also, is there a way to
> > setup the DNS to Round Robin or check server load on the 
> > servers in the
> > Tomcat cluster so it knows which Tomcat server ip:port to 
> > send back.
> 
> No standard way afaik.  Worse, downstream DNS servers may (often do)
> cache the returned IPs for up to a day despite any cache 
> expiry you put
> on them.  If (say) the AOL DNS servers all get the same IP address in
> their cache, all your AOL visitors will visit the same IP address.
> 
> DNS is a very lumpy way of doing load balancing.
> 
> > OR does
> > this whole thing imply that you have an IP for each web 
> > server (IIS)
> 
> IP address yes; IIS depends on whether you want IIS or Tomcat at the
> business end of the cluster.
> 
> > and
> > each web server is tied to each server in the Tomcat 
> cluster via a jk2
> > redirector?
> 
> If you wish to use that architecture, yes.
> 
> > 2)TCP NAT distribution - Does this mean that when the browser 
> > connects to
> > the IP address, that that connection is intercepted and the 
> request is
> > distributed to a server in the Tomcat cluster?
> 
> Yes.
> 
> > If this is the case, then
> > what does the interception?
> 
> Generically, a router that has this capability.  It's that router that
> also does the NATing.  Many mid- to high-end hardware routers and some
> software routing packages can do this.
> 
> > and how do you configure that thing to use a
> > specific algorithm (server load, Round Robin, etc..) to 
> > choose which server
> > to forward the request to?
> 
> That is router-specific.  There is no standard (afaik) for the servers
> to return load information, so you're stuck with proprietary solutions
> *or* the router doesn't load-balance.
> 
> > can it forward to an IP:PORT or does it have to
> > forward to an IP
> 
> That is router-specific.  Given that the capability typically 
> exists on
> mid- to high-end routers, most will also have the capability to change
> the internal port that is in use.
> 
>   - Peter
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



-

RE: Performing an action on form-based login

2005-05-25 Thread Steve Kirk

Not maybe of direct help unless you get really stuck, but my approach was to
use TCs sessions, but not its authentication framework.  My original
reasoning for this was that I wanted login details to be in a RDMS table
along with other data.  So I coded the login/logout process myself, which
was a little work to achieve, but gives me freedom to handle the sorts of
things you are talking about in a flexible way.

My way around the problem you describe is that when someone successfully
authenticates, I add their uid to the session object as a String in the
doGet() method:

String uid = request.getParameter("form_uid_field");
request.getSession(true).setAttribute(uid, null);

And because the uid is now accessible via the session object, when your
SessionListener catches the attributeAdded/Changed/Replaced events, they
pass a HttpSessionBindingEvent, from which you can call
.getSession().getAttribute("uid")

> -Original Message-
> From: Ross Nicoll [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 24 May 2005 15:17
> To: Tomcat Users List
> Subject: Re: Performing an action on form-based login
> 
> 
> We're having more or less the same problem. Is there perhaps a chance
> of a UserFormLoginListener in a future version of Tomcat? Anyone have
> any advice on this?
> 
> Some reliable method for logging out a user would also be 
> extremely useful.
> 
> On 5/22/05, Torsten Römer <[EMAIL PROTECTED]> wrote:
> > This question has been asked (and answered to) earlier, but 
> I am still
> > unsure:
> > 
> > I am using container managed security with form-based 
> authentication. I
> > am really happy with how it works. But now I would like to 
> perform an
> > action when a user has authenticated, such as loading user 
> preferences
> > and store them in the session.
> > 
> > First I thought I could use a HttpSessionListener for that. 
> Now I know
> > when a new session has been created, but what I am missing is the
> > username. The only way to get it seems to be from a request using
> > getRemoteUser(). Or am I wrong? I really hope I am...
> > 
> > I read about setting up a filter but then read somewhere 
> else that this
> > is not reliable.
> > 
> > I also found this article "Active Authentication"
> > http://java.sys-con.com/read/37660.htm which sounds 
> interesting but the
> > link to the source code is broken, so I don't get how to 
> implement that.
> > 
> > Can someone help me out?
> > 
> > Torsten
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Validation Frame work

2005-05-25 Thread Steve Kirk
What a good point, especially as IE becomes harder and harder to secure,
people are starting to turn off "active" content, which can include simple
innocent js code.  I'm a fan of the "lowest common denominator" approach to
using HTML and JS features.

> -Original Message-
> From: Bernhard Slominski [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 13:35
> To: 'Tomcat Users List'
> Subject: AW: Validation Frame work
> 
> 
> I agree with Steve, but there is a much simpler possibility 
> that the JS
> validation does not work:
> The user can just switch it off in the browser.
> This might not be just to bypass validation, but maybe just 
> for security
> reasons, so for a business critical apllications I'd 
> discourage anyone from
> using it, if you have something like a guestbook, and the 
> validation fails
> and you end up with something like an entry without email 
> address, so what.
> 
> Bernhard
> 
> > -Ursprüngliche Nachricht-
> > Von: Steve Kirk [mailto:[EMAIL PROTECTED]
> > Gesendet: Dienstag, 24. Mai 2005 20:02
> > An: 'Tomcat Users List'
> > Betreff: RE: Validation Frame work
> > 
> > 
> > David is right, JS and serverside validation perform 
> > different roles.  To
> > expand on his comment a bit more, remember that the 
> requests that your
> > webapp receives could be sent by any HTTP client, not 
> necessarily by a
> > friendly web browser.  If someone were so inclined, they 
> > could write their
> > own HTTP client to interact with your webapp, that aimed to 
> > deliberately
> > submit bad data to your servlet, in which case your JS 
> > validation would have
> > been bypassed.  What they can't do is bypass your serverside 
> > validation (or
> > at least this is much harder).
> > 
> > Just one trick that such nasty people might try is to insert 
> > JS code in any
> > form fields that you let them create or edit.  If this field 
> > data is then
> > "displayed" in other pages of your app, this might cause 
> > anyone viewing that
> > page on your site to download a trojan/virus/etc.  It's 
> > really very easy to
> > do.  And this is only one such exploit.  There are many others.
> > 
> > > -Original Message-
> > > From: David Smith [mailto:[EMAIL PROTECTED] 
> > > Sent: Tuesday 24 May 2005 16:19
> > > To: Tomcat Users List
> > > Subject: Re: Validation Frame work
> > > 
> > > 
> > > Because you should never trust the client. They may not be 
> > submitting 
> > > from your form.  Javascript is just a nicety to save the 
> > user a whole 
> > > request/response cycle just to find out a field is missing 
> > or wrong. 
> > > Consider it a security issue.
> > > 
> > > -- David
> > > 
> > > raja buddha wrote:
> > > 
> > > > Hi all
> > > > In struts why do we need validation frame work  we have 
> > java script
> > > > to do validations. Is there any extra advantage of using 
> > > the validation
> > > > frame work
> > > >
> > > > raj
> > > >
> > > > 
> _
> > > > On the road to retirement? Check out MSN Life Events for 
> > > advice on how 
> > > > to get there! 
> > http://lifeevents.msn.com/category.aspx?cid=Retirement
> > > >
> > > >
> > > > 
> > > 
> > 
> -
> > > > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > > > For additional commands, e-mail: 
> > [EMAIL PROTECTED]
> > > >
> > > 
> > > 
> > > 
> > 
> -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > > 
> > > 
> > 
> > 
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: How to create user thread in tomcat

2005-05-25 Thread Steve Kirk

Write your thread class (myThreadClass) as implementing Runnable.  

Write a class that implements ServletContextListener and config it in
web.xml like this:


mypackage.MyScListenerClass


Now have your ServletContextListener start a new thread using your Runnable
class in its contextInitialized method, which is called when the app starts.

You might want to consider what happens if/when the run() method of your
myThreadClass returns.  Do you want to restart the thread again or not?  If
yes, you might need to put it in a while loop within run() - if this is of
the type while(true) until it throws an exception, make sure that you catch
the Exception gracefully, and also include code like this in the innermost
part of the loop so that it is well-behaved about sharing resources with
other threads on the machine:

   Thread.currentThread().sleep(1000 * delayMilliseconds);

You might also think about what needs to be done to gracefully exit from the
thread when TC shuts down.  This will influence whether you make the thread
daemon or not, and whether you need inter-thread communication so that your
main webapp can tell your non-daemon thread to exit gracefully ASAP.

Have used this approach before, and am about to use same approach again on
another project.  It works.  You *do* need to take care about being
threadsafe.  If you don't understand how to do that, then you need to read
up on it - it's beyond the scope of a single email.

You can find more detail on all the stuff above in the javadocs, or reply to
the list if you have any specific Qs and I'll try to pick it up.

> -Original Message-
> From: Terence Chan [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 11:24
> To: 'Tomcat Users List'
> Subject: How to create user thread in tomcat
> 
> 
> Hi,
> 
> Please help. I would like to create a thread or service that 
> start running
> once the web server is started. This thread need to 
> communicate with other
> applications using HTTP protocol.
> 
> Terence  
> 
> -- 
> Internal Virus Database is out-of-date.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
>  
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Problem with Tomcat 5.5.9

2005-05-25 Thread Steve Kirk

Have you moved your config files across?
 conf/web.xml
 conf/server.xml
 conf/tomcat-users.xml
 conf/[engineName]/[hostName]/contextName.xml

Do you have the welcome files configured in web.xml (either in conf/ or in
the webapp's WEB-INF folder) ?  What do they point to for /test/?  If a
servlet, are the servlet and its mapping both config'd in web.xml?  If a
JSP, is the jsp servlet and mapping config's in web.xml?

Put a  and  in your server.xml's  tag and see if you
get any more clues from the extra logging.  Se my earlier posts today and
yesterday for details on those.

Hope this helps.

> -Original Message-
> From: Aleksandar Valchev [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 13:19
> To: tomcat-user@jakarta.apache.org
> Subject: Problem with Tomcat 5.5.9
> 
> 
> Hi,
> please advise possible reason for:
> We have a java web application running under Tomcat 5.0.19 
> without problems.  
> After upgrade to Tomcat 5.5.9 we encountered the following:
>   When requesting "http://localhost:8080/test/";(where 
> "test" is our webapp 
> context) an empty page with the following content is returned:
> 
>   All .jsp files are compiled correctly in the work 
> directory but the result is 
> always as written above.
>   When testing with a .html file everything is OK. When 
> testing with a .jsp 
> file with no jsp code in it - blank page again.
>   The Tomcat logs do not indicate any problems during 
> startup or loading of the 
> webapp. We tried to put something in the standard 
> output(System.out) but 
> nothing was written. It seems that the generated servlets are 
> created but not 
> executed at all.
> 
> Thank you in advance,
> Alexander
> 
> P.S.
> System parameters:
>   OS - Slackware Linux, Windows XP
>   Browser - Mozilla Firefox 1.0.4, Mozilla 1.7.6, IE 6.0
>   JDK - 1.5.0
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: log files with servlets ?

2005-05-25 Thread Steve Kirk

For how to set up logging of your Java servlet code on 5.0.28, you need to
add a  to your conf/server.xml file, inserting it inside your
... or ... tags will probably get you going.

To get apache-httpd type logging going, you need a , again insert it
within your Engine or Host tags, looks a bit like this:

  

Do you have doPost method() implemented in your servlet class?  If you only
have doGet(), that is most likely your problem.

> -Original Message-
> From: Jean-Luc Douville [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 09:53
> To: tomcat-user@jakarta.apache.org
> Subject: log files with servlets ?
> 
> 
> I am testing MIDlets connection to servlet. I am using Netbeans 4.1 
> with mobility pack,
> Tomcat bundled with NB (5.5.7) or external Tomcat (5.028). I 
> have added 
> an EchoServlet
> under TomcatServletExample (Servlet v 2.3). My EchoServlet 
> can respond 
> to POST and GET methods.
> It is OK when i send parameters from a browser with GET method.
> With POST method from a MIDlet, i cannot reach the servlet (the 
> HttpConnexion seems no
> connect ...)
> My first question : how can i find or trace log events which 
> relate to 
> that servlet or tomcat ?
> I want to trace the access of my MIDlet to tomcat and to the 
> servlet... 
> but i don't find any log file
> about, except the 
> TOMCAT_HOME/logs/TomcatServletExample.2005-05-xx.log  
> (which describes
> the starting of the servlet).
> Can i find or initiate any log file similar to the 
> .../httpd/access_log 
> of my apache web site ?
> Thanks.
> --
> 
> Jean-Luc Douville
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Mysterious failures

2005-05-25 Thread Steve Kirk
Sorry but I don't use apache-httpd so can't help you there, although would
comment that if you have mod_jk compilation warnings they sound worth
looking at.  My only experience of httpd with tc gave me the impression that
it was unreliable.  Although to be fair that was a few versions back, on
windoze.

Do you have a logger configured in tc at all?  For example on my 5.0.28 I
had this within the ... tag of in my webapp's context.xml



See http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/logger.html for
more details for 5.0

Your alternative to  is to move to commons-logging and/or log4j,
which is what I am about to do myself.

> -Original Message-
> From: Grant Ingersoll [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 25 May 2005 02:29
> To: Tomcat Users List
> Subject: Re: Mysterious failures
> 
> 
> Thanks for the ideas.  I cranked my debugging up to 99.
> 
> There are a couple of things that I see, but don't know if they are 
> serious:
> 1. SEVERE: The scratchDir you specified: 
> /development/jakarta-tomcat-5.0.28/work/Catalina/localhost/admin is 
> unusable.
>   -- I never set this, I am assuming it is the default
> 
> 2. WARNING: Duplicate name in Manifest: Class-Path
>  -- I think this is due to some JAR in struts
> 
> 3. In the apache log I get warnings about compiling mod_jk 
> with EAPI on
> 
> I am mapping through mod_jk, so the error I get is the Apache 
> Internal 
> Server Error.  The Tomcat process is dead, so there is no 
> tomcat error 
> page.
> 
> I am using struts, I will am pretty sure I am returning everything to 
> the pool.  I have a top level servlet filter that logs all 
> exceptions, 
> including Throwable all to no avail.
> 
> It seems to crash at random, but mostly b/c I am not always aware of 
> when it crashes.  Today, after rebooting, it didn't even 
> start up, but 
> then started fine when I called startup.sh
> 
> -Grant
> 
> On May 22, 2005, at 9:51 PM, Steve Kirk wrote:
> 
> >
> > What is your actual logging config?
> >
> > Hazy memory, but don't you want debug=99 rather than debug=1 to get 
> > more
> > detail?
> >
> > If you really can't get logging to work, you could insert
> > System.out.println("blah") statements at key points around 
> where you 
> > think
> > the crash might be caused, in lieu of your log statements.  
> Not pretty 
> > but
> > it can get you results.
> >
> > Some Qs to narrow it down a bit:
> >
> > Is the crash triggered by a single type of request, or 
> maybe a burst of
> > traffic, or will it crash even with no requests?
> >
> > Is the crashing request direct to TC or via apache httpd?
> >
> > Is a TC html error page generated, what does it say?
> >
> > Do you start any of your own threads?
> >
> > Does your code always return pooled objects to the pool?
> >
> >> Is there some app that people use to make sure the server 
> stays up by
> >> checking it every so often and restarting if needed?
> >
> > I've never come across that.  TC is pretty reliable, 
> shouldn't need it 
> > IMHE.
> >
> >> -Original Message-
> >> From: Grant Ingersoll [mailto:[EMAIL PROTECTED]
> >> Sent: Monday 23 May 2005 02:39
> >> To: tomcat-user@jakarta.apache.org
> >> Subject: Mysterious failures
> >>
> >>
> >> Hi,
> >>
> >> Have been a long time user of TC, but first time poster.
> >>
> >> I am running 5.0.28 on OS X with PostgreSQL and Struts and 
> connecting
> >> to Apache using mod_jk.  I have a webapp deployed that is pretty
> >> mature.  However, I am having some mysterious crashes of 
> Tomcat that I
> >> haven't been able to get my head around.  The whole 
> process is dying
> >> w/o so much as a peep.  Not one single log/exception is 
> being written
> >> anywhere (as far as I know) that gives even the most 
> remote clue as to
> >> why and I am at a loss for how to get at the problem.
> >>
> >> Here is what I have done to date:
> >> 1. Put a catch (Throwable) with a log message at my top 
> level part of
> >> the servlet that logs the exception and then throws it out.
> >>
> >> 2. I have turned on DEBUG level logging for every piece of
> >> the application
> >>
> >> 3. I have set debug="1" everywhere I could in server.xml
> >>
> >> Anyone have any suggestions on what else to do for de

RE: redeploy of webapp loses GlobalNamingResource DataSource

2005-05-24 Thread Steve Kirk
>From the look of the stacktrace, which mentions
"org.postgresql.Driver.parseURL" as the point where the initial exception
was thrown, maybe the URL attribute in your 's  or
 might either contain a wrong value or a typo.  This might
be leading to a parsing exception, even though the trace doesn't say so
explicitly.

My experience is that the exceptions in these cases do not always give you a
very precise clue as to the problem.  For example, very recently on 5.5.9, I
was getting a similar problem to you, where just because I had a leading
space in the url attribute value, the whole DBCP resource was rejected, with
the exception messages "Cannot create JDBC driver of class '' for connect
URL 'null'" caused by "no suitable driver".

Check that config *extremely* carefully

> -Original Message-
> From: bob_b [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 24 May 2005 22:28
> To: tomcat-user@jakarta.apache.org
> Subject: redeploy of webapp loses GlobalNamingResource DataSource
> 
> 
> I have a globally named db pool resource that I use across multiple
> contexts to access a particular database. When I redeploy a webapp in
> Tomcat 5.0.28, I am losing the DataSource and getting a pooled
> connection fails with the following (truncated) message:
> 
> 
> org.apache.commons.dbcp
> .SQLNestedException: Cannot create JDBC driver
> of class '' for connect URL 'null'
> =09at 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou=
> rce.java:780)
> =09at 
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource=
> .java:540)
> .
> 
> Caused by: java.lang.NullPointerException
> =09at org.postgresql.Driver.parseURL(Driver.java:269)
> =09at org.postgresql.Driver.acceptsURL(Driver.java:177)
> =09at java.sql.DriverManager.getDriver(DriverManager.java:232)
> =09at 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou=
> rce.java:773)
> =09... 44 more..
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Minimal server

2005-05-24 Thread Steve Kirk

Thanks Will - I had not heard of embedded TC before.  Interesting, and a
nice piece of innovation too.

Hence why I misunderstood the thread earlier (sorry).

This could be very useful.  If I've understood correctly, I can somehow
bundle together my existing TC webapp along with the tc-embedded code,
compile a jar that contains them both, and distribute that as a complete
"system", and when the user double-clicks, it runs a very lightweight
version of tc, running my webapp only, in the user's browser?  If so that
will be a great way to distribute a TC webapp for testing, because as long
as you don't have too many testers, this saves having to set up a separate
test server.

> -Original Message-
> From: Will Hartung [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 24 May 2005 17:38
> To: Tomcat Users List
> Subject: Re: Minimal server
> 
> 
> > From: "Steve Kirk" <[EMAIL PROTECTED]>
> > Sent: Tuesday, May 24, 2005 5:02 AM
> 
> > I don't see how you will do that without installing some 
> kind of dynamic
> > webserver on each PC, whether that be apache-hpptd, tomcat, 
> or other, plus
> > the web application (which needn't be servlets, it could be 
> perl based).
> And
> > if you are going to do that, what's wrong with installing tomcat?
> 
> If the goal is to write an, essentially, stand alone 
> application that just
> happens to be browser based, then you don't want to "install 
> tomcat" per se,
> rather you just want to have an HTTP based core around which 
> you can wrap
> your application. Its not designed to be a general purpose
> application/webserver, rather a very application specific server.
> 
> It also allow the application to be distrubted as either a 
> simple, complete
> Jar file, or perhaps wrapped in a .exe. When the user clicks 
> on the icon,
> the application launches a browser to the applications "home page".
> 
> Now, if he just wants to distribute a WAR, as a central 
> service for several
> users, then, yes, its easier to have the client simply 
> install tomcat (or
> bundle it in their installer), and deploy the war. But for a 
> client side,
> browser based application, embedding can very quite viable.
> 
> Regards,
> 
> Will Hartung
> ([EMAIL PROTECTED])
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Validation Frame work

2005-05-24 Thread Steve Kirk
David is right, JS and serverside validation perform different roles.  To
expand on his comment a bit more, remember that the requests that your
webapp receives could be sent by any HTTP client, not necessarily by a
friendly web browser.  If someone were so inclined, they could write their
own HTTP client to interact with your webapp, that aimed to deliberately
submit bad data to your servlet, in which case your JS validation would have
been bypassed.  What they can't do is bypass your serverside validation (or
at least this is much harder).

Just one trick that such nasty people might try is to insert JS code in any
form fields that you let them create or edit.  If this field data is then
"displayed" in other pages of your app, this might cause anyone viewing that
page on your site to download a trojan/virus/etc.  It's really very easy to
do.  And this is only one such exploit.  There are many others.

> -Original Message-
> From: David Smith [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 24 May 2005 16:19
> To: Tomcat Users List
> Subject: Re: Validation Frame work
> 
> 
> Because you should never trust the client. They may not be submitting 
> from your form.  Javascript is just a nicety to save the user a whole 
> request/response cycle just to find out a field is missing or wrong. 
> Consider it a security issue.
> 
> -- David
> 
> raja buddha wrote:
> 
> > Hi all
> > In struts why do we need validation frame work  we have java script
> > to do validations. Is there any extra advantage of using 
> the validation
> > frame work
> >
> > raj
> >
> > _
> > On the road to retirement? Check out MSN Life Events for 
> advice on how 
> > to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
> >
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Compiling JSP files

2005-05-24 Thread Steve Kirk
Is there a reason why you can't let TC compile the JSP on demand and read
the log output?  Works for me.

Failing that, I suspect your cmd-line classpath has some errors.

What does echo %classpath% produce?

And are you sure these are right in your classpath (from your previous post
below):

C:\tomcat\work\Catalina\Site1\_
C:\tomcat\common\lib\servlet

Not sure what the first one is, and the second should read "servlet-api.jar"
not "servlet".

You also need to add C:\tomcat\common\lib\jsp-api.jar to the classpath too
if you haven't already.

Also you should have all classes in the classpath that your class itself
imports - either explicitly include the full path to each class separately
(drop the ".class" extension), or a folder containing the class hierarchy in
folders, or the full path to one or more jars that include the classes.

> -Original Message-
> From: Charles P. Killmer [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 24 May 2005 16:39
> To: Tomcat Users List
> Subject: RE: Compiling JSP files
> 
> 
> I just need a way to quickly determine why this script times 
> out without compiling.  I have two scripts that create an 
> admin interface to two different tables.  The only difference 
> in the files is the underlying table structure.  One works.  
> Even if I delete the _jsp.java and class files before making 
> the request.  The other does not.  
> 
> Any ideas on how to resolve this issue would be appreciated.
> Charles
> 
> -Original Message-
> From: Bernhard Slominski [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, May 24, 2005 9:47 AM
> To: 'Tomcat Users List'
> Subject: AW: Compiling JSP files
> 
> Hi Charles,
> 
> what you can do is to use an ant task for do the precompilation.
> This is a bit smarter than via the command line I guess.
> The docu is under
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jasper-howto.h
> tml#Web%20Appl
> ication%20Compilation
> It's not very well documented, it took me a while to finally 
> get it working, but it's working fine for me now.
> So if you want to give it a try, I can give you some further 
> assistance, if needed.
> 
> Cheers 
> 
> Bernhard
> 
> > -Ursprüngliche Nachricht-
> > Von: Charles P. Killmer [mailto:[EMAIL PROTECTED]
> > Gesendet: Dienstag, 24. Mai 2005 15:47
> > An: Tomcat Users List
> > Betreff: Compiling JSP files
> > 
> > 
> > I am having a problem where one of my jsp files won't 
> compile.  Tomcat 
> > successfully creates the java file but it never creates the 
> class file 
> > and hence never responds to the request for the page.
> >  
> > I am looking for what needs to be in the command line in order to 
> > manually compile the java file the gets created in order to 
> look for 
> > errors in that process.
> >  
> > This is what I have so far but I am getting errors.
> > c:\jdk1.5.0\bin\javac -classpath
> > %CLASSPATH%;C:\tomcat\work\Catalina\Site1\_;C:\tomcat\common\l
> > ib\servlet
> > .jar test_jsp.java
> >  
> >  
> > Errors:
> > test_jsp.java:5: package javax.servlet.jsp does not exist import 
> > javax.servlet.jsp.*; ^
> > test_jsp.java:8: package org.apache.jasper.runtime does not exist 
> > public final class test_jsp extends 
> > org.apache.jasper.runtime.HttpJspBase
> >  ^
> > test_jsp.java:9: package org.apache.jasper.runtime does not exist
> > implements org.apache.jasper.runtime.JspSourceDependent {
> > ^
> >  
> >  
> > Thanks
> > Charles
> > 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Minimal server

2005-05-24 Thread Steve Kirk
OK glad someone else said that because I don't get this either but didn't
reply because I assumed I must have misunderstood.  Dola, apologies in
advance if I have got the wrong end of the stick, but are you saying that
you want to install an app on many PCs, and the app does not need to
interact with a separate server machine, and you plan to just require that
they have JRE and a browser installed?

I don't see how you will do that without installing some kind of dynamic
webserver on each PC, whether that be apache-hpptd, tomcat, or other, plus
the web application (which needn't be servlets, it could be perl based). And
if you are going to do that, what's wrong with installing tomcat?

Tomcat meets your needs - the user can just click on a desktop shortcut
which points to the http url of the home page of the app and voila, the app
starts.

> -Original Message-
> From: Peter Crowther [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 24 May 2005 09:23
> To: Tomcat Users List
> Subject: RE: Minimal server
> 
> 
> > From: Dola Woolfe [mailto:[EMAIL PROTECTED] 
> > What I'm primarily thinking about is what the user
> > would need to have/install in order to use the
> > program. And I want the user to simply click on a file
> > and for the program to just run (provided the jre is
> > installed).
> 
> Tomcat is capable of running without any formal installation, although
> you'd have to be careful about where it put its working files 
> and how it
> unpacked WARs if you were distributing packed webapps.  There 
> have been
> a couple of threads about getting the whole thing to run off a CD
> without touching the host machine's filestore at all; I think 
> that would
> be difficult to achieve as Tomcat, at least, needs to be able to write
> to temp filestore.
> 
> I disagree slightly with your characterisation of the 
> approach.  I agree
> with you that a browser is often the simplest way to *display* a GUI;
> however, one needs to provide code behind that browser-based GUI, and
> I'm not aware of anything that really solves the problem of deploying
> that code to the messy universe of many users' computers 
> rather than to
> the tidy universe of central Web servers.
> 
>   - Peter
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: confused about simple logging

2005-05-23 Thread Steve Kirk
Sorry can't help you there.  I was where you are now a year or more ago,
"fancy logging frameworks - too much hassle to learn for the simple logs
that I want".  But I soon realised that it was more work, and quite a bit
more ugly, trying to do your own thing.  I'd say bite the bullet and embrace
the latest release and logging framework.  There have been a few different
ones over recent versions, but the TC dev team are converging them nicely
now.  It might seem a little over engineered for simple logging requirements
at first, but once you spend the time to make it work, you will get what you
want, and come to realise that the advanced features are really useful for
debugging in situations exactly like yours.

I'm using commons-logging very successfully, is very flexible and not hard
to learn.

If you really reach your wits end making logging work and just want a blunt
instrument to detect one-off if your overloaded method is called, when not
do something else to signal its presence, such as add a line to it which
creates a file called "ive.been.called" in a certain directory.  Gets you
past having to fix your log/stream problem.  You won't find this logging
framework in the TC docs though ;)

> -Original Message-
> From: Jim Henderson [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 19:58
> To: Tomcat Users List
> Subject: RE: confused about simple logging
> 
> 
> Well I am having lots of self doubt.
> 
> I am trying to install my own overloaded JDBCRealm,  I have 
> been getting
> some Sybase jdescripter error.  (My backend DB has an old 
> means of encoding
> passwords so I overloaded the getPassword method.)  I don't 
> know if my code
> is getting called or is it not.  I have System.out trace 
> statements in
> the constructor after the call to the super ctor as well as 
> the getPassword
> method.   And, I see none of my trace in any of the Tomcat log files.
> 
> This is frustrating after 3 days.
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 23, 2005 1:46 PM
> To: 'Tomcat Users List'
> Subject: RE: confused about simple logging
> 
> 
> 
> Not sure, ut I think all the output streams are diverted to 
> that file.  It's
> probably configurable.  Don't know full detail to be honest.  
> Best wasy is
> try it and see.
> 
> > -Original Message-
> > From: Jim Henderson [mailto:[EMAIL PROTECTED]
> > Sent: Monday 23 May 2005 19:02
> > To: Tomcat Users List
> > Subject: RE: confused about simple logging
> >
> >
> >
> > If I write to stdout where does that go?
> >
> > System.stdout.println("Where does this get printed to?");
> >
> > I assume C:/tomcat.../log/stdout?
> >
> > -Original Message-
> > From: Steve Kirk [mailto:[EMAIL PROTECTED]
> > Sent: Monday, May 23, 2005 12:28 PM
> > To: 'Tomcat Users List'
> > Subject: RE: confused about simple logging
> >
> >
> >
> > Your confusion possibly arises because there are at least 2
> > types of logger
> > that you might mean, and 3 main choices for one of those at
> > the moment,
> > although one of those 3 is deprecated and a second is
> > probably becoming less
> > popular.
> >
> > OK I'll take a quick stab and see if this gets you anywhere
> > in the right
> > direction.
> >
> > You mention two distinct types of logging.  The 1st is the
> > "hit" logging
> > which is very similar to what you would get from apache
> > httpd.  This simply
> > logs each incoming request.  This is achieved by adding a
> >  to your
> > %catalina_home%\conf\server.xml - you can embed it inside the
> > ,
> >  or  tags, but for your
> > purposes, just
> > shove it in the engine for now.  It looks a bit like this:
> >
> > 
> >  > className="org.apache.catalina.valves.FastCommonAccessLogValve"
> > directory="logs"  prefix="ao_access_log_" suffix=".log"
> > pattern="common" resolveHosts="false"/>
> > 
> >
> > You can tweak the path, filename, and the pattern that
> > defines each line -
> > see
> > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
> > for details.  Leave resolveHosts set "false" to speed up 
> performance.
> >
> > Not that my example above is from my own 5.5.9 server - ISTR
> > 5.0 config
> > syntax is different - check the doc link above for the detail.
> >
> > The 2nd part of your

RE: confused about simple logging

2005-05-23 Thread Steve Kirk

Not sure, ut I think all the output streams are diverted to that file.  It's
probably configurable.  Don't know full detail to be honest.  Best wasy is
try it and see.

> -Original Message-
> From: Jim Henderson [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 19:02
> To: Tomcat Users List
> Subject: RE: confused about simple logging
> 
> 
> 
> If I write to stdout where does that go?
> 
> System.stdout.println("Where does this get printed to?");
> 
> I assume C:/tomcat.../log/stdout?
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 23, 2005 12:28 PM
> To: 'Tomcat Users List'
> Subject: RE: confused about simple logging
> 
> 
> 
> Your confusion possibly arises because there are at least 2 
> types of logger
> that you might mean, and 3 main choices for one of those at 
> the moment,
> although one of those 3 is deprecated and a second is 
> probably becoming less
> popular.
> 
> OK I'll take a quick stab and see if this gets you anywhere 
> in the right
> direction.
> 
> You mention two distinct types of logging.  The 1st is the 
> "hit" logging
> which is very similar to what you would get from apache 
> httpd.  This simply
> logs each incoming request.  This is achieved by adding a 
>  to your
> %catalina_home%\conf\server.xml - you can embed it inside the 
> ,
>  or  tags, but for your 
> purposes, just
> shove it in the engine for now.  It looks a bit like this:
> 
> 
>className="org.apache.catalina.valves.FastCommonAccessLogValve"
>   directory="logs"  prefix="ao_access_log_" suffix=".log"
>   pattern="common" resolveHosts="false"/>
> 
> 
> You can tweak the path, filename, and the pattern that 
> defines each line -
> see
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
> for details.  Leave resolveHosts set "false" to speed up performance.
> 
> Not that my example above is from my own 5.5.9 server - ISTR 
> 5.0 config
> syntax is different - check the doc link above for the detail.
> 
> The 2nd part of your logging is where you write your own messages to a
> logfile.  I did that as follows:
> 
> java.util.logging.Logger logger =
> java.util.logging.Logger.getLogger("logname");
> logger.setLevel(logLevel);
> fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
> fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
> logger.addHandler(fh);
> 
> Then to write a log message you can just do this:
> 
>   log("Write this to the log");
> 
> and it will write the log file to logFilePath
> 
> See the java.util.logging.Logger javadocs for more details.
> 
> This is very basic.  Much more spophistication can be achieved through
> config files.
> 
> > -Original Message-
> > From: Lane [mailto:[EMAIL PROTECTED]
> > Sent: Monday 23 May 2005 18:01
> > To: Tomcat Users List
> > Subject: confused about simple logging
> >
> >
> > Hello.
> >
> > I'm a bit confused about simple logging on tomcat 5.0.  I've
> > read much of the
> > FAQ at
> > http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that
> > doesn't seem to address what I'm looking for, which is just
> > routine mundane
> > daily activity.
> >
> > For instance, if I create and deploy a simple "Hello World"
> > application that
> > contains only index.jsp, no servlets, no external classes 
> and no JNDI
> > resources, where on earth will a "hit" be recorded when I 
> navigate to
> > http://localhost/helloworld/index.jsp ?  And where is the
> > error recorded if I
> > mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> >
> > Do I have to build such logging into the application?  Or
> > does Catalina handle
> > that for me?  And if so ... where on earth?
> >
> > I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> >
> > I see log information in 
> /usr/local/jakarta-tomcat5.0/logs/stderr.log
> > and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing
> > that records a
> > "page hit."
> >
> > Thanks,
> >
> > lane
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: confused about simple logging

2005-05-23 Thread Steve Kirk

Your confusion possibly arises because there are at least 2 types of logger
that you might mean, and 3 main choices for one of those at the moment,
although one of those 3 is deprecated and a second is probably becoming less
popular.

OK I'll take a quick stab and see if this gets you anywhere in the right
direction.

You mention two distinct types of logging.  The 1st is the "hit" logging
which is very similar to what you would get from apache httpd.  This simply
logs each incoming request.  This is achieved by adding a  to your
%catalina_home%\conf\server.xml - you can embed it inside the ,
 or  tags, but for your purposes, just
shove it in the engine for now.  It looks a bit like this:





You can tweak the path, filename, and the pattern that defines each line -
see 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html 
for details.  Leave resolveHosts set "false" to speed up performance.

Not that my example above is from my own 5.5.9 server - ISTR 5.0 config
syntax is different - check the doc link above for the detail.

The 2nd part of your logging is where you write your own messages to a
logfile.  I did that as follows: 

java.util.logging.Logger logger =
java.util.logging.Logger.getLogger("logname");
logger.setLevel(logLevel);
fh = new FileHandler(logFilePath, maxLogFileSize, logFileCount, true);
fh.setFormatter(new AoLogFormatter(logFileDateTimePattern));
logger.addHandler(fh);

Then to write a log message you can just do this: 

log("Write this to the log");

and it will write the log file to logFilePath

See the java.util.logging.Logger javadocs for more details.

This is very basic.  Much more spophistication can be achieved through
config files.

> -Original Message-
> From: Lane [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 18:01
> To: Tomcat Users List
> Subject: confused about simple logging
> 
> 
> Hello.
> 
> I'm a bit confused about simple logging on tomcat 5.0.  I've 
> read much of the 
> FAQ at 
> http://jakarta.apache.org/tomcat/faq/logging.html#builtIn but that 
> doesn't seem to address what I'm looking for, which is just 
> routine mundane 
> daily activity.
> 
> For instance, if I create and deploy a simple "Hello World" 
> application that 
> contains only index.jsp, no servlets, no external classes and no JNDI 
> resources, where on earth will a "hit" be recorded when I navigate to 
> http://localhost/helloworld/index.jsp ?  And where is the 
> error recorded if I 
> mistype and navigate to http://localhost/helloworld/jndex.JSP ?
> 
> Do I have to build such logging into the application?  Or 
> does Catalina handle 
> that for me?  And if so ... where on earth?
> 
> I'm using FreeBSD installed at /usr/local/jakarta-tomcat5.0
> 
> I see log information in /usr/local/jakarta-tomcat5.0/logs/stderr.log 
> and /usr/local/jakarta-tomcat5.0/logs/stdout.log but nothing 
> that records a 
> "page hit."
> 
> Thanks,
> 
> lane
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: DBCP

2005-05-23 Thread Steve Kirk

DBCP has some config params in the context.xml that will clean up for you if
you don't return resources to the pool.  It will also test connections for
you to make sure they're alive, and close/replace them if not.  To config
these features, set the params in your 's DBCP  tag, for
example:



The attributes in question are those from removeAbandoned down.

However it is not advised to rely on this as a means of managing your pool -
this is your safety net.  It's far better to return connections to the pool
yourself in the first place.  A proper try/catch/finally structure is the
way to go, there are numerous examples on the web.

You don't mention your TC version but a good starting poing in the docs for
the latest version (5.5.x) are here: 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-how
to.html 

Read the whole page, and for a decent try/catch/finally code example, focus
on the code in the section "Random Connection Closed Exceptions".

> -Original Message-
> From: Charles P. Killmer [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 17:43
> To: Tomcat Users List
> Subject: DBCP
> 
> 
> Supposing I forgot to close a database connection.  And the script was
> requested numerous times.  And now my scripts can not get any database
> connections.  Is there a way to close those connections without
> restarting Tomcat?
>  
> Charles
> 



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



RE: Tomcat For SSL

2005-05-23 Thread Steve Kirk

Get ready for differing opinions on this, it's been asked loads of times
before, try searching the archives for more info.  My very quick summary
would be that you do not need apache httpd to do SSL, and it can be very
fast and stable without apache, as well as simpler to config if you don't
already know apache, but there are good reasons to introduce apache.

depending on the exact requirements of your site, there are some useful
feature benefits from using apache+tomcat, and when the site gets heavily
loaded, apache+tc performs better than tc alone, if you let apache handle
the static page requests.  A friend of mine advises me that he uses
apache+tc for these reasons: 

- server side includes which is easier for most people to use to do minor
dynamic content in otherwise static pages

- mod_rewrite can help with redirection between http <-> https if you have
pages that can only be accessed through one or other protocol

- can config reverse proxy content off another server

I do not run apache with my TC because I do not require any of these
features; however I am not against using it for the right app.

> -Original Message-
> From: Scott Purcell [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 14:39
> To: tomcat-user@jakarta.apache.org
> Subject: Tomcat For SSL
> 
> 
> Hello,
> 
> I have a webapp that is running on Tomcat 5.5. I have always 
> developed just using Tomcat. Now I want to take a site, and 
> host it. The site will also run certificates for SSL. Should 
> I wrap my site around Apache now. Meaning should I install 
> apache and put tomcat inside? Or however this is done. Or can 
> tomcat handle SSL certificates (from Verisign?) as it is. I 
> hear of security issues, etc.
> 
> Any information would be appreciated.
> 
> Thanks,
> Scott
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: problem: Session invalidation in the servlet accessed via foreign context

2005-05-23 Thread Steve Kirk

OK no problem, I'm learning something here too :)

I agree, one app cannot access a session created by another app (unless you
set singlesignon, which we'll ignore for now).

I am referring just to the single line I quoted earlier, from SRV.7.3 of 2.4
spec.  I'm reading that as saying that if app A creates session X for user
U, then the user U then accesses app B, which then includes a servlet from
app A via its RequestDispatcher as you have done in your example, context A
will not have access to the session in the second request, even though it
created it, because it was routed through app B, which is not allowed to
access it.

I might have misinterpreted this, because I have no actual experience of it.
I can see that it might be possible that the session is invisible to B but
not A.  If so I'm more than happy to be told I'm wrong by someone who
knows?

> -Original Message-
> From: Akoulov, Alexandre [IT] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 10:46
> To: Tomcat Users List
> Subject: RE: problem: Session invalidation in the servlet 
> accessed via foreign context 
> 
> 
> Thanks, Steve, again.
> 
> >That's what I'm
> >reading the servlet 2.4 spec as saying, because you can't 
> invalidate a
> >session in one context that is not accessible to you in 
> another context,
> >irrespective of whether you use getRequestDispatcher to do that.
> 
> What section of the spec defines such behaviour? I understand 
> that we cannot access a session created by one application 
> from another one. However, an application can manage its own 
> session(s) and the way the application is accessed (via 
> RequestDispatcher or via direct hit) should not affect 
> session management at all.
> 
> Thanks again, I really appreciate your thoughts on this matter.
> 
> 
> Kind regards,
> 
> Alex.
> 
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Monday, 23 May 2005 6:21 PM
> To: 'Tomcat Users List'
> Subject: RE: problem: Session invalidation in the servlet accessed via
> foreign context 
> 
> 
> 
> OK.
> 
> So... your conclusion is that you can't do that, right?  
> That's what I'm
> reading the servlet 2.4 spec as saying, because you can't invalidate a
> session in one context that is not accessible to you in 
> another context,
> irrespective of whether you use getRequestDispatcher to do that.
> 
> Or maybe I'm reading it wrong.  That's possible as to be 
> honest I've never
> tried what you're trying for real, I'm going on what the docs say not
> personal experience.
> 
> > -Original Message-
> > From: Akoulov, Alexandre [IT] 
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Monday 23 May 2005 06:53
> > To: Tomcat Users List
> > Subject: RE: problem: Session invalidation in the servlet 
> > accessed via foreign context 
> > 
> > 
> > Thanks again, Steve, for your time.
> > 
> > I am not trying to share sessions between different apps. I 
> > just want to ensure that when we're programmatically 
> > accessing web application in the different context it can do 
> > its own session management (ie invalidate / create new ones)
> > 
> > -Original Message-
> > From: Steve Kirk [mailto:[EMAIL PROTECTED]
> > Sent: Monday, 23 May 2005 11:52 AM
> > To: 'Tomcat Users List'
> > Subject: RE: problem: Session invalidation in the servlet 
> accessed via
> > foreign context 
> > 
> > 
> > 
> > I'm not sure why you think there is a problem with 
> > invalidation.  I'm no
> > expert, but I'm not sure that I would expect the code below 
> > to work, because
> > by default, servlets must not share sessions between webapps, 
> > and you are
> > asking that a client request to one context is passed to 
> > another, and still
> > the session data is available.  Withouht single sign-on, I 
> would have
> > thought that sessions will not be shared.
> > 
> > I've just flipped through the 2.4 servlet spec.  Section 
> SRV.7.3 says
> > something very specific about your scenario, as follows: "if 
> > a servlet uses
> > the RequestDispatcher to call a servlet in another Web 
> > application, any
> > sessions created for and visible to the servlet being called must be
> > different from those visible to the calling servlet."
> > 
> > I appreciate that you are also saying that v3/v4 behaved 
> > differently - but
> > are you sure that the config of those versions was no

RE: problem: Session invalidation in the servlet accessed via foreign context

2005-05-23 Thread Steve Kirk

OK.

So... your conclusion is that you can't do that, right?  That's what I'm
reading the servlet 2.4 spec as saying, because you can't invalidate a
session in one context that is not accessible to you in another context,
irrespective of whether you use getRequestDispatcher to do that.

Or maybe I'm reading it wrong.  That's possible as to be honest I've never
tried what you're trying for real, I'm going on what the docs say not
personal experience.

> -Original Message-
> From: Akoulov, Alexandre [IT] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 06:53
> To: Tomcat Users List
> Subject: RE: problem: Session invalidation in the servlet 
> accessed via foreign context 
> 
> 
> Thanks again, Steve, for your time.
> 
> I am not trying to share sessions between different apps. I 
> just want to ensure that when we're programmatically 
> accessing web application in the different context it can do 
> its own session management (ie invalidate / create new ones)
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Monday, 23 May 2005 11:52 AM
> To: 'Tomcat Users List'
> Subject: RE: problem: Session invalidation in the servlet accessed via
> foreign context 
> 
> 
> 
> I'm not sure why you think there is a problem with 
> invalidation.  I'm no
> expert, but I'm not sure that I would expect the code below 
> to work, because
> by default, servlets must not share sessions between webapps, 
> and you are
> asking that a client request to one context is passed to 
> another, and still
> the session data is available.  Withouht single sign-on, I would have
> thought that sessions will not be shared.
> 
> I've just flipped through the 2.4 servlet spec.  Section SRV.7.3 says
> something very specific about your scenario, as follows: "if 
> a servlet uses
> the RequestDispatcher to call a servlet in another Web 
> application, any
> sessions created for and visible to the servlet being called must be
> different from those visible to the calling servlet."
> 
> I appreciate that you are also saying that v3/v4 behaved 
> differently - but
> are you sure that the config of those versions was not 
> different, perhaps
> they were configured to share sessions (single sign-on)?  I'm 
> not sure on
> the detail of earlier versions of the servlet spec, but 
> perhaps session
> behaviour was defined differently in previous versions.  You 
> could find out
> with a google search, or maybe someone else will answer
> 
> > -Original Message-
> > From: Akoulov, Alexandre [IT] 
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Monday 23 May 2005 01:29
> > To: Tomcat Users List
> > Subject: RE: problem: Session invalidation in the servlet 
> > accessed via foreign context 
> > 
> > 
> > Thanks a lot, Steve, for your reply.
> > 
> > No, I am not using SingleSignOn neither hoping to share the 
> > same session across contexts.
> > 
> > The only thing I was testing is that I could invalidate and 
> > then create a new session in different scenarios. 
> > 
> > I ran the test with the java debugger and could observe that 
> > when invalidating/creating a session in ForeignContextServlet 
> > it in fact did not create a new session and left us with the 
> > reference to old (ie invalidated) session after line No.3.
> > 
> > My next step is start looking into the tomcat source code to 
> > try to work out what's happening. Do you think it's best way 
> > to approach this issue?
> > 
> > 
> > Thanks again,
> > 
> > Alex.
> > 
> > -Original Message-
> > From: Steve Kirk [mailto:[EMAIL PROTECTED]
> > Sent: Monday, 23 May 2005 10:18 AM
> > To: 'Tomcat Users List'
> > Subject: RE: problem: Session invalidation in the servlet 
> accessed via
> > foreign context 
> > 
> > 
> > 
> > I'm not sure I fully understand this issue, but seeing as 
> > no-one else seems
> > to have replied yet, maybe a few Qs might help you work through it:
> > 
> > Are you hoping that both contexts will share their sessions?
> > 
> > Are you using the SingleSignOn feature in server.xml?
> > 
> > When you say that ForeignContextServlet does not create a 
> new session
> > object, are you explicitly testing that within 
> > ForeignContextServlet itself,
> > or from a servlet in another context (e.g. 
> DebuggerServlet)?  i.e. is
> > null==session after step 3?
> > 
> > You say that the session is i

RE: Mysterious failures

2005-05-22 Thread Steve Kirk

What is your actual logging config?

Hazy memory, but don't you want debug=99 rather than debug=1 to get more
detail?

If you really can't get logging to work, you could insert
System.out.println("blah") statements at key points around where you think
the crash might be caused, in lieu of your log statements.  Not pretty but
it can get you results.

Some Qs to narrow it down a bit:

Is the crash triggered by a single type of request, or maybe a burst of
traffic, or will it crash even with no requests?

Is the crashing request direct to TC or via apache httpd?

Is a TC html error page generated, what does it say?

Do you start any of your own threads?

Does your code always return pooled objects to the pool?

> Is there some app that people use to make sure the server stays up by
> checking it every so often and restarting if needed?

I've never come across that.  TC is pretty reliable, shouldn't need it IMHE.

> -Original Message-
> From: Grant Ingersoll [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 02:39
> To: tomcat-user@jakarta.apache.org
> Subject: Mysterious failures
> 
> 
> Hi,
> 
> Have been a long time user of TC, but first time poster.  
> 
> I am running 5.0.28 on OS X with PostgreSQL and Struts and connecting
> to Apache using mod_jk.  I have a webapp deployed that is pretty
> mature.  However, I am having some mysterious crashes of Tomcat that I
> haven't been able to get my head around.  The whole process is dying
> w/o so much as a peep.  Not one single log/exception is being written
> anywhere (as far as I know) that gives even the most remote clue as to
> why and I am at a loss for how to get at the problem.
> 
> Here is what I have done to date:
> 1. Put a catch (Throwable) with a log message at my top level part of
> the servlet that logs the exception and then throws it out.
> 
> 2. I have turned on DEBUG level logging for every piece of 
> the application
> 
> 3. I have set debug="1" everywhere I could in server.xml
> 
> Anyone have any suggestions on what else to do for debugging this? 
> Part of me feels that it might be JDBC related as I am not using the
> Tomcat JNDI lookup methods for getting connections (but am managing a
> pool myself).  Should I be using the JNDI lookup methods for getting
> connections?  My only other guess was that it seems to happen after it
> has been running for a little while and I thought it might have
> something to do with the session timeout stuff, but I can't see why
> that would cause the process to exit.
> 
> Is there some app that people use to make sure the server stays up by
> checking it every so often and restarting if needed?
> 
> Thanks for any advice,
> Grant
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: problem: Session invalidation in the servlet accessed via foreign context

2005-05-22 Thread Steve Kirk

I'm not sure why you think there is a problem with invalidation.  I'm no
expert, but I'm not sure that I would expect the code below to work, because
by default, servlets must not share sessions between webapps, and you are
asking that a client request to one context is passed to another, and still
the session data is available.  Withouht single sign-on, I would have
thought that sessions will not be shared.

I've just flipped through the 2.4 servlet spec.  Section SRV.7.3 says
something very specific about your scenario, as follows: "if a servlet uses
the RequestDispatcher to call a servlet in another Web application, any
sessions created for and visible to the servlet being called must be
different from those visible to the calling servlet."

I appreciate that you are also saying that v3/v4 behaved differently - but
are you sure that the config of those versions was not different, perhaps
they were configured to share sessions (single sign-on)?  I'm not sure on
the detail of earlier versions of the servlet spec, but perhaps session
behaviour was defined differently in previous versions.  You could find out
with a google search, or maybe someone else will answer

> -Original Message-
> From: Akoulov, Alexandre [IT] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 01:29
> To: Tomcat Users List
> Subject: RE: problem: Session invalidation in the servlet 
> accessed via foreign context 
> 
> 
> Thanks a lot, Steve, for your reply.
> 
> No, I am not using SingleSignOn neither hoping to share the 
> same session across contexts.
> 
> The only thing I was testing is that I could invalidate and 
> then create a new session in different scenarios. 
> 
> I ran the test with the java debugger and could observe that 
> when invalidating/creating a session in ForeignContextServlet 
> it in fact did not create a new session and left us with the 
> reference to old (ie invalidated) session after line No.3.
> 
> My next step is start looking into the tomcat source code to 
> try to work out what's happening. Do you think it's best way 
> to approach this issue?
> 
> 
> Thanks again,
> 
> Alex.
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Monday, 23 May 2005 10:18 AM
> To: 'Tomcat Users List'
> Subject: RE: problem: Session invalidation in the servlet accessed via
> foreign context 
> 
> 
> 
> I'm not sure I fully understand this issue, but seeing as 
> no-one else seems
> to have replied yet, maybe a few Qs might help you work through it:
> 
> Are you hoping that both contexts will share their sessions?
> 
> Are you using the SingleSignOn feature in server.xml?
> 
> When you say that ForeignContextServlet does not create a new session
> object, are you explicitly testing that within 
> ForeignContextServlet itself,
> or from a servlet in another context (e.g. DebuggerServlet)?  i.e. is
> null==session after step 3?
> 
> You say that the session is invalid/null after line 2, but 
> have you tested
> that it was valid/non-null before line 2?
> 
> > -Original Message-
> > From: Akoulov, Alexandre [IT] 
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Monday 23 May 2005 00:43
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: problem: Session invalidation in the servlet 
> > accessed via foreign context 
> > 
> > 
> > Hi all,
> > 
> > I'd greatly appreciate if you could shed a ray of light on 
> > the following problem ( see below)
> > 
> > 
> > 
> > -Original Message-
> > From: Akoulov, Alexandre [IT] 
> > Sent: Friday, 20 May 2005 11:15 AM
> > To: Tomcat Users List
> > Subject: problem: Session invalidation in the servlet accessed via
> > foreign context 
> > 
> > 
> > Hi all,
> > 
> > It seems that there is a problem with session invalidation in 
> > tomcat5.0. Please refer to the explanation below:
> > 
> > 
> > 1. HttpSession session = req.getSession(true); // get 
> > existing user session or create one if does not exist
> > 2. session.invalidate(); // invalidate user session 
>  
> > 3. session = req.getSession(true); // create a new session ( 
> > ie a valid session)   
> >
> > The above three lines of code are commonly used to invalidate 
> > the user session and then create a new one. Tomcat implements 
> > this behaviour by creating a new session object in line No.3.
> > However, in tomcat5.0 implementation (5.0.28) when the above 
> > code is accessed via foreign conte

RE: Re: Problems with filters in 5.5.9?

2005-05-22 Thread Steve Kirk

Can you say more about how you upgraded?  Specifically, were you very
careful to migrate your config files across?

> -Original Message-
> From: Brandon Dove [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 02:14
> To: Lutz Zetzsche
> Subject: Re: Re: Problems with filters in 5.5.9?
> 
> 
> Lutz -- thanks for the help but unfortunately even after copying
> the jar to the $TOMCAT_HOME/common/lib/ directory I still am
> having problems. :(
> 
> Anyone else have any ideas?
> 
> Cheers,
> 
> Brandon
> 
>  On Sat, 21 May 2005, Lutz Zetzsche
> ([EMAIL PROTECTED]) wrote:
> 
> > Hi Brandon,
> > 
> > Am Freitag, 20. Mai 2005 23:01 schrieb Brandon Dove:
> > > I recently upgraded from 5.5.4 -> 5.5.9. Now when starting
> my
> > > app I get the error:
> > >
> > > May 20, 2005 4:28:10 PM
> org.apache.catalina.core.StandardContext
> > > filterStart
> > > SEVERE: Exception starting filter addressFilter
> > > java.lang.ClassNotFoundException:
> > > com.mycompany.servlet.AddressFilter
> > > [...]
> > > May 20, 2005 4:28:10 PM
> org.apache.catalina.core.StandardContext
> > > start
> > > SEVERE: Error filterStart
> > >
> > > AddressFilter is located in a JAR that can be found in
> > > /webapps/WEB-INF/lib (as usual) so I'm not sure why it can't
> > > find the class?
> > >
> > > Any ideas?
> > 
> > It is strange that this error didn't occur with Tomcat 5.5.4
> if I am 
> > right with my following assumption:
> > 
> > From my point of view, your address filter 
> > com.mycompany.servlet.AddressFilter must be visible to the
> Tomcat class 
> > org.apache.catalina.core.StandardContext.
> > 
> > According to the class loader how-to explaining the class
> loading tree, 
> > such classes that has to be visible to Tomcat classes cannot
> be placed 
> > in the shared or WebappX directories:
> > 
> >
>   
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-h
owto.html
> 
> Try to put your address filter into the common directory. If I
am right 
> this should work after a server restart.
> 
> 
> Best wishes
> 
> Lutz
> 
>
-
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
> 
> 
> 
> 



Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

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




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



RE: problem: Session invalidation in the servlet accessed via foreign context

2005-05-22 Thread Steve Kirk

I'm not sure I fully understand this issue, but seeing as no-one else seems
to have replied yet, maybe a few Qs might help you work through it:

Are you hoping that both contexts will share their sessions?

Are you using the SingleSignOn feature in server.xml?

When you say that ForeignContextServlet does not create a new session
object, are you explicitly testing that within ForeignContextServlet itself,
or from a servlet in another context (e.g. DebuggerServlet)?  i.e. is
null==session after step 3?

You say that the session is invalid/null after line 2, but have you tested
that it was valid/non-null before line 2?

> -Original Message-
> From: Akoulov, Alexandre [IT] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Monday 23 May 2005 00:43
> To: tomcat-user@jakarta.apache.org
> Subject: Re: problem: Session invalidation in the servlet 
> accessed via foreign context 
> 
> 
> Hi all,
> 
> I'd greatly appreciate if you could shed a ray of light on 
> the following problem ( see below)
> 
> 
> 
> -Original Message-
> From: Akoulov, Alexandre [IT] 
> Sent: Friday, 20 May 2005 11:15 AM
> To: Tomcat Users List
> Subject: problem: Session invalidation in the servlet accessed via
> foreign context 
> 
> 
> Hi all,
> 
> It seems that there is a problem with session invalidation in 
> tomcat5.0. Please refer to the explanation below:
> 
> 
> 1. HttpSession session = req.getSession(true); // get 
> existing user session or create one if does not exist
> 2. session.invalidate(); // invalidate user session  
> 3. session = req.getSession(true); // create a new session ( 
> ie a valid session)   
>
> The above three lines of code are commonly used to invalidate 
> the user session and then create a new one. Tomcat implements 
> this behaviour by creating a new session object in line No.3.
> However, in tomcat5.0 implementation (5.0.28) when the above 
> code is accessed via foreign context it does not create a new 
> session object and therefore a session is still invalid after 
> lineNo.3 is executed. The following code demonstrates the 
> problem:  
>
>
> // servlet that runs in the same tomcat instance but in a 
> different context to DebuggerServlet's context
> public class ForeignContextServlet extends HttpServlet {
>  public void doGet(HttpServletRequest req, 
> HttpServletResponse res) 
>  throws ServletException, IOException {
>  
>  HttpSession session = req.getSession(true);
>  
>  session.invalidate();  
>  session = req.getSession(true); // 
> !!PROBLEM!! does NOT create a new session when 
> accessed via foreign context's dispatcher  
>  }
> }
> 
> 
> // servlet that accesses ForeignContextServlet via foreign 
> context's dispatcher
> public class DebuggerServlet extends HttpServlet {
> public void doGet(HttpServletRequest req, 
> HttpServletResponse res) 
> throws ServletException, IOException { 
> 
> ServletContext ctx = getServletContext();
> 
> // dispatch the request to the servlet in a different context 
> ServletContext foreignContext = 
> ctx.getContext("/AccessCommon");
> 
> foreignContext.getRequestDispatcher("/foreignContextServlet").
> include(req, res);
> }
> }   
>
> Such behaviour is only observed in tomcat 5.0 (have not tried 
> on tomcat5.5); tomcat3 and tomcat4 do create new session 
> objects in lineNo.3
> 
> 
> I greatly appreciate your comments on this issue.
> 
> 
> Kind regards,
> 
> Alex.
>
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

2005-05-22 Thread Steve Kirk
Lutz,

I started replying to yr post including my full config, had nearly finished,
then saw the problem - I had a leading space in the 'url' value within the
 tag of my context.xml file.  Grrr!  I must have included it by
accident when converting from the nested
 approach used in
TC5.0 to the single  tag approach favoured in TC5.5.

So basically Nix was right in his first post...

Thanks very much to both of you for your patient help.  Without your
prompting, I was ready to start first thing Monday by writing off 3 days'
upgrade effort by rolling back to 5.0.28, but now tomorrow is now looking
like being productive :)

> -Original Message-
> From: Lutz Zetzsche [mailto:[EMAIL PROTECTED] 
> Sent: Sunday 22 May 2005 22:42
> To: Tomcat Users List
> Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
> 
> 
> Hi Steve,
> 
> Am Sonntag, 22. Mai 2005 22:58 schrieb Steve Kirk:
> > Thanks again Nix, but latest mysql driver is *definitely* in
> > %catalina_home%\common\lib :
> 
> Did you check that the MySQL driver is only there and not 
> additionally 
> in a second directory, i.e. WEB-INF/lib, which could confuse Tomcat?
> 
> 
> > - mysql works from the command line using my datasource username/pw;
> 
> Are you really using the correct URL to connect to the database? Are 
> host name, port and database name ok? I.e. the database name is 
> case-sensitive (at least on Linux, check it on Windows)!
> 
> Are you running Tomcat with Security Manager? Then you may 
> have missed 
> to set the necessary security rules for connecting.
> 
> 
> > I'm almost tired of looking - if I can't solve it tomorrow, I'll be
> > (very reluctantly) setting aside TC 5.5 and carrying on 
> with 5.0.28. 
> > I don't want to do that, because 5.0.28 has some sesssion management
> > bugs I'd like to get past, and also because I've now spent 3 days
> > trying to make 5.5 work.
> 
> Perhaps you can post your exact configuration here, 
> anonymizing user and 
> password values. What did you configure where? I.e. where is the 
> context file in which you did the relevant entry? Etc.
> 
> 
> Bet wishes
> 
> Lutz
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

2005-05-22 Thread Steve Kirk

Thanks again Nix, but latest mysql driver is *definitely* in
%catalina_home%\common\lib : 

C:\>dir %catalina_home%\common\lib
 Volume in drive C is BOOT
 Volume Serial Number is D4DF-165E

 Directory of c:\jakarta-tomcat-5.5.9\common\lib

19/05/2005  19:25  .
19/05/2005  19:25  ..
11/05/2004  12:5454,829 activation.jar
26/03/2005  14:22   112,341 commons-el.jar
26/03/2005  14:22   918,743 jasper-compiler-jdt.jar
26/03/2005  14:22   383,134 jasper-compiler.jar
26/03/2005  14:2276,664 jasper-runtime.jar
26/03/2005  14:2250,493 jsp-api.jar
12/10/2004  13:20   347,137 mail.jar
14/04/2005  22:44   409,191 mysql-connector-java-3.1.8-bin.jar
26/03/2005  14:22   154,101 naming-factory-dbcp.jar
26/03/2005  14:2236,333 naming-factory.jar
26/03/2005  14:2246,606 naming-resources.jar
26/03/2005  14:2297,693 servlet-api.jar
  12 File(s)  2,687,265 bytes
   2 Dir(s)   2,182,369,280 bytes free



OK, so now I'm struggling.

So I'm going to take a punt and say that I think there may be some kind of
class loading problem.  I say this because:

- I have fresh installed TC, mysql and jdk; 
- mysql works from the command line using my datasource username/pw; 
- I have checked and rechecked my config a thousand times; 
- the mysql driver is in the right folder; 
- the error is suggestive of the fact that TC can't find the driver.

However, the driver it is there in the common/lib folder, plain for anyone
to see.  I can only assume this is to do with security/classloading.  I've
eliminated security, because TC runs as a service under the system account,
and I've checked that this account has read access to the file.

I'm almost tired of looking - if I can't solve it tomorrow, I'll be (very
reluctantly) setting aside TC 5.5 and carrying on with 5.0.28.  I don't want
to do that, because 5.0.28 has some sesssion management bugs I'd like to get
past, and also because I've now spent 3 days trying to make 5.5 work.

So, any help would be most gratefully received :)

Original post here for those that missed it: 
http://marc.theaimsgroup.com/?l=tomcat-user&m=111660199623420&w=2  

> -Original Message-
> From: Nikola Milutinovic [mailto:[EMAIL PROTECTED] 
> Sent: Saturday 21 May 2005 13:42
> To: Tomcat Users List
> Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
> 
> 
> Steve Kirk wrote:
> 
> >Thanks nix.
> >
> >  
> >
> >>Could it be that you've missed the fact that 
> >>DataSource JNDI resource setup definition has changed in TC 
> >>5.5? It is 
> >>no longer with those 
> >>... 
> >>
> >>
> >
> >Yes I already changed that.  I used to use the approach you 
> mention in
> >5.0.28, i.e.:
> >
> > 
> > 
> > username
> > ...
> > 
> > 
> > password
> > ...
> > 
> >
> > etc
> >
> > 
> >
> >But noticed that the new 5.5 DBCP example used this approach:
> >
> >
> >
> >So I switched to that, but still no joy.
> >
> >PS does it actually say in the docs anywhere that the
> >.. 
> approach is *NOT*
> >valid in 5.5?  If so then I've missed some docs somewhere, 
> maybe there is
> >other new stuff that I haven't seen.
> >  
> >
> 
> It definitely does not work in 5.5. I've used the config from 
> the docs 
> page with PostgreSQL and it worked. Other possible problem is 
> that the 
> driver class didn't load. Where have you placed the JDBC JAR? It goes 
> either in ${CATALINA_HOME}/common/lib since it must be 
> accessable to TC.
> 
> Nix.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: What happened to the searchable list archive?

2005-05-22 Thread Steve Kirk
Hi Mark,

Eyebrowse was the place that I used to rely on for searching, when I was
active on the list up until a few months back.  When I returned to the list
last week, I found that eyebrowse no longer seemed to be in use, hence I
checked out the official TC site to see what might now replace it.

I started here: 
http://jakarta.apache.org/tomcat/index.html 

Then clicked "mailing lists" towards the bottom of the left hand menu, which
took me here: 
http://jakarta.apache.org/site/mail.html 

And from there I scrolled down to the "Table of Contents" section and
clicked the "Tomcat" link near the bottom of the page, which took me here: 
http://jakarta.apache.org/site/mail2.html#Tomcat 

Finally, from there I clicked "archive" under the list of tomcat-user links,
which took me here, which is what I think you are calling ASF, and what I
was referring to as "the official archive": 
http://mail-archives.apache.org/mod_mbox/jakarta-tomcat-user 

The page above is fine for browsing archived messages, but I can't see a
search link like there used to be on eyebrowse.  Clearly you can use google
to site-search these archive pages, like you can on any site, but it's a
little unwieldy to use, hence why I started this thread.

In going through this all again so that I could quote the links above, I now
see that Marc's site and mail-archives are both already linked at a high
level from the generic apache mail archive page(
http://jakarta.apache.org/site/mail.html ), so apologies for not seeing
those earlier.  However, I didn't spot this the first few times I looked, so
I'd still suggest that in the interests of user friendliness, it might be
worth linking from the TC pages at http://jakarta.apache.org/tomcat more
directly to the search pages that I mentioned in my last post, as well as
any others, given that the "official" archive page does not seem to have its
own search.

Hope this helps, 

Steve.

> -Original Message-
> From: Mark Thomas [mailto:[EMAIL PROTECTED] 
> Sent: Sunday 22 May 2005 21:18
> To: Tomcat Users List
> Subject: Re: What happened to the searchable list archive?
> 
> 
> Steve Kirk wrote:
> > If anyone involved in producing the Tomcat project 
> documentation is reading
> > this, I would suggest maybe linking these sites from the 
> official mailing
> > list pages, as alternatives to the official archive?
> 
> Which pages are you talking about? If you can give me a URL I 
> can look 
> into getting it changed.
> 
> For the record, eyebrowse is now disabled and ASF has moved over to 
> mod_mbox (http://mail-archives.apache.org/mod_mbox/)
> 
> Mark
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: What happened to the searchable list archive?

2005-05-22 Thread Steve Kirk

GB developer, Robert and Tomi, thanks very much for pointing me to these
search sites.  I was not aware of any of them before, despite having
developed on TC for several years.  Perhaps there are more out there.

If anyone involved in producing the Tomcat project documentation is reading
this, I would suggest maybe linking these sites from the official mailing
list pages, as alternatives to the official archive?  I say this because,
with all due respect to those who voluntarily give their time to the
project, these search sites add search features do not seem to be currently
available from the official site pages.  I think most would agree that in
general it's better to have people search existing Q&A rather than repost
the same Q, and these sites seem to provide a good way to help people do
that.

> -Original Message 1 -
> From: GB Developer [mailto:[EMAIL PROTECTED] 
> Sent: Friday 20 May 2005 18:05
> To: 'Tomcat Users List'
> Subject: RE: What happened to the searchable list archive?
> 
> 
> I like marc.
> 
> http://marc.theaimsgroup.com/?l=tomcat-user&r=1&w=2
> 
> 
> -Original Message 2 -
> From: Robert r. Sanders [mailto:[EMAIL PROTECTED] 
> Sent: Saturday 21 May 2005 04:27
> To: Tomcat Users List
> Subject: Re: What happened to the searchable list archive?
> 
> 
> You can also use:  http://dir.gmane.org/gmane.comp.jakarta.tomcat.user


> -Original Message 3 -
> From: tomi (sent by Nabble.com) [mailto:[EMAIL PROTECTED] 
> Sent: Saturday 21 May 2005 07:12
> To: tomcat-user@jakarta.apache.org
> Subject: Re: What happened to the searchable list archive?
> 
> Nabble is also archiving this list and has a good search:
> http://www.nabble.com/Tomcat---User-f342.html
> 



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



RE: What happened to the searchable list archive?

2005-05-20 Thread Steve Kirk

Thanks - great site.  Just what I was looking for.

> -Original Message-
> From: GB Developer [mailto:[EMAIL PROTECTED] 
> Sent: Friday 20 May 2005 18:05
> To: 'Tomcat Users List'
> Subject: RE: What happened to the searchable list archive?
> 
> 
> I like marc.
> 
> http://marc.theaimsgroup.com/?l=tomcat-user&r=1&w=2
> 
> 
> 
> > -Original Message-
> > From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, May 20, 2005 8:14 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: What happened to the searchable list archive?
> > 
> > 
> > 
> > It's been a few months since I've been active on the list, 
> > and the list archive seems to have changed in that time, 
> > could someone please advise?
> > 
> > I used to search the list archives here: 
> > http://nagoya.apache.org/eyebrowse/SearchList?listName=tomcat-
> [EMAIL PROTECTED]
> pache.org 
> 
> But that archive appears to contain very few of the current 
> messages (e.g.
> only 7 from April, none at all for this month), is there a 
> reason for that?
> It appears to have gone quiet after Jan 2005 for some reason, 
> see here: 
> http://nagoya.apache.org/eyebrowse/SummarizeList?listName=tomc
[EMAIL PROTECTED]
a.apache.org 

I see that there is an archive here now 
http://mail-archives.apache.org/mod_mbox/jakarta-tomcat-user 
but it doesn't appear to be searchable...?

Of course we can use google site search to search this list, but it's not
quite the same thing because you can't select a list to search.  Also the
thread browsing is not as easy from this archive, once you have found a post
via google.



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


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




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



RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

2005-05-20 Thread Steve Kirk

Thanks lutz, that's in fact exactly how I now have it.  I have also deleted
the webapp (and the context xml file under /conf) and recompiled/restarted,
to make sure the new context config is loaded, but still no joy.

> -Original Message-
> From: Lutz Zetzsche [mailto:[EMAIL PROTECTED] 
> Sent: Friday 20 May 2005 16:59
> To: Tomcat Users List
> Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
> 
> 
> Hi,
> 
> Am Freitag, 20. Mai 2005 17:22 schrieb Nikola Milutinovic:
> > Steve Kirk wrote:
> > This most commonly means that the definition of the DataSource
> > resource lacks driver definition. Could it be that you've missed the
> > fact that DataSource JNDI resource setup definition has 
> changed in TC
> > 5.5? It is no longer with those
> > ... Check it
> > out.
> 
> This is exactly what I would guess, too. From Tomcat 5.0 to 5.5, the 
> Resource element syntax has changed. It is now like:
> 
>  name="..."
> auth="Container"
> type="javax.sql.DataSource"
> driverClassName="..."
> url="jdbc:..."
> username="..."
> password="..."
> maxActive="20"
> maxIdle="10"
> maxWait="-1"
> 
> removeAbandoned="true"
> removeAbandonedTimeout="300"
> logAbandoned="true" />
> 
> 
> Best wishes
> 
> Lutz



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



RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

2005-05-20 Thread Steve Kirk
Thanks nix.

> Could it be that you've missed the fact that 
> DataSource JNDI resource setup definition has changed in TC 
> 5.5? It is 
> no longer with those 
> ... 

Yes I already changed that.  I used to use the approach you mention in
5.0.28, i.e.:



username
...


password
...


etc



But noticed that the new 5.5 DBCP example used this approach:



So I switched to that, but still no joy.

PS does it actually say in the docs anywhere that the
.. approach is *NOT*
valid in 5.5?  If so then I've missed some docs somewhere, maybe there is
other new stuff that I haven't seen.



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



DBCP datasource works on 5.0.28 but fails on 5.5.9

2005-05-20 Thread Steve Kirk

I know that DBCP is a common problem discussed on this list - I have been
helped, and have helped other people, with it before. So before posting this
message, I have recently re-read the 5.5 release notes and 5.0/5.5 DBCP/JNDI
how-to docs and checked the list archives.  But can't find a solution to my
current problem.

Until recently I had a working webapp running on tomcat 5.0.28 with
connector/j 3.1.7 and mysql 4.1.11-nt, all on windows XP and jdk1.4.2_08.
The app uses container-managed commons DBCP for all its database access.

The DBCP resource config has been set up and working unchanged for a long
time on various builds of TC 5.0.  I have it set up like this:

 defined in context.xml, in war file's META-INF folder
 declared in web.xml in war file's WEB-INF folder
The connector/j jar file is in tomcat's /common/lib folder
name of JNDI resource matches in ,  and Java
source code.

This all works on TC5.0.28 / JDK1.4.2_08.  However, I am attempting to
upgrade to TC 5.5.9 / JDK1.5.0_02.  I did a fresh install of both of these
to standard directories, recompiled the webapp for jdk1.5, and deployed it
with the same config files and setup above from TC 5.0.28. However the
webapp now reports an error when requesting a connection from the pool, see
stacktrace below (from the TC stdout logfile under TC logs directory).

I tried changing my context.xml so that the params are all pairs of
name="value" within a single  tag, as now seems to be preferred
in the 5.5 DBCP how-to, rather than my original nested set of tags under
, which was the approach used in the 5.0 equivalent how-to.
But still no joy.

I also tried upgrading to connector/j 3.1.8, no joy there either.

When TC starts up, the webapp deploys OK from its war file, and the
context.xml is copied to the /conf/[engine]/[host]/ folder OK, without any
parsing errors logged.  The connection pool initially seems to work, in the
sense that this code executes OK: 
Context ctx = new InitialContext();
String resourceString = "java:comp/env/jdbc/" +
config.getString(ConfigConstants.JNDI_DATABASE_RESOURCE_NAME);
DataSource pool = (DataSource)ctx.lookup(resourceString);

However, an Exception is thrown the first time that I do this: 
Connection conn = pool.getConnection();

I'm stumped after hours working on this.  I've read through all the docs,
how-tos, and release notes that I can find, and searched the mail list
archives on mysql and tomcat sites, as well as googling various searches.
Has anyone had this problem themselves or have any insight to offer please?

Thanks,

Steve.
-
Exception caught when establishing/testing database pool
cause[0]: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:780)
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)
 at core.sql.SqlQuery.prepare(SqlQuery.java:80)
 at core.sql.SqlQuery.executeSingleValue(SqlQuery.java:133)
 at core.servlet.Invoker.setUpDataSource(Invoker.java:325)
 at core.servlet.Invoker.init(Invoker.java:129)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:10
91)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3857)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
59)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
 at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
 at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
 at org.apache.catalina.core.StandardService.start(StandardService.java:450)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Del

What happened to the searchable list archive?

2005-05-20 Thread Steve Kirk

It's been a few months since I've been active on the list, and the list
archive seems to have changed in that time, could someone please advise?

I used to search the list archives here: 
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]
pache.org 

But that archive appears to contain very few of the current messages (e.g.
only 7 from April, none at all for this month), is there a reason for that?
It appears to have gone quiet after Jan 2005 for some reason, see here: 
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]
a.apache.org 

I see that there is an archive here now 
http://mail-archives.apache.org/mod_mbox/jakarta-tomcat-user 
but it doesn't appear to be searchable...?

Of course we can use google site search to search this list, but it's not
quite the same thing because you can't select a list to search.  Also the
thread browsing is not as easy from this archive, once you have found a post
via google.



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



RE: error-page not working properly

2004-12-13 Thread Steve Kirk


> -Original Message-
> From: Chris Cherrett [mailto:[EMAIL PROTECTED] 
> 
> Is there a way to catch all exceptions that works in Tomcat 5

You can catch all Exceptions/Throwables and their subclasses by configuring
java.lang.Exception or java.lang.Throwable in the  tag.  However
there is no corresponding wildcard to catch more than one  at a
time, so you have to config each code separately.



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


RE: sessionS info persistence when restart Tomcat

2004-12-10 Thread Steve Kirk

You are of course right ;)  I was just experiencing temporary blindness.

I had overlooked an underlying grandparent class of my User class which was
in the Session; the grandparent contains a reference to its creator, which
is the culprit mentioned in the Exception.  This in itself is a nasty that I
wasn't aware of, so that's 2 things to fix now.

All solved now :) thanks Yoav/Ben.

> -Original Message-
> From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
> Sent: Friday 10 December 2004 14:03
> To: Tomcat Users List
> Subject: RE: sessionS info persistence when restart Tomcat
> 
> 
> 
> Hi,
> Tomcat is not throwing that exception just because it feels 
> like it.  An
> instance of that class must be reachable in the serialization 
> process of
> at least of the session attributes.
> 
> Yoav Shapira http://www.yoavshapira.com
>  
> 
> >-Original Message-
> >From: Steve Kirk [mailto:[EMAIL PROTECTED]
> >Sent: Friday, December 10, 2004 8:25 AM
> >To: 'Tomcat Users List'
> >Subject: RE: sessionS info persistence when restart Tomcat
> >
> >
> >no.  I've checked this by adding more debug code to my SessionLogger
> class
> >(which implements all the Listener interfaces).  Every time a session
> event
> >is fired, my listener code lists all the session attribute names and
> values
> >to the log.  So when I shutdown TC, the log output looks like this:
> >
> >2004-12-10 12:08:25 StandardContext[/ao]*** SESSION EVENT:
> >sessionWillPassivate,
> >[EMAIL PROTECTED]
> >2004-12-10 12:08:25 StandardContext[/ao]logSessionAttributes() called
> >2004-12-10 12:08:25 StandardContext[/ao]session
> attribute:TEST1=TestString
> >2004-12-10 12:08:25 StandardContext[/ao]session
> >attribute:[EMAIL PROTECTED]
> >2004-12-10 12:08:25 StandardContext[/ao]session
> >attribute:LOGGED_IN_USER=[ID=1,TS='2004-09-15
> >18:14:33.0',GUIDELINEFILENAME='user1.html',COMPANYID='0',FIRS
> TNAME='sup
> er',
> >L
> >ASTNAME='user',TITLE='superuser',KNOWNAS='superuser',EMAILADD
> RESS='ao.s
> uper
> >u
> >[EMAIL PROTECTED]',PHONE='01234 superuser',MOBILE='0
> >super',USERNAME='su',PASSWORD='super',ACTIVE='Y',BRANDID='1']
> >2004-12-10 12:08:25 StandardContext[/ao]num attributes:3
> >
> >So the object named in the log message is not in the 
> session.  What is
> in
> >the session is core.sql.bean.User, which is a class of my own design
> that
> >basically just has a load of data fields in it (String, Timestamp,
> int).
> >The blurb you can see in the log is the output of the toString()
> method,
> >which just concats the fields together.  It's parent and 
> subclasses are
> all
> >Serializable.  So is the SessionLogger itself.
> >
> >> -Original Message-
> >> From: Ben Souther [mailto:[EMAIL PROTECTED]
> >> Sent: Friday 10 December 2004 13:14
> >> To: Tomcat Users List
> >> Subject: RE: sessionS info persistence when restart Tomcat
> >>
> >>
> >> > INFO: Cannot serialize session attribute LOGGED_IN_USER
> >> > > for session 58FD0ECF29BDCEB9DC096C5DF57A1DCC
> >> > > java.io.NotSerializableException:
> >> > > core.servlet.processor.SubmitLogin
> >> > > at
> >>
> >> > is certainly *not* the class of any object stored in the
> >> > session - I have
> >>
> >> Do you have a reference to it in any of the objects stored in your
> >> session?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> 
> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> This e-mail, including any attachments, is a confidential 
> business communication, and may contain information that is 
> confidential, proprietary and/or privileged.  This e-mail is 
> intended only for the individual(s) to whom it is addressed, 
> and may not be saved, copied, printed, disclosed or used by 
> anyone else.  If you are not the(an) intended recipient, 
> please immediately delete this e-mail from your computer 
> system and notify the sender.  Thank you.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: How to detect expired session vs. no session? (Solved)

2004-12-10 Thread Steve Kirk

> > In the last of these 4 cases, do you mean that the implicit 
> > JSP session
> > object returns null, or that request.getSession(false) 
> > returns null?  I
> > could understand the first behaviour but would be surprised 
> > by the second.

actually forget I said that, I made a mistake, getSession(false) of course
can return null.  sorry for the confusion.

PS I've done some testing of my own, I think one thing I might have
misunderstood is that if there is no session associated with a request, a
new one is only created by a call to getSession(true) or getSession() - if
you don't do this, then TC will not create a session.  In other words, TC
only creates sessions when you ask for them, rather than doing this as some
sort of automatic background task.  Is that right?  If so then this might be
the source of my confusion with your earlier comments.

> Add this and TC won't create session by default: <%@ page 
> session="false" %>

OK, but that does only work in JSPs. I was talking about servlets too (my
apps contain both).  Given that JSPs are in fact servlets, my guess
(although I don't know for a fact) is that the JSP's underlying servlet
class makes a call to request.getSession() each time the JSP is accessed,
and the underlying servlet stores the result in the JSP's implicit session
object.  I would also guess that it calls getSession(false) rather than
getSession(true) if you make your page declaration above.  So if I am right,
this would mean that TC shouldn't create sessions when there is none
already, and I think that is what you are saying too(?)

But this is not the same as saying that TC will not create sessions until
you authenticate, unless *all* your JSPs use the page directive above and
you have no servlets which could be calling request.getSession(true).



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



RE: How to detect expired session vs. no session? (Solved)

2004-12-10 Thread Steve Kirk
the original question, which Jospeh indicated is now solved, threw up more
questions.  at least that's why I was replying !

> -Original Message-
> From: Phillip Qin [mailto:[EMAIL PROTECTED] 
> Sent: Friday 10 December 2004 15:12
> To: 'Tomcat Users List'
> Subject: RE: How to detect expired session vs. no session? (Solved)
> 
> 
> I am curious why people spent so much time trying to figure 
> out whether
> request.getSession(...) returns null or not but didn't bother using
> request.getSession().isNew()?
> 
> 
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> Sent: December 9, 2004 4:36 PM
> To: 'Tomcat Users List'
> Subject: RE: How to detect expired session vs. no session? (Solved)
> 
> 
> > By default:
> > 1. getSession(true)!=null
> > 2. getSession(false)!=null
> > 
> > But if a JSP page contains the tag <%@ page session="false" 
> %>, then: 
> > 1. getSession(true)!=null 2. getSession(false)==null
> 
> In the last of these 4 cases, do you mean that the implicit 
> JSP session
> object returns null, or that request.getSession(false) 
> returns null?  I
> could understand the first behaviour but would be surprised 
> by the second.
> The problem is that it implies that JSPs execute the code in 
> a way that is
> different than if it were included in a servlet, and given 
> that JSPs are
> servlets, this seems puzzling.  Again, perhaps I'm not fully 
> understanding
> either your case, or the details of how sessions work.
> 
> > For my case, sessions will only be created for logged-in
> > users
> 
> what is it about your case that makes this happen?  I would 
> have thought
> that session creation is independent of whether you are 
> authenticating or
> not.  Or is there a way to config TC to not create sessions 
> by default, and
> only create them when the user successfully authenticates?
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> !DSPAM:41b8c52d300391826077954!
> 



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



RE: sessionS info persistence when restart Tomcat

2004-12-10 Thread Steve Kirk

no.  I've checked this by adding more debug code to my SessionLogger class
(which implements all the Listener interfaces).  Every time a session event
is fired, my listener code lists all the session attribute names and values
to the log.  So when I shutdown TC, the log output looks like this:

2004-12-10 12:08:25 StandardContext[/ao]*** SESSION EVENT:
sessionWillPassivate,
[EMAIL PROTECTED]
2004-12-10 12:08:25 StandardContext[/ao]logSessionAttributes() called
2004-12-10 12:08:25 StandardContext[/ao]session attribute:TEST1=TestString
2004-12-10 12:08:25 StandardContext[/ao]session
attribute:[EMAIL PROTECTED]
2004-12-10 12:08:25 StandardContext[/ao]session
attribute:LOGGED_IN_USER=[ID=1,TS='2004-09-15
18:14:33.0',GUIDELINEFILENAME='user1.html',COMPANYID='0',FIRSTNAME='super',L
ASTNAME='user',TITLE='superuser',KNOWNAS='superuser',EMAILADDRESS='ao.superu
[EMAIL PROTECTED]',PHONE='01234 superuser',MOBILE='0
super',USERNAME='su',PASSWORD='super',ACTIVE='Y',BRANDID='1']
2004-12-10 12:08:25 StandardContext[/ao]num attributes:3

So the object named in the log message is not in the session.  What is in
the session is core.sql.bean.User, which is a class of my own design that
basically just has a load of data fields in it (String, Timestamp, int).
The blurb you can see in the log is the output of the toString() method,
which just concats the fields together.  It's parent and subclasses are all
Serializable.  So is the SessionLogger itself.

> -Original Message-
> From: Ben Souther [mailto:[EMAIL PROTECTED] 
> Sent: Friday 10 December 2004 13:14
> To: Tomcat Users List
> Subject: RE: sessionS info persistence when restart Tomcat
> 
> 
> > INFO: Cannot serialize session attribute LOGGED_IN_USER 
> > > for session 58FD0ECF29BDCEB9DC096C5DF57A1DCC
> > > java.io.NotSerializableException: 
> > > core.servlet.processor.SubmitLogin
> > > at
> 
> > is certainly *not* the class of any object stored in the 
> > session - I have
> 
> Do you have a reference to it in any of the objects stored in your
> session?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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


RE: sessionS info persistence when restart Tomcat

2004-12-10 Thread Steve Kirk
Ben Souther said:
> 
> This is probably the bug you're talking about.
> http://issues.apache.org/bugzilla/show_bug.cgi?id=29521
> 
> 
> 

Aha.  Thanks Ben.  That clears up most of it in one go.

So it was fixed in 5.0.29 but as far as I can see (from the Jakarta news
page and the TC download page) there hasn't been a 5.0.x "final" release
since 5.0.28 (which I'm already running).  So am I right that if I don't
want to use "beta" releases, then to fix this I need to go to 5.5.4?  I
understand that the switch up to 5.5 brings in the need to make other
changes to my code, ISTR logging and some aspects of config are slightly
different?

Also, can anyone shed any light on my third point below please :

> A third point (and perhaps wandering slightly now) is raised 
> by the logged
> NotSerializiableException message: 
> 
> INFO: Cannot serialize session attribute LOGGED_IN_USER 
> for session 58FD0ECF29BDCEB9DC096C5DF57A1DCC
> java.io.NotSerializableException: 
> core.servlet.processor.SubmitLogin
> at
> 
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
> 
> this message is odd in that it refers to one of my classes 
> ("SubmitLogin")
> which, to my mind, has nothing to do with serialisation 
> issues.  What does
> the error message mean when it quotes my class name
> (core.servlet.processor.SubmitLogin) as the error message?  I 
> know that this
> is certainly *not* the class of any object stored in the 
> session - I have
> checked this from my event listening class's logs - I write 
> all the session
> attributes to the log as each one is added.




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


RE: sessionS info persistence when restart Tomcat

2004-12-10 Thread Steve Kirk

I have answered one of the points below myself with more testing:
HttpSessionActivationListener#sessionWillPassivate seems to work slightly
different to the other Listeners in that its methods are only called when
they are an object bound to the session is an instance of the
HttpSessionActivationListener.  The javadocs actually do say this, but I
didn't take it in at first: "Objects that are bound to a session may listen
to container events notifying them that sessions will be passivated and that
session will be activated. A container that migrates session between VMs or
persists sessions is required to notify all attributes bound to sessions
implementing HttpSessionActivationListener."

Thus HttpSessionActivationListener works slightly differently to
HttpSessionListener for example, because the latter's sessionCreated and
sessionDestroyed methods are called irrespective of whether they are methods
of objects bound within the session or not.

However I'd still appreciate any help that anyone can give on the other
points below :)

> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> Sent: Friday 10 December 2004 05:50
> To: 'Tomcat Users List'
> Subject: RE: sessionS info persistence when restart Tomcat
> 
> 
> 
> OK well after a few weeks' break from it I've returned to 
> this problem with
> fresh eyes, and immediately found out something interesting.
> 
> I normally run TC (5.0.28) as a windows service.  So upon 
> re-reading this
> thread, Yoav's earlier comment stood out as something I 
> hadn't checked, so I
> ran TC using the startup and shutdown scripts instead.  I 
> have a simple test
> class which listens for the context/session events and logs 
> them.  This
> shows that the following things happen when running from the 
> DOS scripts,
> which do not happen when running as a service:
> 
> contextDestroyed is called when TC shuts down
> sessions are serialised to SESSIONS.ser when TC is stopped
> java.io.NotSerializableException is thrown when a session 
> object is not
> serializable
> 
> So I guess Yoav's point below from earlier in the thread 
> could be correct
> after all - these could be outstanding bugs.  However I couldn't find
> anything in Bugzilla.
> 
> A second point is that 
> HttpSessionActivationListener#sessionWillPassivate is
> still not being called, even when start/stopping TC from the 
> DOS scripts,
> and whether or not there are any object stored in the session 
> (I store a
> simple String in the session for test purposes).  I can't think what's
> wrong, unless I am using HttpSessionActivationListener 
> incorrectly?  I have
> just added it as another interface implemented by my Listener 
> class along
> with the other Listener interfaces (HttpSessionListener,
> HttpSessionAttributeListener, ServletContextListener), is 
> this correct?
> 
> A third point (and perhaps wandering slightly now) is raised 
> by the logged
> NotSerializiableException message: 
> 
> INFO: Cannot serialize session attribute LOGGED_IN_USER for session
> 58FD0ECF29BDCEB9DC096C5DF57A1DCC
> java.io.NotSerializableException: core.servlet.processor.SubmitLogin
> at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
> 
> this message is odd in that it refers to one of my classes 
> ("SubmitLogin")
> which, to my mind, has nothing to do with serialisation 
> issues.  What does
> the error message mean when it quotes my class name
> (core.servlet.processor.SubmitLogin) as the error message?  I 
> know that this
> is certainly *not* the class of any object stored in the 
> session - I have
> checked this from my event listening class's logs - I write 
> all the session
> attributes to the log as each one is added.
> 
> Obviously I need to fix my unserialisable session object, but 
> aside from
> that, it does seem from all the above as though session events and
> exceptions are handled differently when TC runs as a windows service
> compared to from the DOS scripts.  Also I have the problem that
> sessionWillPassivate still does not seem to be called.
> 
> Any help much appreciated :)
> 
> > -Original Message-
> > From: Ben Souther [mailto:[EMAIL PROTECTED] 
> > Sent: Friday 05 November 2004 14:52
> > To: Tomcat Users List
> > Subject: RE: sessionS info persistence when restart Tomcat
> > 
> > 
> > On Fri, 2004-11-05 at 08:29, Shapira, Yoav wrote:
> > > Hi,
> > > Are you running Tomcat as a windows service?  If so 
> there's an open
> > > issue with it not calling certain destroy methods on shutdown.
> > > 
> > > Yo

RE: sessionS info persistence when restart Tomcat

2004-12-09 Thread Steve Kirk

OK well after a few weeks' break from it I've returned to this problem with
fresh eyes, and immediately found out something interesting.

I normally run TC (5.0.28) as a windows service.  So upon re-reading this
thread, Yoav's earlier comment stood out as something I hadn't checked, so I
ran TC using the startup and shutdown scripts instead.  I have a simple test
class which listens for the context/session events and logs them.  This
shows that the following things happen when running from the DOS scripts,
which do not happen when running as a service:

contextDestroyed is called when TC shuts down
sessions are serialised to SESSIONS.ser when TC is stopped
java.io.NotSerializableException is thrown when a session object is not
serializable

So I guess Yoav's point below from earlier in the thread could be correct
after all - these could be outstanding bugs.  However I couldn't find
anything in Bugzilla.

A second point is that HttpSessionActivationListener#sessionWillPassivate is
still not being called, even when start/stopping TC from the DOS scripts,
and whether or not there are any object stored in the session (I store a
simple String in the session for test purposes).  I can't think what's
wrong, unless I am using HttpSessionActivationListener incorrectly?  I have
just added it as another interface implemented by my Listener class along
with the other Listener interfaces (HttpSessionListener,
HttpSessionAttributeListener, ServletContextListener), is this correct?

A third point (and perhaps wandering slightly now) is raised by the logged
NotSerializiableException message: 

INFO: Cannot serialize session attribute LOGGED_IN_USER for session
58FD0ECF29BDCEB9DC096C5DF57A1DCC
java.io.NotSerializableException: core.servlet.processor.SubmitLogin
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)

this message is odd in that it refers to one of my classes ("SubmitLogin")
which, to my mind, has nothing to do with serialisation issues.  What does
the error message mean when it quotes my class name
(core.servlet.processor.SubmitLogin) as the error message?  I know that this
is certainly *not* the class of any object stored in the session - I have
checked this from my event listening class's logs - I write all the session
attributes to the log as each one is added.

Obviously I need to fix my unserialisable session object, but aside from
that, it does seem from all the above as though session events and
exceptions are handled differently when TC runs as a windows service
compared to from the DOS scripts.  Also I have the problem that
sessionWillPassivate still does not seem to be called.

Any help much appreciated :)

> -Original Message-
> From: Ben Souther [mailto:[EMAIL PROTECTED] 
> Sent: Friday 05 November 2004 14:52
> To: Tomcat Users List
> Subject: RE: sessionS info persistence when restart Tomcat
> 
> 
> On Fri, 2004-11-05 at 08:29, Shapira, Yoav wrote:
> > Hi,
> > Are you running Tomcat as a windows service?  If so there's an open
> > issue with it not calling certain destroy methods on shutdown.
> > 
> > Yoav Shapira http://www.yoavshapira.com
> I believe that issue was with contextDestroyed not being 
> called and was
> tested under 5.0.8 and 5.5.x and working.
> 
> > 
> > >-Original Message-
> > >From: Ben Souther [mailto:[EMAIL PROTECTED]
> > >Sent: Thursday, November 04, 2004 9:22 PM
> > >To: Tomcat Users List
> > >Subject: RE: sessionS info persistence when restart Tomcat
> > >
> > >SessionDestroyed shouldn't be called when tomcat shuts 
> down. Otherwise,
> > >the session wouldn't be valid when it starts up.  I just 
> tested with a
> > >clean install of 5.0.29 with a similar listener to the one you
> > describe.
> > >SessionDestroyed was not called when I stopped TC but the 
> sessions were
> > >still valid when I started it up.  I can give you the war 
> file if you
> > >like.
> > >
> > >Do all of the attributes that you're adding to your 
> session implement
> > >Serializable?
> > >
> > >> 
> C:\jakarta-tomcat-5.0.28\work\Catalina\localhost\ao\SESSIONS.ser (The
> > >>system cannot find the path specified)
> > >Does tomcat have sufficient permissions to write to the 
> work directory?
> > >
> > >How are you stopping Tomcat?
> > >
> > >
> > >
> > >On Thu, 2004-11-04 at 20:15, Steve Kirk wrote:
> > >> Following Yoav's earlier comments I've implemented a basic class
> > >> "SessionLogger" that implements HttpSessionListener,
> > >> HttpSessionActivationListener, HttpSessionAttributeListene

RE: How to detect expired session vs. no session? (Solved)

2004-12-09 Thread Steve Kirk
> By default:
> 1. getSession(true)!=null
> 2. getSession(false)!=null
> 
> But if a JSP page contains the tag <%@ page session="false" %>, then:
> 1. getSession(true)!=null
> 2. getSession(false)==null

In the last of these 4 cases, do you mean that the implicit JSP session
object returns null, or that request.getSession(false) returns null?  I
could understand the first behaviour but would be surprised by the second.
The problem is that it implies that JSPs execute the code in a way that is
different than if it were included in a servlet, and given that JSPs are
servlets, this seems puzzling.  Again, perhaps I'm not fully understanding
either your case, or the details of how sessions work.

> For my case, sessions will only be created for logged-in 
> users

what is it about your case that makes this happen?  I would have thought
that session creation is independent of whether you are authenticating or
not.  Or is there a way to config TC to not create sessions by default, and
only create them when the user successfully authenticates?



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



RE: How to detect expired session vs. no session? (Solved)

2004-12-08 Thread Steve Kirk
Following my comments below I thought I'd follow up a bit with some brief
testing of my own.

This is what I think it going on.  Someone with more knowledge/experience,
please correct me if anything I say here is wrong.  I'm assuming that the
browser is cooperating with sessions OK, i.e. not configured to block them.

When TC receives a request, it checks to see whether the browser has
included a jsessionid in the request.  You can do this yourself as follows:

String sessId = request.getRequestedSessionId();

If there is a jsessionid in the request (i.e. null != sessId), and it
matches a valid TC session object (i.e. one that has not timed out or had
invalidate() called on it), that session object is associated with the
request, and the same jsessionid will be written back to the browser with
the response that TC sends back, so that the session is persisted.

If the requested jsessionid does not match a valid session, a new session is
immediately created by TC and assigned to the request, with a new
jsessionid, which TC writes back to the browser with its response.  This new
session creation seems to take place before the doPost() method is entered.
However you can still tell whether an old jsessionid was requested even
after the new jsessionid has been assigned, as follows:

String id = request.getRequestedSessionId();
if (null==id)
{
// there was no jsessionid in the request
}
else if (request.isRequestedSessionIdValid())
{
// there was a valid jsessionid in the request
}
else
{
// there was an invalid jsessionid in the request
}

In either case, a session object is always returned by request.getSession()
and request.getSession(false).  (Actually this was a surprise to me, because
it seems that it is not possible to suppress creation of a new session where
none exists by using getSession(false)?)

Thus, the effect of all this taken together is that browser sends a
jsessionid to TC with every request except when the browser is opened afresh
and makes its first request to the webapp.  It even seems to send timed out
jsessionids to the server when the browser has been left open for longer
than the session timeout (presumably TC handles expiry issues server-side),
or when the browser is left open while TC is restarted.  Once TC has sent a
jsessionid to the browser, the browser will keep returning it in every
request to TC until the browser is closed, or TC changes the jsessionid for
some reason.

Now, the question of authentication.  I don't think that there is way to
tell that a user has authenticated using any of the code that Joseph or I
have mentioned, because this code deals only with sessions (which exist
whether you authenticate or not).  The code above merely tells you
information about a browser's recent visit to the site.  I'm not familiar
with TC's own authentication, but in my own case, successful authentication
is indicated by adding an object to the session to indicate that a given
authenticated user is using it.  Thus I use a test like:

if (null==(myclasses.User)request.getSession().getAttribute(CURRENT_USER))
{
throw new MyAuthException("User not authenticated");
}
else
{
// complete their request
}

Calling the invalidate() method on a session seems to cause the session
object to be destroyed immediately.  If this is done during processing of a
request, I think that TC still sends the old jsessionid to the browser in
the response.  So the next time that the browser makes a request, it will
present the old jsession, which will be invalid, so TC will replace the
jsessionid at that point.

Hope this is useful to someone else and isn't too far off the mark...?

> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 08 December 2004 16:25
> To: 'Tomcat Users List'
> Subject: RE: How to detect expired session vs. no session? (Solved)
> 
> 
> I'm a bit puzzled.  There is something not quite right here 
> (or maybe I'm
> not quite understanding correctly).  Aren't sessions created 
> as soon as a
> JSP within a ServletContext is accessed, irrespective of 
> whether the user
> authenticates or not?  Thus invalid sessions vs anonymous 
> sessions is not an
> either/or choice - a session can be both valid and 
> authenticated, or both
> valid and anonymous.  Is "invalid" the same as "expired"?
> 
> Also there seems to be a slight contradiction in what you say 
> below, because
> if request.getSession returns null for an invalidated 
> session, how can you
> then call isRequestedSessionIdValid() on an invalidated 
> session without
> getting a NullPointerException?  I realise that the method is 
> not called on
> the session object directly, but surely it must access the 
> session object at
> least indirectly?
> 
> > -Original Me

RE: How to detect expired session vs. no session? (Solved)

2004-12-08 Thread Steve Kirk
I'm a bit puzzled.  There is something not quite right here (or maybe I'm
not quite understanding correctly).  Aren't sessions created as soon as a
JSP within a ServletContext is accessed, irrespective of whether the user
authenticates or not?  Thus invalid sessions vs anonymous sessions is not an
either/or choice - a session can be both valid and authenticated, or both
valid and anonymous.  Is "invalid" the same as "expired"?

Also there seems to be a slight contradiction in what you say below, because
if request.getSession returns null for an invalidated session, how can you
then call isRequestedSessionIdValid() on an invalidated session without
getting a NullPointerException?  I realise that the method is not called on
the session object directly, but surely it must access the session object at
least indirectly?

> -Original Message-
> From: LAM Kwun Wa Joseph [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 08 December 2004 11:23
> To: [EMAIL PROTECTED]
> Subject: RE: How to detect expired session vs. no session? (Solved)
> 
> 
> Confirmed that request.getSession(false)==null for both 
> expired session
> requests and anonymous requests, if I have <%@ page 
> session="false" %> in
> my pages.
> 
> I just figured out the follow which work exactly what I wanted:
> 
> boolean hasSessionID =
> (request.isRequestedSessionIdFromURL() ||
> request.isRequestedSessionIdFromCookie());
> 
> if (hasSessionID && !request.isRequestedSessionIdValid()) {
> // expired/invalidated session
> }
> else {
> // no session at all
> }
> 
> 
> > I haven't tested this, but I *think* that a request containing an
> > expired session will still return a non-null session object, but a
> > different instance to the one that would have been returned 
> pre-timeout.
> >  But I don't know that for a fact.  why not just test it 
> out yourself,
> > it's not that hard, just shorten the timeout interval first 
> so that you
> > don't have to wait 30 mins to do your test ;)
> >
> >> -Original Message-
> >> From: LAM Kwun Wa Joseph [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday 08 December 2004 09:35
> >> To: [EMAIL PROTECTED]
> >> Subject: RE: How to detect expired session vs. no session?
> >>
> >>
> >> But does it have the same effect for a request with an
> >> expired session vs
> >> a request with no session at all? I think it will return 
> null in both
> >> cases.
> >>
> >> > if you call request.getSession(false) this will return 
> null if the
> >> request is not associated with a request already.  the 
> "false" param
> >> turns off the default behaviour of creating a new session when none
> >> exists.
> >> >
> >> >> -Original Message-
> >> >> From: LAM Kwun Wa Joseph [mailto:[EMAIL PROTECTED]
> >> >> Sent: Wednesday 08 December 2004 08:23
> >> >> To: [EMAIL PROTECTED]
> >> >> Subject: How to detect expired session vs. no session?
> >> >>
> >> >>
> >> >> Hi,
> >> >>
> >> >> How can I tell between a request using an expired session
> >> vs a request
> >> >> with no session at all? I need to show different messages to
> >> >> users being
> >> >> kicked due to inactivity and to anonymous users. Thanks!
> >> >>
> >> >> Regards,
> >> >> Joseph Lam
> >> >>
> >> >>
> >> >>
> >> >>
> >> 
> -
> >> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED] For
> >> >> additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> >
> >> --
> >> --- To
> >> > unsubscribe, e-mail: 
> [EMAIL PROTECTED] For
> >> additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >> 
> -
> >> To unsubscribe, e-mail: 
> [EMAIL PROTECTED] For
> >> additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
> > 
> --
> --- To
> > unsubscribe, e-mail: [EMAIL PROTECTED] For
> > additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: How to detect expired session vs. no session?

2004-12-08 Thread Steve Kirk
I haven't tested this, but I *think* that a request containing an expired
session will still return a non-null session object, but a different
instance to the one that would have been returned pre-timeout.  But I don't
know that for a fact.  why not just test it out yourself, it's not that
hard, just shorten the timeout interval first so that you don't have to wait
30 mins to do your test ;)

> -Original Message-
> From: LAM Kwun Wa Joseph [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 08 December 2004 09:35
> To: [EMAIL PROTECTED]
> Subject: RE: How to detect expired session vs. no session?
> 
> 
> But does it have the same effect for a request with an 
> expired session vs
> a request with no session at all? I think it will return null in both
> cases.
> 
> > if you call request.getSession(false) this will return null if the
> > request is not associated with a request already.  the "false" param
> > turns off the default behaviour of creating a new session when none
> > exists.
> >
> >> -Original Message-
> >> From: LAM Kwun Wa Joseph [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday 08 December 2004 08:23
> >> To: [EMAIL PROTECTED]
> >> Subject: How to detect expired session vs. no session?
> >>
> >>
> >> Hi,
> >>
> >> How can I tell between a request using an expired session 
> vs a request
> >> with no session at all? I need to show different messages to
> >> users being
> >> kicked due to inactivity and to anonymous users. Thanks!
> >>
> >> Regards,
> >> Joseph Lam
> >>
> >>
> >>
> >> 
> -
> >> To unsubscribe, e-mail: 
> [EMAIL PROTECTED] For
> >> additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
> > 
> --
> --- To
> > unsubscribe, e-mail: [EMAIL PROTECTED] For
> > additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: How to detect expired session vs. no session?

2004-12-08 Thread Steve Kirk
if you call request.getSession(false) this will return null if the request
is not associated with a request already.  the "false" param turns off the
default behaviour of creating a new session when none exists.

> -Original Message-
> From: LAM Kwun Wa Joseph [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 08 December 2004 08:23
> To: [EMAIL PROTECTED]
> Subject: How to detect expired session vs. no session?
> 
> 
> Hi,
> 
> How can I tell between a request using an expired session vs a request
> with no session at all? I need to show different messages to 
> users being
> kicked due to inactivity and to anonymous users. Thanks!
> 
> Regards,
> Joseph Lam
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: when to use <%@include%> when to use

2004-12-07 Thread Steve Kirk
Here's one perspective based on one way I have used them. there are others.

<%@ include%> is useful when you know the name of the page you want to
include at coding time.

 is useful when you do not know the name of the page you want
to include until execution time, because it can evaluate jsp expressions to
come up with the value of the page attribute. for example I use this code in
a generic page, which assembles a page on the fly according to params that
have been passed to the JSP from my servlet, allowing the same core page
data to be presented within any page layout that you choose.

" />

" />

> -Original Message-
> From: Zerol Tib [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 07 December 2004 16:29
> To: [EMAIL PROTECTED]
> Subject: when to use <[EMAIL PROTECTED]> when to use 
> 
> 
> Howdy,
> 
> As we know, <%@ include%> can include another jsp page 
> at "translation time" while  can include another 
> jsp at "runtime". But when to use each? Could anyone give me
> a scenario?
> 
> Thanks in Advance.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: getting desperate here :)

2004-12-03 Thread Steve Kirk
>From reading your post below, I'm not sure what your problem is, or what you
are trying to achieve.  I must have missed your previous emails.  Can you
explain in a bit more detail?

> -Original Message-
> From: Alex Korneyev [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 02 December 2004 15:06
> Cc: 'Tomcat Users List '
> Subject: getting desperate here :)
> 
> 
> Hello all,
> 
>   i have sent this one before, but i am hoping someone else has
>   had this particular problem.
>   __
> 
> 
>  i am hoping someone has seen the following behavior.
> 
> 
>  TomcatA sends a redirect to TomcatB
> 
>  on the backend, I can see that TomcatB receives a JSESSIONID that was
>  originally assigned to it by TomcatA;
> 
>  i.e. cookie = JSESSIONID=6EF95FA9AA98E608C555E28875F57054;
> 
> 
>  I rewrite reset the jsession id ( see the code bellow ), but
> 
> 
>  on the next request i see this:
> 
>  cookie = JSESSIONID=6EF95FA9AA98E608C555E28875F57054; 
> JSESSIONID=2251830F6F64DEFC974C19C79F1EABAB
> 
>  for some reason using Mozilla works, but I.E. is the one that passes
>  2 JSESSIONID variables. Thoughts?
> 
> if (cookies != null && cookies.length > 0)
> {
> int len = cookies.length;
> for (int i = 0; i < len; i++)
> {
> if 
> (cookies[i].getName().equalsIgnoreCase("jsessionid"))
> {
> cookies[i].setMaxAge(-1);
> cookies[i].setPath("/");
> _LOGGER.debug("COOKIE 
> VALUE " + cookies[i].getValue() );
> 
> _LOGGER.debug("session id:  " +  request.getSession().getId() );
> _LOGGER.debug(" comp" + (
> request.getSession().getId().equals(cookies[i].getValue(;
> if ( 
> request.getSession().getId().equals(cookies[i].getValue()))
> {
> 
> _LOGGER.debug("equal");
> 
> response.addCookie(cookies[i]);
> }
> else
> {
> 
> _LOGGER.debug("not equal");
> Cookie 
> sessionCookie = new Cookie("JSESSIONID",
> request.getSession().getId());
> 
> response.addCookie(sessionCookie);
> }
> foundCookie = true;
> 
> _LOGGER.debug("updated session cookie");
> 
> }
> }
> } 
> 
>  
> 
>  
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



DbcpDataSourceFactory ClassNotFoundException

2004-11-11 Thread Steve Kirk

My webapp has a working JDBC DataSource configured in META-INF/context.xml.

The JNDI how-to mentions that the default factory for TC-managed JDBC
DataSources (i.e. those configured as a  in the config files) is
org.apache.naming.factory.DbcpDataSourceFactory, but if I configure that as
my factory param for my DataSource, I get a ClassNotFoundException, so I
looked in my common, shared and server folders but couldn't find it in any
of the classes folders or the jars...?

If I eliminate the factory param altogether, the app works fine.



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



RE: Are all TC-managed DataSources pooled?

2004-11-11 Thread Steve Kirk
OK thanks, some useful points.  I'll do some more reading. :)

> > So I'm going to submit an enhacement suggestion for the docs
> > (5.0.x/5.5.x),
> > as they imply that DBCP is always used for datasources.
> 
> The docs give a DBCP example.  If someone needs to be told another
> implementation can be plugged in, they not competent enough 
> to be doing the plugging.

That's not the point I'm making.  The jndi-resource-how-to ('JDBC Data
Sources', '0. Introduction') 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html#JD
BC%20Data%20Sources 
says, "Many web applications need to access a database via a JDBC driver
The J2EE Platform Specification requires J2EE Application Servers to make
available a DataSource implementation (that is, a connection pool for JDBC
connections) for this purpose."  Surely this is not correct given what we've
already said, i.e. the connection pool is not required?

> Your understanding is wrong.  BasicDataSource can be pooled or not,
> depending on how you configure it.

OK.  By "configure" are you just meaning the maxActive, maxIdle params, or
there more to it than that, in determining whether it's pooled or not?  e.g.
the choice of factory class perhaps?

Thanks :)

> -Original Message-
> From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 11 November 2004 14:51
> To: Tomcat Users List
> Subject: RE: Are all TC-managed DataSources pooled?
> 
> 
> 
> Hi,
> 
> >So I'm going to submit an enhacement suggestion for the docs
> (5.0.x/5.5.x),
> >as they imply that DBCP is always used for datasources.
> 
> The docs give a DBCP example.  If someone needs to be told another
> implementation can be plugged in, they not competent enough 
> to be doing
> the plugging.  But if you feel like clarifying ad-nauseam, 
> feel free to
> submit doc patches as always.
> 
> >Is this a case where I might use
> org.apache.commons.dbcp.BasicDataSource?
> >As far as I understand it, that class is DBCP's "standard" non-pooled
> >DataSource...?
> 
> Your understanding is wrong.  BasicDataSource can be pooled or not,
> depending on how you configure it.
> 
> >And, are the following valid ways to tell whether a DataSource or
> >Connection
> >has come from a pooled or non-pooled source? :
> > if (conn instanceof javax.sql.PooledConnection)
> > if (dataSource instanceof javax.sql.ConnectionPoolDataSource)
> 
> They're not conclusive ways.  There might not be a conclusive 
> *portable*
> way to tell.  It depends on the pooling implementation.
> 
> >which both fail the tests above, despite the latter's name implying
> >poolability
> 
> Implications are just that, nothing concrete.  Your tests are 
> incorrect.
> 
> >Maybe BasicDataSourceFactory does not produce a pooled DataSource(?),
> but
> 
> It produces a BasicDataSource, which may or may not be pooling.
> 
> >And I can't see another class within DBCP that looks like the pooled
> >datasource factory that I need to specify in my "factory" param...?
> 
> You need to read the JNDI (not just JDBC DataSource) doc again, and/or
> make sure you understand the concept of a factory class.  The 
> latter is
> not in the scope of Tomcat documentation.  
> 
> DBCP provides numerous factories, all of which can produce pooling AND
> non-pooling data sources, and the pools provided have different
> strategies.  Not all resource pooling is the same.
> 
> Yoav
> 
> 
> 
> This e-mail, including any attachments, is a confidential 
> business communication, and may contain information that is 
> confidential, proprietary and/or privileged.  This e-mail is 
> intended only for the individual(s) to whom it is addressed, 
> and may not be saved, copied, printed, disclosed or used by 
> anyone else.  If you are not the(an) intended recipient, 
> please immediately delete this e-mail from your computer 
> system and notify the sender.  Thank you.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Are all TC-managed DataSources pooled?

2004-11-11 Thread Steve Kirk
Thanks Yoav.  I see your original reply in the archive now, but I never got
it via email.  Strange.  I do occasionally get notifications from ezmlm that
my mailbox has been bouncing mails, but haven't had one of those for a
while.  I think the bouncing is due to false positives at my ISP spamfilter,
as my mailbox has plenty of free space.

So I'm going to submit an enhacement suggestion for the docs (5.0.x/5.5.x),
as they imply that DBCP is always used for datasources.

a couple more follow up Qs to clarify if you wouldn't mind:

> there are valid use-cases where you 
> don't want them pooled, although those are fairly esoteric.

Is this a case where I might use org.apache.commons.dbcp.BasicDataSource?
As far as I understand it, that class is DBCP's "standard" non-pooled
DataSource...?

And, are the following valid ways to tell whether a DataSource or Connection
has come from a pooled or non-pooled source? :
 if (conn instanceof javax.sql.PooledConnection)
 if (dataSource instanceof javax.sql.ConnectionPoolDataSource)

I ask this because, whether I specify the factory class or not, the
DataSource/Connection classes I get back are:
datasource class = org.apache.commons.dbcp.BasicDataSource
connection class =
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper

which both fail the tests above, despite the latter's name implying
poolability

Maybe BasicDataSourceFactory does not produce a pooled DataSource(?), but
this seems odd given that it is the recommended class to use in the "MySql
DBCP example" in the docs here: 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html 

And I can't see another class within DBCP that looks like the pooled
datasource factory that I need to specify in my "factory" param...?

> -Original Message-
> From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 11 November 2004 13:24
> To: Tomcat Users List
> Subject: RE: Are all TC-managed DataSources pooled?
> 
> 
> 
> Hi,
> I already answered this... Maybe my post was lost.
> 
> >I had a search through the J2EE spec.  It does not appear to me to
> >_require_
> >that DataSources are provided in a pooled implementation.  
> It seems to
> be
> >preferred.  For example:
> 
> You're right.  Containers are required to support binding of a
> DataSource, but it doesn't have to be pooling.  Most implementations
> give the user the choice, as does Tomcat.  You can use DBCP in
> non-pooling ways (set maxActive to infinite), or use any DataSource
> implementation whether it supports pooling or not.
> 
> >Also there are the other Qs in my last post - including, what is the
> effect
> >of including this:
> > 
> > factory
> >
> >org.apache.commons.dbcp.BasicDataSourceFactory
> > 
> 
> That's effectively required for Tomcat to be able to create
> org.apache.commons.dbcp.BasicDataSource instances.  The general JNDI
> approach in Tomcat is factory-based (this has since been replicated in
> many other server implementations), where the provider impl includes a
> factory, so Tomcat doesn't actually ever call x = new
> BasicDataSource(...).
> 
> >To reiterate, my original issue is that I'm trying to understand
> whether or
> >not TC *always* pools container-managed DataSources.
> 
> That's a simple No.  And there are valid use-cases where you 
> don't want
> them pooled, although those are fairly esoteric.
> 
> I wonder where my original post in this thread, which had all this
> information, went ;)
> 
> Yoav



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



RE: Multi-Site Clustering? (hot failover)

2004-11-11 Thread Steve Kirk
Thanks again and yes, I agree - ideally at least 2 servers in each of at
least 2 locations.  And I'm familiar with the approach shown in your diagram
for a single location, having done something similar a few years ago.

But the original point that Steven was making is, what happens if one of
those location suddenly goes down completely, for whatever reason, so that
all servers at that locaiton are effectively down?  I think that the DNS
issues I have mentioned come into play then, and I'm questioning how
browsers would deal with this - I think many of them will continue to try to
access the servers at the failed location.

> -Original Message-
> From: Peter Lin [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 11 November 2004 13:12
> To: Tomcat Users List
> Subject: Re: Multi-Site Clustering? (hot failover)
> 
> 
> the kind of setup I've seen is to handle it with a load balancing
> router and a cluster of servers. Using just one server doesn't feel
> too redundant or fault tolerant to me. In the past, we had the router
> direct traffic, so that if a single webserver is down, it quickly
> directs it to a good server. So if the setup is like this
> 
> ISP dns --> load balanced router (n webservers)
> / | \
>   /   |   \
>w1  w2  w3
> 
> if w1.mydomain.com goes down, the router should direct traffic to w2
> or w3.  usually, there's some script or daemon running on each box to
> make sure the webserver process is running. If not, it sends out an
> email and tries to restart it.  I know this approach works, but for a
> single webserver in two locations, I don't know first hand. If someone
> is going to the trouble of having two servers in different locations,
> it makes sense to me to put atleast 2 servers in each place. The cost
> is minimal and you get much better fault tolerance.
> 
> peter
> 
> 
> On Thu, 11 Nov 2004 12:56:06 -, Steve Kirk
> <[EMAIL PROTECTED]> wrote:
> > Yes that's true and I have used that feature in the past by 
> asking our ISP
> > (registrar) to enter multiple A records in the primary DNS.
> > 
> > However, the point of this thread is that Steven was asking 
> about the
> > situation where one of the webservers then goes down.  In this case,
> > third-party ISP DNS servers will have cached both the main 
> and backup server
> > entries, and will continue to do so for up to 48 hours (or 
> maybe longer in
> > the case of DNSs that ignore TTL).  So my understanding it 
> that in this
> > case, browsers will potentially try to access both the 
> sites - including the
> > one which has failed.
> > 
> > I am basing this statement on experience from 2-3 years 
> ago.  Maybe things
> > have changed so that this is not a concern anymore? e.g. 
> maybe browsers are
> > smarter at using multiple A records from DNS, so that if one is not
> > reachable they switch to the other, or re-query the DNS, 
> maybe secondary
> > DNSs re-query before TTL if all the A records for a domain name are
> > unreachable, maybe nearly all ISPs now respect TTL?  If 
> anyone can comment
> > on these I'd be interested, because it makes Steven's original idea
> > feasible.
> > 
> > 
> > 
> > > -Original Message-
> > > From: Filip Hanik - Dev [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday 11 November 2004 02:03
> > > To: Tomcat Users List
> > > Subject: Re: Multi-Site Clustering? (hot failover)
> > >
> > >
> > > if you have two TC instances running at two different IP
> > > addresses and they are both up,
> > > just put in DNS loadbalancing (ie, configure DNS to have both
> > > IP addresses in the A records)
> > > you don't need to run DNS to do this
> > >
> > > Filip
> > >
> > > - Original Message -
> > > From: "Steve Kirk" <[EMAIL PROTECTED]>
> > > To: "'Tomcat Users List'" <[EMAIL PROTECTED]>;
> > > "'Peter Lin'" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, November 10, 2004 7:57 PM
> > > Subject: RE: Multi-Site Clustering? (hot failover)
> > >
> > >
> > > Thanks, interesting.  But I think we're talking at crossed
> > > purposes.  I'm
> > > not proposing running my own DNS, and I don't have an
> > > existing installation.
> > > Just an idea of maybe deploying two indentical TC webservers
> > > at different
> > > ISPs.
> > >
> > > What I'm saying is

RE: Are all TC-managed DataSources pooled?

2004-11-11 Thread Steve Kirk
Thanks for your comments Doug.  Good point re relevance of javax.sql API
docs.

I had a search through the J2EE spec.  It does not appear to me to _require_
that DataSources are provided in a pooled implementation.  It seems to be
preferred.  For example:

J2EE.5.4.3 ("J2EE Product Provider's Responsibilities") says, "While not
required by this specification, most J2EE products will provide the
following features:.. A mechanism to pool resources for the application
components and otherwise manage the use of resources by the container. The
pooling must be transparent to the application components."

J2EE6.2.4.3 ("JDBC API") says, "The JDBC API includes APIs for ...
connection pooling ... The connection pooling and distributed transaction
features are intended for use by JDBC drivers to coordinate with an
application server. J2EE products are not required to support the
application server facilities described by these APIs, although they may
prove useful."

Can anyone point me at a section of J2EE that says that pooling is required
for container-managed DataSources?

Also there are the other Qs in my last post - including, what is the effect
of including this:

factory

org.apache.commons.dbcp.BasicDataSourceFactory


as suggested at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html 
compared to not including a "factory" param at all?

To reiterate, my original issue is that I'm trying to understand whether or
not TC *always* pools container-managed DataSources.

> -Original Message-
> From: Parsons Technical Services 
> [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 11 November 2004 02:37
> To: Tomcat Users List
> Subject: Re: Are all TC-managed DataSources pooled?
> 
> 
> > Is every container-managed DataSource configured in TC (e.g. via 
> > server.xml
> > / context.xml) automatically made pooled using commons pooling?
> 
> Yes. No additional code is needed (i.e. TC takes care of the pool.)
> 
> Or can
> > ordinary non-pooled connections be created too using this mechanism?
> >
> No, as it would not be compliant. It might be possible to 
> create a pool of 
> one connection, but it would still be handled as a pool.
> 
> To answer your original questions:
> 
> 
> >> Now, I'm *not* criticising the docs, I'm seeking
> >> clarification.  I'm not
> >> sure whether this is saying that a JDBC DataSource has to be
> >> pooled?  Or is
> >> instead saying that J2EE requires pooled JDBC connections, or
> >> maybe that
> >> J2EE requires connections via a DataSource?
> >>
> To meet the J2EE requirement the DataSource method must be 
> made avalible in 
> a pooled configuration.
> 
> 
> >> I didn't think that DataSources had to be pooled, based on
> >> what is says
> >> here:
> >> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html
> >>
> 
> This is only the API for the language. The language may be 
> able to do many 
> things that are not compliant with the J2EE standard 
> reguarding the server. 
> Think about if you were writing a stand alone desktop app and 
> had it talking 
> to a datasource. The J2EE requirements for the server are of 
> no interest and 
> don't apply.
> 
> >> This might sound like nit picking, but the answer to this
> >> will help me help
> >> someone else on another thread.  Thanks.
> >
> 
> Hope they get the picture.
> 
> Doug
> www.parsonstechnical.com
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Multi-Site Clustering? (hot failover)

2004-11-11 Thread Steve Kirk
Yes that's true and I have used that feature in the past by asking our ISP
(registrar) to enter multiple A records in the primary DNS.

However, the point of this thread is that Steven was asking about the
situation where one of the webservers then goes down.  In this case,
third-party ISP DNS servers will have cached both the main and backup server
entries, and will continue to do so for up to 48 hours (or maybe longer in
the case of DNSs that ignore TTL).  So my understanding it that in this
case, browsers will potentially try to access both the sites - including the
one which has failed.

I am basing this statement on experience from 2-3 years ago.  Maybe things
have changed so that this is not a concern anymore? e.g. maybe browsers are
smarter at using multiple A records from DNS, so that if one is not
reachable they switch to the other, or re-query the DNS, maybe secondary
DNSs re-query before TTL if all the A records for a domain name are
unreachable, maybe nearly all ISPs now respect TTL?  If anyone can comment
on these I'd be interested, because it makes Steven's original idea
feasible.

> -Original Message-
> From: Filip Hanik - Dev [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 11 November 2004 02:03
> To: Tomcat Users List
> Subject: Re: Multi-Site Clustering? (hot failover)
> 
> 
> if you have two TC instances running at two different IP 
> addresses and they are both up,
> just put in DNS loadbalancing (ie, configure DNS to have both 
> IP addresses in the A records)
> you don't need to run DNS to do this
> 
> Filip
> 
> - Original Message - 
> From: "Steve Kirk" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; 
> "'Peter Lin'" <[EMAIL PROTECTED]>
> Sent: Wednesday, November 10, 2004 7:57 PM
> Subject: RE: Multi-Site Clustering? (hot failover)
> 
> 
> Thanks, interesting.  But I think we're talking at crossed 
> purposes.  I'm
> not proposing running my own DNS, and I don't have an 
> existing installation.
> Just an idea of maybe deploying two indentical TC webservers 
> at different
> ISPs.
> 
> What I'm saying is that if I have two identical TC servers, 
> one at ISP A and
> one at ISP B, and my DNS is managed by one (or even both) of 
> them, then if
> my main server fails, it doesn't matter how quick or clever the DNS
> management of A or B is, if users connect to my site via 
> other ISPs (C, D,
> etc) whose DNS servers don't respect my ISP's low TTL. I know 
> that this used
> to be a problem, I'm not sure how much it is these days.
> 
> > -Original Message-
> > From: Peter Lin [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday 10 November 2004 23:50
> > To: Tomcat Users List
> > Subject: Re: Multi-Site Clustering? (hot failover)
> > 
> > 
> > I would check the service level agreement for DNS load balancing
> > across multiple sites. The big guys like Level3, global 
> crossing, mci
> > have this stuff worked out so that when a DNS server does fail, it
> > does get routed immediately. typically that means you actually don't
> > handle DNS at all in your servers.
> > 
> > the ISP handles that completely. If you were running DNS on one of
> > your boxes, they would have a hard time meeting the SLA. The general
> > rule is to set it up and then unplug the CAT5 cable and see how
> > quickly the traffic gets routed to the other cluster.
> > 
> > on a previous job, we did that and it was pretty seamless. it wasn't
> > cheap either since we had a couple of full cabinets at two different
> > locations.
> > 
> > peter
> > 
> > 
> > On Wed, 10 Nov 2004 22:52:08 -, Steve Kirk
> > <[EMAIL PROTECTED]> wrote:
> > > 
> > > OK that's roughly what I thought.  But IME this does not 
> > switch things over
> > > fast enough to count as a "hot failover".  Maybe I'm not 
> > aware of a premium
> > > service that's available, but my experience has been that 
> > DNS updates don't
> > > propagate fast enough for this.  There are often customers 
> > that cannot reach
> > > the site after a DNS change for 24-48 hours, or even more 
> > in some cases.
> > > 
> > > IME the problem seems to be that some secondary DNSs (e.g. 
> > those provided by
> > > some of your end users' ISPs) don't seem to respect TTL in 
> > the DNS records,
> > > and so they keep stale records without checking for 
> > updates, even if you
> > > specify a short TTL.  This is a problem

RE: Multi-Site Clustering? (hot failover)

2004-11-10 Thread Steve Kirk
Thanks, interesting.  But I think we're talking at crossed purposes.  I'm
not proposing running my own DNS, and I don't have an existing installation.
Just an idea of maybe deploying two indentical TC webservers at different
ISPs.

What I'm saying is that if I have two identical TC servers, one at ISP A and
one at ISP B, and my DNS is managed by one (or even both) of them, then if
my main server fails, it doesn't matter how quick or clever the DNS
management of A or B is, if users connect to my site via other ISPs (C, D,
etc) whose DNS servers don't respect my ISP's low TTL. I know that this used
to be a problem, I'm not sure how much it is these days.

> -Original Message-
> From: Peter Lin [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 10 November 2004 23:50
> To: Tomcat Users List
> Subject: Re: Multi-Site Clustering? (hot failover)
> 
> 
> I would check the service level agreement for DNS load balancing
> across multiple sites. The big guys like Level3, global crossing, mci
> have this stuff worked out so that when a DNS server does fail, it
> does get routed immediately. typically that means you actually don't
> handle DNS at all in your servers.
> 
> the ISP handles that completely. If you were running DNS on one of
> your boxes, they would have a hard time meeting the SLA. The general
> rule is to set it up and then unplug the CAT5 cable and see how
> quickly the traffic gets routed to the other cluster.
> 
> on a previous job, we did that and it was pretty seamless. it wasn't
> cheap either since we had a couple of full cabinets at two different
> locations.
> 
> peter
> 
> 
> On Wed, 10 Nov 2004 22:52:08 -, Steve Kirk
> <[EMAIL PROTECTED]> wrote:
> > 
> > OK that's roughly what I thought.  But IME this does not 
> switch things over
> > fast enough to count as a "hot failover".  Maybe I'm not 
> aware of a premium
> > service that's available, but my experience has been that 
> DNS updates don't
> > propagate fast enough for this.  There are often customers 
> that cannot reach
> > the site after a DNS change for 24-48 hours, or even more 
> in some cases.
> > 
> > IME the problem seems to be that some secondary DNSs (e.g. 
> those provided by
> > some of your end users' ISPs) don't seem to respect TTL in 
> the DNS records,
> > and so they keep stale records without checking for 
> updates, even if you
> > specify a short TTL.  This is a problem at the best of 
> times, let alone when
> > your main site has failed.  It seems to me that 
> occasionally, some DNSs also
> > seem to miss changes in SOA, which can be disastrous if you 
> move your DNS to
> > a new ISP.
> > 
> > As far as I can see, there is no way to get around these 
> glitches because
> > the secondary DNSs are under the control of an ISP that you 
> do not have a
> > relationship with?  Or are the problems I'm describing 
> a thing of the
> > past?
> > 
> > 
> > 
> > > -Original Message-
> > > From: Filip Hanik - Dev [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday 10 November 2004 19:14
> > > To: Tomcat Users List; Peter Lin
> > > Subject: Re: Multi-Site Clustering? (hot failover)
> > >
> > >
> > > which might also give you the idea, if you control your own
> > > DNS, you could manually switch it over to a new set of IP
> > > addresses when
> > > your old data center blows up.
> > >
> > >
> > > Filip
> > >
> > > - Original Message -
> > > From: "Peter Lin" <[EMAIL PROTECTED]>
> > > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, November 10, 2004 1:08 PM
> > > Subject: Re: Multi-Site Clustering? (hot failover)
> > >
> > >
> > > normally ISP will offer multi-site load balancing using 
> DNS. In terms
> > > of failover, it generally handled the same way. If an earthquake
> > > swallows the first location, the second site's DNS will 
> pick and route
> > > the traffic to the second cluster.
> > >
> > > I would talk to your service provider. the smaller shops 
> don't offer
> > > it, so you'll have to talk to a bigger ISP.
> > >
> > > peter
> > >
> > >
> > >
> > > On Wed, 10 Nov 2004 12:52:17 -0600, Filip Hanik - Dev
> > > <[EMAIL PROTECTED]> wrote:
> > > > Even a data

RE: Are all TC-managed DataSources pooled?

2004-11-10 Thread Steve Kirk

No interest in my original post so I'll rephrase.

Is every container-managed DataSource configured in TC (e.g. via server.xml
/ context.xml) automatically made pooled using commons pooling?  Or can
ordinary non-pooled connections be created too using this mechanism?

> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 09 November 2004 00:45
> To: 'Tomcat Users List'
> Subject: Are all TC-managed DataSources pooled?
> 
> The docs under 'JDBC Data Sources' at 
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources
> -howto.html 
> say, "The J2EE Platform Specification requires J2EE 
> Application Servers to
> make available a DataSource implementation (that is, a 
> connection pool for
> JDBC connections)."  
> 
> Now, I'm *not* criticising the docs, I'm seeking 
> clarification.  I'm not
> sure whether this is saying that a JDBC DataSource has to be 
> pooled?  Or is
> instead saying that J2EE requires pooled JDBC connections, or 
> maybe that
> J2EE requires connections via a DataSource?
> 
> I didn't think that DataSources had to be pooled, based on 
> what is says
> here: 
> http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html 
> 
> This might sound like nit picking, but the answer to this 
> will help me help
> someone else on another thread.  Thanks.



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



RE: Multiple Servlet Mapping Problem

2004-11-10 Thread Steve Kirk
Interesting.

I had a quick browse of the servlet spec and it doesn't seem to say either
that you can or cannot do this.

However these guys seems to reckon it works on TC: 
http://archives.java.sun.com/cgi-bin/wa?A2=ind0103&L=servlet-interest&F=&S=&;
P=50479 

If it is possible, your config looks fine to me.

> -Original Message-
> From: Dana Cordes [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 10 November 2004 22:37
> To: [EMAIL PROTECTED]
> Subject: Multiple Servlet Mapping Problem
> 
> 
> Is it possible to have two separate servlets, with separate 
> configurations pointing to the same class? 
> 
> Here's my situation, I have a servlet class that has several 
> init-parameters.  I want to have a second instance of that 
> same servlet 
> running with different parameters.  But it doesn't seem to be working 
> properly. 
> 
> Here's an excerpt from my web.xml:
> 
>   MasterControl
>   com.foo.bar.core.MasterControl
>   
> CONTROL_PARAMETER_NAME
> command1
>   
> 
> 
>   MasterControlURA
>   com.foo.bar.core.MasterControl
>   
> CONTROL_PARAMETER_NAME
> command2
>   
> 
> 
>   MasterControl
>   /aop
> 
> 
>   MasterControlURA
>   /ura
> 
> 
> What I see is both mapping running, but only displaying the 
> config from 
> the first servlet definition.  Is there something special 
> that I have to 
> do to get this running correctly?  Is it even possible?
> 
> -Dana Cordes
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Multi-Site Clustering? (hot failover)

2004-11-10 Thread Steve Kirk

OK that's roughly what I thought.  But IME this does not switch things over
fast enough to count as a "hot failover".  Maybe I'm not aware of a premium
service that's available, but my experience has been that DNS updates don't
propagate fast enough for this.  There are often customers that cannot reach
the site after a DNS change for 24-48 hours, or even more in some cases.

IME the problem seems to be that some secondary DNSs (e.g. those provided by
some of your end users' ISPs) don't seem to respect TTL in the DNS records,
and so they keep stale records without checking for updates, even if you
specify a short TTL.  This is a problem at the best of times, let alone when
your main site has failed.  It seems to me that occasionally, some DNSs also
seem to miss changes in SOA, which can be disastrous if you move your DNS to
a new ISP.

As far as I can see, there is no way to get around these glitches because
the secondary DNSs are under the control of an ISP that you do not have a
relationship with?  Or are the problems I'm describing a thing of the
past?

> -Original Message-
> From: Filip Hanik - Dev [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 10 November 2004 19:14
> To: Tomcat Users List; Peter Lin
> Subject: Re: Multi-Site Clustering? (hot failover)
> 
> 
> which might also give you the idea, if you control your own 
> DNS, you could manually switch it over to a new set of IP 
> addresses when
> your old data center blows up.
> 
> 
> Filip
> 
> - Original Message -
> From: "Peter Lin" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, November 10, 2004 1:08 PM
> Subject: Re: Multi-Site Clustering? (hot failover)
> 
> 
> normally ISP will offer multi-site load balancing using DNS. In terms
> of failover, it generally handled the same way. If an earthquake
> swallows the first location, the second site's DNS will pick and route
> the traffic to the second cluster.
> 
> I would talk to your service provider. the smaller shops don't offer
> it, so you'll have to talk to a bigger ISP.
> 
> peter
> 
> 
> 
> On Wed, 10 Nov 2004 12:52:17 -0600, Filip Hanik - Dev
> <[EMAIL PROTECTED]> wrote:
> > Even a datacenter by itself plugs in to more than one 
> backbone (network provider)
> > So a datacenter itself has more than one connection into it.
> > So what I am saying, if you want to fail over between data 
> centers, that is not something you configure in tomcat, or in your own
> > network, that is something you probably arrange with the 
> data centers or the network providers, cause if your data center gets
> > shattered in an earth quake, all the routers in there will 
> be dead anyway.
> >
> > Filip
> >
> 

> 



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



RE: Multi-Site Clustering? (hot failover)

2004-11-10 Thread Steve Kirk
thanks for replying, but can you be a bit more specific please?  I'm stll
not understanding how this can be done.

> -Original Message-
> From: Filip Hanik - Dev [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 10 November 2004 16:47
> To: Tomcat Users List
> Subject: Re: Multi-Site Clustering? (hot failover)
> 
> 
> You need your fail over to be higher up in your network stack
> 
> Filip
> - Original Message - 
> From: "Steve Kirk" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; 
> <[EMAIL PROTECTED]>
> Sent: Wednesday, November 10, 2004 9:35 AM
> Subject: RE: Multi-Site Clustering? (hot failover)
> 
> 
> I've considered something like this in the past.  However, 
> I'd be interested
> to know how you plan to have the failover website at the 
> second take over
> when the first website dies.  In other words, how will a 
> user's browser know
> to access the website at the failover IP address rather than 
> the regular
> one?  Chaning the DNS is not going to do it for you I wouldn't have
> thought?
> 
> >  I've heard tomcat supports clustering, but I'm thinking about a
> > similar, but different situation: having a duplicate server at a
> > distant hosting center, set up to take over if the first 
> server or the
> > first hosting center encounter problems.
> > 
> >  This isn't about load, so much as reliability.  I don't *think*
> > there are any special things I need to do at the tomcat level, but I
> > figure it can't hurt to ask if I'm missing something.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Multi-Site Clustering? (hot failover)

2004-11-10 Thread Steve Kirk
I've considered something like this in the past.  However, I'd be interested
to know how you plan to have the failover website at the second take over
when the first website dies.  In other words, how will a user's browser know
to access the website at the failover IP address rather than the regular
one?  Chaning the DNS is not going to do it for you I wouldn't have
thought?

>  I've heard tomcat supports clustering, but I'm thinking about a
> similar, but different situation: having a duplicate server at a
> distant hosting center, set up to take over if the first server or the
> first hosting center encounter problems.
> 
>  This isn't about load, so much as reliability.  I don't *think*
> there are any special things I need to do at the tomcat level, but I
> figure it can't hurt to ask if I'm missing something.



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



RE: resource defined in web.xml has null attributes but server.xml is ok

2004-11-10 Thread Steve Kirk
You don't say what version.  I am aware that things are changing in this
area in 5.5.x so what I'm saying possibly applies to 5.0.x only.  Check the
docs if you have a different version.

In 5.0.x, you have to put  in web.xml if you want to be
compliant with the servlet spec.
If you do that, you do not need the  anywhere.  I don't think it's
allowed in web.xml anyway.
TC allows you to omit  and use  instead if you
really must, but this is not spec-compliant.
If you do use , it goes wherever you put  as
decribed below.

The ResourceParams can go under a number of places and this is where people
get confused.  You can put it within:
 in server.xml, in which case you need a
 under your  to point from the  to the
global resource

 in server.xml, which you will have to create under the correct
 (which is not recommended any longer)

 in server.xml, again no longer recommended

CATALINA_HOME/conf/Engine/host/yourwebappname.xml - which contains purely
the  tag

META-INF/context.xml within a war file (but not an open filesystem).  If you
choose this option, you need to pay attention to TC reloading behaviour when
you edit the .

All this is in the docs.  Well worth a read! :)
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/index.html 

> When I set up a db resource in web.xml and create it, for some reasons
> it has null's in its attributes (such as username, url, driverClass,
> ..).
> 
> But when I set up the same resource in server.xml, it works fine.
> 
> From the documentation it wasn't clear to me if both need to be set up
> the same way. i.e. I use
> 
> 
> 
>  . 
> 
> 
> in server.xml or web.xml, and then create a reference to it using
>  in web.xml.
> 
> Is this the correct way of doing this and if so any ideas on why a
> resource defined in web.xml should have null attributes when i get the
> object?
> 
> Thanks
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: jsps are not working

2004-11-10 Thread Steve Kirk
Quick guess: check that you have the default JSP servlet and mapping
enabled.  by default this is generally found in two separate chunks within
the web.xml of your tomcat's conf directory and looks a bit like this: 


jsp
org.apache.jasper.servlet.JspServlet




jsp
*.jsp


jsp
*.jspx


> -Original Message-
> From: David Stevenson [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 10 November 2004 12:06
> To: Tomcat Users List
> Subject: Re: jsps are not working
> 
> 
> On 10/11/04 11:58, "Akhthar Parvez. K" <[EMAIL PROTECTED]> wrote:
> 
> > Please let me know what I am missing
> 
> Sufficient detail in your question.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: RE: session-timeout means tomcat restart

2004-11-08 Thread Steve Kirk
sorry but no. what about the other points.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Monday 08 November 2004 22:37
> To: Tomcat Users List 
> Subject: Re: RE: session-timeout means tomcat restart
> 
> 
> We had a 'hung, and won't work without a reboot problem' and it
> was two things - we had to update some driver for the intel 
> NIC cards in our
> server (for RedHat ES) and had to change some settings to get 
> better NIC
> throughput.
> 
> Hope it helps.
> 
> - Original Message -
> From: Steve Kirk <[EMAIL PROTECTED]>
> Date: Monday, November 8, 2004 4:19 pm
> Subject: RE: session-timeout means tomcat restart
> 
> > Sorry for not replying sooner, I've been busy for a few days.
> > 
> > Can you say more about the crashing?  Any evidence from the logs?  
> > A bit
> > difficult to be any more specific without more to go on really :)
> > 
> > > However, I
> > > > have references to them from the controller so that shouldn't 
> > be the
> > > > problem... eh?
> > 
> > You mention "controller". Are you using TC as-is, or are you using a
> > framework such as struts or JSF by any chance?
> > 
> > If you suspect that the problem is triggered by a closing session, 
> > why not
> > try shortening the session timeout to a shorter length and see if 
> > it crashes
> > quicker?  In fact, it's worth checking whether the crash is around 
> > the time
> > of the session expiry or not.  If not, then your problem may not 
> > be directly
> > caused by TC at all.?
> > 
> > Do you have any event listeners?  If you have one for
> > sessionDestroyed/sessionWillPassivate, what does this code do?
> > 
> > > -Original Message-
> > > From: Eric Wulff [EMAIL PROTECTED] 
> > > Sent: Saturday 06 November 2004 00:51
> > > To: Steve Kirk
> > > Cc: Tomcat Users List
> > > Subject: Re: session-timeout means tomcat restart
> > > 
> > > 
> > > Well, this is amazingly frustrating.  My TC 5.0.28 
> running on Linux
> > > FC2 is completely crashing about every half hr when I 
> have a webapp
> > > open and don't interact with it.  I no longer have a time-out 
> > element> in my web.xml so that doesn't seem to matter.  TC 
> > shutdown and restart
> > > does not work.  Instead, I'm required to hard boot my 
> machine.  I'm
> > > hung just trying to access the static welcome page of any app,
> > > although I do know that init() of the webapp I'm working 
> on is being
> > > called.
> > > 
> > > Eric 
> > > 
> > > 
> > > On Fri, 5 Nov 2004 15:43:28 -0800, Eric Wulff 
> > > <[EMAIL PROTECTED]> wrote:
> > > > Linux FC2
> > > > TC 5.0.28
> > > > 
> > > > I'm not storing a db object within a session although I 
> am storing
> > > > objs within the session(of course - session.setAttribute).  
> > > However, I
> > > > have references to them from the controller so that shouldn't 
> > be the
> > > > problem... eh?
> > > > 
> > > > An interesting thing, I sometimes have to reboot my 
> > > machine, not just
> > > > restart TC.  Although other apps run fine, I have to reboot 
> > > my machine
> > > > in order to get TC up again.
> > > > 
> > > > I optimized my db connection, I did have it in servlet init().
> > > > Although I knew I had to do this and I'm much better off 
> > > for it, and I
> > > > appreciate you're noting it, but this didn't eliminate the 
> > crashing> > problem.
> > > > 
> > > > I also am now taking advantage of a connection pool.  
> > > However, as you
> > > > figured, that does not solve the crash problem.
> > > > 
> > > > Finally, I removed the  
> > > element from
> > > > myapp web.xml to test if this is the initiator of the problem. 
> > Let
> > > > you know what I find.  Still, even if this is what initiates the
> > > > sequence leading to a crash, it shouldn't so something need be
> > > > fixed/optimized.  Any other ideas?
> > > > 
> > > > Eric
> > > > 
> > > > 
> > > > 
> > > > 
> > > > On Fri, 5 Nov 2004 13:03:27 -, Steve Kirk
> > &g

Are all TC-managed DataSources pooled?

2004-11-08 Thread Steve Kirk

The docs under 'JDBC Data Sources' at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html 
say, "The J2EE Platform Specification requires J2EE Application Servers to
make available a DataSource implementation (that is, a connection pool for
JDBC connections)."  

Now, I'm *not* criticising the docs, I'm seeking clarification.  I'm not
sure whether this is saying that a JDBC DataSource has to be pooled?  Or is
instead saying that J2EE requires pooled JDBC connections, or maybe that
J2EE requires connections via a DataSource?

I didn't think that DataSources had to be pooled, based on what is says
here: 
http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html 

This might sound like nit picking, but the answer to this will help me help
someone else on another thread.  Thanks.




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



RE: connection pooling

2004-11-08 Thread Steve Kirk

Worth clarifyig what we are meaning by "DBCP".  The DBCP I was referring to
was the specific implementation of connection pooling that is part of
Jakarta Commons: 
http://jakarta.apache.org/commons/dbcp/ 

There are other pooling implementations which are alternatives to Commons
DBCP.

Some DB drivers included pooling support as-is.  Others do not.  For those
that do not, you need to implement pooling by building code around the
standard driver.  You used to have to do this yourself, but now there is
DBCP to take care of this for you.  DBCP is a "wrapper" used around a
non-pooling DB driver.

So, hence my question, are you intending to use DBCP, or does your Informix
driver include pooling?

>From the JNDI/JDBC guides it appears that you have the choice of using DBCP
or not (although there is one aspect of the docs that seem slightly unclear
on that, which I am going start another thread to clear up).  The configs
are similar.  Personally I have only got the DBCP approach to work, hence my
suggestion of using that, for which you need to include the factory
parameter.  What this does is basically tells TC to call DBCP rather than
your database driver when making a connection - DBCP then calls your DB
driver if and when it needs to.

I think I'm right in saying that if you don't explcitly use DBCP, and your
DB driver does not support pooling, you will end up with non-pooled
connections.  The webapp will still work but you will not have the
advantages of pooling.

In case it helps, here are my ResourceParams.  Note that I have both
"factory" and "driverClassName":



factory

org.apache.commons.dbcp.BasicDataSourceFactory


driverClassName
com.mysql.jdbc.Driver


username
me


password
secret


 url
 jdbc:mysql://localhost:3306/myDb




> -Original Message-
> From: Eric Wulff [mailto:[EMAIL PROTECTED] 
> Sent: Friday 05 November 2004 18:34
> To: Steve Kirk
> Cc: Tomcat Users List
> Subject: Re: connection pooling
> 
> 
> Steve, I am trying to use DBCP(hence the subject of the thread) and I
> believe I have a driver that supports it.  Especially considering that
> the connection works when I wrap my data resource in a DefaultContext
> tag inside a stand alone Engine tag(server.xml), instead of inside a
> Context tag(how all instructions I've followed so far suggest).
> 
> This means my driver support DBCP, correct?
> 
> The only source code I imagine would help is the code I use to gain
> connection...
> 
> Context initialContext = new InitialContext();
> Context context = (Context) initialContext.lookup("java:comp/env");
> DataSource dataSource = (DataSource) context.lookup("jdbc/wms");
> connection = dataSource.getConnection();
> 
> I have seen no mention of this factory class parameter you speak of. 
> I'm using TC 5.0.28.  I'll try it.
> 
> thx much for your help
> Eric
> 
> 
> On Fri, 5 Nov 2004 13:30:35 -, Steve Kirk
> <[EMAIL PROTECTED]> wrote:
> > Eric - you are correct,  you do not need both 
>  and 
> > (although I've found that having both does not cause a problem).
> > 
> > Back to your problem.
> > 
> > The error message indicates that TC cannot find the Resource.
> > 
> > I'm not sure if you are trying to use DBCP or not (in other 
> words, does the
> > informix driver support pooling on its own, or do you in 
> fact need DBCP or
> > some other implementation wrapped around it)?  You have
> > javax.sql.DataSource but do not list 
> the factory class
> > under your Resource, e.g. :
> > 
> > factory
> > 
> org.apache.commons.dbcp.BasicDataSourceFactory
> > 
> > 
> > I have not seen any Java source code on this thread, maybe 
> you posted it
> > before I started reading it.
> > 
> > Thinking slightly laterally I'll pass on something I 
> learned from Yoav
> > recently on this list you don't need to use 
> container-managed resources
> > to do connection pooling.  In other words you don't need to 
> set any Resource
> > or Context to get it to work.
> > 
> > 
> > 
> > > -Original Message-
> > > From: Eric Wulff [mailto:[EMAIL PROTECTED]
> > > Sent: Friday 05 November 2004 05:57
> > > To: Tomcat Users List; Atishay Kumar
> > &g

RE: How to fix: Tomcat responce time gets to 10-200 seconds once a day

2004-11-08 Thread Steve Kirk
My favourite answer to any query about a server being painfully slow:  does
the slowdown coincide with a slowdown or outage of your DNS service?  This
can have suprisingly big impact if TC is doing reverse lookups of the IP of
every request.

At the risk of asking the obvious, are you sure that some other heavy
process is not kicking off at that time, either on one of the machines you
mention, or some other machine on the network?

> -Original Message-
> From: Roman Zhovtulya [mailto:[EMAIL PROTECTED] 
> Sent: Friday 05 November 2004 18:35
> To: [EMAIL PROTECTED]
> Subject: How to fix: Tomcat responce time gets to 10-200 
> seconds once a day
> 
> 
> Dear Sirs,
> I wonder if anyone had anything similar before.
> I'm running some JSP/Java Bean websites under Tomcat (on one PC as a
> stand-alone server, on another in connection with Apache).
> 
> The website is a dynamic (3-tier architechture) connects to MySQL
> database to get the content to display any page (around 3-4 
> connections
> per page). 
> 
> Normally the performance is really good, but about once a day it gets
> really slow (around 1-5 minutes to display the page). It also recovers
> autocatically to normal response time when you simply wait 
> 5-10 minutes.
> 
> Any ideas?
> 
> I'm running Tomcat 4.05 with Apache on RedHat 8.0 (one PC) as well as
> Tomcat 4.127 on SuSE 9.0 with MySQL 4.015.
> 
> I'm closing all db-connections in JSP/JavaBeans, so I don't 
> think it's a
> db-issue.
> 
> I'd highly appreciate any help on the topic.
> 
> Thank you very much,
> Roman Zhovtulya
> 
> 
> ---
> Roman Y. Zhovtulya
> Manager
> 
> InternetServiceCenter
> Fachbereich Medien und Informationswesen
> FH Offenburg
> 
> InternetServiceCenter bietet In-House Beratung,
> professionelle und preiswerte Entwicklung von individueller Software
> Lösungen in Bereich Internet, WWW, Datenbanken, etc
> 
> 
> Kostenlose vor-Ort Istanalyse und "Sparpotenzialanalyse" für 
> potenzielle
> Kunden.
> 
> Sprechen Sie uns an:
> 
> InternetServiceCenter
> Offenburg University of Applied Sciences
> Room B205a
> Badstr. 24, Offenburg
> D-77652 Germany
> 
> VoIP ID (Skype): romanlutsk (mehr unter www.skype.com)
> Tel.: +49 781 205 137 / Fax: 290
> www.fh-offenburg.de/isc
> 
> --- 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Index.jsp

2004-11-08 Thread Steve Kirk

OK no-one's answered so here's an idea.  Not sure if this is right but maybe
if I get it wrong someone will correct me ;)

I think it's that, despite appearances, you are in fact running a
precompiled servlet class, which is installed by default, rather than a JSP
page via org.apache.jasper.servlet.JspServlet, because of the default
mappings in web.xml. Check webapps/ROOT/WEB-INF/web.xml:


org.apache.jsp.index_jsp
org.apache.jsp.index_jsp



org.apache.jsp.index_jsp
/index.jsp


What I think the above adds up to is that when you access "/index.jsp", you
run "index_jsp.class" directly, which is already installed under the
webapps/ROOT/WEB-INF/classes/org/apache/jsp directory (as well as under
webapps/ROOT/WEB-INF/lib/catalina-root.jar), and the fact that the extension
is "jsp" is in fact not relevant.  I think the mapping above also overrides
the general mapping in conf/web.xml for JSP mapping/compilation, so that
this jsp won't compile even if you change the page, because TC does not see
it as a JSP.  What I'm not sure about is why the JSP page is included at
all.  Maybe this proves that I've got it completely wrong ;)

> -Original Message-
> From: Luc Vantroys [mailto:[EMAIL PROTECTED] 
> Sent: Saturday 06 November 2004 17:52
> To: Tomcat Users List
> Subject: Index.jsp
> 
> 
> Hi,
> 
> When I modify this file, I don't see the changes in the 
> browser when I start
> Tomcat 5.0.28...
> but when I just launch that file from my hard drive, I see 
> the changes. What
> do I need to do?
> 
> Thanks,
> 
> Luc.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: session-timeout means tomcat restart

2004-11-08 Thread Steve Kirk
Sorry for not replying sooner, I've been busy for a few days.

Can you say more about the crashing?  Any evidence from the logs?  A bit
difficult to be any more specific without more to go on really :)

> However, I
> > have references to them from the controller so that shouldn't be the
> > problem... eh?

You mention "controller". Are you using TC as-is, or are you using a
framework such as struts or JSF by any chance?

If you suspect that the problem is triggered by a closing session, why not
try shortening the session timeout to a shorter length and see if it crashes
quicker?  In fact, it's worth checking whether the crash is around the time
of the session expiry or not.  If not, then your problem may not be directly
caused by TC at all.?

Do you have any event listeners?  If you have one for
sessionDestroyed/sessionWillPassivate, what does this code do?

> -Original Message-
> From: Eric Wulff [mailto:[EMAIL PROTECTED] 
> Sent: Saturday 06 November 2004 00:51
> To: Steve Kirk
> Cc: Tomcat Users List
> Subject: Re: session-timeout means tomcat restart
> 
> 
> Well, this is amazingly frustrating.  My TC 5.0.28 running on Linux
> FC2 is completely crashing about every half hr when I have a webapp
> open and don't interact with it.  I no longer have a time-out element
> in my web.xml so that doesn't seem to matter.  TC shutdown and restart
> does not work.  Instead, I'm required to hard boot my machine.  I'm
> hung just trying to access the static welcome page of any app,
> although I do know that init() of the webapp I'm working on is being
> called.
> 
> Eric 
> 
> 
> On Fri, 5 Nov 2004 15:43:28 -0800, Eric Wulff 
> <[EMAIL PROTECTED]> wrote:
> > Linux FC2
> > TC 5.0.28
> > 
> > I'm not storing a db object within a session although I am storing
> > objs within the session(of course - session.setAttribute).  
> However, I
> > have references to them from the controller so that shouldn't be the
> > problem... eh?
> > 
> > An interesting thing, I sometimes have to reboot my 
> machine, not just
> > restart TC.  Although other apps run fine, I have to reboot 
> my machine
> > in order to get TC up again.
> > 
> > I optimized my db connection, I did have it in servlet init().
> > Although I knew I had to do this and I'm much better off 
> for it, and I
> > appreciate you're noting it, but this didn't eliminate the crashing
> > problem.
> > 
> > I also am now taking advantage of a connection pool.  
> However, as you
> > figured, that does not solve the crash problem.
> > 
> > Finally, I removed the  
> element from
> > myapp web.xml to test if this is the initiator of the problem.  Let
> > you know what I find.  Still, even if this is what initiates the
> > sequence leading to a crash, it shouldn't so something need be
> > fixed/optimized.  Any other ideas?
> > 
> > Eric
> > 
> > 
> > 
> > 
> > On Fri, 5 Nov 2004 13:03:27 -, Steve Kirk
> > <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Eric Wulff [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday 05 November 2004 07:01
> > > > To: Tomcat Users List
> > > > Subject: session-timeout means tomcat restart
> > > >
> > > >
> > > > Hi, I'm experiencing 2 interesting problems that may be 
> related to my
> > > > session timeout.
> > > >
> > > > 1.  It seems that when my session times out I need to 
> restart tomcat,
> > > > often just the application via reload in the manager, 
> in order to gain
> > > > access to my db again.  Could this be because I've been 
> accessing the
> > > > db via jdbc hard coded in the servlet?  Might using a datasource
> > > > connection pool take care of this?
> > >
> > > I would say that rather than the problem being JDBC 
> hardcoded in the
> > > servlet, the problem is more likely to be _how_ that code 
> is written.
> > >
> > > if it really is the session timeout that is causing this, 
> it sounds to me
> > > like you are storing the database objects within a 
> session object (which
> > > seems a bit unusual).  or at least the last reference to 
> them is stored
> > > there, so that when the session is destroyed, the 
> database connection is
> > > lost.  it might be better to store the objects in local 
> variables within
> > > doPost if

RE: sessionS info persistence when restart Tomcat

2004-11-05 Thread Steve Kirk


> -Original Message-
> From: Ben Souther [mailto:[EMAIL PROTECTED] 

> Have you tried any of this on a fresh install of Tomcat?

No, I last installed fresh a couple of weeks back to upgrade from .27 ; I
deleted the whole CATALINA_HOME dir first.  I then replaced conf/server.xml
and conf/web.xml, and installed my warfiles.

> I think you mentioned that you have made changes to the Persistance
> Manaager in server.xml.

sort of.  I have modified server.xml, although having said that, there is no
Manager by default in server.xml, persistent or not, as far as I can tell.

My server.xml is very sparse:












> Try downloading and installing a fresh instance and run the 
> test again.
> There is a similar test war file (attachment) that looks tests the
> contextCreated/Destroyed methods here:
> http://issues.apache.org/bugzilla/show_bug.cgi?id=29521

OK, will do next week but out of time for that today.

> For what it's worth. Serialization of sessions is working for me with
> 5.0.28 running as an NT Service on windows.

aha. so it looks like it's something I screwed up ;)

out of interest, does contextDestroyed work on that platform?

> -Ben
> 
> On Fri, 2004-11-05 at 11:20, Steve Kirk wrote:
> > Thanks Ben, have looked at your war, and my test code 
> covers the same as
> > yours plus some of the other Listener events.  The 
> sessionCreated and
> > sessionDestroyed events work fine on my code (5.0.28).  The 
> problem is that
> > the other events I mentioned are not called - e.g. contextDestroyed.
> > 
> > > If your object (or any of the objects contained within it) are not
> > > serializable) tomcat will quietly not save it.
> > 
> > ok that's interesting and perhaps a little surprising given 
> that the docs
> > say that they MUST be.  I've also tried adding the 
> distributable attribute
> > to the webapp as indicated here
> > 
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/manager
> .html#Restart%
> > 20Persistence 
> > to see if that causes stricter behaviour (e.g. throwing an 
> exception when TC
> > tries to serialize session objects), but this appears to 
> make no difference
> > in my situation.
> > 
> > > try creating a real simple object that implements 
> Serializable and see
> > > if it survives a restart.
> > 
> > In effect I have already done that by restarting TC, then 
> browsing webapp
> > pages as a user that does not log in.  In this case I do 
> not assign any
> > objects to the session (I have checked this using 
> session.getAttributeNames
> > in my SessionLogger to check that there are none).  Even in 
> this case TC
> > does not serialize to SESSIONS.ser on shutdown.  So I don't 
> think that the
> > problem is serialisability?
> > 
> > Also, still can't work out why SESSIONS.ser is only 
> accessed when a new
> > warfile causes a reload and not otherwise.
> > 
> > > -Original Message-
> > > From: Ben Souther [mailto:[EMAIL PROTECTED] 
> > > Sent: Friday 05 November 2004 15:08
> > > To: Tomcat Users List
> > > Subject: RE: sessionS info persistence when restart Tomcat
> > > 
> > > 
> > > On Fri, 2004-11-05 at 09:06, Steve Kirk wrote:
> > > > > SessionDestroyed shouldn't be called when tomcat shuts down. 
> > > > 
> > > > good point.  doh!  but if I've understood correctly, 
> > > shouldn't other methods
> > > > of my SessionLogger be called?  namely sessionWillPassivate,
> > > > contextDestroyed (and possibly finalize although I'm not 
> > > 100% confident of
> > > > that).
> > > contextDestroyed does get called when you shut down tomcat. I 
> > > don't know
> > > about sessionWillPassivate.
> > > 
> > > > 
> > > > > I just tested with a
> > > > > clean install of 5.0.29 with a similar listener to the one 
> > > > > you describe.
> > > > > SessionDestroyed was not called when I stopped TC but the 
> > > > > sessions were
> > > > > still valid when I started it up.  I can give you the war 
> > > file if you
> > > > > like.
> > > > 
> > > > yes please.  email it to me off list if you prefer.
> > > 
> > > You can grab it here:
> > > http://www.souther.us/sessionTest.war
> > > 
> > > I ran it

  1   2   3   >