You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Paul <pa...@kywb.uscourts.gov> on 2008/11/03 17:32:00 UTC

Re: By-passing Security on Home Page

Bob Schellink <sabob1 <at> gmail.com> writes:

> > ********** Error when starting Tomcat ***********************
> > [Click] [info ] initialized in debug mode
> > Oct 30, 2008 10:15:05 AM org.apache.catalina.session.StandardManager doLoad
> > SEVERE: IOException while loading persisted sessions:
java.io.InvalidClassExcept
> > ion: com.mycompany.myapp.page.HomePage; unable to create instance
> > java.io.InvalidClassException: com.mycompany.myapp.page.HomePage; unable to
> > create instance
> > at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1739)
> > at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
> > at org.apache.catalina.session.StandardSession.readObject
> >   (StandardSession.java:1439) ...
> 
> The above exception is not related to login but rather to the session 
> which was persisted after Tomcat shutdown. Upon restart Tomcat tries 
> to recreate the previous sessions but cannot instantiate the HomePage 
> class. I think this is because your HomePage does not implement 
> Serializable?
> 
> Btw how did your HomePage end up in the session? Did you set HomePage 
> to stateful or did you manually add it to the session?
> 
> kind regards
> 
> bob
> 
> 


Hi Bob,

Below is a part of my "HomePage.java".  Should I not be using
"setStateful(true)" in my "HomePage.java"?

...
public class HomePage extends BorderPage implements Serializable {    

    public Form form1 = new Form();
    public Table table1 = new Table();
    private TextField searchField;
    private Select typeSelect;
    private PageSizeSelect pageSizeSelect;
    public String title = "MyApp: Home";    
    
    // constructor
    public HomePage() {
        
        setStateful(true);
...

Thanks for your help,
Paul


Re: By-passing Security on Home Page

Posted by Bob Schellink <sa...@gmail.com>.
Hi Paul,


> Below is a part of my "HomePage.java".  Should I not be using
> "setStateful(true)" in my "HomePage.java"?
> 


Setting pages to stateful means they are placed in the users Session.

So unless you really want to have the HomePage carry state across 
requests, I would not recommend it. Especially for public web sites 
where the amount of visitors are unlimited and a stateful pages could 
use up quite a bit of memory. But this is just a generalization and 
each app is different, so perhaps a stateful HomePage is justified in 
your case.


> ...
> public class HomePage extends BorderPage implements Serializable {    


You should probably specify the serial version id as well:

public class HomePage extends BorderPage implements Serializable {

     private static final long serialVersionUID = 1L;

     public HomePage() {

     }
}

kind regards

bob