You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/02/22 23:27:46 UTC

[Catalina] Confirmed: Classreloading Session Persistence doesn't work with Turbine

Yea, I have proof AND a way to test it in 10 easy steps! :-)

    (but no idea on how to fix it :-()

What I did to confirm and test it was this:
(sorry Craig, it is going to require installing MySQL and loading the Scarab
schema...it isn't hard and directions are provided below):

#1. Install MySQL. Set it up so that connections from localhost with no
username/password can connect to it.

INSERT INTO user VALUES
('localhost%','','','Y','Y','Y','Y','Y','Y','Y','Y','Y',
'Y','Y','Y','Y','Y');

#2. Get Scarab from CVS.
    <http://scarab.tigris.org/>

    Further path references start with the top level "scarab" directory.

#3. Create and import the database.
    cd scarab/src/sql
    ./create-mysql-database.sh
    (this will drop a database called "scarab" and re-create it.)

#4. Build the scarab/target directory.
    cd scarab/build
    ./build.sh

#5. Start Tomcat...
    cd scarab/target
    ./bin/catalina.sh run

#6. go to:
    <http://localhost:8080/scarab/servlet/scarab/template/Login.vm>
    login username: jon@latchkey.com
    login password: 1
    click login button

    [this establishes a Turbine User object in the HTTP Session. without
        this object there, a request to a "privileged" page will return you
        to the login page again.]

#7. edit url and make this request:
<http://localhost:8080/scarab/servlet/scarab/template/admin,ModifyProject.vm
>
    make sure to keep the logged in session id if it is there still. this
    page is a "privileged" page and cannot be accessed directly without a
    "logged in" session id.

#8. click on the popup menu to select a different project (there are only
    two projects) and then click "Refresh". that will demonstrate that the
    session id is being carried through extra requests properly by allowing
    you to perform this action. make sure to keep this window open.

#9. 
cd scarab/target/webapps/scarab/WEB-INF/classes/org/tigris/scarab/actions
touch *.class
    [this will cause the classloader to reload. simulating the recompiling
        of the classes.]

#10. Now, try to select the other project in the popup. you will be returned
to the login page again. obviously showing that the User object was not
persisted.


The server.xml file is in:
    scarab/src/tomcat-4.0/conf/server.xml

You *may* wish to replace the catalina.jar in:
    scarab/src/tomcat-4.0/server

If you do that, make sure to re-build the "target" directory by
re-executing:

    cd scarab/build
    ./build.sh

Please let me know if there is anything else you need from me. I'm doing
this on OSX with JDK 1.3 and Hotspot client VM, but I doubt that that is the
problem.


Here is the log of things that I got...


[ things start up]

2001-02-22 13:47:09 scarab: init
2001-02-22 13:47:11 scarab: Turbine: init() Ready to Rumble!
2001-02-22 13:47:12 scarab: Turbine: doGet() Start Initializing Services!
2001-02-22 13:47:12 scarab: Turbine: doGet() Finish Initializing Services!

[this is when step #9 is performed]

2001-02-22 13:59:44 StandardContext[/scarab]: Reloading this Context has
started
2001-02-22 13:59:44  -- INFO -- Shutting down service: ResourceService
2001-02-22 13:59:44  -- INFO -- Shutting down service:
TurbineUniqueIdService
2001-02-22 13:59:44  -- INFO -- Turbine instance running at
http://localhost:8080/scarab/servlet/scarab shutting down.
2001-02-22 13:59:44  -- INFO -- Shutting down service:
TurbineSecurityService
2001-02-22 13:59:44  -- INFO -- Shutting down service:
TurbineTemplateService
2001-02-22 13:59:44  -- INFO -- Shutting down service: TurbineServletService
2001-02-22 13:59:44  -- INFO -- Shutting down service: TurbineFactoryService
2001-02-22 13:59:44  -- INFO -- Shutting down service:
TurbineGlobalCacheService
2001-02-22 13:59:44  -- INFO -- Shutting down service:
TurbineResourceService
2001-02-22 13:59:44  -- INFO -- Shutting down service: TurbineUploadService
2001-02-22 13:59:44 scarab: Turbine: Done shutting down!
2001-02-22 13:59:44 Manager[/scarab]: Unloading persisted sessions
2001-02-22 13:59:44 Manager[/scarab]: Stopping

[ this is when step #10 is performed]

2001-02-22 13:59:44  -- INFO -- Initializing service (late):
TurbineSecurityService
2001-02-22 13:59:44 StandardLoader[/scarab]: Reloading checks are enabled
for this Context
2001-02-22 13:59:44 Manager[/scarab]: Starting
2001-02-22 13:59:44 Manager[/scarab]: Force random number initialization
starting
2001-02-22 13:59:44 Manager[/scarab]: Seeding random number generator class
java.security.SecureRandom
2001-02-22 13:59:44 Manager[/scarab]: Seeding of random number generator has
been completed
2001-02-22 13:59:44 Manager[/scarab]: Force random number initialization
completed
2001-02-22 13:59:44 Manager[/scarab]: Loading persisted sessions
2001-02-22 13:59:44 StandardContext[/scarab]: Reloading this Context is
completed
2001-02-22 13:59:53 scarab: init
2001-02-22 13:59:55 scarab: Turbine: init() Ready to Rumble!
2001-02-22 13:59:55 scarab: Turbine: doGet() Start Initializing Services!
2001-02-22 13:59:55 scarab: Turbine: doGet() Finish Initializing Services!
2001-02-22 14:00:16  -- INFO -- IDBroker thread finished.


Re: [Catalina] Confirmed: Classreloading Session Persistence doesn'twork with Turbine

Posted by Jon Stevens <jo...@latchkey.com>.
on 2/22/01 6:59 PM, "Craig R. McClanahan" <Cr...@eng.sun.com>
wrote:

> Real simple -- use the current CVS code -- *all* of it, not just replacing
> catalina.jar :-)

Ok. Got it. It is now working! Yea!

Sorry for the false alarm. :-(

> Using your script, you will see in the logs that the user object is persisted
> and restored correctly.

Hmmm...I still don't see it...this is everything in the
"scarab_log.2001-02-23.txt"...

2001-02-23 12:38:41 StandardLoader[/scarab]: Reloading checks are enabled
for th
is Context
2001-02-23 12:38:41 Manager[/scarab]: Starting
2001-02-23 12:38:41 Manager[/scarab]: Force random number initialization
startin
g
2001-02-23 12:38:41 Manager[/scarab]: Seeding random number generator class
java
.security.SecureRandom
2001-02-23 12:38:41 Manager[/scarab]: Seeding of random number generator has
bee
n completed
2001-02-23 12:38:41 Manager[/scarab]: Getting message digest component for
algor
ithm MD5
2001-02-23 12:38:41 Manager[/scarab]: Completed getting message digest
component
2001-02-23 12:38:41 Manager[/scarab]: Force random number initialization
complet
ed
2001-02-23 12:38:42 ContextConfig[/scarab]: Configured an authenticator for
meth
od BASIC
2001-02-23 12:38:42 Manager[/scarab]: Loading persisted sessions
2001-02-23 12:38:42 StandardWrapper[/scarab:default]: Loading container
servlet
default
2001-02-23 12:38:42 default: init
2001-02-23 12:38:42 StandardWrapper[/scarab:invoker]: Loading container
servlet
invoker
2001-02-23 12:38:42 invoker: init
2001-02-23 12:38:58 scarab: init
2001-02-23 12:38:59 scarab: Turbine: init() Ready to Rumble!
2001-02-23 12:38:59 scarab: Turbine: doGet() Start Initializing Services!
2001-02-23 12:38:59 scarab: Turbine: doGet() Finish Initializing Services!

> NOTE:  There appears to be a logic problem in the admin screen, though --
> attempts to switch back to the PacMan project fail, and it keeps redisplaying
> the Turbine project info.  But you are *not* redirected back to the login
> screen, because the session was correctly persisted and restored.

Yea, I see that as well. I wonder why that suddenly stops working after a
reload. Hmm...I will have to dig into that one further. This code isn't well
fleshed out yet and needs to be re-done using Pull anyway...

Sorry for the false alarm. :-(

thanks,

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>


Re: [Catalina] Confirmed: Classreloading Session Persistence doesn'twork with Turbine

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Jon Stevens wrote:

> Yea, I have proof AND a way to test it in 10 easy steps! :-)
>
>     (but no idea on how to fix it :-()
>

Real simple -- use the current CVS code -- *all* of it, not just replacing
catalina.jar :-)

Using your script, you will see in the logs that the user object is persisted
and restored correctly.

NOTE:  There appears to be a logic problem in the admin screen, though --
attempts to switch back to the PacMan project fail, and it keeps redisplaying
the Turbine project info.  But you are *not* redirected back to the login
screen, because the session was correctly persisted and restored.

Craig McClanahan



Re: [Catalina] Confirmed: Classreloading Session Persistence doesn'twork with Turbine

Posted by Jon Stevens <jo...@latchkey.com>.
on 2/22/01 2:42 PM, "Craig R. McClanahan" <Cr...@eng.sun.com>
wrote:

> Not a problem ... I want this puppy to work.

So do I. :-)

> One quick question (that I'm sure will be answered when I look into this in
> detail) -- the log files show that it did the "Unload persistent sessions"
> stuff, but no actual sessions or attributes were listed.  Was that because
> there
> were none, or because you did not set the debugging detail level on the
> session
> manager up?
> 
> <Context path="/scarab">
> ...
> <Manager debug="99"/>
> ...
> </Context>
> 
> If this was not done in your tests, could you try it as well?  Doing this will
> cause each individual session being unloaded or loaded (along with all of the
> attributes) to be dumped to the log files as well.
> 
> Craig

The log file was copy/pasted asis.

Here is the relevant section of the server.xml (as checked into Scarab's CVS
tree):

        <Context path="/scarab" docBase="scarab" reloadable="true"
debug="0">
           <Logger className="org.apache.catalina.logger.FileLogger"
                     prefix="scarab_log." suffix=".txt"
                  timestamp="true"/>
           <Loader checkInterval="3"
                className="org.apache.catalina.loader.StandardLoader"/>
           <Manager debug="99"/>
        </Context>

Maybe the Context debug=0 caused it to not print out the right information?

I was also going to try with the latest nightly of Tomcat, but I want to
confirm that the /lib/ directory is right before I go messing around with my
Scarab CVS tree to do the upgrade (before upgrading was replacing one .jar
file...now it is more work). :-)

thanks,

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>


Re: [Catalina] Confirmed: Classreloading Session Persistence doesn'twork with Turbine

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Jon Stevens wrote:

> Yea, I have proof AND a way to test it in 10 easy steps! :-)
>

Not as good as the 7-stepper last time, but it will have to do :-).

>
>     (but no idea on how to fix it :-()
>
> What I did to confirm and test it was this:
> (sorry Craig, it is going to require installing MySQL and loading the Scarab
> schema...it isn't hard and directions are provided below):
>

Not a problem ... I want this puppy to work.

One quick question (that I'm sure will be answered when I look into this in
detail) -- the log files show that it did the "Unload persistent sessions"
stuff, but no actual sessions or attributes were listed.  Was that because there
were none, or because you did not set the debugging detail level on the session
manager up?

    <Context path="/scarab">
        ...
        <Manager debug="99"/>
      ...
    </Context>

If this was not done in your tests, could you try it as well?  Doing this will
cause each individual session being unloaded or loaded (along with all of the
attributes) to be dumped to the log files as well.

Craig