RE: problem: cannot autorecompile jsp

2002-08-27 Thread Julius Davies


Manoj's advice is good.  I just thought I'd elaborate on this:

"Also, tomcat looks for the entry 'reloadable' in its context entries.  If set to 
true, it will automatically reload any classes that are changed."

Often I don't bother defining context entries - it's convenient enough for me to just 
let Tomcat deploy whatever it finds in the "/webapps/" directory.  If you're doing 
things that way, then you won't be able to find any context entries in which to add 
the "reloadable" attribute.  In that case you have to add a  element 
(inside ) like so:



It's described here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/defaultcontext.html

As far as I can tell all "reloadable" is really good for is changes to the classpath - 
so new Jars, classes and properties files inside WEB-INF/classes.

In addition:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5497:

"Tomcat pays no attention at all to changes in files included by the <%@ include 
%> directive (it doesn't matter what your browser is).  If you want the JSP page 
to be recompiled, you must modify the timestamp of the JSP page itself."

- Craig McClanahan, 2001-12-19


Here are two ways to force a complete recompile of every jsp:
1. "touch" every jsp (the unix utility that changes the datestamp on files).
2. or delete all subdirectories inside /Tomcat/work/* and restart Tomcat.


Julius Davies
Programmer
Credit Union Central of British Columbia
604-730-6385
[EMAIL PROTECTED]


> -Original Message-
> From: koktsing [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 26, 2002 10:25 PM
> To: [EMAIL PROTECTED]
> Subject: problem: cannot autorecompile jsp
> 
> 
> Hai,
> 
> I faced some trouble in using tomcat, hope you can solve the 
> problem for
> me.
> below are some of the main points:
> -I installed Tomcat4.1.9 beta on linux server
> -Develop in windows enviroment by using samba
> -But i got problem like this: No changes from the browser when i edit
> the jsp file in windows but instance change when i edit the jsp file
> using vi. I tried to log this into to tomcat bug database [11963]
> before, Andrew Conrad had give me some advise.
> -Andrew Conrad told me that it should my samba problem, but nothing to
> do with tomcat. so i ask him may i know how tomcat check the file is
> modified or not and he told me i can try to send email to this address
> -I also suddenyl think off that it should not be the samba 
> problem. This
> is because i have another Miva  web engine running in the same server,
> but all the development works were done without problem.
> 
> May anyone help me on this?
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

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




RE: Tomcat 4.1 Caching Classes?

2002-10-23 Thread Julius Davies

Hello, Kendall Gifford,

That's really weird behaviour you're reporting.  I've never studied any portion of 
Tomcat's code, so I cannot make any definitive statements regarding Tomcat, especially 
anything undocumented.

However, I have had the same thing happen to me.  It turned out to be completely my 
own fault:  in a switch from one platform to another (and the many, many changes that 
can entail) the order in which different versions of the same class were loaded 
somehow changed on me.

The thing about including different versions (the different versions being:  NEW GOOD 
ONE and OLD BAD ONE) of the same class in the classpath is that there seems to be a 
relatively good (~75-80%???) chance that on your original platform you'll load the NEW 
GOOD ONE.  However, there seems to be a 100% chance that when you switch to a 
different platform, you'll load the OLD BAD ONE instead.

And you'll go insane.  

This could be what's happening to you...

yours,



Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Kendall Gifford [mailto:kendall@;jedis.com]
> Sent: Wednesday, October 23, 2002 2:02 PM
> To: [EMAIL PROTECTED]
> Subject: Tomcat 4.1 Caching Classes?
> 
> 
> Hello all, I've a question regarding some strange (undocumented?) 
> caching behavior in Tomcat. We've been moving some code (mostly JSP's 
> with some supporting classes) from a server running an older (3.x?) 
> version of Tomcat to a FreeBSD 4.7-STABLE server running Tomcat 4.1.
> 
> Since this transition, there have been a few problems and some 
> classes, used by all the JSP's in an entire context, needed to be
> modified. This exposed some odd behavior, the topic of this post. We 
> noticed that after we replaced the class file and restarted Tomcat,
> the web application behaved as though it still had the old version of
> the class file.
> 
> To test if there was some caching going on, the class file was
> completely removed and Tomcat restarted. The web application STILL
> behaved as if the class file were still there. Note that this is an
> independent class file and not a JSP page we're talking about. But,
> just to be safe, when restarting Tomcat we also cleaned out the
> context's work directory as well.
> 
> Does anyone have any idea what might be causing this behavior? Is
> there some place where Tomcat is caching class files (not in the work
> directory)?
> 
> Any help is appreciated. Thanks!
> 
> -- 
> 
> ASCII RIBBON CAMPAIGN   /\
> NO HTML/RTF EMAILS!/  \
> \  /
> Kendall P. Gifford  \/
> [EMAIL PROTECTED]   /\
> http://kendall.jedis.com   /  \
> 
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>




RE: Tomcat version output

2002-10-18 Thread Julius Davies
Hello, SigurĂ°ur Bjarnason,

I recently ran into this problem, as well.  I found a solution that 
works nicely with all web-servers (Tomcat, JRun, Weblogic, etc...). 
Probably others have emailed you with this solution, but in case they 
haven't:

First, create the following jsp:

getServerInfo.jsp
---


<%= application.getServerInfo() %>


---

Then access it however you can, assuming your webserver is running.  At 
work we use lynx, eg. "lynx http://localhost:8080/getServerInfo.jsp. 
There are some flags you can use to make lynx just dump the output on 
std-out.  Another possibility is Curl, or even Ant's "get" task.


That's it!  However, I've added extra information to this email which 
you may find useful... you may be wondering where this undefined 
'application' variable in the jsp comes from!

In any jsp you have the following variables already in scope, among 
others.  Here's the link where I found this:

http://developer.java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro5

request
response
application
out

"request" is an instance of javax.servlet.http.HttpServletRequest.
"response" is an instance of javax.servlet.http.HttpServletResponse.
"application" is an instance of javax.servlet.ServletContext.
"out" is an instance of javax.servlet.jsp.JspWriter.  I tend to think of 
the superclass, java.io.Writer, instead, though.

As you can see, ServletContext provides the very useful 
"getServerInfo()" method.  Here's the link in the J2EE api for 
ServletContext.getServerInfo():

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServerInfo()


Good luck!

yours,

Julius Davies
Vancouver, Canada



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>



RE: AW: web.xml error

2002-10-21 Thread Julius Davies

Ann,

This error has also happened to me.  I found it pretty confusing at first, especially 
since other java web servers (JRun, Weblogic) don't seem to care what order the 
"web.xml" is in (am I correct in this?).

Try this instead:



http://java.sun.com/dtd/web-app_2_3.dtd";>


  Welcome to Tomcat
  
 Welcome to Tomcat
  

  
 invoker
 /servlet/*
  




Whenever I've run into this error:

"[...] icon?,display-name?,description?,distributable?,context-param*, [...], 
servlet*, servlet-mapping*, [...]"

I find it helps to make sure my "web.xml" contains elements in exactly the same order 
as the error message... in this case, notice "display-name" and "description" are 
mentioned before "servlet-mapping" in the error message, whereas in your "web.xml" you 
have them showing up afterwards.


(icon?,display-name?,description?,distributable?,context-para
> m*,filter*,fil
> > ter-mapping*,listener*,servlet*,servlet-mapping*,session-confi
> > g?,mime-mappin
> > g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,re
> > source-ref*,se
> > curity-constraint*,login-config?,security-role*,env-entry*,ejb
> > -ref*,ejb-loca
> > l-ref*)".

Good luck!


yours,


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>




RE: Please Help: Any tomcat/3rd party class that can do this?

2002-10-22 Thread Julius Davies

Chuck Carson,

Try:

http://www.google.com/search?q=printf+for+java


Sorry if that's glib.  :-)

Anyway, looks like it's $20 USD to compile with sharkysoft's "printf for java" jar 
file - might save you a few hours.


yours,

Julius
Vancouver, Canada


> -Original Message-
> From: Carson, Chuck [mailto:Chuck.Carson@;syrrx.com]
> Sent: Monday, October 21, 2002 4:10 PM
> To: Tomcat Users List
> Subject: Please Help: Any tomcat/3rd party class that can do this?
> 
> 
> 
> Sorry if this is newbie but I am somewhat new to Java. I have poured
> thru several books and cannot find anything that does what I want.
> 
> I have to generate reports with multiple columns of variable width. I
> need a java class to format these. In C, I would do this:
> printf("%10s %10s %-10s", string1, string2, string3);
> 
> This would effectively create three columns 10 characters 
> wide and right
> justify the last column. I am sure I could 'jerry rig' this 
> behavior but
> this is part of an application that will get heavy usage and I would
> prefer a clean, robust approach. (Note: This is a very scaled down
> example, the actual reporting is much more complex)
> 
> Does tomcat come with a utility to do this? (or does anyone 
> know of any
> public domain classes out there)
> 
> Much thanks,
> Chuck
> 
> 
> --
> This message contains confidential information and is 
> intended only for
> the individual named. If you are not the named addressee you 
> should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be
> intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
> contain viruses. The sender therefore does not accept 
> liability for any
> errors or omissions in the contents of this message, which arise as a
> result of e-mail transmission. If verification is required please
> request a hard-copy version. 
> 
> --
> To unsubscribe, e-mail:   

For additional commands, e-mail: 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: JAR Files needed

2002-10-29 Thread Julius Davies

Brian Brookwell,

Officially, you need J2EE (Java 2, Enterprise Edition).  Go to http://java.sun.com to 
download it.  After installing J2EE you'll find a jar file called "j2ee.jar" which 
contains everything you need to compile servlets.

Personally, I just dip into $TOMCAT/common/lib and use the jar files in there.  For my 
own web applications I tend to need "servlet.jar", "activation.jar" and "mail.jar".  
These are just subsets of "j2ee.jar".

yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Brookwell Brookwell [mailto:BrookwellB@;MacEwan.ca]
> Sent: Tuesday, October 29, 2002 10:17 AM
> To: [EMAIL PROTECTED]
> Subject: JAR Files needed
> 
> 
> This is the first time I've tried getting a servlet running 
> under Linux.  We're using TOmcat and I'd like to know what 
> JAR files are needed tocompile the servlet.
> 
> Brian Brookwell
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:tomcat-user-help@;jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>




RE: compile error?

2002-10-30 Thread Julius Davies

Phillip Qin,

I only use semicolons in "<% %>" and "<%! %>", but never in "<%= %>".  Weblogic 
refuses to compile my jsps when I put semicolons in "<%= %>".  Tomcat and JRun don't 
seem to mind, though, and so since this is a Tomcat mailing list, I guess you're 
correct.

<%
String blah = "hello";
%>

<%-- NO SEMI-COLON: --%>
<%= blah %>

<%-- SEMI-COLON REQUIRED: --%>
<% out.println( blah ); %>


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: [EMAIL PROTECTED] [mailto:pqin@;shareowner.com]
> Sent: Wednesday, October 30, 2002 10:40 AM
> To: [EMAIL PROTECTED]
> Subject: RE: compile error?
> 
> 
> Missing = at the beginning and ; at the end.
> 
> Regards,
>  
>  
> Phillip Qin
>  
> Software Developer
> Canadian Shareowner
> 121 Richmond Street W, 7th Floor
> Toronto, ON M5H 2K1
> (416) 595-9600 ext 291
>  
> 

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>




RE: Search engines and MVC

2002-10-30 Thread Julius Davies

Michele Emmi,

I've never used Struts, or anything which could be abbreviated to MVC.  Despite this, 
your question did strike a chord with me.  I think what you're asking is this:

How do search engines handle dynamic content, where the content changes based on the 
query-string?

Example: 

/blah.jsp?animal=frog
/blah.jsp?animal=cat

These pages will appear to be the same page to most search engines, even though their 
content might be dramatically different.  So, what do you do if you want both of these 
pages to be individually indexed by search engines?  The answer is simple, albeit a 
hack.  There are two parts:

1.)  Switch to "pure" servlets and never use query strings.  This would mean changing 
those two urls to look something like this instead:

/blah/animal/frog.html
/blah/animal/cat.html

Servlets can support this.  Even though those URLs look static, you can make it so 
they're actually dynamic.  Go to "http://globeandmail.com";, a Canadian newspaper, and 
click on any article.  You'll notice the Globe & Mail is basically doing this with 
their URLs:  no query strings.  The URLs are somewhat insane looking (obviously 
dynamic), but they fool the search engines into thinking they are static.

2.)  Create a "site map", and have every page on your site link to the "site map".  
Submit your "site map" to the search engines.


I hope this is what you meant.

yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Michele Emmi [mailto:micheleemmi@;hotmail.com]
> Sent: Wednesday, October 30, 2002 2:40 PM
> To: [EMAIL PROTECTED]
> Subject: Search engines and MVC
> 
> 
> I was wondering how search engines handle multi-view-controller 
> architecture?
> 
> Thanks,
> Michele
> 
> 
> 
> 
> 
> _
> Internet access plans that fit your lifestyle -- join MSN. 
> http://resourcecenter.msn.com/access/plans/default.asp
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:tomcat-user-help@;jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>




RE: Support multiple page encoding with JSP

2002-11-04 Thread Julius Davies

Liu,

Excellent question.  Here's my (limited) understanding:  the content type is just 
another HTTP header, and the general (loose?) rule with headers is that you set them 
once and only once.  Tomcat (or more specifically, J2EE) provide some utilities to set 
the most common headers, e.g.  HttpServletResponse.sendRedirect(), 
HttpServletResponse.addCookie(), ServletResponse.setContentType().

If you want to dynamically set your content-type inside your jsps, I think you will 
need to do two things:

1.)  Omit the <%@ page contentType="JuliusEncoding" %> at the top of the JSP.

2.)  Instead, inside your JSP make a call to <% response.setContentType( 
"JuliusEncoding" ); %>, determining your encoding in some fancy, dynamic way.

If you don't omit the <%@ page contentType %>, then your jsp will just be making a 
call to "response.setContentType()" two times.  I'm not sure, but in this case I think 
the second one will be ignored  this is where my limited understanding starts to 
show.


yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Liu, Xiaoyan [mailto:xliu@;CapitalThinking.com]
> Sent: Monday, November 04, 2002 11:06 AM
> To: 'Tomcat Users List'
> Subject: Support multiple page encoding with JSP
> 
> 
> Hi, 
> 
> I have seen this question asked on this list before, but
> didn't see a good answer or conclusion at the time they are
> raised. Hope there are new ideas now.
> 
> The question is: for jsp pages targeting multiple locales, how
> to dynamically set page encoding (especially response encoding)
>  so that there is no need of maintaining multiple set of jsp pages
> with them differing only in <% page contentType %> bit. 
> 
> Request parsing for different encoding can be handled dynamically
> by the proposed 'filter' approach. But how about 'response'?
> 
> 
> Thanks.
> 
> 
> Liu
> 
> 
> 
> 

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>




RE: Problems running Tomcat from command line

2002-11-25 Thread Julius Davies

Steve Russell,

Perhaps this link will help:

http://www.google.com/search?q=out+of+environment+space+tomcat


Try to get that "out of environment space" error to go away, then we'll work on the 
absentee "servlet.jar" issue.


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385


> -Original Message-
> From: Steve Russell [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 25, 2002 1:55 PM
> To: Tomcat Users List
> Subject: Re: Problems running Tomcat from command line
> 
> 
> Hi;
> 
> I'm reposting this, hoping  that this version is more clear.
> --
> 
> I'm on Windows 2000 using Tomcat 3.2.4 ( not my choice ).
> 
> I can start tomcat by double clicking the startup.bat file in
> C:\TOMCAT\bin.
> 
> However, I can't start tomcat programmatically by typing "startup.bat"
> or "startup" ( without quotes ) from a dos prompt that is in
> C:\TOMCAT\bin
> 
> I have tried running C:\TOMCAT\bin directly.  It complains that it is
> out of environment space ( how do you set that in win 2000 )AND
> that it cant find C:\TOMCAT\lib\servlet.jar
> 
> Its there.
> 
> Here are the Windows 2000 environmental variables I have set for
> "system":
> 
> 
> CLASSPATH:
> ..;C:\W2Kimage_c\cygwin\home\steve\Projects\Classes;C:\TOMCAT\
> lib\servlet.jar
> 
> PATH:
> %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
> %SystemRoot%\system32\nls;%SystemRoot%\system32\nls\English;C:
> JDK\bin;C:\ProgramFiles\GnuEmacs21.2\bin;C:\ProgramFiles;C:\PR
> OGRA~1\ULTRAE~1;C:\Program
> Files\Microsoft SQL Server\80\Tools\BINN;
> 
> JAVA_HOME:
> C:\JDK
> 
> TOMCAT_HOME
> C:\TOMCAT
> 
> Thanks in advance for any clues
> 
> Steve
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

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




RE: Memory/Performance

2002-12-02 Thread Julius Davies

Developer,

Hello.  I use Tomcat 4.1.12 standalone.  I was just thinking about what you were 
saying, especially "[...] I would think the memory stamp would correspondingly shrink 
when all these sessions are closed and it doesn't".

I noticed this section in the default "web.xml":

  
  
  


30


So, by default on my machine sessions will stay around for 30 minutes, unless either 
"session.setMaxInactiveInterval()" or "session.invalidate()" was called.  I haven't 
changed this file since I installed Tomcat, and so I'm assuming you have the same file.

Are you calling either of those methods - invalidate or setMaxInactiveInterval?  Or 
when you say "these sessions are closed", do you mean they time out after 30 minutes?

Secondly, what are you doing to generate all this (server-crashing!) load?  Obviously 
you're not going to call "session.invalidate()" on the same page that you created the 
session.  That would be pointless...  so here comes an interesting possibility:  
suppose a significant portion of your load didn't support cookies?  Or, if you were 
using URL rewriting for the sessions, suppose you forgot to use 
"response.encodeURL()"?  In both cases the result is the same:

Sessions are being created for a client, but the client won't remember his special 
"session id".  This means a new session is created for this client with every request 
he makes!  

So, I have three questions I need to know:

1.)  What kind of load is Tomcat experiencing on your machine, and where is this load 
coming from?

2.)  Does your load support cookies?  Is the "session id" being remembered by the 
client?

3.)  How are you closing your sessions?

Suppose each of your sessions weighed in at 512 bytes.  If your load, at, let's 
pretend 10/hits second, didn't support cookies, you're going to need ~15mb to hold on 
to 30 minutes of sessions before they start expiring.  This is because each hit is 
going to create a new session.

Tomcat User please correct any mistakes I may have made here!  


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 02, 2002 1:24 PM
> To: Tomcat Users List
> Subject: Re: Memory/Performance
> 
> 
> Thanks for your comments.  Well all my jspcode is definitely 
> session happy
> and I am creating several
> objects per session.  The objects I am creating consist of mostly
> string, int and floats, probably up to like 20 of each.  
> Although i create
> a large application pool of jdbc
> connections I am fairly positive that this is not the problem 
> because I
> use this pooling model in several applications that don't 
> seem to have a
> problem.  I realize that every time a session is created all 
> these objects
> must be allocated, and that should cause the memory blob to 
> keep growing
> as the session count increase but I would think the memory stamp would
> correspondingly shrink when all these sessions are closed and it
> doesn't.  I am basing this on tomcats crashing or slow behavior
> in conjunction with monitoring the processes and memory 
> usage.  What other
> information can I share that would help?  Like I said I don't 
> know if this
> is tomcat or me or a bit a both so I am jsut throwing out 
> what seems to be
> going on and looking for insight?  
> 
> 
> 
> 
> On Mon, 2 Dec 2002, Michael Nicholson wrote:
> 
> > I suppose it depends on what you're doing, which, 
> unfortunately, I don't
> > know.
> > 
> > If you're overly filling your session w/ objects, or if you 
> have a session
> > scoped bean that is spiraling out of control or something, 
> that might lead
> > to the problem, or if you create/leave open jdbc 
> connections or stuff like
> > that.  I'm running tomcat 4.03 on a much less beefy system, 
> and I don't ever
> > notice any memory issues, now that I make sure I close and null my
> > connections and such.
> > 
> > More info on what's happening might help, though..
> > 
> > 
> > - Original Message -
> > From: <[EMAIL PROTECTED]>
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > Sent: Monday, December 02, 2002 3:51 PM
> > Subject: Memory/Performance
> > 
> > 
> > > I find that tomcat's memory stamp grows continually until 
> eventually there
> > > are out of memory errors or it just bogs down.  I am 
> running on jdk1.4_1,
> > > tomcat 4.1.12, apache 1.27, mod_jk on the linux 2.2 
> kernel.  The box I am
> > > ope

RE: Memory/Performance

2002-12-02 Thread Julius Davies
te later.

Don't use notify().  Use notifyAll() instead.

In my opinion "wait(void)" and "notify()" are not meant for mortals.  Especially not 
in conjunction with web applications.


Good luck, ryan!  Hopefully we can help you fix your website, and help Tomcat conquer 
the world!

It would be a good idea to try and isolate your problem.  Can you get the memory usage 
to balloon up during a simulation in a test environment?  Of course, you're probably 
frantically trying to fix your production site... in which case banging out 
fear-inspired fixes can also work quite well, too.

I do envy your close proximity to such a respectable load on your computer.  I wish I 
could see what my own code would do at such use.  My company plays it too safe to ever 
know:  when the CPU hits 35% in top, they add a new computer to the cluster.

yours,

Julius
[EMAIL PROTECTED]

-Original Message-
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent:   Mon 12/2/2002 2:31 PM
To: Julius Davies
Cc: Tomcat Users List
Subject:RE: Memory/Performance
Thanks for replying I think you are on the right track i must not be doing
something right here. You certainly got me confused and that can only be a
step in the right direction. I have my session-timeout set to 15.  My load
is being generated from massive usage i get a million unique hits a month
and have a lot of customers simultaneously logged in at once.  Tomcat
starts out with 128 megs and baloons up pretty quickly to 300 megs.  It
often exceeds that, there also seems to be a huge thread count.   

I do not use cookies and I do not call
"session.setMaxInactiveInterval()" or
"session.invalidate()" or response.encodeURL().  In fact I am completely
ignorant about these calls.  I assume my sessions are closed automatically
by tomcat when there is no usage from that client for 15 minutes.  So can
I assume session.invalidate() kills a session.  How and in what situation
would I use this method?

What does setMaxInactiveInterval do and how is that applied?


And same questions on  response.encodeURL()?


So you are saying that possible  it is not only creating a new session
per new user but per page each user accesses? 
If so please teach me how to fix my problems with my coding.

-ryan


On Mon, 2 Dec 2002, Julius Davies wrote:

> 
> Developer,
> 
> Hello.  I use Tomcat 4.1.12 standalone.  I was just thinking about what you were 
>saying, especially "[...] I would think the memory stamp would correspondingly shrink 
>when all these sessions are closed and it doesn't".
> 
> I noticed this section in the default "web.xml":
> 
>   
>   
>   
> 
> 
> 30
> 
> 
> So, by default on my machine sessions will stay around for 30 minutes, unless either 
>"session.setMaxInactiveInterval()" or "session.invalidate()" was called.  I haven't 
>changed this file since I installed Tomcat, and so I'm assuming you have the same 
>file.
> 
> Are you calling either of those methods - invalidate or setMaxInactiveInterval?  Or 
>when you say "these sessions are closed", do you mean they time out after 30 minutes?
> 
> Secondly, what are you doing to generate all this (server-crashing!) load?  
>Obviously you're not going to call "session.invalidate()" on the same page that you 
>created the session.  That would be pointless...  so here comes an interesting 
>possibility:  suppose a significant portion of your load didn't support cookies?  Or, 
>if you were using URL rewriting for the sessions, suppose you forgot to use 
>"response.encodeURL()"?  In both cases the result is the same:
> 
> Sessions are being created for a client, but the client won't remember his special 
>"session id".  This means a new session is created for this client with every request 
>he makes!  
> 
> So, I have three questions I need to know:
> 
> 1.)  What kind of load is Tomcat experiencing on your machine, and where is this 
>load coming from?
> 
> 2.)  Does your load support cookies?  Is the "session id" being remembered by the 
>client?
> 
> 3.)  How are you closing your sessions?
> 
> Suppose each of your sessions weighed in at 512 bytes.  If your load, at, let's 
>pretend 10/hits second, didn't support cookies, you're going to need ~15mb to hold on 
>to 30 minutes of sessions before they start expiring.  This is because each hit is 
>going to create a new session.
> 
> Tomcat User please correct any mistakes I may have made here!  
> 
> 
> Julius Davies, Programmer, CUCBC
> Email: [EMAIL PROTECTED], Ph: 604.730.6385
> 
> 
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Se

RE: Not getting CSS with XML

2002-12-03 Thread Julius Davies

Paul Caton,

The error message your getting is because of the fact that "response.setContentType()" 
doesn't return anything.  You used "<%= %>" in your jsp, which needs an Object or a 
primitive inbewteen those brackets.  Your jsp is then going to call toString() on that 
Object (or just blithely print the primitive) and make that part of your webpage.

Since "response.setContentType()" doesn't return anything, there is no Object to call 
toString() on, or no primitive to blithely print!

Try "<% %>" instead.  Omit the equals sign.  Don't forget to put a semicolon at the 
end.

yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385


Code inside "<%= %>" should never end with a semicolon.

Code inside "<% %>" needs semicolons at the end of each line.



> -Original Message-
> From: Caton, Paul [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 03, 2002 10:49 AM
> To: Tomcat Users List
> Subject: RE: Not getting CSS with XML
> 
> 
> Okay, I put the Java expression first so that now the JSP file looks
> like this:
> 
>   <%= response.setContentType("text/html;charset=UTF-8") %><%@ include
> file="mary.xml" %>
> 
> 
> After I recompiled and tried to access the page I got this error
> message:
> 
>   > org.apache.jasper.JasperException: Unable to compile class for
> JSPNote: sun.tools.javac.Main has been deprecated.
>   > An error occurred at line: 1 in the jsp file: /mary.jsp
> 
>   > Generated servlet error:
>   >
> /opt/local/jakarta-tomcat-4.0.6-LE-jdk14/work/Standalone/local
> host/acsam
> /mary$jsp.java:54: Incompatible type for method. Can't convert void to
> java.lang.Object.
>   > out.print( response.setContentType("text/html;charset=UTF-8") );
> 
> Paul.
> 
> 
> **
> 
> Charlie wrote:
> 
> Make sure you have it *before* your include and before any 
> whitespace in
> your jsp.
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

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




RE: JSP Last-modified/If-modified-since

2002-12-03 Thread Julius Davies

Noel J. Bergman,

I was thinking about this same thing recently.  I really like what you've done.  I 
just have one concern - your default "getLastModified()" method seems incorrect to me:

>   protected long getLastModified(HttpServletRequest request)
>   {
>   long lm = (new
> java.io.File(getServletConfig().getServletContext().getRealPat
> h(request.getS
> ervletPath())).lastModified()) / 1000L * 1000L;
>   return lm;
>   }
> 

1.  java.io.File.lastModified() already returns a long.  Why are you dividing and 
multiplying by 1000L?

2.  It looks to me like your "getLastModified()" method is returning the last time 
this very jsp was edited.  To me that seems misleading:  suppose a developer 
mistakenly uses your feature, but their jsp is actually quite dynamic and its response 
changes with each new request.  They are going to have a helluva time figuring out why 
their jsp refuses to change its output.  I could be mistaken in my understanding of 
what's going on, though.

Instead I think your getLastModified() method should look like this instead:

protected long getLastModified(HttpServletRequest request)
{
return -1;
}

Notice from Javadoc:
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServlet.html#getLastModified(javax.servlet.http.HttpServletRequest)

Returns:
a long integer specifying the time the HttpServletRequest object was last modified, in 
milliseconds since midnight, January 1, 1970 GMT, or -1 if the time is not known

Now you'll have to add a little bit of code to deal with the "-1" circumstance in your 
service() method.  Thanks for your post though - very interesting.  


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385


> -Original Message-
> From: Noel J. Bergman [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 03, 2002 2:25 PM
> To: Tomcat User List
> Subject: JSP Last-modified/If-modified-since
> 
> 
> This seems to be an FAQ item without a good solution, at 
> least that I've
> noticed on the list.  Recently I had to address this myself, 
> moving some
> sites over to Tomcat.  Here is my solution, for critique.
> 
> First, I subclassed Jasper's HttpJspBase to add the desired behavior:
> 
> abstract public class LastModifiedJSP extends
> org.apache.jasper.runtime.HttpJspBase
> {
>   protected long getLastModified(HttpServletRequest request)
>   {
>   long lm = (new
> java.io.File(getServletConfig().getServletContext().getRealPat
> h(request.getS
> ervletPath())).lastModified()) / 1000L * 1000L;
>   return lm;
>   }
> 
>   public void service(ServletRequest req, ServletResponse res)
>   throws ServletException, IOException
>   {
>   HttpServletRequest request = (HttpServletRequest) req;
>   HttpServletResponse response = 
> (HttpServletResponse) res;
> 
>   long checkDate = 
> request.getDateHeader("If-Modified-Since");
>   long lastMod = getLastModified(request);
>   if (checkDate > 0 && lastMod <= checkDate)
>   {
>   
> response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
>   return;
>   }
>   response.setDateHeader("Last-Modified", lastMod);
> 
>   super.service(request, response);
>   }
> 
>   public String getServletInfo()
>   {
>   return "Base class for JSP pages that want 
> Conditional Get handling.
> Default getLastModified() returns lastModified() for JSP 
> source file.";
>   }
> }
> 
> then each page that wants to use this behavior includes:
> 
><%@ page extends="com.devtech.jsp.LastModifiedJSP" %>
> 
> That's it.  If a page wants to change its Last-Modified 
> behavior, it can
> optionally provide a getLastModified() method, just as a 
> servlet would do.
> And I will change the default behavior to also check included 
> pages via
> getIncludes().
> 
>   --- Noel
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

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




RE: difference between apache and tomcat webserver

2003-01-09 Thread Julius Davies

krip pane,

> I was under the impression that apache is needed to
> serve the jsp pages - looks like not.

Too many people are under that impression.

> what is the advantage or disadvantage of
> installing/using apache as your webserver and
> installing some connector (i.e. mod_jk) to use with
> tomcat.

Advantages of using apache with tomcat:

- Feels safer when using port < 1024 on linux/unix.
- Works together very well with lots of other web stuff (cgi, perl, php).
- All the extra modules, for example: https.
- Everybody's doin' it.

Notice that I don't include "speed of serving static files and images".  This is 
because, frankly, if you're hosting a dynamic web site, static files are the least of 
your problems.  Tomcat is just as fast at sending a "304 - Unmodified" response as 
Apache is, and that's all that matters.

Disadvantages of using apache with tomcat:

- Much, much harder to get everything working.  As you've discovered, it takes about 2 
minutes to get Tomcat up and running!  You will spend hours, if not days, learning to 
pair Tomcat up with Apache.  At least judging from this mailing list.  I've never done 
it!

yours,


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385

The contents of this message are my own personal opinions, and not those of CUCBC.


> -Original Message-
> From: krip pane [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 09, 2003 2:05 PM
> To: tomcat
> Subject: difference between apache and tomcat webserver
> 
> 
> All,
> 
> I hope I am understanding and asking this answer
> correctly.  I recently installed tomcat 4.1 with
> default values and was able to server jsp pages.
> 
> I was under the impression that apache is needed to
> serve the jsp pages - looks like not.  So the question
> is what is the advantage or disadvantage of
> installing/using apache as your webserver and
> installing some connector (i.e. mod_jk) to use with
> tomcat.
> 
> Thanks
> 
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

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




RE: saving and opening files

2003-01-13 Thread Julius Davies

Clive De Silva,

I may be wrong, but I think your file would be here:

System.getProperty( "user.dir" );

That should output a string showing the directory where your files will be put by 
default.  This is because you specified a relative path -- new 
java.io.File("states.gip") -- not an absolute path.

You can call 'System.getProperty( "user.dir" )' at anytime from anywhere in your 
application, even a jsp.

yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Clive De Silva [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 13, 2003 3:48 PM
> To: [EMAIL PROTECTED]
> Subject: saving and opening files
> 
> 
> Hi, I have placed my package in the \Apache Group\Tomcat 
> 4.1\common\classes\ folder and they are all standard Java 
> classes [no servlets or jsps]. One of the methods invoked in 
> my main class serializes an object and saves it to a 
> persistent file at runtime :
> 
> -Start Snip 1---
>   public boolean saveUser(){
> File file2 = new java.io.File("states.gip");
>   try{
> myUser.allocateUser(user);
> FileOutputStream out2 = new FileOutputStream(file2);
> ObjectOutputStream s2 = new ObjectOutputStream(out2);
> s2.writeObject(myUser);
> s2.flush();
> System.out.println("You have save successfully");
> return true;
>   }
>   catch(Exception e){
> e.printStackTrace();
> System.out.println("You have save UN-Successfully");
> return false;
>   }
>   }
> -End Snip 1---
> 
> When the class is initialised/created, it first checks to see 
> if there is a file called states.gip and if there is, then it 
> reads in the object, if there isnt, then it creates an object 
> and at a latter stage saves it:
> 
> -Start Snip 2---
>   public boolean createUser(String name){
> try{//see if a user had been created and try to load it back
>   File file2 = new java.io.File("states.gip");
>   FileInputStream in = new FileInputStream(file2);
>   ObjectInputStream s1 = new ObjectInputStream(in);
>   myUser = (MainUser)s1.readObject();
>   user = recommenderEPG.addUser(name);
>   user = myUser.unallocate(user);
>   System.out.println("There was an old user!");
>   return true;
> }
> catch(Exception e){//user has not been created so an 
> exception is thrown -going to create a new user
>   try{
> myUser = new MainUser(name);
> user = recommenderEPG.addUser(name);
> myUser.allocateUser(user);
> System.out.println("there is definitely no old user");
> return true;
>   }
>   catch (DataNotFoundException ef){
> return false;
>   }
> }
> -End Snip 2---
>   
> When the class does get created for the first time, it does 
> not see the 'states.gip' file, which is correct, because it 
> has not been created yet. If it is instantiated for a second 
> or nth time, it always sees the file and loads it correctly. 
> My Question is: where is this file stored? I can not find a 
> physical trace of this file - i have done search after search 
> and it is not there - yet the Java class opens it correcly! Help!
> 
> 
> Regards,
> 
> Clive
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002
> 

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




RE: Logging System.out to a text file

2003-01-15 Thread Julius Davies
Rommel Sharma,

Question 1.)

Because I feel like being mischevious, I thought I'd respond to this.  Try the 
following.  The nice thing is that it will work with all webservers and even any 
application written in java, not just Tomcat.  You can even do it from a jsp!!!

==
FileOutputStream f = new FileOutputStream("/usr/julius/app-out.txt");
PrintStream ps = new PrintStream( f );
System.setOut( ps );
==

Question 2.)

Again, this is probably not the right answer, but I'm happy to just copy the Tomcat 
shortcut into my "start-->programs-->startup" folder.

yours,

Julius

This is my own opinion and not that of CUCBC.

-Original Message-
From:   Rommel Sharma [mailto:[EMAIL PROTECTED]]
Sent:   Wed 1/15/2003 9:32 PM
To: Tomcat MailGroup
Cc: 
Subject:Logging System.out to a text file
Hi!
   1. How to log the System.out outputs to a text file instead of the
console?
Tried modifying the server.xml file's  element with attribute
className="org.apache.catalina.logger.SystemOutLogger" but output is still
on console.

  Also, specifying directory and file name in  with
className="org.apache.catalina.logger.FileLogger" did not help

  Using Tomcat 4x, do not want to run it as a service in this case.

   2. Second Question: How do I run Tomcat 4 as a service after it has been
installed when I didnot specify it to run as a service at the time of its
installation.

Thanks and regards,
Rommel Sharma.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 





<>--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


RE: Question about detecting version

2003-01-29 Thread Julius Davies

Hello, Steve Vanspall,

Have you looked at any of these methods?

class javax.servlet.ServletContext

public int getMajorVersion()
- Returns the major version of the Java Servlet API that this servlet container 
supports.

public int getMinorVersion()
- Returns the minor version of the Servlet API that this servlet container supports.

public String getServerInfo()
- Returns the name and version of the servlet container on which the servlet is 
running.

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

Notice that the "application" variable, implicitly visible in a jsp, is an instance of 
ServletContext.

=


<%= application instanceof ServletContext %>


=

That will print "true" in the browser.


yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385



> -Original Message-
> From: Steve Vanspall [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 3:29 AM
> To: Tomcat Users List
> Subject: Question about detecting version
> 
> 
> Hi there,
> 
> This may be an off-beat question.
> 
> Basically I am creating an installation application for my 
> software, for
> some people who are going to demonstrate it.
> 
> What I want to be able to do, is detect whether the correct version of
> Tomcat is installed on their system.
> 
> The installer will only be used in a Windows NT/2000 
> environment. I being
> platform specific goes against the whole point of JAva, but 
> this is a case
> where the guy doign the demo is all the way over the other side of the
> world. Have found some classes that will read the registry in 
> a Sun Java
> environment, but Tomcat only lists the version as 4.1, is 
> there a way to
> tell whether it is 4.1.1x as opposed to 4.1.1y etc?
> 
> Regards
> 
> Steve Vanspall
> 
> 
> 
> -
> 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: Question about detecting version

2003-01-29 Thread Julius Davies

Steve,

Here's a method which should work.  Make sure Tomcat's 
"$TOMCAT_DIR/server/lib/catalina.jar" file is in the classpath of whatever java 
program is executing this code!  "ResourceBundle" comes from the "java.util" package.

===
public String getTomcatVersion()
{
   String serverInfo = "doh!";
   try
   {
  ResourceBundle bundle = ResourceBundle.getBundle( 
"org.apache.catalina.util.ServerInfo" );
  serverInfo = bundle.getString("server.info");
   }
   catch ( Exception e )
   {
  // either catalina.jar is not in classpath, or Tomcat team has changed things 
around!
   }
   return serverInfo;
}
===

Alternatively, you could unzip "catalina.jar" and look for this file:  
"./org/apache/catalina/util/ServerInfo.properties".

yours,


Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Steve Vanspall [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 4:38 AM
> To: Tomcat Users List
> Subject: RE: Question about detecting version
> 
> 
> Thanks Julius,
> 
> That actually helps me with another problem.
> 
> However, my main problem here is that Tomcat will not be running.
> 
> And that the installer in not a web application running under tomcat.
> 
> I was wondering whether tomcat keep it's version number in a 
> file somewhere
> 
> Regards
> 
> Steve Vanspall
> 
> -Original Message-
> From: Julius Davies [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 30 January 2003 11:15 AM
> To: Tomcat Users List
> Cc: [EMAIL PROTECTED]
> Subject: RE: Question about detecting version
> 
> 
> 
> Hello, Steve Vanspall,
> 
> Have you looked at any of these methods?
> 
> class javax.servlet.ServletContext
> 
> public int getMajorVersion()
> - Returns the major version of the Java Servlet API that this servlet
> container supports.
> 
> public int getMinorVersion()
> - Returns the minor version of the Servlet API that this 
> servlet container
> supports.
> 
> public String getServerInfo()
> - Returns the name and version of the servlet container on 
> which the servlet
> is running.
> 
> http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/Se
> rvletContext.h
> tml
> 
> Notice that the "application" variable, implicitly visible in 
> a jsp, is an
> instance of ServletContext.
> 
> =
> 
> 
> <%= application instanceof ServletContext %>
> 
> 
> =
> 
> That will print "true" in the browser.
> 
> 
> yours,
> 
> Julius Davies, Programmer, CUCBC
> Email: [EMAIL PROTECTED], Ph: 604.730.6385
> 
> 
> 
> > -Original Message-
> > From: Steve Vanspall [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 30, 2003 3:29 AM
> > To: Tomcat Users List
> > Subject: Question about detecting version
> >
> >
> > Hi there,
> >
> > This may be an off-beat question.
> >
> > Basically I am creating an installation application for my
> > software, for
> > some people who are going to demonstrate it.
> >
> > What I want to be able to do, is detect whether the correct 
> version of
> > Tomcat is installed on their system.
> >
> > The installer will only be used in a Windows NT/2000
> > environment. I being
> > platform specific goes against the whole point of JAva, but
> > this is a case
> > where the guy doign the demo is all the way over the other 
> side of the
> > world. Have found some classes that will read the registry in
> > a Sun Java
> > environment, but Tomcat only lists the version as 4.1, is
> > there a way to
> > tell whether it is 4.1.1x as opposed to 4.1.1y etc?
> >
> > Regards
> >
> > Steve Vanspall
> >
> >
> >
> > 
> -
> > 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: RMI Performance problem

2003-01-31 Thread Julius Davies
Hello, Mike Arachtingi,

>When I run this
>as a stand-alone program, my results show an average invocation time of
>about 3 - 4ms.  When I run the same program as a web app (tomcat 4.0.1,
>or 4.0.4) I'm seeing averages around 80 ms.

80ms doesn't sound too slow to me!  But you've made a very interesting observation.  I 
don't have much experience with RMI, and I've never looked at Tomcat's source code.  
But this is a mailing list, so I don't see why these facts should stop me from writing 
a response!  ;-)

In your Test program, I would try starting up a second "do nothing" thread before you 
run your RMI test.  All it would do in its run() method is this:

while ( true )
{
   synchronized( this )
   {
   wait( 10 );
   }
}

With that running, how much slower is your RMI test?

Tomcat is somehow always listening on 1 or more ports for incoming requests...  (that 
code is probably not in Tomcat, but in the JDK Socket stuff...)  Those have got to eat 
up a few resources.  Now, I don't imagine my "do nothing" thread is an accurate 
simulation of a web server waiting for incoming requests, but it must be better than 
nothing!

yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385


ps to Derek:  any thoughts?


> -Original Message-
> From: Arachtingi, Mike [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 31, 2003 2:07 PM
> To: [EMAIL PROTECTED]
> Subject: RMI Performance problem
> 
> 
> Has anyone noticed a performance problem, using RMI from within a web
> app?  
> I developed a test program that looks up a remote object, and sends it
> 99 messages (i.e., invokes one of the remote methods.)  When 
> I run this
> as a stand-alone program, my results show an average 
> invocation time of
> about 3 - 4ms.  When I run the same program as a web app 
> (tomcat 4.0.1,
> or 4.0.4) I'm seeing averages around 80 ms.
>  
> JProbe confirms that cpu time is primarily spent in
> sun.rmi.server.UnicastRef.invoke( )   
>  
> I don't have the sun.rmi source right now (I've looked on Sun One, but
> can't find it --  anyone know the URL?), so I don't have any 
> idea what's
> the hang up.
>  
> Anyone have insight into this?   I saw a similar thread msg77001 "RMI
> Class Annotation",  in which a fellow sees 800 ms per 
> invocation for his
> test, but he was talking about JBoss, and huge classpaths.  Or, am I
> having the same problem?  (I don't know anything about
> RMIClassLoader.getClassAnnotation(), which he says delivers 35K bytes
> from server to client in his situation.)
>  
> Thanks,
>  
> Mike Arachtingi 
> 

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




RE: Reading client certificates

2003-01-31 Thread Julius Davies

Hello, Robert Dana,

I cannot help you exactly, but perhaps a debugging trick would help you.  Try this:

Object o = request.getAttribute("javax.servlet.request.X509Certificate");
System.out.println( o.getClass().toString() );
System.out.println( o instanceof javax.servlet.request.X509Certificate );
System.out.println( o instanceof javax.servlet.request.X509Certificate[] );
System.out.println( o instanceof Object[] );

Object.getClass() will give you the runtime class of the object.  Sometimes the 
runtime class it not what you expect: it might be a subclass or an implementation of 
the class/interface you want.  Which is fine, but can be hard to realize.  So I like 
fire off a few instanceof's for a little extra information.


yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385




> -Original Message-
> From: Robert Dana [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 31, 2003 3:00 PM
> To: [EMAIL PROTECTED]
> Subject: Reading client certificates
> 
> 
> Tomcat 4.0 is supposed to implement the Servlet 2.3 
> specification.  The 
> 2.3 spec says that 
> ServletRequest.getParameter("javax.servlet.request.X509Certifi
> cate") is 
> required to return an array of Objects of type 
> java.security.cert.X509Certificate.  But this code:
> 
> X509Certificate[] certs =
>   (X509Certificate[]) request.getAttribute(
>  "javax.servlet.request.X509Certificate");
> 
> Always generates a ClassCastException.  There is a non-null 
> object being 
> returned from getAttribute, but it won't cast to 
> X509Certificate[].  Can 
> anybody tell me where I'm going wrong?
> 
> My configuration is Apache 2.0.44, Tomcat 4.1.18, mod_jk 
> built from the 
> connectors-4.1.18 package and the mod_ssl that comes with the 2.0.44 
> source distribution.
> 
> Any help would be appreciated.
> 
> Robert Dana
> 
> 
> 
> -
> 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]




response.sendRedirect() - is this allowed?

2003-02-06 Thread Julius Davies

Hello, Tomcat User's List,

There was some talk a few days ago about "response.sendRedirect()" after a POST 
request being against the HTTP specification...  is that really true?  For example, 
would this be a problem?  IE and Netscape seem to do what I want!


// This is common trick I use after a form submission to
// help make navigation easier for the user, and to help
// avoid dual-submission of the same form.
//
// "request" is an HttpServletRequest and "response"
// is an HttpServletResponse.

if ( "POST".equalsIgnoreCase( request.getMethod() ) )
{
   StringBuffer buf = new StringBuffer();
   buf.append( request.getRequestURI() );
   buf.append( "?" );
   buf.append( request.getQueryString() );
   response.sendRedirect( buf.toString() );
   return;
}


I would appreciate any advice anyone might have.


yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385

This email represents my personal opinions and concerns and not those of CUCBC.

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




Re: issue config'ing a webapp

2005-01-05 Thread Julius Davies
Hi, Erik,

Instead of adding your  entries directly to "server.xml",
I recommend adding tiny little "context.xml" file snippets under
TOMCAT_HOME/conf/Catalina/localhost.

tomcat/conf
|-- Catalina
|   `-- localhost
|   |-- ROOT.xml
|   |-- manager.xml
|   `-- julius-app.xml
|-- catalina.policy
|-- catalina.properties
|-- jk2.properties
|-- server-minimal.xml
|-- server-original.xml
|-- server.xml
|-- tomcat-users.xml
`-- web.xml

In this case, notice "julius-app.xml".  Here is its contents:

==

==

Notice how this "julius-app.xml" is essentially just a symlink.


yours,

Julius Davies


On Wed, 2005-05-01 at 10:12 -0800, Erik Weibust wrote:
> I'm having a problem getting a webapp running in my instance of tomcat.
>  I have attached all the relevant info below.
> 
> What I'm trying to do is use a sym link in a dir that points to a
> "generic" version of my app.  That way I can have numerous versions of
> that app on my machine and instead of having to edit the server.xml
> every time I want to switch from one version of the app to another I
> can just change my sym link.  When I do this I get a "Resources start
> failed" error in my log files.
> 
> Any ideas?  Do I need to provide more info?  Will Tomcat not allow a
> sym link in the docBase of a Context element?
> 
> Thanks...
> Erik
> 
> 
> from catalina.out
> StandardContext[/mondev_ng]: Resources start failed:
> java.lang.IllegalArgumentException: Document base
> C:\cygwin\home\efw\cvs\MonDev_NG does not exist or is not a readable
> directory at
> org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:193)
> 
> from server.xml
>  docBase="C:\cygwin\home\efw\cvs\MonDev_NG">
>
> 
> 
> [EMAIL PROTECTED] ~/cvs$ ls -l
> total 1
> lrwxrwxrwx   1 efw mkgroup-l-d 18 Jan  5 12:02 MonDev_NG ->
> MonDev_NG_20050105/
> drwxr-xr-x+ 14 efw mkgroup-l-d  0 Jan  5 11:57 MonDev_NG_20050103/
> drwxr-xr-x+ 14 efw mkgroup-l-d  0 Jan  5 11:32 MonDev_NG_20050105/
> 
> =
> Erik Weibust
> http://erik.weibust.net
> 
> -
> 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: catalina.out export to another file

2005-01-06 Thread Julius Davies
Hi, Benoit,

You can could try adding code like this to a jsp, and then hitting the jsp with 
a browser:

<%
OutputStream os = new FileOutputStream( "/var/log/myNewLogFile.log" );
PrintStream ps = new PrintStream( os );
System.setOut( os );
%>

>From that point on you will have taken over "catalina.out".

Also, when starting Tomcat, you could use "catalina.sh run" command instead of 
"startup.sh" or "catalina.sh start" and redirect it.  Like so:

catalina.sh run > /var/log/myNewLogFile.log

These are just two workarounds I happen to know about.  Probably there are 
betters ways using Tomcat's config files.

yours,

Julius


-Original Message-
From:   Benoit - Althosting.fr [mailto:[EMAIL PROTECTED]
Sent:   Thu 1/6/2005 3:54 PM
To: tomcat-user@jakarta.apache.org
Cc: 
Subject:catalina.out export to another file
Hi,

Sorry, I post this message again, I have no answer and I really need help :(

I'm trying to redirect catalina logs to another file
(montest_access_log.txt) but catalina out is not redirect in my file (steal
in catalina.out)

That's my configuration in server.xml for the host :


   
   
   
   


Does anybody know anything about this ?
I tried to make the change but unfortynately it does not work.

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: Coding In Paradise: Tomcat JSP Precompilation is SLOW!!

2005-01-07 Thread Julius Davies
Why not hit every URL with "curl" or "wget" before deploying and include
Tomcat's "work" directory with your deployment?  How does that compare
for speed? 

Also, have you tried giving Ant some extra heap to play with?  I think
this is how (on unix):

export ANT_OPTS="-Xms256M -Xmx256M"

yours,

Julius

On Fri, 2005-07-01 at 17:01 -0800, Kevin A. Burton wrote:
> >
> >
> >  The entire JSP compilation process, using Ant and the jasper2 ant 
> > task, takes about 30 minutes! This is far too long. I mean, there are 
> > systems that are doing more than just compiling text, such as advanced 
> > 3D graphics and speech recognition, that are far faster than Tomcat's 
> > JSP compilation.
> >
> Fun!  Why isn't fixing this a huge priority!?
> 
> http://codinginparadise.org/weblog/2005/01/tomcat-jsp-precompilation-is-slow.html
> 

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



Re: Minimum Memory Requirement for TC 5.0.x

2005-01-12 Thread Julius Davies
Linux itself requires 12MB of RAM:

http://www.debian.org/releases/stable/i386/ch-hardware-req.en.html#s2.3

I think you could squeeze Tomcat + Java into an additional 32MB, so I
would say the minimum memory requirement is 48MB.  :-)

yours,

Julius

On Wed, 2005-12-01 at 19:03 -0600, QM wrote:
> On Wed, Jan 12, 2005 at 01:28:16PM -0500, Yang Xiao wrote:
> : What is the minimum memory requirement to run TC 5.0.x in a Linux
> : environment? or is there such a thing? I can't find it anywhere,
> 
> There really isn't one, because Tomcat is sandwiched between the JVM and
> your application.  Chances are, most of the memory consumption is
> app-specific.
> 
> : which is kind of amusing.
> 
> That's debatable. ;)
> 
> -QM
> 

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



RE: reload log4j.properties on-the-fly?

2005-01-21 Thread Julius Davies
Hi, Andy,

I never thought of Mike's first suggestion there before.  I like it.  I
have some more suggestions (although I think my 2nd is just the details
of Mike's 2nd):

Suggestion #1

Put this in a JSP, and hit the JSP whenever you change your log
properties:

PropertyConfigurator.configure( "/path/to/log4j.properties" );


Suggestion #2

Execute this somewhere near the beginning of your application's
initialization:

PropertyConfigurator.configureAndWatch( "/path/to/log4j.properties" );

http://logging.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurator.html

On Fri, 2005-21-01 at 12:19 -0600, Mike Curwen wrote:
> There's two approaches.   
> 
> Configure tomcat to reload the context when class changes are made
> (log4j.properties being in the classes directory, will count as a class
> being changed, and then the whole context will reload).  We do this all the
> time.
> 
> Log4j can be used in a manner where config changes are discovered at
> run-time, though I've never tried it (and you should ask about in on the
> log4j-user list)
> 
> Mike Curwen
> 
> 
> > -Original Message-
> > From: Andy Kriger [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, January 21, 2005 12:03 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: reload log4j.properties on-the-fly?
> > 
> > 
> > I am running Tomcat 5.5 with log4j logging (log4j.properties 
> > in common/classes).
> > 
> > Is it possible to make changes to the log4j properties and 
> > have the changes reloaded on-the-fly instead of having to 
> > restart Tomcat in order to pick up changes? This would be 
> > very useful for those times debug level logging or specific 
> > class logging is needed where generally that level of logging 
> > is not required.
> > 
> > thx
> > andy
> > 
> > -
> > 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]