RE: HttpSession usage
FYI - putAttribute() has been depricated and you shoud use setAttribute() when working with sessions. -Original Message- From: Pawson, David [mailto:[EMAIL PROTECTED] Sent: January 17, 2005 4:37 AM To: Tomcat Users List Subject: RE: HttpSession usage Sounds to me like you need to do some reading on JSP/Servlets, any book will explain sessions to you and provide examples. There are numerous online resources too. No problem, nice to know I'm reading the right stuff though! You don't need to worry about identifying the user in most cases, this is managed internally with cookies, i.e you would not need to check, you can assume. The reason you see jsessionid being appended onto some URLs ni JSPs is because the user may have cookies turned off, in which case when they post or whatever back to the server, the server may create a new session. Which then raises the question, do I (can I) check that a user has cookies enabled? HttpSession sess = request.getSession(true); if( sess.isNew() ) logger.info(pNew Session/p); else logger.info(pExisting Session/p); Or is this sufficient? From this and my own flow logic I guess I can see if the user is 'new' when she shouldn't be. I'm not entirely sure of the strategy or decisions developers use to determine if they are going to add jsessionid manually to URLs in JSPs, perhaps someone can pick that up for you. It may be that you could test the user's ability to store cookies and make a decision there. I would recommend picking up a good JSP/Servlet manual for examples. I've got the O'Reilly book, and Google :-) Thanks, DaveP ** snip here ** -- DISCLAIMER: NOTICE: The information contained in this email and any attachments is confidential and may be privileged. If you are not the intended recipient you should not use, disclose, distribute or copy any of the content of it or of any attachment; you are requested to notify the sender immediately of your receipt of the email and then to delete it and any attachments from your system. RNIB endeavours to ensure that emails and any attachments generated by its staff are free from viruses or other contaminants. However, it cannot accept any responsibility for any such which are transmitted. We therefore recommend you scan all attachments. Please note that the statements and views expressed in this email and any attachments are those of the author and do not necessarily represent those of RNIB. RNIB Registered Charity Number: 226227 Website: http://www.rnib.org.uk - 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]
Tomcat 4.1.24, Classloader problems
Hi all, Having a weird problem that is driving me nuts. In the past week, every time I update a supporting class (Not a servlet or JSP) and refresh my page, I get all kinds of null pointer exceptions and must log out and back into my application or restart Tomcat. This is a pain in development. FYI - I do have the app set to reload=true. I looked into the stdout.log file and noticed the following messages: - TimeOut WebAppClassLoader:Lifecycle Error: CL Stopped. - Sometimes it appears several dozen times in a row, almost like some sort of loop is causing the output. A quick restart and everything is ok again...for a while anyway. I've not seen this before with Tomcat 4 or 5. Any help appreciated. JW - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Still need help! - DBCP/DB2/Tomcat 4.1.24 problem!
Hi, despite the fact that I did get some responses (and a thread hijack), I am still trying to solve this. Any help appreciated. I am trying to get DBCP connection pooling to work with Tomcat 4.1.24 and DB2 8.X. I can connect directly, but whenever I try to use DBCP, I receive a Cannot load driver class 'null' error. The DB2 and JNDI jar files are located in tomcat-root\common\lib. This code snippet works: ... String url = jdbc:db2://myserver:5/mydb; String user = test; String pass = password; Class.forName(com.ibm.db2.jcc.DB2Driver); Connection conn = DriverManager.getConnection(url,user,pass); Statement stmt = conn.createStatement(); ResultSet myRs = stmt.executeQuery(select * from myTable); ... This leads me to believe that: a) My driver is fine and jar file location is ok b) My login credentials are fine I use the same driver and connection info in my DBCP config. --- Now when I try to use DBCP, this code snippet does NOT work. ... Context jndiCtx = new InitialContext(); Context ctx = (Context) jndiCtx.lookup(java:comp/env); DataSource ds = (DataSource) ctx.lookup(jdbc/mydb); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet myRs = stmt.executeQuery(select * from myTable); ... Tomcat does not throw any errors at startup in any logs and when I execute the above code, the DataSource retrieved (ds) is not null and a getClassName() call reveals a generic commons DataSource object. However, once it gets to the getConnection() method, the evil Cannot load driver class 'null' error occurs. I tried messing around with the JNDI entries to prove that was OK, and as expected I get a naming error if I put a wrong value. This tells me that the lookup portion works, yes? Here are the relevant server.xml and the web.xml entries: -- server.xml (note: I also tried it without the factory param) -- ... Context... Resource name=jdbc/mydb scope=Shareable type=javax.sql.DataSource auth=Container / Resourceparams name=jdbc/mydb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameusername/name valuetest/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namedriverClassName/name valuecom.ibm.db2.jcc.DB2Driver/value /parameter parameter nameurl/name valuejdbc:db2://myserver:5/mydb/value /parameter /Resourceparams /Context -- web.xml -- ... resource-ref resource-ref-namejdbc/mydbresource-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref So, that is pretty much it. I have consulted 2 books, countless websites, and would appreciate any help. Thanks JW - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP/DB2/Tomcat 4.1.24 problem!
Hi Andreas, I think your comments would help me if I was having the opposite problem. In other words, if I was using the Class.forName... That works fine, it is the DBCP code that is failing. James -Original Message- From: Andreas Vombach [mailto:[EMAIL PROTECTED] Sent: December 21, 2004 1:51 AM To: Tomcat Users List Subject: Re: DBCP/DB2/Tomcat 4.1.24 problem! James, please see my message in Tomcat 5.5 classloading blues from 20.12 and the following. Cheers Andreas - 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]
DBCP/DB2/Tomcat 4.1.24 problem!
Hi, I am trying to get DBCP connection pooling to work with Tomcat 4.1.24 and DB2 8.X. I can connect directly, but whenever I try to use DBCP, I receive a Cannot load driver class 'null' error. The DB2 and JNDI jar files are located in tomcat-root\common\lib. This code snippet works: ... String url = jdbc:db2://myserver:5/mydb; String user = test; String pass = password; Class.forName(com.ibm.db2.jcc.DB2Driver); Connection conn = DriverManager.getConnection(url,user,pass); Statement stmt = conn.createStatement(); ResultSet myRs = stmt.executeQuery(select * from myTable); ... This leads me to believe that: a) My driver is fine and jar file location is ok b) My login credentials are fine I use the same driver and connection info in my DBCP config. --- Now when I try to use DBCP, this code snippet does NOT work. ... Context jndiCtx = new InitialContext(); Context ctx = (Context) jndiCtx.lookup(java:comp/env); DataSource ds = (DataSource) ctx.lookup(jdbc/mydb); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet myRs = stmt.executeQuery(select * from myTable); ... Tomcat does not throw any errors at startup in any logs and when I execute the above code, the DataSource retrieved (ds) is not null and a getClassName() call reveals a generic commons DataSource object. However, once it gets to the getConnection() method, the evil Cannot load driver class 'null' error occurs. I tried messing around with the JNDI entries to prove that was OK, and as expected I get a naming error if I put a wrong value. This tells me that the lookup portion works, yes? Here are the relevant server.xml and the web.xml entries: -- server.xml (note: I also tried it without the factory param) -- ... Context... Resource name=jdbc/mydb scope=Shareable type=javax.sql.DataSource auth=Container / Resourceparams name=jdbc/mydb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameusername/name valuetest/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namedriverClassName/name valuecom.ibm.db2.jcc.DB2Driver/value /parameter parameter nameurl/name valuejdbc:db2://myserver:5/mydb/value /parameter /Resourceparams /Context -- web.xml -- ... resource-ref resource-ref-namejdbc/mydbresource-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref So, that is pretty much it. I have consulted 2 books, countless websites, and would appreciate any help. Thanks JW - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HELP! - Modifying Catalina.bat for RMI
Hi all, I searched the archives on this one, but couldn't find any answers, sorry if it is basic. I rebuilt my laptop and decided to upgrade from TOMCAT 3 to TOMCAT 4 (on Win2k pro with JDK 1.4). I managed to get everything working except RMI. I suspect that I simply need to add a configuration option to catalina.bat in the %_EXECJAVA% sections near the end of the file (which is what I did in tomcat.bat with TOMCAT 3) like this: -Djava.rmi.server.codebase=path to my interface stub classes; However, when I do this in catalina.bat, TOMCAT won't start (I'm using startup.bat, not the Start TOMCAT link from the start menu...more on that below). I've tried moving the code snip around thinking that the order might matter, but have had no luck. Help! Also, I tried to add the same parameter to the link on the startmenu (which calls bootstrap.jar) but ran into a length issue for the target as I need to set the security policy in the same way. Can I shorten this link by using environment variables? I tried that with no luck either! Any help appreciated. James Milks Noncubicle Corporation / LostHockey.com http://www.noncubicle.com http://www.losthockey.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Please recommend book or Other Help
Sorry I can't offer help, but I am also looking for a good book. What is your opinion on James Goodwill's Apache Jakarta Tomcat? Does it discuss RMI at all? James -Original Message- From: The Kelley's [mailto:[EMAIL PROTECTED]] Sent: July 17, 2002 12:01 PM To: [EMAIL PROTECTED] Subject: Please recommend book or Other Help I'm having problems with JDBCRealms and JDBCStore in Tomcat. They seem buggy to me. Any expert help would be great. I good book would be even better. I already have James Goodwill's Apache Jakarta Tomcat book Thanks Tim -- 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]