JDBC Driver disappears when using Mod_jk !
Dear Sirs, This is truly bizarre. I've been runing Apache+mod_webapp in front of one of our websites for quite a time now and it has worked fine for serving up JSP pages. So, the Apache-mod_webapp-Tomcat communication seems to be working OK. I recently added a JNDI datasource to the Tomcat web application. The datasource is configured perfectly, as proven with the useful servlet (below) which we always use to test JNDI datasource connections. ie. http://www.oursite.com:8080/ourapp/TestDb?jndi=jdbc/dbname reports that we successfully created a database connection from the JNDI datasource. However, when we now try to access via mod_webapp ie. http://www.oursite.com/ourapp/TestDb?jndi=jdbc/dbname it reports an error message Cannot load JDBC driver class 'null' How can this be ??? Apache+mod_webapp has been proven to be configured properly since we've been serving up JSP from this webapp for months. When connecting directly to Tomcat on port 8080, the JNDI resource does indeed exist and we can create the connection so the JDBC driver must exist too (and it does) ! Why does the JDBC driver seem to disappear when using mod_webapp??? I hope somebody can shed some light on this. Thank you in advance, Soefara. ps. here's the servlet we use for testing JNDI datasource connections, maybe some of you will find it useful. -- import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class DbHandlerDebug extends HttpServlet { public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection conn = null; String jndiName = request.getParameter(jndi); response.setContentType(text/html); PrintWriter out = new PrintWriter(response.getOutputStream() ); out.println(htmlbodyh3Test JNDI/h3); Context ctx = null; DataSource ds = null; if (jndiName == null) { out.println(font color=#ffpUsage : send argument 'jndi'. br eg. /servlet/TestDB?jndi=jdbc/ourdb); } try { ctx = new InitialContext(); Context envCtx = (Context) ctx.lookup(java:/comp/env/); out.println(liRetrieved Context); ds = (DataSource) envCtx.lookup(jndiName); out.println(liObtained Datasource); conn = ds.getConnection(); out.println(liGot Connection); out.println(h3OK :-)/h3); } catch (NamingException e) { out.println(Failed to get datasource from context : + e.getMessage()); } catch (SQLException e) { out.println(Failed to get DB connection : + e.getMessage()); } catch (Exception e) { out.println(Unexpected error : + e.getMessage()); } out.flush(); } } _ Download ringtones, logos and picture messages from MSN Malaysia http://www.msn.com.my/mobile/ringtones/default.asp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDBC Driver disappears when using Mod_WEBAPP
Sorry, just realized the title should have read JDBC driver disappears when using mod_webapp. From: Soefara Redzuan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: JDBC Driver disappears when using Mod_jk ! Dear Sirs, This is truly bizarre. I've been runing Apache+mod_webapp in front of one of our websites for quite a time now and it has worked fine for serving up JSP pages. So, the Apache-mod_webapp-Tomcat communication seems to be working OK. I recently added a JNDI datasource to the Tomcat web application. The datasource is configured perfectly, as proven with the useful servlet (below) which we always use to test JNDI datasource connections. ie. http://www.oursite.com:8080/ourapp/TestDb?jndi=jdbc/dbname reports that we successfully created a database connection from the JNDI datasource. However, when we now try to access via mod_webapp ie. http://www.oursite.com/ourapp/TestDb?jndi=jdbc/dbname it reports an error message Cannot load JDBC driver class 'null' How can this be ??? Apache+mod_webapp has been proven to be configured properly since we've been serving up JSP from this webapp for months. When connecting directly to Tomcat on port 8080, the JNDI resource does indeed exist and we can create the connection so the JDBC driver must exist too (and it does) ! Why does the JDBC driver seem to disappear when using mod_webapp??? I hope somebody can shed some light on this. Thank you in advance, Soefara. ps. here's the servlet we use for testing JNDI datasource connections, maybe some of you will find it useful. -- import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class DbHandlerDebug extends HttpServlet { public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection conn = null; String jndiName = request.getParameter(jndi); response.setContentType(text/html); PrintWriter out = new PrintWriter(response.getOutputStream() ); out.println(htmlbodyh3Test JNDI/h3); Context ctx = null; DataSource ds = null; if (jndiName == null) { out.println(font color=#ffpUsage : send argument 'jndi'. br eg. /servlet/TestDB?jndi=jdbc/ourdb); } try { ctx = new InitialContext(); Context envCtx = (Context) ctx.lookup(java:/comp/env/); out.println(liRetrieved Context); ds = (DataSource) envCtx.lookup(jndiName); out.println(liObtained Datasource); conn = ds.getConnection(); out.println(liGot Connection); out.println(h3OK :-)/h3); } catch (NamingException e) { out.println(Failed to get datasource from context : + e.getMessage()); } catch (SQLException e) { out.println(Failed to get DB connection : + e.getMessage()); } catch (Exception e) { out.println(Unexpected error : + e.getMessage()); } out.flush(); } } _ Download ringtones, logos and picture messages from MSN Malaysia http://www.msn.com.my/mobile/ringtones/default.asp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Are you in love? Find a date on MSN Personals http://match.msn.com.my/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mod_jk virtual hosts ? 90% of the way there.
Hello all, Mod_jk2 is much easier to install and configure than mod_jk ever was, largely due to some much more abundant and well-written documentation. I've set up mod_jk2 and now Apache is passing requests to Tomca OK. I've also set up Virtual Hosts in Tomcat's server.xml, and now I can access my server via http://www.mydomain.com:8080; instead of the IP address. Now I'd like to put the two together and have Apache handle http://www.mydomain.com and pass the requests through to Tomcat4, and now I'm confused where I go from here. I'm comfortable with Apache's VirtualHost directive in httpd.conf but can't see how it works with mod_jk since there's only one set of mod_jk directives per httpd.conf This is what I have so far, Tomcat_Home/conf/jk2.properties: # Define the communication channel [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 # Map the Tomcat examples webapp to the Web server uri space [uri:/examples/*] info=Map the whole webapp Apache's httpd.conf --- LoadModule jk_module modules/mod_jk.so IfModule mod_jk.c AddModule mod_jk.c JkWorkersFile /usr/local/etc/httpd/conf/workers.properties JkLogFile /usr/local/etc/httpd/logs/mod_jk.log JkLogLevel info JkLogStampFormat [%a %b %d %H:%M:%S %Y] JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat %w %V %T JkMount /examples/* worker1 /IfModule workers.properties (in same directory as httpd.conf) # Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=3 The above passes requests from Apache to Tomcat OK. Now for virtual hosts, Host name=www.domain1.com appBase=webapps Aliasdomain1.com/Alias Context path= docBase=ROOT/Context /Host Host name=www.domain2.com appBase=webapps Aliasmydomain2.com/Alias Context path= docBase=mainsite/Context /Host But what do I add to Apache's httpd.conf for the virtual hosts ? VirtualHost aaa.bbb.ccc.ddd ServerName www.domain1.com DocumentRoot /usr/local/etc/httpd/site1 ErrorLog logs/error_log TransferLog logs/access_log /VirtualHost I feel I'm so close. Could somebody please help with this last part ? Thank you very much, Soefara. ps. is 1 worker enough to handle everything ? _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Solved it. Re: mod_jk virtual hosts ? 90% of the way there.
Solved it myself :-) I added the JkMount to the VirtualHost directives and now everything appears to work perfectly. VirtualHost aaa.bbb.ccc.ddd ServerName www.domain1.com ErrorLog logs/error_log TransferLog logs/access_log JkMount /* worker1 /VirtualHost VirtualHost aaa.bbb.ccc.ddd ServerName www.domain2.com ErrorLog logs/error_log TransferLog logs/access_log JkMount /* worker1 /VirtualHost Wow, this mod_jk2 really is much easier to configure than mod_jk was, though the advanced configuration looks quite daunting. For simple virtual hosting of a servlet/JSP site, I shouldn't need more than one worker, should I? Thank you. Soefara. From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: mod_jk virtual hosts ? 90% of the way there. Date: Tue, 18 Feb 2003 16:05:04 +0800 Hello all, Mod_jk2 is much easier to install and configure than mod_jk ever was, largely due to some much more abundant and well-written documentation. I've set up mod_jk2 and now Apache is passing requests to Tomca OK. I've also set up Virtual Hosts in Tomcat's server.xml, and now I can access my server via http://www.mydomain.com:8080; instead of the IP address. Now I'd like to put the two together and have Apache handle http://www.mydomain.com and pass the requests through to Tomcat4, and now I'm confused where I go from here. I'm comfortable with Apache's VirtualHost directive in httpd.conf but can't see how it works with mod_jk since there's only one set of mod_jk directives per httpd.conf This is what I have so far, Tomcat_Home/conf/jk2.properties: # Define the communication channel [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 # Map the Tomcat examples webapp to the Web server uri space [uri:/examples/*] info=Map the whole webapp Apache's httpd.conf --- LoadModule jk_module modules/mod_jk.so IfModule mod_jk.c AddModule mod_jk.c JkWorkersFile /usr/local/etc/httpd/conf/workers.properties JkLogFile /usr/local/etc/httpd/logs/mod_jk.log JkLogLevel info JkLogStampFormat [%a %b %d %H:%M:%S %Y] JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat %w %V %T JkMount /examples/* worker1 /IfModule workers.properties (in same directory as httpd.conf) # Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=3 The above passes requests from Apache to Tomcat OK. Now for virtual hosts, Host name=www.domain1.com appBase=webapps Aliasdomain1.com/Alias Context path= docBase=ROOT/Context /Host Host name=www.domain2.com appBase=webapps Aliasmydomain2.com/Alias Context path= docBase=mainsite/Context /Host But what do I add to Apache's httpd.conf for the virtual hosts ? VirtualHost aaa.bbb.ccc.ddd ServerName www.domain1.com DocumentRoot /usr/local/etc/httpd/site1 ErrorLog logs/error_log TransferLog logs/access_log /VirtualHost I feel I'm so close. Could somebody please help with this last part ? Thank you very much, Soefara. ps. is 1 worker enough to handle everything ? _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Solved it. Re: mod_jk virtual hosts ? 90% of the way there.
Hi RK, I thought my workers.properties file looked very different from everybody else's using mod_jk2 ! I just checked again and realize I misread the page http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk2/confighowto.html I actually put the following in jk2.properties instead of in workers2.properties - _jk2.properties # Define the communication channel [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 # Map the Tomcat examples webapp to the Web server uri space [uri:/examples/*] info=Map the whole webapp -- and the really strange thing is that it all worked My workers.properties looks very different from everybody else's but it also works fine _workers.properties___ worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=3 -- Is the mod_jk2.so backwards compatible ? I'm also using the mod_jk-1.3-noeapi.so file from http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.1/bin/solaris8/ which was linked from the jk2 FAQ http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/faq.html Or is the link in the FAQ incorrect ? It's going to hurt if I've somehow managed to use mod_jk1 as opposed to mod_jk2 :( Soefara. _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Solved it. Re: mod_jk virtual hosts ? 90% of the way there.
OK, you're right RK. Thank you for pointing it out - I am indeed using mod_jk instead of mod_jk2 ! I also must take back what I said about the mod_jk2 docs being so much better than the mod_jk(1) documents; it seems that I've been following the mod_jk(1) documentation. I've been using this http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk/aphowto.html#Installation assuming from the 'jk2' in the URL that it applied to mod_jk2 but now I see from the navigation in the left of the page that it's actually mod_jk(1) I still can't believe I got virtual hosts working exactly as I wanted though, and since I'm only running Apache 1.3 and don't wish to recompile it for pthreads, I think I'll stick with mod_jk for now, unless there's an over-riding reason why I should not ? I'll get to the bottom of this one day. Soefara. From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Solved it. Re: mod_jk virtual hosts ? 90% of the way there. Date: Tue, 18 Feb 2003 19:18:51 +0800 Hi RK, I thought my workers.properties file looked very different from everybody else's using mod_jk2 ! I just checked again and realize I misread the page http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk2/confighowto.html I actually put the following in jk2.properties instead of in workers2.properties - _jk2.properties # Define the communication channel [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 # Map the Tomcat examples webapp to the Web server uri space [uri:/examples/*] info=Map the whole webapp -- and the really strange thing is that it all worked My workers.properties looks very different from everybody else's but it also works fine _workers.properties___ worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=3 -- Is the mod_jk2.so backwards compatible ? I'm also using the mod_jk-1.3-noeapi.so file from http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.1/bin/solaris8/ which was linked from the jk2 FAQ http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/faq.html Or is the link in the FAQ incorrect ? It's going to hurt if I've somehow managed to use mod_jk1 as opposed to mod_jk2 :( Soefara. _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: mod_jk virtual hosts ? 90% of the way there.
Thank you John, You're right on all three counts (a) I forgot a JkMount line and now it works fine (b) I was a clumsy clown and actually using mod_jk, not mod_jk2 (c) Jk does indedd have far more documentation than mod_jk2 Therefore I am going to stick with the mod_jk, especially since I have got it running. There just remains one thing that I do not understand - I'm using Tomcat4.1.18 (just installed today) and if my tomcathome/conf/jk2.properties file is not being read at all then how does Tomcat know how to communicate with Apache ? Or is Apache the only piece of this puzzle which needs configuring (with mod_jk) since it is the one making the connections? Thank you and sorry for all the confusion earlier. Soefara. From: Turner, John [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: mod_jk virtual hosts ? 90% of the way there. Date: Tue, 18 Feb 2003 06:46:54 -0500 JK has way more documentation and support than JK2. You're missing a JkMount line. VirtualHost aaa.bbb.ccc.ddd ServerName www.domain1.com DocumentRoot /usr/local/etc/httpd/site1 ErrorLog logs/error_log TransferLog logs/access_log JkMount /*.jsp ajp13 JkMount /servlets/* ajp13 /VirtualHost John -Original Message- From: Soefara Redzuan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:05 AM To: [EMAIL PROTECTED] Subject: mod_jk virtual hosts ? 90% of the way there. Hello all, Mod_jk2 is much easier to install and configure than mod_jk ever was, largely due to some much more abundant and well-written documentation. I've set up mod_jk2 and now Apache is passing requests to Tomca OK. I've also set up Virtual Hosts in Tomcat's server.xml, and now I can access my server via http://www.mydomain.com:8080; instead of the IP address. Now I'd like to put the two together and have Apache handle http://www.mydomain.com and pass the requests through to Tomcat4, and now I'm confused where I go from here. I'm comfortable with Apache's VirtualHost directive in httpd.conf but can't see how it works with mod_jk since there's only one set of mod_jk directives per httpd.conf This is what I have so far, Tomcat_Home/conf/jk2.properties: # Define the communication channel [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 # Map the Tomcat examples webapp to the Web server uri space [uri:/examples/*] info=Map the whole webapp Apache's httpd.conf --- LoadModule jk_module modules/mod_jk.so IfModule mod_jk.c AddModule mod_jk.c JkWorkersFile /usr/local/etc/httpd/conf/workers.properties JkLogFile /usr/local/etc/httpd/logs/mod_jk.log JkLogLevel info JkLogStampFormat [%a %b %d %H:%M:%S %Y] JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat %w %V %T JkMount /examples/* worker1 /IfModule workers.properties (in same directory as httpd.conf) # Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=3 The above passes requests from Apache to Tomcat OK. Now for virtual hosts, Host name=www.domain1.com appBase=webapps Aliasdomain1.com/Alias Context path= docBase=ROOT/Context /Host Host name=www.domain2.com appBase=webapps Aliasmydomain2.com/Alias Context path= docBase=mainsite/Context /Host But what do I add to Apache's httpd.conf for the virtual hosts ? VirtualHost aaa.bbb.ccc.ddd ServerName www.domain1.com DocumentRoot /usr/local/etc/httpd/site1 ErrorLog logs/error_log TransferLog logs/access_log /VirtualHost I feel I'm so close. Could somebody please help with this last part ? Thank you very much, Soefara. ps. is 1 worker enough to handle everything ? _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/2003 --- Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Re: How to write custom authentication method forTomcat as well asweblogic/orion?
From: Craig R. McClanahan [EMAIL PROTECTED] Whilst Tomcat's JDBC Realm's are easy to set up and get working, (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html), I'm wondering how easy it might be to write our own authentication mechanism using Filters ? You might want to check out at least one project that has already done the kind of thing you describe: http://securityfilter.sourceforge.net Oooh, how cool is that ? :) Thank you Craig. Soefara. _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Keep getting logged out of Tomcat?
I've set up a JDBC Realm and it works fine for the most part but sometimes I'll get logged out and have to log in again within the space of less than 2 minutes - this happens repeatedly. Has anybody else encountered such a problem ? Thank you. Soefara. _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to write custom authentication method forTomcat as well as weblogic/orion?
Whilst Tomcat's JDBC Realm's are easy to set up and get working, (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html), I'm wondering how easy it might be to write our own authentication mechanism using Filters ? There are a few reasons for this, 1) We'd like a security mechanism which has Groups as well as users and roles, with roles attached to groups (as well as users). 2) The current JDBC Realm is logging off users (sometimes within a minute of them logging-in). 3) We'd like a security mechanism that will work with Weblogic and Websphere as well as Tomcat, with little (or no) change. 4) We would like the passwords encrypted in the database. Having thought about this for a while, it seems that I could easily write one as follows, - create a AuthenticatedUser javabean - write a Filter that checks whether an AuthenticatedUser object exists in the session. If it does, the user is authenticated. If not, the Filter redirects to a log-in page instead. Also remember the originally requested URL. - create a login page and an associated FormHandler which simply authenticates against the database and creates an AuthenticatedUser object in the session, then redirects to the originally requested URL. Is that it or have I overlooked something? It seems a bit too simple. Thank you very much in advance. Soefara Redzuan. _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running XML-parsing servlets on Tomcat, using JAXP ?
Sorry for the very very late follow up to my problem. Eventually solved it. I later found out it was a clash with the XML-RPC libraries which I forgot were also in WEB-INF/lib. I think it's a bug in the Apache XML-RPC libs as somebody else experienced the same problem. So, I've got JAXP working on Tomcat. Hoorah ! And yes, I put the JAXP classes in $TOMCAT_HOME/common/lib (And also removed some of the previous libraries that were there). Soefara. From: Jacob Kjome [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Running XML-parsing servlets on Tomcat, using JAXP ? Date: Sun, 15 Sep 2002 22:29:17 -0500 At 10:58 AM 9/16/2002 +0800, you wrote: Let me know how it went. I'm curious that the java xml pack had instructions for that. Well I suppose they have tested it, so I guess it is harmless. Anyway like you said, you can always bundle the java xml pack under its own webapp. Bad assumption! Tomcat will either ignore or throw exceptions if you put your XML and/or DOM classes under WEB-INF/lib. This is because it violates the Sun classloading spec which Tomcat started enforcing as of Tomcat-4.0.2. In order to use XML/DOM libraries, they need to be in a parent classloader such as $TOMCAT_HOME/lib (shared/lib on Tomcat-4.1.x) or common/lib. Don't ask me to explain the reasons why this is against the classloading spec. It just is. Maybe Remmy can explain better? Jake Soefara Redzuan wrote: From: Kwok Peng Tuck [EMAIL PROTECTED] Hmm, how did you get a jasper directory under the tomcat root ? That's where it is in Tomcat4.0.x under Windows 2000, at least the version that I downloaded and installed. I checked my tomcat installation in Win2K I didn't see anything like this. Perhaps you have a different version to me. It seems that the libraries shipped with Tomcat4 are changing a lot. Your /common/lib seems to have a lot more than the standard libraries that shipped with it, I 've got : a) activation.jar b) jdbc2_0-stdex.jar c) jndi.jar d) jta-spec1_0_1.jar e) mail.jar f) naming-common.jar g) naming-resource.jar h) servlet.jar i) tools.jar j) tyrex.license k) tyrex-0.9.7.0.jar l) xerces.jar Well, in my version I had crimson.jar and not xerces.jar. How did dom.jar , xalan.jar, mysql.jar end up there ? dom.jar and xalan.jar are part of the Java XML pack, along with xercesImpl.jar, sax.jar, jaxp-api.jar and xsltc.jar. The Java XML Pack says to put them in tomcat_home/common/lib In your case, I think they would require you to remove xerces.jar Generally if you wish to use any other jar(s) you put them in {webapps root} /WEB-INF/lib . That's true, but for libraries that you're going to use amongst all webapps (eg. mysql.jar in my case), then you can also put them in tomcat_home/common/lib However, I do think I'll try what you said - put the libraries in /webapps/webapp name/WEB-INF/lib and see if that helps. Will let you know. Thank you, Soefara. I'd still like to keep jaxp installed on my machine for other java applications. This won't affect Tomcat at all, will it ? NO, It should not, I recommend you do not place the jar file in your classpath. We never know... I tried removing the jars from the classpath but it made no difference, as we all pretty much expected in any case. I'm using Tomcat4.0.x and JDK1.3 I found that tomcat_home/common/lib/crimson.jar also included a org.xml.sax library, so I removed crimson.jar. Still, the errors persisted. Here is what I have on my system, tomcat_home/common/lib contains - activation.jar dom.jar jaxp-api.jar jdbc2_0_stdext.jar jndi.jar jta.jar ldap.jar mail.jar mysql.jar naming-common.jar naming-resources.jar sax.jar servlet.jar tools.jar tyrex-0.9.7.0.jar xalan.jar xercesImpl.jar xsltc.jar (none of those seem to have any clashing xml libraries) tomcat_home/lib contains -- jasper-runtime.jar naming-factory.jar But now I think I've found the culprit - Jasper ! tomcat_home/jasper contains - crimson.jar jasper-compiler.jar jaxp.jar who or what is Jasper ? I don't wish to remove something that is core to Tomcat functionality, but I think that crimson.jar and jaxp.jar may be clashing with xercesImpl.jar and jaxp-api.jar in tomcat_home/common/lib. Does anybody know how I should handle this ? I really would just upgrade to the latest version of Tomcat and JDK1.4 but my production servers are running JDK1.3 and Tomcat 4.0 so I can't take that risk at the moment. So many changes, so little time. Thank you in advance, Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail
Re: Running XML-parsing servlets on Tomcat, using JAXP ?
My oh my, Jake, thank you so much for this most incredible explanation of the Endorsed mechanism, the differences between the various versions of Tomcat as well as JDK1.3/1.4. This is such a valuable body of knowledge, and so well explained, that I hope it will be archived by many for future reference. Thanks also for confirming that stuff you just put on the classpath won't affect Tomcat at all since it ignores the system classpath. Regards, Soefara. From: Jacob Kjome [EMAIL PROTECTED] common/endorsed only exists in Tomcat-4.1.x, not 4.0.x. Also, since you are using JDK1.3.x, there is no concept of the Endorsed Standards Override Mechanism as that was introduced with the release of j2sdk1.4.0. I imagine that the common/endorsed directory doesn't really act any different than common/lib when running under JDK1.3.x, but when running with j2sdk1.4.x, common/endorsed provides a way to override classes in the JDK itself. So, if the JDK used an older version of Xerces, you could put a newer version in common/endorsed and it would be used instead of the one that came with the JDK. That same newer library in common/lib would be ignored as the JDK would take precedence in classloading. Putting your classes in $CATALINA_HOME/lib (same as $CATALINA_HOME/shared/lib in Tomcat-4.1.x) or common/lib is the way to go in your setup. With j2sdk1.4.x, you might think about putting them in common/endorsed which is where the Xerces libraries are in the full version of Tomcat-4.1.x (not the jdk1.4-lite version as it is assumed that the JDK provides those libraries). You can permanently add these to your system under j2sdk1.4.x by putting them in $JAVA_HOME/jre/lib/endorsed. You will have to create the endorsed directory if it isn't there already. This does the same thing as common/endorsed in Tomcat, only it affects the entire system. server/lib is not viable to put your libraries unless they are only for the container's use. Your app cannot see libraries in that folder. As far as affecting Tomat, endorsed stuff will affect it, but stuff you just put on the classpath won't affect Tomcat at all since it ignores the system classpath. Jake _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Running XML-parsing servlets on Tomcat, using JAXP ?
I'd still like to keep jaxp installed on my machine for other java applications. This won't affect Tomcat at all, will it ? NO, It should not, I recommend you do not place the jar file in your classpath. We never know... I tried removing the jars from the classpath but it made no difference, as we all pretty much expected in any case. I'm using Tomcat4.0.x and JDK1.3 I found that tomcat_home/common/lib/crimson.jar also included a org.xml.sax library, so I removed crimson.jar. Still, the errors persisted. Here is what I have on my system, tomcat_home/common/lib contains - activation.jar dom.jar jaxp-api.jar jdbc2_0_stdext.jar jndi.jar jta.jar ldap.jar mail.jar mysql.jar naming-common.jar naming-resources.jar sax.jar servlet.jar tools.jar tyrex-0.9.7.0.jar xalan.jar xercesImpl.jar xsltc.jar (none of those seem to have any clashing xml libraries) tomcat_home/lib contains -- jasper-runtime.jar naming-factory.jar But now I think I've found the culprit - Jasper ! tomcat_home/jasper contains - crimson.jar jasper-compiler.jar jaxp.jar who or what is Jasper ? I don't wish to remove something that is core to Tomcat functionality, but I think that crimson.jar and jaxp.jar may be clashing with xercesImpl.jar and jaxp-api.jar in tomcat_home/common/lib. Does anybody know how I should handle this ? I really would just upgrade to the latest version of Tomcat and JDK1.4 but my production servers are running JDK1.3 and Tomcat 4.0 so I can't take that risk at the moment. So many changes, so little time. Thank you in advance, Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Running XML-parsing servlets on Tomcat, using JAXP ?
Has anybody managed to run XML-parsing servlets on Tomcat 4 using JAXP? If so, could you please help me with the XML configuration for Tomcat because I keep getting class clashes. Here's what I've done so far, 1. Downloaded the Java XML Pack from http://java.sun.com/xml/javaxmlpack.html 2. Unpacked the Java XML Pack and put the JAXP jar files (dom.jar, jaxp-api.jar, sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar) in the directory c:\jdk1.3\jaxp-1.2_01 3. Added all the jars to the CLASSPATH 4. The Java XML Pack instructions then read, When you run the examples on Tomcat you must copy all the JAR files from the Java XML Pack to CATALINA_HOME/common/lib . Some of these files already exist in Tomcat distribution and should be overwritten by the Java XML Pack JARs. The xerces.jar that comes with the tomcat installation should also be removed from CATALINA_HOME/common/lib. I copied all of the JAXP jar files (dom.jar, jaxp-api.jar, sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar) to CATALINA_HOME/common/lib but strangely none of them existed there previously ! Also, there was no xerces.jar that supposedly came with the Tomcat distribution according to the Sun documentation. There is however, a crimson.jar (I'm using an early Tomcat4.x) and a jaxp.jar which I removed, since JAXP's jaxp-api.jar seems to contain updated libraries. 5. I restarted Tomcat and then tried to run a servlet which uses some XML-parsing, which I have already tested in a standalone command-line program and found to be working OK. However, the servlet generated this error, java.lang.LinkageError: loader constraints violated when linking org/xml/sax/InputSource class which I believe means that the Tomcat class loader is finding two conflicting org.xml.sax.InputSource classes (and possibly associated libraries). This was my big worry with adding XML libraries to my operating system, that they would clash with Tomcat's to stop functioning. How should I have arranged things to make this work ? I put all the JAXP libraries in c:\jdk1.3\jaxp-1.2_01 and added them to the CLASSPATH so that I can easily compile all XML programs without defining where to find the Sax libraries and classes, because my XML applications are not just for Tomcat. Thank you so much for any help. Soefara. _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Running XML-parsing servlets on Tomcat, using JAXP ?
Thank you very much for replying, Jean-Francois, From: Jean-Francois Arcand [EMAIL PROTECTED] You don't need the jax-pack for your problem. Under {CATALINA_HOME}/common/endorsed, just copy the xerces.jar and the jaxp-ri.jar file. Tomcat will uses this folder for selecting which parser to use (so crimson will not be used). I don't have a common/endorsed folder. Is this specific to more recent versions of Tomcat ? I'll create it anyway. Also, I've got a jaxp.jar and jaxp-api.jar file but what is jaxp-ri.jar ? I'd still like to keep jaxp installed on my machine for other java applications. This won't affect Tomcat at all, will it ? Thank you again. Soefara. Soefara Redzuan wrote: Has anybody managed to run XML-parsing servlets on Tomcat 4 using JAXP? If so, could you please help me with the XML configuration for Tomcat because I keep getting class clashes. Here's what I've done so far, 1. Downloaded the Java XML Pack from http://java.sun.com/xml/javaxmlpack.html 2. Unpacked the Java XML Pack and put the JAXP jar files (dom.jar, jaxp-api.jar, sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar) in the directory c:\jdk1.3\jaxp-1.2_01 3. Added all the jars to the CLASSPATH 4. The Java XML Pack instructions then read, When you run the examples on Tomcat you must copy all the JAR files from the Java XML Pack to CATALINA_HOME/common/lib . Some of these files already exist in Tomcat distribution and should be overwritten by the Java XML Pack JARs. The xerces.jar that comes with the tomcat installation should also be removed from CATALINA_HOME/common/lib. I copied all of the JAXP jar files (dom.jar, jaxp-api.jar, sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar) to CATALINA_HOME/common/lib but strangely none of them existed there previously ! Also, there was no xerces.jar that supposedly came with the Tomcat distribution according to the Sun documentation. There is however, a crimson.jar (I'm using an early Tomcat4.x) and a jaxp.jar which I removed, since JAXP's jaxp-api.jar seems to contain updated libraries. 5. I restarted Tomcat and then tried to run a servlet which uses some XML-parsing, which I have already tested in a standalone command-line program and found to be working OK. However, the servlet generated this error, java.lang.LinkageError: loader constraints violated when linking org/xml/sax/InputSource class which I believe means that the Tomcat class loader is finding two conflicting org.xml.sax.InputSource classes (and possibly associated libraries). This was my big worry with adding XML libraries to my operating system, that they would clash with Tomcat's to stop functioning. How should I have arranged things to make this work ? I put all the JAXP libraries in c:\jdk1.3\jaxp-1.2_01 and added them to the CLASSPATH so that I can easily compile all XML programs without defining where to find the Sax libraries and classes, because my XML applications are not just for Tomcat. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
More JDBCRealm Questions
I have set up a JDBCRealm and am using it with form-based login to secure/protect my webapp. However, I have a few questions which I hope somebody could help me with, 1. The JDBCRealm is set up with the following in server.xml. Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://localhost/authentication userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/ However, I have noticed that this requires the password (stored in the user_pass column) to be clear text, which I really don't like doing. Is there any way to have store the passwords as hashes (ie. using the password() function in MySQL) ? 2. I read that a call to j_security_check will be made by every attempt access your secured pages. Since I am protecting every page in my webapp, I'm wondering how efficient is j_security_check ? Does it simply look at the session, or does it make a database call on each and every request ? 3. How do you specify a page for authenticated users who do not have the correct permissions/roles ? At the moment, I have this in web.xml, login-config auth-methodFORM/auth-method form-login-config form-login-pagelogin.jsp/form-login-page form-error-pagelogin-error.jsp/form-error-page /form-login-config /login-config login.jsp is the form that shows when an authenticated user tries to access the site. login-error.jsp is displayed when an incorrect username/password is submitted. However, when a correct username/password is submitted but the user does not possess an adequate role, I see a default You are not authorized message. How can I customize the page that is shown in such circumstances ? 4. Is there a formal method to logging out, rather than calling invalidate() on the session ? 5. If your webapp's authentication works fine on Tomcat, would it then work on say BEAWeblogic or IBMWebsphere ? Sorry for so many questions but I can't find a comprehensive description of this anywhere. I've only found setup/configuration guides which deal with the simple issues. Soefara. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: More flexible JDBCRealm implementation ? (for ASP-style webapp)
From: [EMAIL PROTECTED] (Will Hartung) I've setup a JDBCRealm for Tomcat using MySQL. It works OK but the database schema is not good for an ASP (application service provider) model. For example, I would like several companies to use the same webapp (each company should not know of the other's existence) and each should be able to create a user 'admin' and a user 'david' but in the way that JDBCRealm is currently configured only one instance of any user name is possible since it is the primary key in the users table. Is there a better way to do this ? I'm not familiar enough with MySQL, but I'll toss this out. Since you can configure your Realms on a Webapp basis, that may give you the flexibility you need. For example, if you were using, say, Oracle, or most any other database that has a concept of User ownership for its tables (most DBs do, MySQL may do this, I don't know), you could set up seperate Users or Schemas in the database for each Client Webapp. This way, each client would have access to their own versions of the tables. You would distinguish the realms by each having their own login to the client database with a client specific username/password for the database. Yes, but this adds complexity due to different table names for different clients. I like to keep things simple. So, I can do what you suggest except with different databases (running on the same MySQL instance) for different customers and webapps. That's my current setup. If you'd rather share the tables (for whatever reason), perhaps you could make views on a master table that's limited by the client id. I do prefer to share the tables. The reason is that you can easily set up new clients and customers without restarting Tomcat. Better yet, users can register and sign-up themselves, something that's not possible if I have to set up a different database for them, with its own JNDI resource configuration in server.xml These views would be placed in the appropriate client schemas and shadow the master table in a central schema. Something like CREATE VIEW CLIENT1.USERS(user_name, user_pass, user_goupid) AS SELECT user_name, user_pass, user-groupid FROM MASTER.USERS WHERE CLIENTID = 'CLIENT1'. I'll have to investigate this use of views. It's something I'd never considered before and looks very useful. Finally, if you look at $CATALINA_HOME/src/share/org/apache/cataline/realm/JDBCRealm.java, it looks pretty darn simple to tweak that to do whatever you want, or, better, to subclass and change the relevant methods (not many from the looks of it). The only fear here is that the TC team can change JDBCRealm behind your back in a later release. I'd much rather avoid something this drastic. It would be better for me to write a filter and use custom authentication I believe. Stick the pertinent webapp specific entries into ENV-ENTRY, and you can do all sorts of scary things I would think. Thank you, Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: context-param for a list/array of values ?
From: Shapira, Yoav [EMAIL PROTECTED] Subject: RE: context-param for a list/array of values ? Howdy, There are a couple of ways. My favorite is: param-namejndi.resources/param-name param-valuejndi/a,jndi/b,jndi/c/param-value String jndiString = getServletContext().getInitParameter(jndi.resources); StringTokenizer st = new StringTokenizer(jndiString, ,); ArrayList jndiResources = new ArrayList(); while(st.hasMoreTokens()) { jndiResources.add(st.nextToken()); } That's it, very simple. ;) Oh my, now why didn't I think of that ? :) I had thought there would be something like request.getParameterValues() which allows us to detect an array of values. Ex. a fictional getServletContext().getInitParameterValues() Looks like I'll have to go with the String split instead :-) Thank you, Yoav. Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: More JDBCRealm Questions
From: Craig R. McClanahan [EMAIL PROTECTED] I have set up a JDBCRealm and am using it with form-based login to secure/protect my webapp. However, I have a few questions which I hope somebody could help me with, 1. The JDBCRealm is set up with the following in server.xml. Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://localhost/authentication userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/ However, I have noticed that this requires the password (stored in the user_pass column) to be clear text, which I really don't like doing. Is there any way to have store the passwords as hashes (ie. using the password() function in MySQL) ? The database password isn't the only sensitive piece of information in server.xml -- you should ensure that the server.xml file as a whole is not accessible to any OS user other than the one running Tomcat. In addition, you can use security manager protections to prevent webapps from being able to access it directly. Sorry, I was not very coherent in my explanation. I was worried about storing users' passwords in clear text in the database. Somebody else has kindly pointed out that JDBCRealm supports hashed passwords in the user/password columns. 2. I read that a call to j_security_check will be made by every attempt access your secured pages. Since I am protecting every page in my webapp, I'm wondering how efficient is j_security_check ? Does it simply look at the session, or does it make a database call on each and every request ? If you are using sessions, the user identity is cached the first time, so the database will only get hit once. Excellent. 3. How do you specify a page for authenticated users who do not have the correct permissions/roles ? At the moment, I have this in web.xml, login-config auth-methodFORM/auth-method form-login-config form-login-pagelogin.jsp/form-login-page form-error-pagelogin-error.jsp/form-error-page /form-login-config /login-config login.jsp is the form that shows when an authenticated user tries to access the site. login-error.jsp is displayed when an incorrect username/password is submitted. However, when a correct username/password is submitted but the user does not possess an adequate role, I see a default You are not authorized message. How can I customize the page that is shown in such circumstances ? You can use an error-page element in your web.xml for the 403 status. Thank you. I was just checking that I hadn't missed something. I had expected an equivalent to form-error-page which would allow one to tailor the authorization-failure to the section of the webapp. 4. Is there a formal method to logging out, rather than calling invalidate() on the session ? Not in Servlet 2.3. Such things are under consideration for 2.4. For now, invalidating the session is the right way to do it (if you're using form based login). 5. If your webapp's authentication works fine on Tomcat, would it then work on say BEAWeblogic or IBMWebsphere ? As long as you are not relying on wierd container-specific behaviors and using j_security_check the way it was intended to be used. Note that the user database itself, and how you set it up, will be specific for each app server (i.e. JDBCRealm is Tomcat specific). But the app won't have to change. Thank you for the clarification, Craig. Soefara. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
More flexible JDBCRealm implementation ? (for ASP-style webapp)
I've setup a JDBCRealm for Tomcat using MySQL. It works OK but the database schema is not good for an ASP (application service provider) model. For example, I would like several companies to use the same webapp (each company should not know of the other's existence) and each should be able to create a user 'admin' and a user 'david' but in the way that JDBCRealm is currently configured only one instance of any user name is possible since it is the primary key in the users table. Is there a better way to do this ? I followed instructions found on many websites for setting up a JDBCRealm. The table schema is create table user_groups ( group_id int not null auto_increment, group_name char(24), parent_id int not null default -1, primary key(group_id) ); create table users ( user_name varchar(32) not null, user_pass varchar(32) not null, user_groupid int not null default -1, primary key(user_name) ); create table user_roles ( user_name varchar(15) not null, role_name varchar(15) not null, primary key (user_name, role_name) ); And in Tomcat's server.xml I have this in the appropriate context, Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://servername/databasename userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/ And finally this in the webapp's web.xml, security-constraint web-resource-collection web-resource-nameProtectedApp/web-resource-name url-pattern/*/url-pattern http-methodPOST/http-method http-methodGET/http-method /web-resource-collection auth-constraint descriptionname the security roles that are allowed to access/description role-nameadministrator/role-name role-nameuser/role-name /auth-constraint /security-constraint The alternative is to set up a separate webapp for each company that wishes to use our service but that really isn't scalable and doesn't allow for users to self-register and be up-and-running without administrator intervention. Has anybody solved this problem ? Thank you in advance, Soefara. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: More flexible JDBCRealm implementation ? (for ASP-style webapp)
Thank you for the reply Vic. From: Vic C. [EMAIL PROTECTED] That is a frequent need. What is needed is the concept of organization, a 3rd field in every db table. Yes, I've done something like that too. But have therefore found that the Tomcat out-the-box JDBCRealm setup (using server.xml, web.xml as I described below) is not flexible in any way. So it looks like I too will have to use a manual authentication which I had hoped to avoid in the name of standardization. Oh well. I know how to manualy code (using getuserpricipal and a bean) but nothing automatic I can think of. Why use getUserPrincipal ? I thought we were supposed to use request.getRemoteUser() ? Also, may I ask by what you mean a bean for this ? I really like to design code (including Javabeans) so that they will run in standalone applications, as well as in the servlet container environment. Is it possible to design an authentication mechanism that is not dependent upon the servlet container (eg. Tomcat) ? Soefara. Vic Soefara Redzuan wrote: I've setup a JDBCRealm for Tomcat using MySQL. It works OK but the database schema is not good for an ASP (application service provider) model. For example, I would like several companies to use the same webapp (each company should not know of the other's existence) and each should be able to create a user 'admin' and a user 'david' but in the way that JDBCRealm is currently configured only one instance of any user name is possible since it is the primary key in the users table. Is there a better way to do this ? I followed instructions found on many websites for setting up a JDBCRealm. The table schema is create table user_groups ( group_id int not null auto_increment, group_name char(24), parent_id int not null default -1, primary key(group_id) ); create table users ( user_name varchar(32) not null, user_pass varchar(32) not null, user_groupid int not null default -1, primary key(user_name) ); create table user_roles ( user_name varchar(15) not null, role_name varchar(15) not null, primary key (user_name, role_name) ); And in Tomcat's server.xml I have this in the appropriate context, Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://servername/databasename userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/ And finally this in the webapp's web.xml, security-constraint web-resource-collection web-resource-nameProtectedApp/web-resource-name url-pattern/*/url-pattern http-methodPOST/http-method http-methodGET/http-method /web-resource-collection auth-constraint descriptionname the security roles that are allowed to access/description role-nameadministrator/role-name role-nameuser/role-name /auth-constraint /security-constraint The alternative is to set up a separate webapp for each company that wishes to use our service but that really isn't scalable and doesn't allow for users to self-register and be up-and-running without administrator intervention. Has anybody solved this problem ? Thank you in advance, Soefara. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tomcat 4.x and Database Connection Pooling
I don't understand why you need it to be abstract. I don't think that Struts necessarily changes it either. Remember that your servlets calling the class are multi-threaded. That's the one thing that I completely misunderstood when I first started writing servlets. As I understand it, just say 3 simultaneous requests come in for the servlet that uses your DatabaseManager class. The servlet will create 3 threads to deal with these requests. Each thread will create an instance of your DatabaseManager class (unless you make it a static class variable which would probably be a bad idea). Each instance of the DatabaseManager class (one instance for each servlet thread) will then grab a database connection from the database pool manager using JNDI. Therefore, do not employ global static variables or else you'll need to use synchronized and that will also defeat the object of database pooling. Please correct me if I'm wrong and sorry if I have not answered your question. Be aware that I'm not a java maestro. Soefara From: Ric Searle [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Tomcat 4.x and Database Connection Pooling Date: Thu, 11 Apr 2002 20:17:32 +0100 Thanks to everyone who's commented on this - I can't believe that I hadn't come across the JNDI solution, but it's working beautifully now. So onto the next, closely related issue... I'm accessing my database, via JNDI, using a class called DatabaseManager. My aim is that this class abstracts the database backend, so I can just call addUser(myUser), and it will take care of the SQL stuff behind the scenes. At the moment, this DatabaseManager contains code similar to Soefara's below to get a connection for itself whenever it has to make a db request. My confusion is what to do with this class - Should I declare it as abstract? Does that ruin some of the pooling stuff? I would really like to be able to create a global instance of this class, instantiated when the server starts, since individual requests don't need their own DatabaseManager. But I'm using Struts, and I don't know how to do that! Arghh... Any thoughts/experiences? Ric Searle Web Application Developer -- Dialogue Communications Ltd http://www.dialogue.co.uk +44 (0) 114 221 0307 On Thursday, April 11, 2002, at 06:02 pm, Craig R. McClanahan wrote: On Thu, 11 Apr 2002, Soefara Redzuan wrote: Date: Thu, 11 Apr 2002 10:46:14 +0800 From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Tomcat 4.x and Database Connection Pooling Tomcat: As far as I'm concerned, JNDI support is a now and forever more feature of Tomcat 4 and later. It's the standard access mechanism for J2EE app servers as well. This is what I love to hear. With so many changes (servlets to JSP to Struts) over the last few years, future-proofing is so important. Recommendation: If you can, you should use JNDI based access to data sources. This is both portable across containers, and portable across Struts versus non-Struts applications. In addition, it can be used from directly from within a JavaBean implementing your business logic, without requiring a reference to ActionServlet or the servlet context (or the web layer at all). Really ? This is incredibly important news to me. I've been acquiring the JNDI resource within my servlet then passing it as a parameter to my Javabean which is a terrible mechanism because it makes my javabean dependent on the servlet :( So, are we saying that once we've set up a pooled database connection JNDI resource in server.xml and web.xml, any Javabean that is called by a serlvet or JSP can make use of this JNDI resource directly like this In the javabean. import javax.naming.NamingException; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingEnumeration; import javax.naming.directory.InitialDirContext; class mybean() { java.sql.Connection conn get getPooledDatabaseConnection() { Context ctx = new InitialContext(); Context envCtx = (Context) ctx.lookup(java:/comp/env/); DataSource ds = (DataSource) envCtx.lookup(jdbc/dbpool); conn = ds.getConnection(); } ... } If so, this is going to make development much easier. :-) Yep ... that is exactly the pattern you can use. Nice, isn't it? Soefara. Craig -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional
Re: Designing for scalability ?
From: David Lu [EMAIL PROTECTED] you're talking about a clustered environment. such capabilities are already available in commercial app servers like weblogic. I've often wondered why somebody would actually want to put out several thousand US$ for a BEA or ATG when Tomcat is available. Are such features in the Tomcat roadmap ? I presume that they were not in the J2EE specifications. here are some things you want to do now if you think you'll ever go clustered: - make sure everything you put into the session implements Serializable. this way the app server can share session data. Nice tip. How does a clustered environment share these objects ? I'm surprised that they (and Tomcat) don't provide the option of usinga central relational database for storing session objects between multiple servers. - don't put large data objects (like a Collection) into the session. - don't rely on static data held in singleton objects, because you may end up with multiple singleton objects, one in every app server instance. - code to standards and avoid app-server-specific features as much as you can, for you may have to change app servers for clustering. Super. Thank you for sharing this experience and wisdom, David. Soefara. _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: JNDI realm against win2000 DC (REPOST SORRY)
Do you mean authentication against a Windows 2000 Active Directory ? The latter is based upon LDAP I believe and therefore should be accessible. At least that's what the JNDI FAQ implies http://java.sun.com/products/jndi/faq.html However, for authentication purposes, you need to communicate with the server via SSL. I've never managed to get this to work successfully but there are quite a few references in the forums. For example http://forum.java.sun.com/thread.jsp?forum=51thread=91182 Please do let us know if you get it working. I'm sure there are many people who would love to use it too. Soefara. From: Jacob Lund [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: JNDI realm against win2000 DC (REPOST SORRY) Date: Fri, 12 Apr 2002 14:39:07 +0200 Sorry about this repost, but it is really bugging me! Does anyone have a TC 4.0.x configured with a JNDI realm against a windows 2000 domain controller? Or maybe just know how to set this up! I have been looking at the JNDI how-to and I cannot get it working. Thanks, Jacob -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: JNDI realm against win2000 DC (REPOST SORRY)
No sooner have I hit send then I find the solution for you !! http://forum.java.sun.com/thread.jsp?forum=51thread=194669 Please do let us know if it works. Soefara. From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: JNDI realm against win2000 DC (REPOST SORRY) Date: Fri, 12 Apr 2002 20:55:31 +0800 Do you mean authentication against a Windows 2000 Active Directory ? The latter is based upon LDAP I believe and therefore should be accessible. At least that's what the JNDI FAQ implies http://java.sun.com/products/jndi/faq.html However, for authentication purposes, you need to communicate with the server via SSL. I've never managed to get this to work successfully but there are quite a few references in the forums. For example http://forum.java.sun.com/thread.jsp?forum=51thread=91182 Please do let us know if you get it working. I'm sure there are many people who would love to use it too. Soefara. From: Jacob Lund [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: JNDI realm against win2000 DC (REPOST SORRY) Date: Fri, 12 Apr 2002 14:39:07 +0200 Sorry about this repost, but it is really bugging me! Does anyone have a TC 4.0.x configured with a JNDI realm against a windows 2000 domain controller? Or maybe just know how to set this up! I have been looking at the JNDI how-to and I cannot get it working. Thanks, Jacob -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Tomcat 4.x and Database Connection Pooling
In the javabean. import javax.naming.NamingException; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingEnumeration; import javax.naming.directory.InitialDirContext; class mybean() { java.sql.Connection conn get getPooledDatabaseConnection() { Context ctx = new InitialContext(); Context envCtx = (Context) ctx.lookup(java:/comp/env/); DataSource ds = (DataSource) envCtx.lookup(jdbc/dbpool); conn = ds.getConnection(); } ... } If so, this is going to make development much easier. :-) Yep ... that is exactly the pattern you can use. Nice, isn't it? It's so good we're updating all of our code to use this. Now the whole MVC framework finally makes sense :-) At least in a webapp, that is. I'm not sure how a standalone application would be able to provide the JNDI environment to the same Javabeans but I'll check the Sun JNDI mailing list. Thank you for all the great work on Tomcat, Soefara. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Tomcat 4.x and Database Connection Pooling
Tomcat: As far as I'm concerned, JNDI support is a now and forever more feature of Tomcat 4 and later. It's the standard access mechanism for J2EE app servers as well. This is what I love to hear. With so many changes (servlets to JSP to Struts) over the last few years, future-proofing is so important. Recommendation: If you can, you should use JNDI based access to data sources. This is both portable across containers, and portable across Struts versus non-Struts applications. In addition, it can be used from directly from within a JavaBean implementing your business logic, without requiring a reference to ActionServlet or the servlet context (or the web layer at all). Really ? This is incredibly important news to me. I've been acquiring the JNDI resource within my servlet then passing it as a parameter to my Javabean which is a terrible mechanism because it makes my javabean dependent on the servlet :( So, are we saying that once we've set up a pooled database connection JNDI resource in server.xml and web.xml, any Javabean that is called by a serlvet or JSP can make use of this JNDI resource directly like this In the javabean. import javax.naming.NamingException; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingEnumeration; import javax.naming.directory.InitialDirContext; class mybean() { java.sql.Connection conn get getPooledDatabaseConnection() { Context ctx = new InitialContext(); Context envCtx = (Context) ctx.lookup(java:/comp/env/); DataSource ds = (DataSource) envCtx.lookup(jdbc/dbpool); conn = ds.getConnection(); } ... } If so, this is going to make development much easier. :-) Soefara. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Designing for scalability ?
If one day you suspect that one Tomcat server will not be sufficient, and you will have to employ 2 or more Tomcat servers running on separate machines, how can we allow for scalability ? For example, using simple DNS round-robbin to offload requests between servers, a first request might arrive at one server and a Session object created. But if the subsequent request (from the same client) arrives at a different server, that Session will not be found, will it ? (As far as I know, there is no method to store Sessions in a common database used by several servers) What steps are people taking to allow for scalability in their applications ? Are there any steps that can be implemented at initial development which may save time further down the road ? Thank you, Soefara. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Tomcat/Apache trying to hide /webapp/ from URL
Sorry, I know Tomcat/Apache has been discussed endlessly but this problem is driving me around the bend. We have Tomcat(3.2.3) running fine. We have several webapps running on it with no problem, including our main corporate website which is accessed directly via Tomcat at http://www.domain.com:8080/corporatesite (ie. the webapp is tomcat_home/webapps/corporatesite) We have Apache configured to be in front of Tomcat with mod_jk which simply means that we need to insert this line into Apache's httpd.conf and it works fine. Include /usr/local/jakarta/tomcat/conf/mod_jk.conf-auto However, there are 2 problems with this 1. The URL to reach the site is http://www.domain.com/corporatesite but we'd really like it to be http://www.domain.com 2. I think that Tomcat still has to serve up all of the images and static content which are part of the webapp. (ie. they're stored in subdirectories of tomcat_home/webapps/corporatesite) I thought that I could solve both of these problems using this ProxyPass but that didn't work as expected. There must be an easy way to solve this. I was also surprised that setting Apache's httpd.cont to include DocumentRoot /usr/local/jakarta/tomcat/webapps/corporatesite did not help at all. Any and all help is truly welcome. Thank you so much, Soefara. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Multiple users share java bean?
Wow, you boys made me realize how little I know, and now I'm even starting to doubt my prior understanding. Can you please help me clarify the following. First, am I correct in saying that the default behaviour for a Javabean is that each servlet or JSP that uses it will create a new instance of that Javabean ? For example, if we have Register.jsp which uses a Javabean called memberData.java then if 2 people were to submit data to Register.jsp at exactly the same time, each page would actually create and use a separate instance of the bean memberData.java. Is this correct? Second, if this is the case, how do you actually create a shared bean and why would you want one ? Third, I'm getting confused and starting to doubt my understanding of servlets within the Tomcat servlet container. If we have a simple servlet using the helloWorld.class and it just prints hello world to the web page, then if 10 people were to requsest the servlet at the same time, am I correct in assuming that 10 different instances of the class are created to handle these requests ? Sorry for these seemingly basic questions but I'm going through one of those stages where I question the fundamental understanding. I must go read the servlet API I think. Soefara. From: Daniel Hinojosa [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Multiple users share java bean? Date: Mon, 25 Mar 2002 15:58:20 -0700 In that case I recommend a facade bean in order to do this For example, doing this. Chenming Zhao wrote: Dniel, There is still one problem: the value set by the second user2 updated the value of the first user1 before finishing user1's work. I paste the code. Please take a look. public class test { int numEvents= 5; public synchronized int test() { int real=0; int eventCounter=0; while(eventCounter=numEvents) { real=eventCounter; // wait for 0.01 second try{wait(10);} catch(InterruptedException e){}; eventCounter++; } return real; } public synchronized int setNumEvents(int sec) { numEvents= sec; } } For example, I input 200 as the value of numEvents for user1. Before finishing user1's task, user2 input 100 as numEvents and begin his work. I hope I can get results 200 and 100 respectively. But I got 100 both. - Original Message - From: Daniel Hinojosa [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, March 25, 2002 11:35 AM Subject: Re: Multiple users share java bean? If it's a shared bean, sycnchronize it. Make sure that all mutators(Setters) are synchronized, and it would be a bad idea to do that to the accessors (mututors) are synchronized too. If you have more open than private member variables in this bean, make sure they are private. e.g. public void synchronized setName(String name) { . } -- Daniel Hinojosa -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] public class TestFacade { private Test test = null; public void synchronized process() { if (test == null) test = new Test(); test.test(); test.setNumEvents(2); } } With this I am pretty sure that you can take the synchronized off of methods of the Test Object and always use this testFacade before using your test object. Hope that helps _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: AW: Multiple users share java bean?
First of all, thank you so much Alexander for taking the time to explain this so thoroughly. First, am I correct in saying that the default behaviour for a Javabean is that each servlet or JSP that uses it will create a new instance of that Javabean ? For example, if we have Register.jsp which uses a Javabean called memberData.java then if 2 people were to submit data to Register.jsp at exactly the same time, each page would actually create and use a separate instance of the bean memberData.java. Is this correct? Nice answer: That depends :-) a) jsp:useBean id=mb class=MyBean scope=page / The bean is created for exactly this page executed by this user b) jsp:useBean id=mb class=MyBean scope=request / The bean is created for this page and all pages you jsp:include in this request. c) jsp:useBean id=mb class=MyBean scope=session / The bean is created and accessible by all pages of this application (You must include this line into all pages) p.ex.: You create a session bean that accesses a database. The database connection will be made once and will stand until the session runs out. There is a seperate bean for every user, though. d) jsp:useBean id=mb class=MyBean scope=application / The bean is created the first time a user accesses a page in your application. From then on, every user and every page will have the same bean! Lovely concise answer. I've printed this out as a cheat sheet :-) Now, since each JSP is essentially a servlet, how does the servlet perform the sharing of the javabean ? Does a servlet that shares a javabean (similar to the JSP case [d] above, where scope=application), is actually creating the javabean as a *static* variable so that it is shared by all members of the class ? Third, I'm getting confused and starting to doubt my understanding of servlets within the Tomcat servlet container. If we have a simple servlet using the helloWorld.class and it just prints hello world to the web page, then if 10 people were to requsest the servlet at the same time, am I correct in assuming that 10 different instances of the class are created to handle these requests ? true Great, that's what I thought. But here's why I'm getting confused. The servlet tutorial says that a servlet is created once and once only (that's when the init() is run). http://java.sun.com/docs/books/tutorial/servlets/lifecycle/index.html If the servlet class is created only once, how does Tomcat then create multiple instances of the class ? I could recommend a german book here, but I think that wouldn't be of great use for you... Good guess. Learning German through Java would surely be a challenge :) Thank you again, Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Problem with cache clearing in Tomcat
To first check whether it's a browser or Tomcat server problem, go to another computer on your nework that has not yet been used to view the offending JSP/servlet. If you find you're still viewing an older version of the page, then it's obviously caching on the server. I've found that 9 times out of 10 it's Tomcat caching and not browser caching. If it's Tomcat caching then the META tags or pragma-no-cache will not help. There's the reloadable=false (or should it be true? I have to check) parameter for the context in server.xml. But even that has not helped for me and I have to just delete the /work directory whenever I want to reload things. Be careful not to delete something in the webapps directory by mistake. That can really ruin your day. Soefara. From: Jeff Larsen [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problem with cache clearing in Tomcat Date: Tue, 26 Mar 2002 09:29:48 -0600 You may also want to try META http-equiv=Expires content=0 However, I don't really trust META tags. Browser implementations of META tags are not always reliable. Write to the response headers directly. I embed the following at the top of every jsp page. % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setDateHeader(Expires, 0); % If you're not using jsp, you could also put this in your servlet code. However, during the development of my latest web app, I had similar cache problems while running under Tomcat 3.2.3 standalone. In my production environment however, I run Apache 1.3.23 with mod_jk to connect to Tomcat 4.0.3 and my cache problems went away. I'm not sure if it's a Tomcat version issue or if Tomcat's standalone HTTP connector just doesn't handle the headers correctly. Good luck, Jeff - Original Message - From: somya_iyer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 3:58 AM Subject: Problem with cache clearing in Tomcat Hi, I'm using apache tomcat 4.0 and my application has been developed using only servlets and an oracle database. After a user logs out, when the next one logs in, the application continues with the old pages belonging to the previous user. The old session has been invalidated and the new session values are being correctly taken by the system. On refreshing the screen, the correct pages come up. I have tried setting the header information as follows: meta http-equiv=pragma content=no-cache meta http-equiv=cache-control content=no-store but this doesn't help either. Can anyone help out? Thanks, Somya -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Tomcat and Unicode parameters in URLs ???
Thanks for pointing this out Larry. Unfortunately we use Tomcat 4 only because it seems quite a bit faster than the Tomcat 3 series. Thank you though. It looks like I'm going to have to learn how to guess the character set and language. Thank you, Soefara. From: Larry Isaacs [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: Tomcat and Unicode parameters in URLs ??? Date: Tue, 19 Mar 2002 07:51:46 -0500 If you can live with the Servlet 2.2 spec, Tomcat 3.3 has a work around for this. The DecodeInterceptor can accept a URL like the following to specify the encoding as part of the URI: http://localhost:8080/myapp/index.jsp;charset=UTF-8?param=value For details, see the charsetAttribute attribute of the DecodeInterceptor: http://jakarta.apache.org/tomcat/tomcat-3.3-doc/serverxml.html#DecodeInterceptor You are welcome to give it a try. Cheers, Larry -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 8:50 PM To: Tomcat Users List Subject: Re: Tomcat and Unicode parameters in URLs ??? On Tue, 19 Mar 2002, Soefara Redzuan wrote: Date: Tue, 19 Mar 2002 09:20:47 +0800 From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Tomcat and Unicode parameters in URLs ??? Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. But what happens if you really do not know what character set to expect ? In our company, the webserver is used for B2B messaging with customers and not purely serving web pages. For example, we can accept a message with a query string like this http://vpn.ourcompany.com/servlet/incoming? company=CustomerNamerefere nceId=1234noteText= The noteText could be in one of several languages since we do international business. We're currently considering adding a language parameter such as Language=English but it would be nicer to autodetect the language. Is this possible ? It would be possible if the HTTP specs defined a way to tell the server what language the HTTP URL is encoded in, and if browsers actually sent along that indication. Neither seems to be the case in general -- even on a POST transaction (where the browsers really have no excuse for not including the character encoding in the Content-Type header), many don't. Thus, you're stuck haveing to figure it out for yourself. Note that adding a language parameter to the query string isn't going to do you much good -- you have to call setCharacterEncoding() *before* you call request.getParameter(), so you won't have been able to read the language field first. Thank you, Soefara _ Craig Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Is there db caching ? Re: Managing Tomcat(4.0.x) JNDI JDBC pool resources
Super explanation, Craig. I've taken a look at the Tyrex site and think I'm correct in saying that there is no caching of database results. Is this true ? I understand that database connections take longer than queries so the connection pooling creates the greatest time saving, but I think result caching can also improve performance. Does Tomcat have a mechanism for doing this or is it up to us to build that into our own web-apps ? Is there a boilerplate for doing this ? Thank you, Soefara From: Craig R. McClanahan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Managing Tomcat(4.0.x) JNDI JDBC pool resources - Craig? Date: Sat, 16 Mar 2002 12:51:22 -0800 (PST) On Sat, 16 Mar 2002, Steven Elliott wrote: Date: Sat, 16 Mar 2002 17:46:01 + From: Steven Elliott [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Managing Tomcat(4.0.x) JNDI JDBC pool resources - Craig? Apologies in advance if this has already been answered in another thread but my searches have turned up numerous references to JNDI pooling JDBC - etc. but only one post mentioned managing container (Tomcat) pool resources and that question went unanswered as far as I could tell. Nor did I find anything particullarly illuminating in the Tomcat documentation. At least I haven't found the After reading the JDBC2.0 stdext documentation it seems that the container does not use the driver's ConnectionPoolDataSource interface as a factory for PooledConnection objects but instead (at least what I can tell from Tomcat) uses its own pooling resource? The container exposes a javax.sql.DataSource implementation to applications. Internally, the factory is currently based on Tyrex (http://tyrex.exolab.org) for 4.0.x, but has switched to the DBCP package from Jakarta Commons (http://jakarta.apache.org/commons) in the nightly builds. What I don't see provided for is any kind of management methods to set Min or Max Pool size, or setting the initial Pool size, etc. Nor do I see any default values? Although I can set parameters for the DataSource object supported by my driver (like dataBaseName, etc. I think) I don't see any way to get to the setter, getter methods supported by my driver's ConnectionPoolDataSource factory (beyond the methods declared in the javax API)? Tyrex, and the DBCP pool, both do their own pool management of java.sql.Connection instances provided by your driver, so they can be used with any JDBC driver -- even those that do not support ConnectionPoolDataSource themselves. The DBCP based pool does have configuration management properties for pool size and so on. Is there any way to configure these parameters for Tomcat? If not is there any way to register a third party connection pool from within server.xml or will this have to be done in a separate package. It should be possible to use the DBCP based pool even with Tomcat 4.0.x by overriding the default JNDI factory for javax.sql.DataSource objects (I haven't tested this, but in theory it should all work). This requires the following steps: * Download recent nightly builds of the Collections, Pool, and DBCP packages from Jakarta Commons (http://jakarta.apache.org/builds/jakarta-commons/nightly/) and put the JAR files into $CATALINA_HOME/common/lib along with your JDBC driver. * Configure the factory parameter in the ResourceParams element to set the JNDI ObjectFactory class for this resource: ResourceParams name=jdbc/EmployeeDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter ... other configuration parameters ... /ResourceParams * Configure the other parameter values of the ResourceParams element from the list of supported properties below: - driverClassName - Fully qualified Java class name of the JDBC driver - maxActive - Maximum number of active connections at one time - maxIdle - Maximum number of idle connections at one time (if more are returned to the pool, they will be closed to release database resources) - maxWait - Number of milliseconds the pool will wait when there are no available connections before causing getConnection() to throw an exception - password- Database password - url - Connection URL (also accepts driverName for backwards compatibility) - user- Database username - validationQuery - Optional SQL SELECT statement used to validate a connection before returning it to the application (must return at least one row). This is helpful in catching stale connections because of timeouts
Re: Tomcat and Unicode parameters in URLs ???
Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. But what happens if you really do not know what character set to expect ? In our company, the webserver is used for B2B messaging with customers and not purely serving web pages. For example, we can accept a message with a query string like this http://vpn.ourcompany.com/servlet/incoming?company=CustomerNamereferenceId=1234noteText= The noteText could be in one of several languages since we do international business. We're currently considering adding a language parameter such as Language=English but it would be nicer to autodetect the language. Is this possible ? Thank you, Soefara _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: jndi versus database connection pooling
Maybe but if it's just the docs that you're missing, why not get them from the Apache site ? http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html Soefara From: Bing Zhang [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: jndi versus database connection pooling Date: Sat, 16 Mar 2002 18:19:13 -0800 I asked this before, but got no answear. Since we are talking about docs, here we go again. I installed tomcat-4.0.1, 4.0.1-manuls and 4.0.1-webapps, all from rpms on RedHat 6.2. However some of key docs under webapps/tomcat-docs are empty, such as jndi-resources-howto.html, class-loader-howto.html, ssl-howto.html, index.html, introduction.html and .. Am I missing something here? Thanks Bing Zhang -Original Message- From: Craig R. McClanahan To: Tomcat Users List Sent: 3/15/02 11:26 PM Subject: Re: jndi versus database connection pooling On Sat, 16 Mar 2002, Soefara Redzuan wrote: Date: Sat, 16 Mar 2002 15:03:10 +0800 From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: jndi versus database connection pooling Oh dear, Craig, I'm fairly embarassed. Sorry. You're going to kick yourself ... the required element name is res-ref-name, not resource-ref-name :-). I should have noticed that when I copied my web.xml right next to the previous person's. What is it they say about being so close to a problem to be blinded. But may I suggest that the JNDI docs are updated because it's resource-ref-name in many cases there, for Mail as well as JDBC. http://127.0.0.1:8080/tomcat-docs/jndi-resources-howto.html Well, now I'm somewhat embarrassed, because I wrote the original document that had the wrong element name :-(. However, this was fixed in the Tomcat source code on October 10, 2001, and therefore the correct version was included from release 4.0.1 onwards (current production release is 4.0.3). Which version are you running? Is there anyplace that the wrong version of this document still exists online that we need to fix? Craig -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: jndi versus database connection pooling
DataSource ds = null; Context initCtx = new InitialContext(); Context envCtx = (Context)initCtx.lookup( java:comp/env ); ds = (DataSource)envCtx.lookup( jdbc/DB ); The problem is that returned datasource is always null. I wish I could get that far. I am using a web.xml that is almost identical to your own below and yet Tomcat will not start without reporting this XML parsing error. org.xml.sax.SAXParseException: Element resource-ref does not allow resource-ref-name here. From: Taavi Tiirik [EMAIL PROTECTED] In web.xml I have following resource-ref defined: resource-ref description Resource reference to a factory for javax.sql.DataSource instances that may be used for talking to a particular database that is configured in the server.xml file. /description res-ref-namejdbc/DB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref My own web.xml is contains almost the same resource-ref resource-ref description Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. /description resource-ref-name jdbc/mydb /resource-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref The error I get is an XML parsing error and the actual values are actually irrelevant. I'm using Tomcat 4.0.1 on Windows 2000. How come nobody else is reporting this error regardless if you're using Postgres, Oracle or mysql org.xml.sax.SAXParseException: Element resource-ref does not allow resource-ref-name here. Also, IF I ever get this to work, will this also work on other java servers like Websphere or will your own database pool manager be more cross platform ? Thank you, Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: jndi versus database connection pooling
Oh dear, Craig, I'm fairly embarassed. Sorry. You're going to kick yourself ... the required element name is res-ref-name, not resource-ref-name :-). I should have noticed that when I copied my web.xml right next to the previous person's. What is it they say about being so close to a problem to be blinded. But may I suggest that the JNDI docs are updated because it's resource-ref-name in many cases there, for Mail as well as JDBC. http://127.0.0.1:8080/tomcat-docs/jndi-resources-howto.html I really should have checked the DTD though. With regards to your question about portability, the answer is yes -- resource references declared in the web.xml are portable, as long as the servlet container you plan to run on supports a JNDI naming context for each web application. That covers *all* J2EE-compatible servers and Tomcat 4 -- for anything else, you will want to double check. I think *all* J2EE compatible servers should be enough for the meantime. :-) Note, however, that the actual mechanism for defining what connection pool the resource reference actually refers to is server dependent. For Tomcat 4, that means setting things up in server.xml. For other servers, consult the documentation for that server. Thank you, Soefara. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
what is intermixed ? Re: a better way to deploy servlets on tomcat ?
Are you referring to an alternative product to Tomcat or a particular configuration somewhere ? It's not in my server.xml or web.xml and I can't find a mention of it on the Jakarta website. Soefara From: [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: a better way to deploy servlets on tomcat ? Date: Thu, 14 Mar 2002 08:39:21 -0600 see intermixed. Soefara Redzuan [EMAIL PROTECTED] on 03/14/2002 12:26:08 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: a better way to deploy servlets on tomcat ? Sorry for another question but is there an easier way to load servlets into Tomcat than the following process which I'm using now. First, I write my servlet .java file for example in webapps/myapp/WEB-INF/classes/myservlet.java Second, I compile it. Third, I add the servlet and servlet mapping to webapps/myapp/WEB-INF/web.xml web-app servlet servlet-nametestServlet/servlet-name servlet-classtestServlet/servlet-class /servlet servlet-mapping servlet-name testServlet /servlet-name url-pattern /testServlet /url-pattern /servlet-mapping /web-app Finally, I restart Tomcat. Do I really have to add each servlet and its servlet mapping to web.xml or is there a way to have all servlets automatically detected and served by Tomcat ? You typically could live without the need to add a mapping for each servlet that you write. But if you wish to do some advanced stuff such as loading the servlet when Tomcat starts, or you need to access the servlet by another name rather than say http://yourdomain/yourwebapp/servlet/testServlet, or suppose your servlet needs init parameters, then it's a good idea to create a web.xml (deployment descriptor). There are other uses for a web.xml. Check the servlet spec. See Deployment Descriptor section. Plus is there anyway to avoid the restarting of Tomcat ? The reloadable=true attribute serves the purpose of reloading the web application whenever tomcat detects a change (although the documentation doesn't recommend once you have deployed your applications). The manager web app can be used also to restart/install/stop/etc. a particular web application without restarting Tomcat. See http://localhost:8080/tomcat-docs/config/context.html Thank you again, Soefara _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: jndi versus database connection pooling
Mark Muffett [EMAIL PROTECTED] on 03/14/2002 04:18:13 AM The coding side seems to be well documented, and there have been several instances posted here, but (as far as I can see) we're all working in the dark with server.xml. I've spent a lot of time trying to get database pooling to work with Postgresql, but I've failed and given up. I'd be interested to know what database/tomcat configurations anyone has got to work - with some sample server.xml fragments if possible. Thank goodness it's not just me. I was starting to feel very stupid. From: [EMAIL PROTECTED] Hi, here is an example. Server.xml Context path=/creditel docBase=creditel debug=0 reloadable=true crossContext=true Resource name=jdbc/creditel auth=Container type =javax.sql.DataSource/ ResourceParams name=jdbc/creditel parameternamedriverClassName/name valueCOM.ibm.db2.jdbc.net.DB2Driver/value/parameter parameternamedriverName/name valuejdbc:db2://URL/DATABASENAME/value/parameter parameternameuser/namevalueUSERNAME/value/parameter parameternamepassword/namevaluePASSWORD/value/parameter parameternamemaxPoolSize/namevalue2/value/parameter parameternameloginTimeout/namevalue10/value/parameter /ResourceParams /Context I did something similar in server.xml and Tomcat has not complained yet. This is mine for mysql Context path=/myapp docBase=myapp debug=0 reloadable=true Resource name=jdbc/ibs auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/mydb parameter nameuser/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter namedriverName/name valuejdbc:mysql://url/databasename/value /parameter /ResourceParams /Context web.xml resource-ref res-ref-namejdbc/creditel/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref My web.xml has more in it. web-app servlet servlet-namemyServlet/servlet-name servlet-classmyServlet/servlet-class /servlet servlet-mapping servlet-namemyServlet/servlet-name url-pattern/myServlet/url-pattern /servlet-mapping resource-ref description Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. /description resource-ref-name jdbc/mydb /resource-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app But when I start Tomcat it gives me this error Apache Tomcat/4.0 PARSE error at line 29 column -1 org.xml.sax.SAXParseException: Element resource-ref does not allow resource-ref-name here. Which is very strange because I just followed the examples in the JNDI howto. Soefara. _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: jndi versus database connection pooling
Yes, sorry, I was using dummy values and forgot that. Thank you for pointing that out. But my main problem seems to be with the XML parsing of the config file, regardless of the values I use, since the Tomcat error on the console is org.xml.sax.SAXParseException: Element resource-ref does not allow resource-ref-name here. I'm surprised nobody else got this following the JNDI howto. Soefara. From: [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: jndi versus database connection pooling Date: Thu, 14 Mar 2002 11:03:07 -0500 Hi Soefara, Your res-ref-name in web.xml should have same name with Resource name= jdbc/creditel auth=Container type=javax.sql.DataSource/ in server.xml. Good luck, Soefara Redzuan [EMAIL PROTECTED] on 03/14/2002 10:47:51 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To:[EMAIL PROTECTED] cc: Fax to: Subject:Re: jndi versus database connection pooling Mark Muffett [EMAIL PROTECTED] on 03/14/2002 04:18:13 AM The coding side seems to be well documented, and there have been several instances posted here, but (as far as I can see) we're all working in the dark with server.xml. I've spent a lot of time trying to get database pooling to work with Postgresql, but I've failed and given up. I'd be interested to know what database/tomcat configurations anyone has got to work - with some sample server.xml fragments if possible. Thank goodness it's not just me. I was starting to feel very stupid. From: [EMAIL PROTECTED] Hi, here is an example. Server.xml Context path=/creditel docBase=creditel debug=0 reloadable=true crossContext=true Resource name=jdbc/creditel auth=Container type =javax.sql.DataSource/ ResourceParams name=jdbc/creditel parameternamedriverClassName/name valueCOM.ibm.db2.jdbc.net.DB2Driver/value/parameter parameternamedriverName/name valuejdbc:db2://URL/DATABASENAME/value/parameter parameternameuser/namevalueUSERNAME/value/parameter parameternamepassword/namevaluePASSWORD/value/parameter parameternamemaxPoolSize/namevalue2/value/parameter parameternameloginTimeout/namevalue10/value/parameter /ResourceParams /Context I did something similar in server.xml and Tomcat has not complained yet. This is mine for mysql Context path=/myapp docBase=myapp debug=0 reloadable=true Resource name=jdbc/mydb auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/mydb parameter nameuser/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter namedriverName/name valuejdbc:mysql://url/databasename/value /parameter /ResourceParams /Context web.xml resource-ref res-ref-namejdbc/creditel/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref My web.xml has more in it. web-app servlet servlet-namemyServlet/servlet-name servlet-classmyServlet/servlet-class /servlet servlet-mapping servlet-namemyServlet/servlet-name url-pattern/myServlet/url-pattern /servlet-mapping resource-ref description Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. /description resource-ref-name jdbc/mydb /resource-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app But when I start Tomcat it gives me this error Apache Tomcat/4.0 PARSE error at line 29 column -1 org.xml.sax.SAXParseException: Element resource-ref does not allow resource-ref-name here. Which is very strange because I just followed the examples in the JNDI howto. Soefara. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
jndi versus database connection pooling
I am getting very confused. Is JDNI Tomcat's own builtin database pool manager or must I still use a database conncetion pool manager such as the one at www.javaexchange.com ? Really I would love to have the database connection URL and username/password outside of my JSPs and in one place so JNDI looks best. But I'd also like to use database connection pooling within my JSPs and Servlets. How are people doing this with mysql ? Thank you, Soefara _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
a better way to deploy servlets on tomcat ?
Sorry for another question but is there an easier way to load servlets into Tomcat than the following process which I'm using now. First, I write my servlet .java file for example in webapps/myapp/WEB-INF/classes/myservlet.java Second, I compile it. Third, I add the servlet and servlet mapping to webapps/myapp/WEB-INF/web.xml web-app servlet servlet-nametestServlet/servlet-name servlet-classtestServlet/servlet-class /servlet servlet-mapping servlet-name testServlet /servlet-name url-pattern /testServlet /url-pattern /servlet-mapping /web-app Finally, I restart Tomcat. Do I really have to add each servlet and its servlet mapping to web.xml or is there a way to have all servlets automatically detected and served by Tomcat ? Plus is there anyway to avoid the restarting of Tomcat ? Thank you again, Soefara _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]