No, we're currently using Tomcat 3.3.1.....

Jerry

> -----Original Message-----
> From: Gaurang Shah [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 12:42 PM
> To: Struts Users Mailing List
> Subject: RE: Session-scope JavaBean being removed
> 
> 
> Are you using Websphere 4.0?
> We had a NullPoinerException when using session EJBs not sure 
> if that was
> the case with JavaBeans or not.
> A fixpack to 4.0.3 from IBM fixed it.
> 
> -----Original Message-----
> From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 11:46 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Session-scope JavaBean being removed
> 
> 
> My bad.  Should've included the details to begin with......
> 
> Struts-Config....
> 
> <struts-config>
>       <data-sources>
>               <data-source key="AEFA">
>                       <set-property property="autoCommit"
> value="false" />
>                       <set-property property="driverClass"
> value="oracle.jdbc.driver.OracleDriver" />
>                       <set-property property="maxCount"
> value="10" />
>                       <set-property property="minCount"
> value="1" />
>                       <set-property property="password"
> value="L2P1" />
>                       <set-property property="url"
> value="jdbc:oracle:thin:@devsrv:1526:DL2P1" />
>                       <set-property property="user"
> value="L2P1" />
>               </data-source>
>       </data-sources>
>       <form-beans>
>               <form-bean name="LogonForm"
> type="com.labone.aefa.validate.LogonForm" dynamic="true">
>                       <form-property name="userID"
> type="java.lang.String"/>
>                       <form-property name="password"
> type="java.lang.String"/>
>               </form-bean>
>               <form-bean name="DataEntryForm"
> type="com.labone.aefa.validate.DataEntryForm" dynamic="true">
>                       <form-property name="orderBy"
> type="java.lang.String"/>
>                       <form-property name="lastName"
> type="java.lang.String"/>
>                       <form-property name="firstName"
> type="java.lang.String"/>
>                       <form-property name="middleName"
> type="java.lang.String"/>
>                       <form-property name="ssn"
> type="java.lang.String"/>
>                       <form-property name="acctNum"
> type="java.lang.String"/>
>                       <form-property name="acctSfx"
> type="java.lang.String"/>
>                       <form-property name="prodApplied"
> type="java.lang.String"/>
>                       <form-property name="policyName"
> type="java.lang.String"/>
>                       <form-property name="quoteback"
> type="java.lang.String"/>
>                       <form-property name="entryDate"
> type="java.lang.String"/>
>                       <form-property name="userid"
> type="java.lang.String"/>
>                       <form-property name="dob"
> type="java.lang.String"/>
>                       <form-property name="advisorName"
> type="java.lang.String"/>
>                       <form-property name="advisorNum"
> type="java.lang.String"/>
>                       <form-property name="advisorArea"
> type="java.lang.String"/>
>                       <form-property name="advisorPhone"
> type="java.lang.String"/>
>                       <form-property name="advisorPhoneExt"
> type="java.lang.String"/>
>                       <form-property name="advisorFax"
> type="java.lang.String"/>
>                       <form-property name="drvLcnsNum"
> type="java.lang.String"/>
>                       <form-property name="drvLcnsState"
> type="java.lang.String"/>
>                       <form-property name="workPhone"
> type="java.lang.String"/>
>                       <form-property name="workPhoneExt"
> type="java.lang.String"/>
>                       <form-property name="homePhone"
> type="java.lang.String"/>
>                       <form-property name="timeContWork"
> type="java.lang.String"/>
>                       <form-property name="timeContWorkAMPM"
> type="java.lang.String" initial="AM"/>
>                       <form-property name="timeContHome"
> type="java.lang.String"/>
>                       <form-property name="timeContHomeAMPM"
> type="java.lang.String" initial="AM"/>
>                       <form-property name="streetNum"
> type="java.lang.String"/>
>                       <form-property name="streetName"
> type="java.lang.String"/>
>                       <form-property name="apt"
> type="java.lang.String"/>
>                       <form-property name="city"
> type="java.lang.String"/>
>                       <form-property name="state"
> type="java.lang.String"/>
>                       <form-property name="zip"
> type="java.lang.String"/>
>                       <form-property name="physName"
> type="java.lang.String"/>
>                       <form-property name="physStreetNum"
> type="java.lang.String"/>
>                       <form-property name="physStreetName"
> type="java.lang.String"/>
>                       <form-property name="physSuite"
> type="java.lang.String"/>
>                       <form-property name="physCity"
> type="java.lang.String"/>
>                       <form-property name="physState"
> type="java.lang.String"/>
>                       <form-property name="physZip"
> type="java.lang.String"/>
>                       <form-property name="physPhone"
> type="java.lang.String"/>
>                       <form-property name="physPhoneExt"
> type="java.lang.String"/>
>                       <form-property name="typePolicy"
> type="java.lang.String"/>
>                       <form-property name="consultDate"
> type="java.lang.String"/>
>                       <form-property name="policyAmount"
> type="java.lang.String"/>
>                       <form-property name="aibRider"
> type="java.lang.String"/>
>                       <form-property name="buttonAction"
> type="java.lang.String"/>
>                       <form-property name="otherInsured"
> type="java.lang.String"/>
>                       <form-property name="policyChange"
> type="java.lang.String"/>
>                       <form-property name="gender"
> type="java.lang.String"/>
>                       <form-property name="stateSigned"
> type="java.lang.String"/>
>                       <form-property name="paramedName"
> type="java.lang.String"/>
>                       <form-property name="internalReplacement"
> type="java.lang.String"/>
>                       <form-property name="advisorNotes"
> type="java.lang.String"/>
>                       <form-property name="socialBenefit"
> type="java.lang.String"/>
>                       <form-property name="status"
> type="java.lang.String"/>
>                       <form-property name="socBenefRider"
> type="java.lang.String"/>
>                       <form-property name="socBenefRiderAmt"
> type="java.lang.String"/>
>                       <form-property name="stateList"
> type="java.lang.String[]"
>                               initial="{'Select
> One','AK-Alaska','AL-Alabama','AR-Arkansas','AZ-Arizona','CA-C
> alifornia',
>       
> 'CO-Colorado','CT-Connecticut','DC-District of 
> Columbia','DE-Delaware',
>       
> 'FL-Florida','GA-Georgia','HI-Hawaii','IA-Iowa','ID-Idaho','IL
> -Illinois',
>       
> 'IN-Indiana','KS-Kansas','KY-Kentucky','LA-Louisiana','MA-Mass
> achusetts',
>       
> 'MD-Maryland','ME-Maine','MI-Michigan','MN-Minnesota','MO-Missouri',
>       
> 'MS-Mississippi','MT-Montana','NC-North Carolina','ND-North Dakota',
>                                         'NE-Nebraska','NH-New
> Hampshire','NJ-New Jersey','NM-New Mexico','NV-Nevada',
>                                         'NY-New
> York','OH-Ohio','OK-Oklahoma','OR-Oregon','PA-Pennsylvania',
>                                         'RI-Rhode Island','SC-South
> Carolina','SD-South Dakota','TN-Tennessee',
>       
> 'TX-Texas','UT-Utah','VA-Virginia','VT-Vermont','WA-Washington',
>                                         'WI-Wisconsin','WV-West
> Virginia','WY-Wyoming'}"/>
>                       <form-property name="stateListValues"
> type="java.lang.String[]"
>       
> initial="{'0','1','2','3','4','5','6','7','8','9','10','11','1
> 2','13','14','
> 15','16','17','18','19','20',
>       
> '21','22','23','24','25','26','27','28','29','30','31','32','3
> 3','34','35','
> 36','37','38',
>       
> '39','40','41','42','43','44','45','46','47','48','49','50','51'}"/>
>               </form-bean>            
>       </form-beans>
>       <global-forwards>
>               <forward name="logon"
> path="/logon.do"/>
>               <forward name="dataentry"
> path="/dataentry.do"/>
>       </global-forwards>
>       <action-mappings>
>               <action path="/logon"
> type="com.labone.aefa.util.TilesForward">
>                       <forward name="success"
> path="logon"/>
>               </action>
>               <action path="/dataentry"
> type="com.labone.aefa.util.TilesForward">
>                       <forward name="success"
> path="dataentry"/>
>               </action>
>               <action path="/LogonAction"
> type="com.labone.aefa.struts.LogonAction"
>                               name="LogonForm"
>                               scope="request"
>                               input="logon"
>                               validate="true">
>                       <forward name="success"
> path="menu"/>
>                       <forward name="failure"
> path="logon"/>
>               </action>
>               <action path="/DataEntryAction"
> type="com.labone.aefa.struts.DataEntryAction"
>                               name="DataEntryForm"
>                               scope="session"
>                               input="dataentry"
>                               validate="true">
>                       <forward name="success"
> path="final"/>
>                       <forward name="failure"
> path="error"/>
>               </action>
>       </action-mappings>
>       <controller
> processorClass="org.apache.struts.tiles.TilesRequestProcessor"
> nocache="true">
>       </controller>
>       <plug-in className="com.labone.aefa.util.MemoryDatabasePlugIn">
>       </plug-in>
> </struts-config>
> 
> The MemoryDatabasePlugIn looks like....
> 
> public final class MemoryDatabasePlugIn implements PlugIn
> {
>       private ApplicationConfig config = null;
>       private ActionServlet servlet = null;
>       
>       private MemoryUserDatabase database = null;
>       
>       private String databasePath = 
> "/WEB-INF/databases/userDatabase.xml";
>       
>       public void init(ActionServlet servlet, 
> ApplicationConfig config)
>               throws ServletException
>       {
>               this.config = config;
>               this.servlet = servlet;
>               
>               database = new MemoryUserDatabase();
>               try
>               {
>                       String path =
> servlet.getServletContext().getRealPath(databasePath);
>                       database.setPathname(path);
>                       database.open();
>               }
>               catch(Exception e)
>               {
>                       throw new ServletException("Cannot load 
> persistent
> database from '" + databasePath + "'", e);
>               }
>               
>       
> servlet.getServletContext().setAttribute(Constants.DATABASE_KE
> Y, database);
>       }
>       
>       public void destroy()
>       {
>       
> servlet.getServletContext().removeAttribute(Constants.DATABASE_KEY);
>               
>               database = null;
>               servlet = null;
>               config = null;
>       }
> }
> 
> MemoryUserDatabase looks like.....
> 
> public final class MemoryUserDatabase
> {
>       private HashMap users = new HashMap();
>       
>       private String pathname = null;
> 
>       public String getPathname()
>       {
>               return this.pathname;
>       }
>               
>       public void setPathname(String pathname)
>       {
>               this.pathname = pathname;
>       }
>       
>       public MemoryUser findUser(String username)
>       {
>               synchronized (users)
>               {
>                       return ((MemoryUser) users.get(username));
>               }
>       }
>       
>       public MemoryUser createUser(String username)
>       {
>               synchronized(users)
>               {
>                       if (users.get(username) != null)
>                       {
>                               throw new
> IllegalArgumentException("Duplicate user '" + username + "'");
>                       }
>                       
>                       MemoryUser user = new MemoryUser(this, 
> username);
>                       
>                       synchronized(users)
>                       {
>                               users.put(username, user);
>                       }
>                       
>                       return (user);
>               }
>       }
>       
>       public void open()
>               throws Exception
>       {
>               FileInputStream fis = null;
>               BufferedInputStream bis = null;
>               
>               try
>               {
>                       fis = new FileInputStream(pathname);
>                       bis = new BufferedInputStream(fis);
>                       
>                       Digester digester = new Digester();
>                       digester.push(this);
>                       digester.setValidating(false);
>                       digester.addFactoryCreate("database/user", new
> MemoryUserCreationFactory(this));
>                       
>                       digester.parse(bis);
>                       
>                       bis.close();
>                       bis = null;
>                       fis = null;
>               }
>               catch(Exception e)
>               {
>                       throw e;
>               }
>               finally
>               {
>                       if (bis != null)
>                       {
>                               try
>                               {
>                                       bis.close();
>                               }
>                               catch(Throwable t)
>                               {
>                                       ;
>                               }
>                               bis = null;
>                               fis = null;
>                       }
>               }
>       }
> }     
>       class MemoryUserCreationFactory implements ObjectCreationFactory
>       {
>               public MemoryUserCreationFactory(MemoryUserDatabase
> database)
>               {
>                       this.database = database;
>               }
>               
>               private MemoryUserDatabase database = null;
>               
>               private Digester digester = null;
>               
>               public Digester getDigester()
>               {
>                       return (this.digester);
>               }
>               
>               public void setDigester(Digester digester)
>               {
>                       this.digester = digester;
>               }
>               
>               public Object createObject(Attributes attributes)
>               {
>                       String username = 
> attributes.getValue("username");
>                       MemoryUser user = database.createUser(username);
>                       
> user.setFullname(attributes.getValue("fullname"));
>                       
> user.setPassword(attributes.getValue("password"));
>                       return (user);
>               }
>       }       
> 
> Here is the code from the logon process.....
> 
> public class LogonAction extends Action
> {
>       public ActionForward execute(ActionMapping mapping, 
> ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
>               throws ServletException, Exception
>       {
>               ActionErrors errors = new ActionErrors();
>               ActionForward forward = new ActionForward();
>                
>               MemoryUser user = null;
>                
>               String userID = (String)
> PropertyUtils.getSimpleProperty(form, "userID");
>               String password = (String)
> PropertyUtils.getSimpleProperty(form, "password");
>               
>               MemoryUserDatabase database = (MemoryUserDatabase)
> servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
>               if (database != null)
>               {
>                       user = (MemoryUser)
> database.findUser(userID.toLowerCase());
>                       if (user != null)
>                       {
>                               if
> (user.getPassword().equalsIgnoreCase(password))
>                               {
>                                       HttpSession session =
> request.getSession();
>       
> session.setAttribute(Constants.USER_KEY, user);
>                                       
>                                       if 
> (mapping.getAttribute() != null)
>                                       {
>                                               if
> ("request".equals(mapping.getScope()))
>                                               {
>       
> request.removeAttribute(mapping.getAttribute());
>                                               }
>                                               else
>                                               {
>       
> session.removeAttribute(mapping.getAttribute());
>                                               }
>                                       }
>                                       
>                                       forward =
> mapping.findForward("success");
>                               }
>                               else
>                               {
>                                       errors.add("password", new
> ActionError("error.05"));
>                                       forward =
> mapping.findForward("failure");
>                               }
>                       }
>                       else
>                       {
>                               errors.add("userID", new
> ActionError("error.03"));
>                               forward = 
> mapping.findForward("failure");
>                       }
>               }
>               else
>               {
>                       errors.add("userID", new 
> ActionError("error.01"));
>                       forward = mapping.findForward("failure");
>               }
>               if (!errors.empty())
>               {
>                       saveErrors(request, errors);
>               }
>               return forward;
>       }
> }
> 
> and here is the code that is failing.....
> 
> <snip>
>       public class DataEntryAction extends Action
>       {
>               PreparedStatement ps = null;
>               ResultSet rs = null;
>       
>               public ActionForward execute(ActionMapping mapping,
> ActionForm form, HttpServletRequest request, 
> HttpServletResponse response)
>                       throws Exception
>               {
>                       ActionErrors errors = new ActionErrors();
>       
>                       HttpSession session = request.getSession();
>                       MemoryUser user = (MemoryUser)
> session.getAttribute(Constants.USER_KEY);
>                       String userid = user.getUsername();     
> </snip>
> 
> The MemoryUser beans looks like this....
> 
> public class MemoryUser
> {
>       private MemoryUserDatabase database = null;
>       private String username = null;
>       private String password = null;
>       private String fullname = null;
>       
>       public MemoryUser(MemoryUserDatabase database, String username)
>       {
>               super();
>               this.database = database;
>               this.username = username;
>       }
>       
>       public MemoryUserDatabase getDatabase()
>       {
>               return this.database;
>       }
>       
>       public String getPassword()
>       {
>               return this.password;
>       }
>       
>       public void setPassword(String password)
>       {
>               this.password = password;
>       }
>       
>       public String getUsername()
>       {
>               return this.username;
>       }
>       
>       public String getFullname()
>       {
>               return this.fullname;
>       }
>       
>       public void setFullname(String fullname)
>       {
>               this.fullname = fullname;
>       }
> }
> 
> Anything else?
> 
> TIA!
> 
> Jerry
> 
> 
> 
> > -----Original Message-----
> > From: James Mitchell [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 16, 2002 10:38 AM
> > To: Struts Users Mailing List
> > Subject: RE: Session-scope JavaBean being removed
> > 
> > 
> > I'm afraid that you'll have to provide more details before 
> > anyone can help
> > you.
> > 
> > James Mitchell
> > Software Engineer\Struts Evangelist
> > Struts-Atlanta, the "Open Minded Developer Network"
> > http://www.open-tools.org/struts-atlanta
> > 
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, August 16, 2002 10:19 AM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: Session-scope JavaBean being removed
> > >
> > >
> > > Hi All,
> > >
> > > Got a strange one that I can't figure out.  We've developed 
> > an internal
> > > webapp that uses the MemoryDatabase from the struts-example that
> > > comes with
> > > the distribution.  The implementation works great, providing a
> > > basic user ID
> > > / password table in XML, etc.  Once the logon process completes,
> > > we store a
> > > javabean with the user ID in the session so we can grab it later
> > > when we do
> > > our database updates (store the user ID as the last person to
> > > update, etc.)
> > > Everything seems to be fine, then BLAM! - I get a
> > > NullPointerException when
> > > I try to access the bean.  I've checked the session timeout 
> > and set it to
> > > such a high value that the session should never time out.  I've
> > > also search
> > > the archives, the 'net, and have e-mailed Craig directly 
> (thanks for
> > > response, but it still happens :-).  I've found nothing 
> > that would tell me
> > > why this bean is being removed.  The only time it should be is
> > > during logoff
> > > processing.  Help!  Anyone have any ideas?
> > >
> > > Thanks in advance - and TGIF!
> > >
> > > Jerry Jalenak
> > > Web Publishing
> > > LabOne, Inc.
> > > 10101 Renner Blvd.
> > > Lenexa, KS  66219
> > > (913) 577-1496
> > > [EMAIL PROTECTED]
> > >
> > >
> > > This transmission (and any information attached to it) may be
> > > confidential and is intended solely for the use of the individual
> > > or entity to which it is addressed. If you are not the intended
> > > recipient or the person responsible for delivering the
> > > transmission to the intended recipient, be advised that you have
> > > received this transmission in error and that any use,
> > > dissemination, forwarding, printing, or copying of this
> > > information is strictly prohibited. If you have received this
> > > transmission in error, please immediately notify LabOne at 
> > (800)388-4675.
> > >
> > >
> > >
> > > --
> > > 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]>
> 
> 
> This transmission (and any information attached to it) may be 
> confidential
> and is intended solely for the use of the individual or 
> entity to which it
> is addressed. If you are not the intended recipient or the person
> responsible for delivering the transmission to the intended 
> recipient, be
> advised that you have received this transmission in error and 
> that any use,
> dissemination, forwarding, printing, or copying of this information is
> strictly prohibited. If you have received this transmission 
> in error, please
> immediately notify LabOne at (800)388-4675.
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 

This transmission (and any information attached to it) may be confidential and is 
intended solely for the use of the individual or entity to which it is addressed. If 
you are not the intended recipient or the person responsible for delivering the 
transmission to the intended recipient, be advised that you have received this 
transmission in error and that any use, dissemination, forwarding, printing, or 
copying of this information is strictly prohibited. If you have received this 
transmission in error, please immediately notify LabOne at (800)388-4675.



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

Reply via email to