Re: How to expire?

2001-10-23 Thread Luc Vanlerberghe

raj wrote:

>> The user-experience stays the same: When the user access any url in 
>> the protected area, the login page will pop up and after he provides 
>> correct information he will be directed to the page he requested.
>> For Tomcat 3, just make sure the login page is outside the protected 
>> area, for tomcat 4 it does not matter.
>>
>> Luc Vanlerberghe
>>
>
> Hi Luc,
>
> I tried form based login by just disabling  BASIC and adding FORM (as 
> below) to my web.xml file:
>  
>
>   ClaroLogic
>   FORM
>   
>  /LoginForm.html
>  /LoginError.html
>   
>   
>
> But I end up getting a 404 error always (with the browser URL reading: 
> http://192.168.0.20/testservlet/j_security_check)
>
> I tried putting LoginForm.html and LoginError.html at the webapps 
> level (and chaged the web.xml) as below:
>
>   
>  /../LoginForm.html
>  /../LoginError.html
>   
>
> But now I get the 404 error with the URL reading 
> (http://192.168.0.20/j_security_check).
>
>
> Aaaahhh!
>
> Tomcat version is 3.2.3. Any ideas/suggestions would be gratefully 
> gobbled. I cannot use 4.0 because
> Cloudscape (the D/base) does not work with 4.0.
>
> Aaaahhh! (again)
>
> Cheers
> -raj
>
The login page should be in your webapp, but outside the protected area. 
 If you are using an apache/tomcat combination, make sure apache sends 
the "j_security_check" to tomcat and not only *.jsp

Luc





Re: How to expire?

2001-10-22 Thread Luc Vanlerberghe

raj wrote:

> I have set the session expiry time in my Test
> servlet to 10 secs (BASIC auth., using JDBC realm).
>
> But when I type in the URL in the browser
> (IE5/6, Mozilla, Netscape 4.x etc), the login window
> does not reappear but request goes straight to the
> servlet in question.
>
> I even tried to invalidate the session cookie using a "logout" link
> in the tes servlet, but to no avail.
>
> Only if the browser is destroyed does the login window reappear.
>
> Any idea to force a login after a certain interval of time?
>
> Cheers
> -raj

If you are using BASIC authentication, then your browser will send your 
credentials with every request.  There's no way to 'log off' short of 
closing the browser.

If in the mean time the session has died at the server end, the server 
will see a new request with correct credentials and create a new session 
(Test this by putting a session.getId() in your jsp or servlet 
somewhere) .  Since the browser already gave the credentials, no login 
screen will be shown.

Try the same using FORM-based authentication.  In that case the 
session-id is either stored in a cookie or encoded in the url.  If the 
session dies at the server, a request will have an invalid session-id 
and the user will be prompted for his username/password again.
It is possible to switch to FORM-based login without changing anything 
in your web-app.  Simply create a page with the correct  and 
 elements and modify your web.xml
The user-experience stays the same: When the user access any url in the 
protected area, the login page will pop up and after he provides correct 
information he will be directed to the page he requested.
For Tomcat 3, just make sure the login page is outside the protected 
area, for tomcat 4 it does not matter.

Luc Vanlerberghe





Re: JSP Performance

2001-09-05 Thread Luc Vanlerberghe

Jim Cheesman wrote:

> At 09:48 PM 04/09/01, you wrote:
>
>> Hi,
>> I have a JSP file and it takes nearly 25 seconds to
>> run for the first time.  Is there a way to make JSP's
>> fast on first execution?
>
>
>
>
> The first call will always (*) take longer, as tomcat has to translate 
> and compile your page - you can see the final result in the work 
> directory in CATALINA/TOMCAT_HOME.
>
> * The exception: if you precompile (using jspc.bat) the pages to 
> servlets, and then "install" them in web.xml.
>
> From a post by Sophie ?:
> 
> Hi Oskar,
> I am using the options:
> -uriroot /$TOMCAT_HOME/webapps/AppName
> -d /$TOMCAT_HOME/webapps/AppName/WEB-INF/classes
> to set the directory where the results of jspc should be placed
> -webxml /OWN_DIR/webAppName.xml
> -webapp /$TOMCAT_HOME/webapps/AppName
> to specify the directory that contains the jsp's
> I remove the jsp's after running jspc from /$TOMCAT_HOME/webapps/AppName.
> After running jspc, you should run javac to compile the generated 
> java-files to
> class files.
> I update my own web.xml with the results of /$OWN_DIR/webAppName.xml,
> and then everything runs fine.
> Hope this help,
> Sophie
> 
>
> Jim
>
>
>
>
> -- 
>
>   *   Jim Cheesman   *
> Trabajo: [EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
>  What is the probability that something
>will happen according to the odds?
>
Another way is to call your pages in a browser adding the jsp_precompile 
parameter (See section 8.4.2 of the JSP 1.2 PFD Spec)
E.g.: http://myserver/mywebapp/mypage.jsp?jsp_precompile="true";

This gives a hint to the servlet/jsp container that the page should be 
precompiled and installed as a servlet.
The page itself will *not* be executed.

I don't know if there's a way to specify that all jsp pages in a webapp 
should be precompiled

Luc Vanlerberghe






Re: URGENT! TomCat won't run my servlets.

2001-02-16 Thread Luc Vanlerberghe

Without more information about your setup it's difficult to guess...
Could you send any configurations you changed from the defaults?

Some wild guesses:
- Your HTTPConnectionHandler still uses the default port 8080 instead of
80.
>From the default server.xml:





Change the 8080 to 80

- You changed the port of the Ajp12ConnectionHandler to 80 instead of
the HttpConnectionHandler...

- On the production server, tomcat does not have the rights to open port
80.  On unix the application needs root access to open ports < 1024

Luc Vanlerberghe

"Cato, Christopher" wrote:
> 
> Hi all.
> 
> I'm deploying my applications to the production server. The production
> server (a DELL system running 2 processors) silently refuses to run my
> applications. They init okay (can see it in the tomcat log and also in the
> database log) but they won't run the doGet method for some reason. On the
> development server, they run just fine.
> 
> Both systems run RedHat 6.2 and TomCat 3.21.
> The development server runs TomCat thru Apache and mod_jk, the production
> server runs TomCat standalone.
> I found a bug report on redhat.com that stated that in some cases glibc can
> break java, so I upgraded glibc to the latest version. Still doesn't work.
> Question is: am I overlooking something simple here? Could it be the
> difference between running as mod_jk and running standalone? All other files
> are served as they should through TomCat standalone.
> 
> So, to reiterate the problem:
> machine A (development server) - rh 6.2 - tomcat 3.21 - apache 1.3.12 -
> mod_jk: runs ok
> machine B (production server) - rh 6.2 - tomcat 3.21 standalone: doesn't
> run. WHY??
> 
> What's the friggin' problem here, I just can't get it!
> 
> Please help me if you can, deadline is overdrawn and decapitation is moving
> in rapidly :(
> 
> regards,
> 
> christopher cato
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: help about tomcat virtual hosting...

2001-02-15 Thread Luc Vanlerberghe

In the original JServ, you could use the loadbalancer to solve a problem
like that.
You could make a second servlet engine active with the new settings and
configure the loadbalancer to have that instance receives all new
sessions.  Any active session would still be routed to the 'old' engine.
When after a while the 'old' sessions die out, you can take the 'old'
servlet engine down and configure it for the next cycle.

I don't know if any of this is implemented in the loadbalancer for
tomcat, but I hope to have given you some idea on how to proceed your
search for a solution.

Luc Vanlerberghe

Saurabh Shukla wrote:
> 
> NO, i do not think you can add a virtual host with out restarting.
> 
> -Original Message-
> From: Jino Lee [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 3:27 PM
> To: [EMAIL PROTECTED]
> Subject: help about tomcat virtual hosting...
> 
> I'm using apache 1.3.17 + tomcat 3.2.1 + red-hat 6.2.
> 
> Every time I add a virtual host, I have to restart apache and tomcat.
> During the restart, the visitors will loose all connection to the site is
> there anyway to add a virtual host without restarting the server?
> 
> Currentl, I'm only using tomcat3.2.1 for web service. Is there a way to
> refresh additional virtual hosts without restarting the server?
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: req.getSession(true) problems with 3.2.1

2001-02-12 Thread Luc Vanlerberghe

I don't know about the first problem, but the fact that the initial
getSession is slower than before is due to the fact that the sessionid
is now generated useing a java.security.SecureRandom object.  The
initialisation of objects that class take a while to initialise to make
sure their state is not predictable...
This delay should only occur for the first session though.

I believe the latest (development) versions of tomcat (both 3.x and 4.x)
initialise this generator on startup instead of waiting for the first
session.
However, you can configure them to use the normal java.util.Random class
instead during development.  Search the archives for keywords like
session, SecureRandom, server.xml etc...

Luc Vanlerberghe

Richard Downey wrote:
> 
> Hi,
> 
> I am moving working applications from 3.1.1 to 3.2.1 and after getting over
> the strictly enforced case rules everything seemed to be OK , however I've
> noticed that whenever a session expires using  HttpSession session =
> req.getSession(true); seems to trigger a loop leading to a stack overflow.
> This can be replicated and the problem disappears when I switch back to
> 3.1.1 . Has anybody else noted anything similar ? I'm running Sun JDK 2 1.3
> on Windows 2000.
> 
> I have also observed that the initial getSession is slower than under 3.1.1
> (5 seconds 3.2.1 versus a time in milliseconds for 3.1.1) I've checked that
> it wasn't some kind of cookie conflict between 3.1.1 and 3.2.1 by getting
> rid of the cookies. Any ideas would be gratefully received.
> 
> Regards
> 
> Richard Downey
> Contenlo
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: Help with servlet mapping

2001-02-09 Thread Luc Vanlerberghe

You probably configured workdb as a *User* DSN under ODBC.
Either configure your service to run using the same userid as the one
you defined your datasource for, or use a *System* DSN.

Luc Vanlerberghe

Wesley Ribeiro wrote:
> 
> I've solved it. It seems that the file $TOMCAT_HOME/conf/web.xml is no
> longer considered in Tomcat 3.2.1.
> You have to put your web.xml in the Web-inf directory where your files
> are.
> Now I have one more problem:
> If I start Tomcat from the command-line, everything works fine. But,
> if I start it as a NT service, the servlets/JSP cannot
> 
> access the database. The following error message is given:
> 
> Starting tomcat. Check logs/tomcat.log for error messages
> SQL Exception opening DB connection:java.sql.SQLException:
> [Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified
> 
> URL: jdbc:odbc:workdb
> UserName: PUBLIC
> SQL State: IM002
> Message: [Microsoft][ODBC Driver Manager] Data source name not found
> and no default driver specified
> Vendor: 0
> 
> I have configured the wrapper.properties file according to the
> documentation, and everything but the database access seems to work.
> 
> Can anyone help ? Should I change something in the server.xml file ?
> Thanks,
> 
> Wesley
> 
> PS: I'm using WinNT4sp6 and JDK1.3.0_01.
> 
>  -Original Message-
>  From:   Ribeiro, Wesley [CMPS:2852-A:EXCH]
>  Sent:   quinta-feira, 8 de fevereiro de 2001 13:28
>  To: Tomcat User mailing list
>  Subject:Help with servlet mapping
> 
>  Hi !
> 
>  Can you please help me solve the following problem (sorry if this
>  is a naive
>  question) :
> 
>  I'm trying to make Tomcat 3.2.1 to invoke a servlet (class
>  myServlet in
>  package com.mycompany)
>  whenever I use this URL: http://myServer/myServlet
>  In order to do that, I've added to the $TOMCAT_HOME/conf/web.xml:
> 
>  
>  
>  myServlet
>  
>  
>  com.mycompany.myServlet
>  
>  
> 
>  
>  
>  myServlet
>  
>  
>  /myServlet
>  
>  
> 
>  However, all I get is a 404 error when I try the URL above
>  mentioned. The
>  class com.mycompany.myServlet is in
>  the CLASSPATH, and this used to work with Tomcat 3.1, so I don't
>  know what
>  I'm doing wrong.
>  One thing I noticed is that the classes
>  org.apache.tomcat.servlets.DefaultServlet and
>  org.apache.tomcat.servlets.InvokerServlet are no longer part of
>  $TOMCAT_HOME/lib/webserver.jar, although they
>  continue to be mentioned in the default $TOMCAT_HOME/conf/web.xml
>  file. Can
>  this be the cause of this problem ?
>  One other thing I noticed is that the
>  $TOMCAT_HOME/conf/server.xml file has
>  an entry like:
> 
>   
>  className="org.apache.tomcat.request.InvokerInterceptor"
>  debug="0" prefix="/servlet/" />
> 
>  If I remove or comment that, the servlet examples which come with
>  the
>  distribution stop working (i.e., the servlet
>  examples work because of this entry, and not because of the
>  $TOMCAT_HOME/conf/web.xml file).
>  Thanks in advance for any help,
> 
>  Wesley
> 
>  -
> 
>  To unsubscribe, e-mail:
>  [EMAIL PROTECTED]
>  For additional commands, email:
>  [EMAIL PROTECTED]


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




Re: Whitespace

2001-02-02 Thread Luc Vanlerberghe

The whitespace is not generated by tomcat, but is present in your
source-jsp page between the jsp tags.
If you have a page that starts like:
<%@ page contentType="text/html"%>
<%@ page session="true"%>
<%@ page import="java.util.*,org.vanlerberghe.luc.spaans.*"%>



then it may not be obvious, but there are 4 (four!) linefeeds between
the jsp tags and your first  tag.  The way I solve this, without
giving up the readability of my page too much is by putting the closing
bracket on the start of the next line like so:
<%@ page contentType="text/html"
%><%@ page session="true"
%><%@ page import="java.util.*,org.vanlerberghe.luc.spaans.*"
%>

This way "" will be the very first characters written to output.

I do similar things with <% ... %> too, like:

<%
for (int i=0;i><%=topic.description%>
<%
}
%>

(Note the single linefeed at the end of the line starting with
"%>description0
description1
description2


I believe this trick is especially inportant to get the '' at the start of the output, because XML requires it to
be at offset 0 (I think).

Luc Vanlerberghe

P.s.: By the way: there is no way to let tomcat do this automatically. 
It is impossible for it to know which whitespace is needed and which
not.  In html, whitespace sometimes *does* make a difference (e.g. in a
 block)

Cato Førrisdahl wrote:
> 
> Hi,
> I have some jsp-pages which, when run, generates a lot of
> whitespace in the resulting page. It typically looks something like:
> ---Start---
> 
>   
> ...
> --Stop--
> Is there a way to prevent tomcat from making all this whitespace and make
> output like:
> --Start--
>   
> --Stop--
> 
> ?
> 
> Cato Førrisdahl
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: Invoking parameterized constructor using sueBean tag from a jsp

2001-02-01 Thread Luc Vanlerberghe

AFAIK the bean spec requires that a no-arg constructor must exist.

To initialise your bean you must use another method or getter/setter
methods.

You can always include your constructor with arguments as well and let
it call this() (as very first statement) and then the initialisation
method with the arguments.

I'm not sure, but I think you can have java statements (using <% ... %>)
within the  tags that will be executed right after
the bean is first instantiated.  Won't look to good, but might be
useful...

Luc

Abdullah wrote:
> 
> Hi
> can anyone tell me how to invoke a parameterizd constructor using useBean tag
> from a jsp
> 
> Thanks
> Abdullah
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: list of HttpSession objects

2001-01-31 Thread Luc Vanlerberghe

I'd have to check the servlet spec for the details, but I'm pretty sure
that servlets are not supposed to use the sessions, request and response
object after the request has been processed.
The servlet spec was designed to allow easy development of independent
web applications that can be run on any server that conforms to the
spec.
One of the 'features' of the spec is each webapp runs in its own context
shielded from other webapps that may be running on the same server, and
that sessions are maintained by the container in whatever way it sees
fit (as long as it conforms to the spec).  The Session, Request and
Response objects you see are objects that implement the required
interfaces but that says nothing about the way they are implemented.

Tomcat uses facade objects to shield the user objects from the actual
implementations to prevent users holding references to the
implementations and opening security holes.
E.g.: In tomcat, when a session times out, the implementing object is
not destroyed, but recycled to be reused when a new session is needed. 
If the user could still hold a reference, he would be able to see data
that is no longer his.

If the data you're trying to gather is limited to a single webapp, you
could take a look at the new Filter interface that is defined in the
proposed 2.3 servlet spec, or the events that can be sent when a new
session is started/stopped (HttpSessionActivationListener).  Tomcat 3.x
does not implement the 2.3 spec, but 4.x does.

If not, then what you are trying to write is something that is
inherently dependent on the way the servlet container implements these
objects, so I would suggest delving into the internals of tomcat and
writing a tomcat dependent RequestInterceptor (for 3.x) or Valve (for
4.x) for that functionality.

Luc Vanlerberghe

Ivo Limmen wrote:
> 
> Do you always get the nullpointerexception or is it only when the user
> closes the connection?
> I am working on a similar problem, I want to see how many sessions are
> active. I have tried to use a weak reference to each session object
> but it didn't work because all the sessions are reused by Tomcat, so
> they don't dissapear.
> 
> Ivo
> 
> -Original Message-
> From: TeamOn Crosswinds [mailto:[EMAIL PROTECTED]]
> Sent: woensdag 31 januari 2001 5:33
> To: [EMAIL PROTECTED]
> Subject: list of HttpSession objects
> 
> Hi,
> 
> We are moving to Tomcat3.2.1 and noticed a problem.
> We monitor user-activity per web-server by keeping a list of
> HTTPSession
> objects; we query this list to see the sessions active (and thereby
> some ser
> information) at a given point.
> 
> With this version of tomcat, there seems to be this HTTPSessionfacade
> object
> that has a 'realsession' object. this realsession object gets nuked at
> the
> end of every request.
> 
> So, our list maintains a list of httpsessionfacade objects that do not
> have
> any realsession objects associated with them, so we get
> nullpointerexception
> when we try to read from these httpsession objects we maintain..
> 
> Is this a feature?
> Is there any other way our management console can keep track of
> httpsessions?
> 
> thanks,
> murthy
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 
> Furore Informatica B.V.
> Rijswijkstraat 175-8
> Postbus 9204
> 1006 AE Amsterdam
> tel. (020) 346 71 71
> fax. (020) 346 71 77
> 
> --
> The information transmitted is intended only for the person
> or entity to which it is addressed and may contain confidential
> and/or privileged material. Any review, retransmission,
> dissemination or other use of, or taking of any action in
> reliance upon, this information by persons or entities other
> than the intended recipient is prohibited. If you received
> this in error, please contact the sender and delete the material
> from any computer
> --


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




Re: and getInitParameter woes

2001-01-28 Thread Luc Vanlerberghe

Just a guess:

You defined a servlet in your web.xml, but called it using a
/servlet/ style url...
The /servlet interceptor can't know that you already used that class to define a
servlet and initialises its own copy...
This would also explain why there are no init-parameters available in the "second"
call: the /servlet interceptor has no access to the web.xml.

Try adding a instance variable that counts the number of init() calls.  This should
prove two different instances of your servlet are created.

If in web.xml, you define the servlet, define a url-mapping and then access the
servlet through that mapping there should be only one instance that is initialised
exactly once.

Luc Vanlerberghe

"Stein M. Eliassen" wrote:

> Hi,
>
> I think there is a problem with the getInitParameter in 3.2.1.
>
> When a servlet is defined with 1 in
> WEB-INF/web.xml the init()-method gets called twice.
>
> First time, as expected, when the servlet-engine fires-up.
>
> Everthing is swell with the getInitParameter-calls, that is, the init-params are
> valid.
>
> The "second time" init() is called is when the servlet is getting a request for
> the first time, but this time the getInitParameter just return nulls so init()
> exits with an exception.
>
> I say "second time" because tomcat is trying to create a new instance of the
> servlet.
>
> And when I shut-down tomcat I can see the destroy-method gets called for the
> rightly created instance.
>
> When I remove the -parameter from web.xml the getInitParameter
> also returns null in the init-method.
>
> This happens both in VAJ 3.02 on linux(jdk 1.1.7) and IBM JDK 1.3, also on
> linux.
>
> ROOT-context or not doesn't seem to matter.
>
> I searched the mailing-lists, but couldn't determine if this was fixed or of any
> workarounds that worked.
>
> Any comments on this?
>
> Regards
> Stein M. Eliassen
> System Developer - KPNQwest Norway AS
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]



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




Re: java.exe deadlock

2001-01-26 Thread Luc Vanlerberghe

I remember a problem like that being discussed.  It occurs if you remove
the ROOT webapp.
It was reported several times. Check the BugRat reports:

http://w4.metronet.com/~wjm/tomcat/2000/Sep/msg00086.html
http://w4.metronet.com/~wjm/tomcat/2000/Sep/msg00087.html
http://znutar.cortexity.com/BugRatViewer/ShowReport/630
http://znutar.cortexity.com/BugRatViewer/ShowReport/631

And finally:
http://znutar.cortexity.com/BugRatViewer/ShowReport/691
A comment on that page says that it has been fixed, but not in what
release... (http://znutar.cortexity.com/BugRatViewer/ShowComment/282)

There's a workaround on:
http://w4.metronet.com/~wjm/tomcat/2000/Sep/msg00088.html

Luc Vanlerberghe



Helge wrote:
> 
> Hi there everyone,
> 
> I have a problem that drives me nuts. I didn't find anything in the FAQs,
> nor in the the How-Tos, nor in the newsgroups. I set up Tomcat 3.2.1
> (including my own context within the "webapps" directory) in combination
> with Apache 1.3.14 via mod_jk.dll on Windows NT 4. I set it up according to
> the Tomcat documentation. Everything works fine until I send a request to
> Apache pointing at a non-existing *.jsp, which is apped to Tomcat using a
> "JKMount /*.jsp" statement via an ajp13-worker. This request will result in
> a constant "java.exe" process which consumes 100% cpu time. The server is
> locked and takes no more requests. Did I make a mistake within the .conf
> files? Do I need a special mapping? Any idea what could be the resaon for
> this? I tried multiple (really, multiple!) configurations. I'm starting to
> get so very tired...
> 
> Please help me ... or give me a hint, where help to this special problem
> could be found.
> 
>  Thanks,
> 
> Helge Carstensen
> [EMAIL PROTECTED]
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: mod_jk load balancing

2001-01-26 Thread Luc Vanlerberghe

Your workers.properties file contains the entry worker.list

Normally that lists the available workers and the JkMount directives
indicate which one to connect to

However, If you want to do loadbalancing, the workers.list should only
contain the name of your loadbalacing worker and none of the workers the
loadbalancer itself is using!

So with the configuration you gave, you should have
worker.list=loadbalancer
(The rest of the config including the JkMount directives looks correct)

If you want to switch back to no loadbalancing, change back to
worker.list=ajp12,ajp13
and connect to either one using JkMount

Luc Vanlerberghe

P.s.: I only did something similar using mod_jserv, but I don't see any
reason why this should be different for mod_jk
P.p.s.: Perhaps consider changing the names of your workers (In the
tomcat examples they are confusing as well, I know).  ajp12 and ajp13
are names of two different communication protocols between the webserver
and tomcat...
If you change the names of your workers to worker_1 and worker_2, the
configs become

worker.list=my_loadbalancer

worker.worker_1.port=10101
worker.worker_1.host=localhost
worker.worker_1.type=ajp12
worker.worker_1.lbfactor=1

worker.worker_2.port=10103
worker.worker_2.host=localhost
worker.worker_2.type=ajp12
worker.worker_2.lbfactor=1

worker.my_loadbalancer.type=lb
worker.my_loadbalancer.balanced_workers=worker_1,worker_2



"Royzen, Margaret" wrote:
> 
> Hi everyone,
> 
> I am trying to configure the Apache server to balance the load between
> two independent Tomcat workers using ajp12 protocol.
> 
> One worker is listening on port 10101, another one on port 10102. I
> put in my workers.properties file:
> 
> worker.ajp12.port=10101
> worker.ajp12.host=localhost
> worker.ajp12.type=ajp12
> worker.ajp12.lbfactor=1
> 
> worker.ajp13.port=10103
> worker.ajp13.host=localhost
> worker.ajp13.type=ajp12
> worker.ajp13.lbfactor=1
> 
> worker.loadbalancer.type=lb
> worker.loadbalancer.balanced_workers=ajp12, ajp13
> 
> At first I put in my apache configuration file :
> 
> JkMount /apps-jsp/servlet/* loadbalancer
> JkMount /apps-jsp/*.jsp loadbalancer
> 
> thinking, that this way mod_jk will process requests via loadbalancer
> worker, but I got "Internal Server Error"
> After that, I changed it back to:
> 
> JkMount /apps-jsp/servlet/* ajp12
> JkMount /apps-jsp/*.jsp ajp12
> 
> Servlets started working, but log files are showing no load balancing,
> all requests are processes via port 10101.
> 
> Does anyone know, what should I put into Apache configuration file to
> achieve load balancing?
> 
> Thank you very much in advance,
> Margaret Royzen.


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




Re: Session creation speed

2001-01-23 Thread Luc Vanlerberghe

Note that this only happens for the very first session that is created
after tomcat is started.

All following session id's will be generated much faster, it's only the
initialisation of the secure random number generator that takes a long
time.

The latest versions of tomcat (both the 3.x and 4.x versions) address
this problem by initialising the generator when tomcat starts instead of
waiting until the first session id is needed. I'm not sure this is
already present in the release versions...

You can use the simple java.util.Random class during development, but
for production, you should use the SecureRandom class to prevent anyone
from guessing your session id and taking over from another browser...

Luc Vanlerberghe

Steve Smale wrote:
> 
> Im having problems with creating sessions with a servlet in tomcat.
> 
> When the getSession line is reached in the code it freezes for around 9-10
> seconds before returning a session, leading the user to think theyre not
> going to get anything back...
> 
> This only seems to be the case with new sessions being created;  - once
> the session is established, future access to the servlet is an acceptable
> speed for the duration of that client's session.
> 
> Im testing it with netscape 4.71/linux and a standalone tomcat server...
> 
> Anyone else had this problem?
> 
> --
> Steve Smale
> [EMAIL PROTECTED]
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: Error 500 when starting examples

2001-01-05 Thread Luc Vanlerberghe

> Root cause:
> java.lang.NoClassDefFoundError: sun/tools/javac/Main

What it says is that it can't find the Sun Java compiler
(sun.tools.javac.Main) that is normally located in tools.jar

> I use JRE 1.3.

Instead of using the java *runtime* environment 1.3 (JRE 1.3) you should
be using one of the java *development* kits (JDK 1.1, 1.2 or 1.3) that
include the tools.jar

One word of caution though: on a windows system, even if you installed
the development kit, a JRE is installed as well.  Make sure you set your
JAVA_HOME environment variable to correct one.
(On my system the JDK is on c:\java\jdk1.3 and the JRE on c:\program
files\JavaSoft\JRE\1.3)

Luc

"Weßling, Achim" wrote:
> 
> Hallo,
> 
> I try to run Tomcat 3.2.1 on a WinNTServer 4.0 SP 6a with IIS 4.0.
> 
> The installation seams to be easy, but when I try to run the examples on
> http://localhost/examples/jsp/index.html I get the error-messages like this:
> 
> Error: 500
> Location: /examples/jsp/error/err.jsp
> Internal Servlet Error:
> 
> javax.servlet.ServletException: sun/tools/javac/Main
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:399)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java:166)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
> at java.lang.Thread.run(Unknown Source)
> 
> Root cause:
> java.lang.NoClassDefFoundError: sun/tools/javac/Main
> at
> org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:128)
> at org.apache.jasper.compiler.Compiler.compile(Compiler.java:245)
> at
> org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
> at
> org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
> at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> rvlet.java:152)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:164)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java:166)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
> at java.lang.Thread.run(Unknown Source)
> 
> Can someone tell me, where the probleme is located?
> 
> I use JRE 1.3.
> 
> Mit Freundlichem Gruß
> 
> Achim Weßling
> 
> **
> INFOKOM Gütersloh
> Fachbereich Technische Anwendungen / Zentrale Anwendungen
> Tel.: 05241/85-2926
> [EMAIL PROTECTED]
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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




Re: curious behavior - pseudo servlet-mapping with mod_jk

2001-01-04 Thread Luc Vanlerberghe

Great, now I am confused... :)

No, what you read in my comments is correct...

The fact that both "quiz" and "Quiz" are accepted in the URL is entirely
dependent on the implementation of the InvokerInterceptor.  Other
servlet containers may or may not have such an interceptor configured.  
Containers configured for production use (including tomcat) probably
will not.

To comply with the servlet spec, a servlet must be mapped to a
url-pattern in a  in web.xml like


quiz
/quiz


Relying on the presence of a /servlet/* interceptor would be
non-portable.

Luc

P.s.: Apparently you are on GMT-6, I'm on GMT+1.  Don't count on fast
replies :)

> > 
> >  quiz
> >  /quiz
> > 

Jacob Kjome wrote:
> 
> Thanks, Luc
> 
> But I'm not sure if you answered my question or not.
> 
> I understand the /servlet/ stuff and that you can even leave out any
> registration of a servlet and see that servlet under, for example,
> /servlet/Quiz (as long as the class is named Quiz.class with case being
> meaningful).
> 
> The thing I'm seeing, but not sure why, is that when actaully
> registering a servlet like:
> 
> 
>  quiz
>  Quiz
> 
> 
> you can now reference the serlvet in question by calling it with the
> spelling in either the  or .
> 
> Maybe that is what you just said.
> 
> The thing is, you can throw out the fact that Tomcat uses /servlet/ in
> the default settings for the RequestInterceptor in server.xml.  That
> path can be different among servlet runners.  As long as the URL in your
> HTML is relative and is written like href="./quiz", you will be on
> target either way.  Now, if you've gotten to the servlet successfully
> already, the URL referencing back to itself will always be correct.
> 
> The issue now becomes only "will other servlet runner
> RequestInterceptor's recognize the spellings of both  and
>  to invoke the Quiz.class servlet"?
> 
> I think you may have answered the above question by saying that Tomcat's
> RequestInterceptor, specifically, accepts both the  and
>  spellings when referencing the servlet (that is
> referencing Quiz.class as /Quiz or /quiz) in a URL but that this is NOT
> a behavior that can be counted on by other servlet runner
> RequestInterceptor's.
> 
> Am I reading you correctly?
> 
> Jake
> 
> -Original Message-
> From: Luc Vanlerberghe [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 03, 2001 11:05 AM
> To: [EMAIL PROTECTED]
> Subject: Re: curious behavior - pseudo servlet-mapping with mod_jk
> 
> That's because you're using the InvokerInterceptor that is mapped to all
> /servlet/ requests.
> 
> In your server.xml file you'll see the entry:
>  className="org.apache.tomcat.request.InvokerInterceptor"
> debug="0" prefix="/servlet/" />
> 
> It is just a handy tool to use during development that allows you to
> call any servlet without having to register it in .
> Apparently it accepts both the class name and the servlet name to invoke
> a servlet.  For servlets that are defined within a package, you'd use
> http://localhost/mycontext/servlet/xxx.yyy.mypackage.Quiz (could be that
> it must be http://localhost/mycontext/servlet/xxx/yyy/mypackage/Quiz,
> not sure) with Quiz being in the appropriate sub-/sub-/subdirectory
> under /WEB-INF/classes.
> 
> Most servlet-containers will have a similar mechanism, but I don't think
> there's really a standard, so for production you'd better use the
> standard  entries.
> 
> Luc Vanlerberghe
> 
> Jacob Kjome wrote:
> >
> > I just noticed something that seems to work for me, but I can't
> determine
> > quite why?  Maybe someone can confirm that this is expected behavior
> or
> > not.
> >
> > I am running Tomcat 3.2.1 on Windows 2000
> >
> > It seems that if you have a servlet registered in web.xml like this:
> >
> > 
> > quiz
> > Quiz
> > 
> >
> > AND you have the default values in mod_jk.conf:
> >
> > JkMount /mycontext/*.jsp ajp13
> > JkMount /mycontext/servlet/* ajp13
> >
> > you are able to access the above servlet at either of the following
> URL's:
> >
> > http://localhost/mycontext/servlet/Quiz
> > http://localhost/mycontext/servlet/quiz
> >
> > Notice the case difference in Quiz/quiz
> >
> > It seems that the  provides a rudimentary amount of
> servlet
> > mapping.
> >
> > I tested this theory by changing the  to "quiza" and
> testing
&g

Re: curious behavior - pseudo servlet-mapping with mod_jk

2001-01-03 Thread Luc Vanlerberghe

That's because you're using the InvokerInterceptor that is mapped to all
/servlet/ requests.

In your server.xml file you'll see the entry:


It is just a handy tool to use during development that allows you to
call any servlet without having to register it in . 
Apparently it accepts both the class name and the servlet name to invoke
a servlet.  For servlets that are defined within a package, you'd use 
http://localhost/mycontext/servlet/xxx.yyy.mypackage.Quiz (could be that
it must be http://localhost/mycontext/servlet/xxx/yyy/mypackage/Quiz,
not sure) with Quiz being in the appropriate sub-/sub-/subdirectory
under /WEB-INF/classes.

Most servlet-containers will have a similar mechanism, but I don't think
there's really a standard, so for production you'd better use the
standard  entries.

Luc Vanlerberghe



Jacob Kjome wrote:
> 
> I just noticed something that seems to work for me, but I can't determine
> quite why?  Maybe someone can confirm that this is expected behavior or
> not.
> 
> I am running Tomcat 3.2.1 on Windows 2000
> 
> It seems that if you have a servlet registered in web.xml like this:
> 
> 
> quiz
> Quiz
> 
> 
> AND you have the default values in mod_jk.conf:
> 
> JkMount /mycontext/*.jsp ajp13
> JkMount /mycontext/servlet/* ajp13
> 
> you are able to access the above servlet at either of the following URL's:
> 
> http://localhost/mycontext/servlet/Quiz
> http://localhost/mycontext/servlet/quiz
> 
> Notice the case difference in Quiz/quiz
> 
> It seems that the  provides a rudimentary amount of servlet
> mapping.
> 
> I tested this theory by changing the  to "quiza" and testing
> that.  After I did that, "Quiz" and "quiza" worked, but "quiz" did not.
> 
> NOTE:  This was done WITHOUT servlet mapping tags such as:
> 
> 
>  quiz
>  /quiz
> 
> 
> So, it seems you can very simply (without complex servlet mappings) make
> your servlet case insensitive; that is in First letter upper case java
> style class naming syntax OR all lower case.
> 
> HOWEVER,
> 
> I am not sure if this is portable accross servers!
> 
> Can someone confirm that this isn't just a quirk of Tomcat?  Should it work
> this way based on the servlet spec  Is it portable across servlet
> runners  Does this work on Tomcat 4.0
> 
> Jake
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


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