RE: Web Application Question
Joe, Are you sure your filter is doing the right thing? Sounds like it may be forwarding to a bad URL or something. If it works without the web.xml then I assume you've set up your context for the /cms application. Maybe try a System.err.println( myDestURL ) in the filter and then copy/paste that output into your browser to see it exists. Hope this helps. Chris Ward Hello, I'm running Tomcat 5.5.7, and right now I have one application ( the default application ). I just created a new dir ( $CATALINA_HOME/webapps/cms ) for a new application. The home page ( index.jsp ), for the application, is just a simple jsp file with static content. Once I added a WEB-INF/web.xml file, with just filter filter-mapping tags, and my welcome-file list, and browse to the application I get a 404 error. Now, if I remove the web.xml file from the WEB-INF/web.xml directory, I see the correct index.jsp. I'm looking in the $CATALINA_HOME/logs/catalina.out file and see nothing. I have watched the file, using tail -f during start up, and don't see any message about a misconfiguration in my web-xml file. Am I missing a step in the process of creating a new web application? Any help would be appreciated. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mulitple JVMs
Dear All, Due to a version upgrade of some third-party component accessed through J-Integra (Java/COM bridge) I've been informed that I need to run the new version in a different JVM to the rest of my webapp (the earlier versions lived in harmony). I know I could have a separate Tomcat on a different (or the same) server dedicated to running the new stuff, but I wondered if anyone has any advice on this. Many thanks, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mulitple JVMs
Hi, One webapp can only run in one JVM. But if you are splitting your webapp, you can use the CATALINA_BASE/CATALINA_HOME approach QM referred to, or have an entirely new Tomcat instance. It doesn't make that big a difference. That's is what I thought, but thanks for verifying it. Consider also making the rest of your webapp run in the new JVM, so that you stay in harmony. Ah, now, there's the rub. One of my webapps uses the COM/Java bridge to talk to a COM app (Bloomberg) on a REMOTE machine and requires the bridge to be run in DCOM mode. Something in the *new* version of my other COM componenet (Monis) apparently dictates use of NATIVE mode for the bridge. This COM app is on the same machine as Tomcat. Before the new version, it would happily run in non-native mode. The folks who produce the bridge code confirm what I'd found in extensive tests... Unfortunately, J-Integra is not designed to run in both native mode and DCOM mode within the same JVM. My suggestion is to alter your architecture such that Bloomberg and Monis are accessed from separate JVM instances. So the most painless thing would be to install Bloomberg on all the machines that will be running Tomcat. Just so you see why I asked the question. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Form Based Authentication with Cookies?
Chris, For what it's worth, I spent ages trying to get a remember-me login thing going out of the box but never managed it. In the end I implemented my own user/role setup and use a Filter to ensure the user is logged in when accessing servlets/ JSPs with specifice URL paths. The login page sets cookies to do the remembering. If you get your's going (I'm now on Tomcat 5.0.28, maybe there's something new) I'd be interested in the details. Good luck. Best regards Chris -- Chris Ward, Horizon Asset Limited mailto:[EMAIL PROTECTED] Tel +44 (20) 7367 7028, Fax 7367 7029 -- THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS E- MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. HORIZON ASSET LIMITED IS AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY. -Original Message- From: Chris Forbis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 12, 2004 7:45 PM To: [EMAIL PROTECTED] Subject: Form Based Authentication with Cookies? I have been looking for a way withing tomcat using a JDBCRealm to do form bases authentication and allow users to set some sort of Remember Me cookie, so they do not need to log into my application more than once a month or so. It looks like to me that FormAuthenticator is sort of hardcoded into tomcat without a way to allow for a context to allow for a CustomFormAuthenticator that would allow for this. Am I missing something, or is there no easy way to do this? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
WAR deploy problem
Hi all, I've been using the manager application to deploy/undeploy my webapp. I've put the context descriptor file (context.xml) in my META-INF dir and everything *seems* to run just fine. However, in the console window I'm getting a lot on noise - starting with this... (note, my context is called hal) ... ... INFO: Processing Context configuration file URL file:C:\intranet\webserver\jakarta-tomca t-5.0.28\conf\Catalina\localhost\hal.xml 04-Oct-2004 11:48:39 org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl. java:25) at java.lang.reflect.Method.invoke(Method.java:324) ... ... I thought this looked like invalid XML in the context.xml but I've checked it with XML Spy and even removed the bulk of it as a test. Any ideas? Many thanks, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: WAR file deployment snag - any suggestions?
Thanks very much for this. There are some very good points in here that have got me thinking. At present I have only one Tomcat running and a small number of users (it's an intranet) but the complexity and resource requirements of the application set is growing. I don't have any experience of larger scale web systems so all suggestions are welcome. Saving the XML files was an initial step at caching things that I can control. I did play around with holding onto the (dom4j) Documents in the ServletContext but I was concerned that this would swallow all the memory unless I used some sort of soft-reference caching system. I posted a question about this to this list - but I never heard back - must have been too dull a question (or the wrong list)! I imagine spreading the apps over multiple Tomcats/machines would allow me to do more in-memory caching. Feels like this is a move toward Web Services - I don't know much about them. Thanks again for your response - I'd be interested in hearing any other pearls of wisdom. Chris On Wed, Sep 29, 2004 at 06:27:13PM +0100, Chris Ward wrote: : Only having to release one file is great, but I've hit a problem : of my own making. My webapp writes various XML files to datestamped : dir within the webapp context. When I deploy the WAR file I purge : all these generated files. : [snip] : Should I use a different context to hold my data? That's one option; but another (likely more scalable) idea would be to put files in a filesystem, where they belong. The idea is to setup a directory outside of the Tomcat context path -- specify it in a properties file, or in a context param, whatever -- and write the data there. As the system grows to support multiple Tomcat instances spread across different machines, you could share the filesystem via NFS (not pretty, but it works), stuff the docs in a database (not pretty, but it works), or have the mid-tier Tomcat instances push the data to another, internal Tomcat setup that writes the files to a clustered/RAID'd fs. etc, etc, depending on how valuable these docs are and how much this app grows. By not writing to your context, you can wrap everything up in a WAR file and, better still, gain (a little) more security by making the WAR file owned and served by two different user accounts. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
WAR file deployment snag - any suggestions?
Hi, I've just started to use ANT to build my webapp and then deploy it to Tomcat as a WAR file (using the catalina-ant.jar stuff). Only having to release one file is great, but I've hit a problem of my own making. My webapp writes various XML files to datestamped dir within the webapp context. When I deploy the WAR file I purge all these generated files. Anyone out there have any suggestions? Should I use a different context to hold my data? Would it be better to be running Apache as well as Tomcat? Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
catalina-ant info
Hi all, Can anyone direct me to a user manual for the catalina-ant.jar tasks that come with Tomcat? I've read the documentation found under /tomcat-docs but I'd really like to see something specifically detailing ANT interface to the manager app. Many thanks, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting lastModified() from a (relative) URL
Hi, I'm just switching my servlets to read files using URLs rather than fully qualified filenames - which is fine - but I can't figure out how to get the files last modified value. I can get a lastModified header value from the connection but I'm not reading HTML files (if this makes any sense). This is what I've been using to read from the relative URLs. URL myURL = new URL( req.getScheme(), req.getServerName(), req.getServerPort(), req.getParameter(URL) ); HttpURLConnection conn = (HttpURLConnection)myURL.openConnection(); ... ... I need this info' because some of my apps' are caching files and need to notice when they've change on disc. Couldn't find anything in the archive. Thanks, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL 11 with Tomcat 5.0.27
I tried adding the XML element suggested but it made no difference. I still find that the XML tags of JSTL 1.1 under Tomcat 5.0.27 cause a silent failure of previously working JSPs. Anyone got any other suggestions on this one? Chris Thanks again. I'm showing my ignorance now but I don't know what a 2.4 XSD is let alone if I should have one or not! I did Google it but don't have time to reas all that came back! It's sitting on the printer now. I see mention of XMLSchema in there - which is something I'm not currently making use of in my code. If you have a 2.4 XSD in web.xml, the EL is turned on by default. Also for jstl 1.1, tlds are already included in the jars, so no need to copy them to your web-inf On Tue, 31 Aug 2004 12:56:56 +0100, Chris Ward [EMAIL PROTECTED] wrote: make sure u modify your web.xml with something like web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL 11 with Tomcat 5.0.27
Hi, I went back to first principles and you are quite correct, things do seem to be functioning properly. Thanks very much for the patient help. In the course of doing all this I downloaded the JSTL 1.1 zip from the Jakarata site so I could test the standard-examples WAR file. However, I now find that there seems to be something problematic with loading, using c:import, an XSLT stylesheet from file for use with the x:transform If I copy the guts of the stylesheet into my JSP locally it seems to work fine. In short; c:set var=XSL c:import url=../xsl/CubeToPositionHistory.xsl/ /c:set Fails in the x:transform doc=${XML} xslt=${XSL} x:param name=POS_ID_STR value=${param.POS_ID_STR} / /x:transform Whereas c:set var=XSL ... contents of ../xsl/CubeToPositionHistory.xsl ... /c:set works as anticipated. I must be doing something wrong or something subtle has changed. I know the import is working because I've output the ${XSL} to the screen in the first example. Any thoughts gratefully received. Chris But does a simple %@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; % c:set var=test value=hello/ ${test} work! On Wed, 1 Sep 2004 09:35:51 +0100, Chris Ward [EMAIL PROTECTED] wrote: I tried adding the XML element suggested but it made no difference. I still find that the XML tags of JSTL 1.1 under Tomcat 5.0.27 cause a silent failure of previously working JSPs. Anyone got any other suggestions on this one? Chris Thanks again. I'm showing my ignorance now but I don't know what a 2.4 XSD is let alone if I should have one or not! I did Google it but don't have time to reas all that came back! It's sitting on the printer now. I see mention of XMLSchema in there - which is something I'm not currently making use of in my code. If you have a 2.4 XSD in web.xml, the EL is turned on by default. Also for jstl 1.1, tlds are already included in the jars, so no need to copy them to your web-inf On Tue, 31 Aug 2004 12:56:56 +0100, Chris Ward [EMAIL PROTECTED] wrote: make sure u modify your web.xml with something like web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSTL 11 with Tomcat 5.0.27
Hi, I've upgraded from Tomcat 4.1.24 to Tomcat 5.0.27, most of my JSPs that use JSTL (1.0) work with the new setup, but none of the XML tags work. Pages just bomb out - nothing in the browser, nothing in the console, nothing in the logs. Even just using x:parse Since the core and sql tags do work I believe I am picking things up okay (I copied jstl.jar and standard.jar into my /lib dir and I notice the .tld files are in the standard.jar file). Does this smell like a parser jar file problem? Any ideas? This is sucking up all my time and delaying a release. Best regards Chris p.s. I notice in some docs that the url for JSTL 1.1 tags are like this %@ taglib prefix=x uri=http://java.sun.com/jsp/jstl/xml; % rather than %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % - the new one doesn't seem to work for me. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL 11 with Tomcat 5.0.27
make sure u modify your web.xml with something like web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 Thanks for the pointer. I'm not really sure what this entry is supposed to do though. I'll add it web.xml to see if magic happens. also, for jstl 1.1 no need to copy the .tld for standard and jstl I assumed I was picking these up since they are in the jar files I copied from the jsp-examples webapp into my webapp/WEB-INF/lib dir. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat Holding Database Open??????
Hi Mike, Some thoughts. If anyone sees errors please let me know - it may save me time in the long run! Tomcat doing this, because my Application ran just fine, using MySQL, and JDBC driver in a Web Server called OmniCron in CGI If I recall correctly, the CGI approach throws everything away after each request. I moved from Perl CGI to Java Servlets a few years back partly to make use of the load-once-then -reuse aspect. I think there was Mod Perl or something that sort of did this with Perl. Any road up, you may find that that is why the CGI version worked. Maybe it was freeing/releasing things when the CGI script/prog finished each request. You got a virgin state every time. format. The only thing different now is, Im trying to run SERVLETS using Apache/Tomcat. At the Start of each Servlet I do a connect to database CONNECT TO 'jdbc:mysql://127.0.0.1:3306/Imagescan' DRIVER 'com.mysql.jdbc.Driver' Then do my processing and then do a DISCONNECT ALL.. Are you sure the disconnect all is being fired when you think it is? Also, is there any chance the the disconnect all is freeing something you later depend on in subsequent requests? For example, do you have an init() method in your servlet that (initially) creates/connects, and the doGet/doPost then uses the connection? If this is the case, check the disconnect all is not closing/nullifying the connections since the init() won't get fired again. This might explain why the CGI implementation did make it through. It just does not make sense I can connect ONE TIME only when running a Servlet and have to back out of app, STOP, START, and go back in, to get another one time connection.the 08002, connection name in use, to me, points to Tomcat .. But as I said, Im just a baby in diapers to this world.. I believe its something in one of the .xml files, but I have no idea. I don't know for sure - but it sounds like the sort of right-of-passage problem most of us have had when first starting with servlets. I'd recommend gratuitous use of; System.err.println( Now executing {your method name} ); then stare at the console window for Tomcat to see what's being executed. It's always my last port of call for this sort of thing. As for Connection Pooling,is that for a system taking large numbers of hits on it? Right now, Im just one guy trying to make one connection work. I use connection pooling on my intranet site which has low traffic but large/complex applications on the server. I use it for two reasons; a) It shifts some of the work to a thirdparty bunch of code that I didn't have to write b) Saves time on the creation/connection cycle for DB-centric applications. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL 11 with Tomcat 5.0.27
Thanks again. I'm showing my ignorance now but I don't know what a 2.4 XSD is let alone if I should have one or not! I did Google it but don't have time to reas all that came back! It's sitting on the printer now. I see mention of XMLSchema in there - which is something I'm not currently making use of in my code. If you have a 2.4 XSD in web.xml, the EL is turned on by default. Also for jstl 1.1, tlds are already included in the jars, so no need to copy them to your web-inf On Tue, 31 Aug 2004 12:56:56 +0100, Chris Ward [EMAIL PROTECTED] wrote: make sure u modify your web.xml with something like web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 5 : JSTL (x:transform fails silently
Hi, I've moved to Tomcat 5 over the last week but I now find a JSP that worked on Tomcat 4.1.24 fails when it gets to the x:transform. I can't find an error anywhere. I looked at the JSTL 1.1 spec' (that's what Tomcat 5 uses right?) and noticed x:transform parameters changed from x:transform xml=...foo... xslt=...bar.../ to x:transform doc=...foo... xslt=...bar.../ but that doesn't seem to solve it. BTW : I have copied jstl.jar standard.jar to my webapp/WEB-INF/lib dir from the out-of-the-box Tomcat 5 jsp-examples webapp. Any ideas? Do I need to include crimson.jar or something? I don't think I do. Best regards Chris -- Chris Ward, Horizon Asset Limited mailto:[EMAIL PROTECTED] Tel +44 (20) 7367 7028, Fax 7367 7029 -- THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS E- MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. HORIZON ASSET LIMITED IS AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY. -Original Message- From: Cox, Charlie [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 2:24 PM To: 'Tomcat Users List' Subject: RE: Tomcat causes Apache to hang. Any ideas? -Original Message- From: Sean Finkel [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 3:52 PM To: Tomcat Users List Subject: Re: Tomcat causes Apache to hang. Any ideas? Sorry, this is a shared server, and he wants his site available on port 80. Tomcat standalone can run on port 80 without running as root by using jsvc (from commons-daemon). There are examples and more information on this configuration at http://jakarta.apache.org/tomcat/faq/security.html#jsvcExample. Maybe I am missing something, but wouldn't that not be able to bind to port 80 since Apache is already bound to it? There is a lot about the Java world I am not familiar with, so maybe it can... You would need separate ip addresses for apache and tomcat. reason we hand everything off, is because he has his application hosted inside a directory (ie: ~/public_html/appdir) but wants it to be available to users as http://www.domainname.com/whatever.jsp instead of http://www.domainname.com/appdir/whatever.jsp. You can configure Tomcat to have a Context whose docbase is ~/public_html/appdir but whose path is (the empty string, not null or /). And indeed that is what we are doing for him right now. However, my previous attempts at fiddling with mod_rewrite to translate root request /whatever.jsp into /appdir/whatever.jsp had failed. I now have this working in a preliminary stage. Since I was unable to get mod_rewrite processing the requests right, we just did a jkMount /* workername, which passed every request off to tomcat, and since we had the root context setup to serve from ~/public_html/appdir it all worked out fine. But of course, this results in trying to pass PHP requests (and things outside the appdir) to tomcat. how about passing only requests that are not php to tomcat? You can do this in httpd.conf: LocationMatch ^/(?!phpdir) jkUriSet ... /LocationMatch He also wants to use PHP on his main domain for forums or some such, once we get him to move his application out of appdir and into his website root. This is the deal breaker I think, for a commercial organization anyways. While you can use PHP on Tomcat, the performance is apparently not good enough for a large scale installation. See http://wiki.apache.org/jakarta-tomcat/UsingPhp for how to do this anyways. Well, I don't think I want to run PHP through Tomcat as we already have Apache running with PHP and it runs solid (and quite snappy too). What I am currently working on is this for his .htaccess (well, testing on a test instance): ( snip ) RewriteEngine On RewriteCond %{REQUEST_URI} !^/appdir/ RewriteRule ^(.*\.jsp)$ /appdir/$1 ---( /snip )- This results in all jsp pages being sent to tomcat. I also added a jkMount /appdir/* workername to the httpd.conf file. This means, that in the user's JSP pages, if he uses absolute paths for images, css, etc then they will be handed off to tomcat as well so that a complete page is sent back. The problem currently is, the user used relative paths for all his images, css files, etc. So while the JSP is being served correctly from Tomcat with the above .htaccess lines, it is not passing the css and image files off, which is the expected behavior. So I am trying to find some way to remedy this via
JAVA_OPTS in catalina.bat (Tomcat 5.0.27)
Hi, I've added set JAVA_OPTS= -Xms128m -Xmx128m to my catalina.bat file and Tomcat no longer starts. Same happens if I set JAVA_OPT as an environment variable (Windows XP). Anyone hit this? It works on my Tomcat 4.x catalina.bat file. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JAVA_OPTS in catalina.bat (Tomcat 5.0.27)
Thanks Matt, I've since found that it just didn't like the version of the command in catalina.bat (or setclasspath.bat) Fails = set JAVA_OPTS= -Xms128m -Xmx128m Succeeds = set JAVA_OPTS=-Xms128m -Xmx128m I'd seen some mailing list posting the other day that recommended putting the leading and trailing spaces in the command to avoid potential problems when it gets expanded. Oh well. Thanks again, Chris -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 11:22 AM To: Tomcat Users List Subject: RE: JAVA_OPTS in catalina.bat (Tomcat 5.0.27) There must be an error message somewhere. Either in catalina.out or on the console. Put a pause in at the end of catalina.bat so it stays on screen when you try to start tomcat. -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED] Sent: 26 August 2004 11:17 To: [EMAIL PROTECTED] Subject: JAVA_OPTS in catalina.bat (Tomcat 5.0.27) Hi, I've added set JAVA_OPTS= -Xms128m -Xmx128m to my catalina.bat file and Tomcat no longer starts. Same happens if I set JAVA_OPT as an environment variable (Windows XP). Anyone hit this? It works on my Tomcat 4.x catalina.bat file. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JAVA_OPTS in catalina.bat (Tomcat 5.0.27)
I'm on 2K in this case. I've just double checked that I'm not talking rubbish and find that having the double-quoted version, with leading an trailing spaced still blows up. However, simply removing the double-quotes works fine. I only used the quotes to ensure the spaces were there (see my previous mail) (In catalina.bat) Fails set JAVA_OPTS= -Xms128m -Xmx128m Succeedsset JAVA_OPTS= -Xms128m -Xmx128m(note trailing space still present) Best regards Chris -- Chris Ward, Horizon Asset Limited mailto:[EMAIL PROTECTED] Tel +44 (20) 7367 7028, Fax 7367 7029 -- THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS E- MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. HORIZON ASSET LIMITED IS AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY. -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 12:00 PM To: Tomcat Users List Subject: RE: JAVA_OPTS in catalina.bat (Tomcat 5.0.27) It works fine on my XP machine and in 2K, what version of windows are you running? -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED] Sent: 26 August 2004 11:46 To: Tomcat Users List Subject: RE: JAVA_OPTS in catalina.bat (Tomcat 5.0.27) Thanks Matt, I've since found that it just didn't like the version of the command in catalina.bat (or setclasspath.bat) Fails = set JAVA_OPTS= -Xms128m -Xmx128m Succeeds =set JAVA_OPTS=-Xms128m -Xmx128m I'd seen some mailing list posting the other day that recommended putting the leading and trailing spaces in the command to avoid potential problems when it gets expanded. Oh well. Thanks again, Chris -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 11:22 AM To: Tomcat Users List Subject: RE: JAVA_OPTS in catalina.bat (Tomcat 5.0.27) There must be an error message somewhere. Either in catalina.out or on the console. Put a pause in at the end of catalina.bat so it stays on screen when you try to start tomcat. -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED] Sent: 26 August 2004 11:17 To: [EMAIL PROTECTED] Subject: JAVA_OPTS in catalina.bat (Tomcat 5.0.27) Hi, I've added set JAVA_OPTS= -Xms128m -Xmx128m to my catalina.bat file and Tomcat no longer starts. Same happens if I set JAVA_OPT as an environment variable (Windows XP). Anyone hit this? It works on my Tomcat 4.x catalina.bat file. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mid-size dynamic XML (DOM) result handling in Tomcat.
Hi all, I'm not sure if my question should be addressed to the Tomcat or dom4j list, so this is going to both. I'm running Tomcat for my company intranet and most of my Java applications return their results as XML so that I can style the data with XSLT. I am using dom4j to dynamically build up the DOM (dom4j Document) and I pass that to a Transformer in a servlet. Since I want to slice'n'dice these results with XSLT, I am keeping hold of the Document on the server using an HttpSession entry so it's sitting there as I apply the different stylesheets (specified as a servlet parameter). I've read that dom4j in-memory representations are 8-to-10 times the size of the XML text - so I am very aware that my solution is not scalable (my current project results are about 1MB on disc). Is there a best practice for this sort of thing? Should I be serializing the Document to a DB or something and just keeping a handle to that in the HttpSessions? Should I be using SAX in some clever way? I'm sure it's a common task to handle medium-sized results from Tomcat. Any input would be gratefully received. Best regards Chris -- Chris Ward, Horizon Asset Limited mailto:[EMAIL PROTECTED] Tel +44 (20) 7367 7028, Fax 7367 7029 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JDBC/DBCP problems
Hi Jay, I don't know if it's of any help at all, but I went through something similar. What I found to be my problem was that my URLs for invoking JSPs/servlets did not always specify my Tomcat Context and all the DataSource stuff was set up in my context (in server.xml and the associated web.xml). Since I had pointed the default Context / to my Context (/hal) by setting it's docBase in server.xml most of the requests appeared to be working. For example, if I asked for {host}/jsp/myJSP.jsp I would get in fact reach the JSP at... {host}/hal/jsp/myJSP.jsp) but the JNDI stuff did not get picked up. Leaving the /hal out of my request meant it never saw the /hal stuff in server.xml which is where my DataSource stuff lives. I cleaned up my URL in links/forms etc. and seemed to get on okay. Hope it helps a bit. Best regards Chris -Original Message- From: Burgess, Jay S [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 3:36 PM To: [EMAIL PROTECTED] Subject: JDBC/DBCP problems I'm obviously missing something important with regards to moving our database/JDBC connectivity to use JNDI DataSource/DBCP. I've read and re-read the docs, looked at every related message in the archive, and Google'd every set of keywords I can think of, but still no luck. Here's the issue: Tomcat version is 4.1.29 on Windows XP. I'm attempting to connect to SQL Server. The JDBC driver JARs are in CATALINA_HOME\common\lib, and since everything works fine if I manually load the driver via Class.forName(), I don't think my problem is related to my driver files location. When attempting to use getConnection(), however, I get the dreaded Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver error. The highlights of my configuration are below. - SERVER.XML - GlobalNamingResources Resource name=jdbc/mydb auth=Container type=javax.sql.DataSource description=The database. / ResourceParams name=jdbc/mydb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://###.###.###.###:1433;Databas e=MyDB/va lue /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameusername/name valueMyUsername/value /parameter parameter namepassword/name valueMyPassword/value /parameter ... /GlobalNamingResources - WEB.XML - resource-ref descriptionSome description. /description res-ref-namejdbc/mydb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref - In my servlet's init(): - Context initialContext = new InitialContext(); Context envContext = (Context) initialContext.lookup(java:comp/env); DataSource dataSource = (DataSource) envContext.lookup(jdbc/mydb); Connection conn = dataSource.getConnection(); // throws exception - Further info: - Adding the following line after acquiring dataSource above, I get class org.apache.commons.dbcp.BasicDataSource: System.out.println(dataSource.getClass()); And if I add the following, I get [EMAIL PROTECTED]: System.out.println((org.apache.commons.dbcp.BasicDataSource) dataSource); So, since it looks like a valid BasicDataSource object, I tried the following, but get null back: System.out.println(((org.apache.commons.dbcp.BasicDataSource) dataSource).getUrl()); This seems to indicate that the object isn't initialized? Turning on debug for the relevant listeners (NamingContextListener and GlobalResourcesLifecycleListener), I see the following related info in my Tomcat console window, which looks good from what I understand: Jan 28, 2004 9:06:11 AM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 8080 NamingContextListener[/]: Creating JNDI naming context NamingContextListener[/]: Resource parameters for mydb = ResourceParams[name=mydb, parameters= {url=jdbc:microsoft:sqlserver://###.###.###.###:1433;Database=MyDB, maxIdle=4, maxActive=8, driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver, maxWait=1, removeAbandoned=true, username=MyUsername, factory=org.apache.commons.dbcp.BasicDataSourceFactory, logAbandoned=true, removeAbandonedTimeout=60, password=MyPassword}] NamingContextListener[/]: Adding resource ref mydb NamingContextListener[/]: ResourceRef[ className=javax.sql.DataSource, factoryClassLocation=null, factoryClassName=org.apache.naming.factory.ResourceFactory,
RE: Repeated load-on-startup niggle
Correct - the only place the Filter is mentioned is in the web.xml for the / Context and the .class file is in that Context. If it further confirms your understanding, I should mention that in the beginning I *did* have a copy of the Filter under /hal (for initial testing of the Filter) and that caused an infinite loop for redirections! The first request to / got redirected to /hal which then got redirected to /hal etc. etc. Chris Chris, thanks for responding. I think I understand. Sanity check: the filter is not even mentioned anywhere in the webapps/hal heirarchy, right? That hierarchy is totally unaware of the filter. If that's the case then all is making sense now. thanks again, -joe Chris Ward wrote: Hi Joe, I'm not sure exactly what your query is but the setup I have is a / and a /hal Context. The Filter I am using to direct any requests to / to /hal lives in the WEB-INF/classes dir of the / context. In my case I used the Tomcat default dir of ../webapps/ROOT for the / docBase. Further. the configuration for the Filter and the URL pattern to fire it is in the web.xml file in that same WEB-INF dir. I do use /* as the URL pattern, but remember that these URL patterbs are relative to the Context the web.xml file is in. i.e. webapps/ROOT/WEB_INF/web.xml URL pattern of /* matches http://myserver/* webapps/hal/WEB_INF/web.xml URL pattern of /* matches http://myserver/hal/* Sorry if I've missed your point. Regards, Chris Shapira, Yoav wrote: Howdy, A javax.servlet.Filter is one nice clean way. Apologies if this is dumb q: Googling the jakarta site and reading the tomcat o'reilly have left me confused on this. Isn't the filter part of web app? From jakarta: Filters are configured in the deployment descriptor of a web application And in o'reilly the filter and filter-mappnig tags are discussed in the web.xml section. Doesn't this raise a namespace issue? If your servlet-mapping is to /foo, then a filter on /* seems like it will either never fire, or else be ambiguous with other /* filters in other web apps (such as the /bar webapp, with it's own /* filter). The original poster had a /hal context and a / context. Does the filter solution require the / context to remain? Or is that unneeded? thanks for any unconfusion, -joe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
302 -- found (redirect), this is expected and good. 304 -- not modified, means it's in your browser's cache. Try clearing your browser's cache. Top tip. Cleared the cache and the gifs etc. turned up! Thanks for that. I should take more notice of the codes. I'm not convinced my Filter is correct since there are other things that have not had the /hal added to them... - - [23/Jan/2004:17:31:22 00] GET /stylesheets/HAL_Styles.css HTTP/1.1 302 - - - [23/Jan/2004:17:31:22 00] GET /JavaScript/HAL_CommonJavaScript.js HTTP/1.1 302 - Is there a matching 304 with /hal for these requests? I'll check this later. I was kinda hoping there would be nothing other than /hal/ entries in here. No: all requests are logged (because of where in server.xml the AccessLogValve is defined -- you can change this), so you see requests for / as well as /hal. Ah. I get it, that makes sense. Thanks again. I'm close to having my initial problem solved now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setting system properties in standalone Tomcat 4.1.24
Hi all, Sorry if this is a really dumb question, but how/where do I set system properties when using Tomcat 4.1.24? I've searched around but found nothing obvious. Is it in an xml file rather than a .properties file? Is it in the Java JDK? Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting system properties in standalone Tomcat 4.1.24
Thanks. That's just what I needed. I thought I'd done it at some point in the past! Best regards Chris If by system properties you mean JVM (Java Virtual Machine) settings, then you can do this by setting the CATALINA_OPTS variable in the catalina.sh (unix, linux) or catalina.bat (win32) file in the /bin directory of your Tomcat installation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
Hi Joe, I'm not sure exactly what your query is but the setup I have is a / and a /hal Context. The Filter I am using to direct any requests to / to /hal lives in the WEB-INF/classes dir of the / context. In my case I used the Tomcat default dir of ../webapps/ROOT for the / docBase. Further. the configuration for the Filter and the URL pattern to fire it is in the web.xml file in that same WEB-INF dir. I do use /* as the URL pattern, but remember that these URL patterbs are relative to the Context the web.xml file is in. i.e. webapps/ROOT/WEB_INF/web.xml URL pattern of /* matches http://myserver/* webapps/hal/WEB_INF/web.xml URL pattern of /* matches http://myserver/hal/* Sorry if I've missed your point. Regards, Chris Shapira, Yoav wrote: Howdy, A javax.servlet.Filter is one nice clean way. Apologies if this is dumb q: Googling the jakarta site and reading the tomcat o'reilly have left me confused on this. Isn't the filter part of web app? From jakarta: Filters are configured in the deployment descriptor of a web application And in o'reilly the filter and filter-mappnig tags are discussed in the web.xml section. Doesn't this raise a namespace issue? If your servlet-mapping is to /foo, then a filter on /* seems like it will either never fire, or else be ambiguous with other /* filters in other web apps (such as the /bar webapp, with it's own /* filter). The original poster had a /hal context and a / context. Does the filter solution require the / context to remain? Or is that unneeded? thanks for any unconfusion, -joe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Repeated load-on-startup niggle
Hi all, In my Tomcat setup I have a Context called hal which contains all my applications, HTML everything. Context path=/hal docBase=hal debug=0 privileged=true reloadable=true Therefore I run things with a URL such including /hal Way back when I started with Tomcat I set the Tomcat Root Context to point to the same docBase directory so any requests to /page.html would resolve to /hal/page.html. !-- Tomcat Root Context -- Context path= docBase=hal debug=0/ The problem I now have is that all the initialisation of /hal is run twice. Once for each context. Since I have several servlets with load-on-startup set this is a pain. Question What is the cleanest way to redirect requests made to / to /hal? Can I do this by setting something up in the web.xml file for the / context. Then I could remove the docBase=hal. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
Thanks. That's exactly what I'd started to use. What's the best way to add the /hal and redirect while preserving all the request parameters etc. i.e. Original URL = /somedir/somefile.html Filtered URL = /hal/somedir/somefile.html Should I be using a request dispatcher or response.sendRedirct()? I'm trying to do it in the best way. Best regards Chris -- Chris Ward, Horizon Asset Limited mailto:[EMAIL PROTECTED] Tel +44 (20) 7367 7028, Fax 7367 7029 -- THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS E- MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. HORIZON ASSET LIMITED IS AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 2:43 PM To: Tomcat Users List Subject: RE: Repeated load-on-startup niggle Howdy, A javax.servlet.Filter is one nice clean way. Yoav Shapira Millennium ChemInformatics -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 5:34 AM To: Tomcat Users List Subject: Repeated load-on-startup niggle Hi all, In my Tomcat setup I have a Context called hal which contains all my applications, HTML everything. Context path=/hal docBase=hal debug=0 privileged=true reloadable=true Therefore I run things with a URL such including /hal Way back when I started with Tomcat I set the Tomcat Root Context to point to the same docBase directory so any requests to /page.html would resolve to /hal/page.html. !-- Tomcat Root Context -- Context path= docBase=hal debug=0/ The problem I now have is that all the initialisation of /hal is run twice. Once for each context. Since I have several servlets with load-on-startup set this is a pain. Question What is the cleanest way to redirect requests made to / to /hal? Can I do this by setting something up in the web.xml file for the / context. Then I could remove the docBase=hal. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
Howdy, But he wants to redirect all requests, not just those for /. Exactly. I did in fact have an index.html which did a redirect to /hal so it looks like I'd tried that solution in the dim and distant past. Obviously once I had pointed / at /hal using it's docBase attribute (in server.xml) the /index.html never got processed. All of this is required to keep current users from having to update their URLs (they do a lot of web query imports to Excel) whilst avoiding the stuff in the /hal Context being initialised for both / and /hal. I'm going to try a response.sendRedirect() from a Filter running in under /. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
Hi, This would be fine if the everyone started at the entry level of the web site, but a lot of my problems are caused by including/importing resources like javascript files, servlets, etc. etc. e.g.Most od my generated HTML files have SCRIPT SRC=/JavaScript/HAL_CommonJavaScript.js LANGUAGE=JAVASCRIPT TYPE=TEXT/JAVASCRIPT /SCRIPT But that JavaScript file really should be /hal/JavaScript/HAL_CommonJavaScript.js So it would never see the redirection from /index.html. I was lazy in the early stages and now it's biting me in the bum! I guess I'm imagining this situation... www.foo.com/ and www.foo.com/hal/ Someone types in the first one, because they're lazy. Immediately they're redirected to /hal, and from then on, they stay there. ie: There's nothing at all at / other than the redirect. (he'd modify the root context to be NOT the same docbase as /hal) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 9:10 AM To: Tomcat Users List Subject: RE: Repeated load-on-startup niggle Howdy, But he wants to redirect all requests, not just those for /. Yoav Shapira Millennium ChemInformatics -Original Message- From: Mike Curwen [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 10:10 AM To: 'Tomcat Users List' Subject: RE: Repeated load-on-startup niggle Is it simpler in this case to have an index.html file sitting at '/' and all it does is a meta refresh to the '/hal' context? That way, once you're at /hal, you'll stay at /hal, and won't worry about request parameters, etc. -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 9:02 AM To: Tomcat Users List Subject: RE: Repeated load-on-startup niggle Thanks. That's exactly what I'd started to use. What's the best way to add the /hal and redirect while preserving all the request parameters etc. i.e. Original URL = /somedir/somefile.html Filtered URL = /hal/somedir/somefile.html Should I be using a request dispatcher or response.sendRedirct()? I'm trying to do it in the best way. Best regards Chris -- Chris Ward, Horizon Asset Limited mailto:[EMAIL PROTECTED] Tel +44 (20) 7367 7028, Fax 7367 7029 -- THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS E- MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. HORIZON ASSET LIMITED IS AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 2:43 PM To: Tomcat Users List Subject: RE: Repeated load-on-startup niggle Howdy, A javax.servlet.Filter is one nice clean way. Yoav Shapira Millennium ChemInformatics -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 5:34 AM To: Tomcat Users List Subject: Repeated load-on-startup niggle Hi all, In my Tomcat setup I have a Context called hal which contains all my applications, HTML everything. Context path=/hal docBase=hal debug=0 privileged=true reloadable=true Therefore I run things with a URL such including /hal Way back when I started with Tomcat I set the Tomcat Root Context to point to the same docBase directory so any requests to /page.html would resolve to /hal/page.html. !-- Tomcat Root Context -- Context path= docBase=hal debug=0/ The problem I now have is that all the initialisation of /hal is run twice. Once for each context. Since I have several servlets with load-on-startup set this is a pain. Question What is the cleanest way to redirect requests made to / to /hal? Can I do this by setting something up in the web.xml file for the / context. Then I could remove the docBase=hal. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may
RE: Repeated load-on-startup niggle
I would use sendRedirect in this case for two reasons: - To really make it look/act as if the request was for the /hal URL, - To avoid getting a RequestDispatcher for a resource outside your docBase sendRedirect would preserve all the request parameters, including POST data. Hi Yoav, Below is the filter I've been using. It seems to mostly work, but any image files from a path such as /images/Delete.gif seem to not get updated to /hal/images/Delete.gif in the HTML. However, the output I get to System.out *does* show the filter processing these requests. Any ideas? Is this the correct way to implement the filter? Chris public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; try { System.out.println( REQ : getRequestURI : + request.getRequestURI() ); String filteredURL = /hal+request.getRequestURI(); System.out.println( filteredURL ); //chain.doFilter(request, response); response.sendRedirect(response.encodeRedirectURL(filteredURL)); } catch (IOException io) { System.out.println (IOException raised in Filter); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
Hmm, that's strange. Enable the AccessLogValve (in server.xml) so that you can see what's actually being requested from the server. Seems to request both versions... try { System.out.println( REQ : getRequestURI : + request.getRequestURI() ); String filteredURL = /hal+request.getRequestURI(); System.out.println( filteredURL ); //chain.doFilter(request, response); response.sendRedirect(response.encodeRedirectURL(filteredURL)); It might not matter to you, but I think this code would drop the query string from the forward URL. Test to make sure it doesn't, or it if does add the request.getQueryStrign() to filterURL (before encoding). So you get the image forward URLs in your System.out output? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Repeated load-on-startup niggle
Hmm, that's strange. Enable the AccessLogValve (in server.xml) so that you can see what's actually being requested from the server. Seems to request both versions... - - [23/Jan/2004:17:31:22 00] GET /images/buttons/Delete.gif HTTP/1.1 302 - - - [23/Jan/2004:17:31:22 00] GET /images/buttons/Clone.gif HTTP/1.1 302 - - - [23/Jan/2004:17:31:22 00] GET /hal/images/buttons/Delete.gif HTTP/1.1 304 - - - [23/Jan/2004:17:31:22 00] GET /hal/images/buttons/Clone.gif HTTP/1.1 304 - - - [23/Jan/2004:17:31:22 00] GET /images/buttons/Filter.gif HTTP/1.1 302 - - - [23/Jan/2004:17:31:22 00] GET /hal/images/buttons/Filter.gif HTTP/1.1 304 - Or is this what you'd expect to see (i.e. a before and after)? I'm not convinced my Filter is correct since there are other things that have not had the /hal added to them... - - [23/Jan/2004:17:31:22 00] GET /stylesheets/HAL_Styles.css HTTP/1.1 302 - - - [23/Jan/2004:17:31:22 00] GET /JavaScript/HAL_CommonJavaScript.js HTTP/1.1 302 - I was kinda hoping there would be nothing other than /hal/ entries in here. It might not matter to you, but I think this code would drop the query string from the forward URL. Test to make sure it doesn't, or it if does add the request.getQueryStrign() to filterURL (before encoding). Ah. True. Thanks for the tip. So you get the image forward URLs in your System.out output? Oddly, yes... ... REQ : getRequestURI : /images/buttons/Filter.gif /hal/images/buttons/Filter.gif ... Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Displaying busy page while servlet/JSP running
Hi all, Does anyone have a recommended way of displaying a busy page while tomcat executes a servlet or JSP? I've done this before using JavaScript to flip the display to busy on the client, but I wondered if there was a more generic way using Filters or something. Many thanks as always, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forms Authentication
snip I want to have a login link and a logout link.snip snip how do you tell j_security_check where to go once the user has logged in successfully. snip If your application requires the click here to login functionality, where would the user expect to go after logging in? If it's to a generic welcome/login confirmation page then could you not have that page in a protected url? (set up in web.xml) When the user clicks on the Login link they will get your login page based on the url and only successful users will go to the welcome/login confirmation page Are you storing other user specific info in cookies that can be used to determine their post-login destination? If so you could make the welcome page a JSP/servlet that is smart. If you can do anything programmatic involving j_security_check let me know, I've asked a couple of times about this myself. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: criteria for a session
I thought sessions were essentially browser sessions. For anything I've done that requires knowledge of user state between different browsers (but same machine) I've used cookies to save some form of user id. I did turn on the Tomcat setting for persistent sessions and found that preserved session in the same browser with a Tomcat reboot. I guess you could serialise sessions to a DB and retrieve from user id in a cookie - or am I losing the plot now? Best regards Chris what are the criteria for tomcat 4.1.26 to say the session is null (((HttpServletRequest)request).getSession(false))? It seams to depend on something in the request. When i open a second new IE Window, not a child from the first IE Window, the session is null. I dontt call session.invalidate() and the timeout is not reached. I know that there are only two reasons for invalidate a session. 1) session.invalidate(); 2) session timeout I thought these where the only reasons. Thanks for your help Günter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Xalan redirect (to file) within Tomcat
Hi, I'm using Xalan for XSL transformations. I can get the Xalan extension redirect) to work from the command line test progs, but fails when used within servlet. The output file I'm trying to write has the full path. Any ideas? Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Xalan redirect (to file) within Tomcat
Howdy, Perhaps if you provided a bit more detail than just fails when used within servlet then we could help some more ;) Ah. Yes. Very good point. Are there any errors in your log? Do you (i.e. the user account running tomcat) have write permissions to the directory/file you're trying to write? What tomcat version, what JDK version, and what OS are you using? In the Tomcat console window I get this... jstl:; Line 24;[EMAIL PROTECTED] Column -1; javax.xml.transform.TransformerException: java.lang.ClassNotF oundException: redirect I've got xalan.jar in my context WEB-INF/lib dir (and in the Tomcat common/endorsed dir for that matter). I've eyeballed the xalan.jar and can see Redirect.class in there. I am running Tomcat 4.1.24 and jdk1.3.0_02 and I get the same error whether using a servlet or using JSP with JSTL. Any ideas anyone? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Xalan redirect (to file) within Tomcat
Correction to previous posting... (error message) Howdy, Perhaps if you provided a bit more detail than just fails when used within servlet then we could help some more ;) Ah. Yes. Very good point. Are there any errors in your log? Do you (i.e. the user account running tomcat) have write permissions to the directory/file you're trying to write? What tomcat version, what JDK version, and what OS are you using? In the Tomcat console window I get this... jstl:; Line 24; Column -1; javax.xml.transform.TransformerException: java.lang.ClassNotF oundException: redirect I've got xalan.jar in my context WEB-INF/lib dir (and in the Tomcat common/endorsed dir for that matter). I've eyeballed the xalan.jar and can see Redirect.class in there. I am running Tomcat 4.1.24 and jdk1.3.0_02 and I get the same error whether using a servlet or using JSP with JSTL. Any ideas anyone? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Xalan redirect (to file) within Tomcat
Howdy, Perhaps a case-sensitivity issue? What happens if you use Redirect instead of redirect? I thought that, but the redirect is defined in the stylesheet as... extension-element-prefixes=redirect My example is in the samples directory in the standard Xalan download and it does work (with the associated xml file) when I run xalan from the command line. - the full xsl stylesheet - xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xmlns:redirect=http://xml.apache.org/xalan/redirect; extension-element-prefixes=redirect xsl:template match=/ standard-out Standard output: xsl:apply-templates/ /standard-out /xsl:template !-- not redirected -- xsl:template match=doc/main main -- look in xsl:value-of select=/doc/foo/@file/ for the redirected output -- xsl:apply-templates/ /main /xsl:template !-- redirected -- xsl:template match=doc/foo !-- get redirect file name from XML input -- redirect:write select=@file foo-out xsl:apply-templates/ /foo-out /redirect:write /xsl:template !-- redirected (from the xsl:apply-templates above. I.e., bar is in /doc/foo -- xsl:template match=bar foobar-out xsl:apply-templates/ /foobar-out /xsl:template /xsl:stylesheet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Xalan redirect (to file) within Tomcat
Howdy, I don't know Xalan well enough to answer, but it seems pretty clear tomcat is looking for a class called Redirect, while the stylesheet uses redirect. It seems like a case-sensitivity issue, but I can't help much beyond that ;) Yoav Shapira I agree. Anyway, a few Googles later and I found this http://www.biglist.com/lists/xsl-list/archives/200309/msg00716.html which uses an alternative namespace declaration... ... xmlns:redirect=org.apache.xalan.xslt.extensions.Redirect extension-element-prefixes=redirect and this seems to work for me. I don't know if there is anything sinister about using this different declaration, and I am confused (like the guy in the above mail thread) as to why the other declaration of xmlns:redirect=http://xml.apache.org/xalan/redirect; works in my command line tests. Anyway - there's what I've found out in case anyone else is interested. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Persistent User Login
Hi, I was asking about this subject on this list a while back http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/msg111700.h tml but I've not managed to get it working yet. In short. I'm working on an intranet application and I want my users to only have to log in once. If they start a new browser session it should pick up their details and not ask them to log in. I expect the username/password should live in a persistent cookie, and I've been using FORM based authentication on Tomcat 4.1.23. I've spent days faffing about with redirects from servlets to j_security_check (which has never worked for me) and filters on / etc. etc. etc. I came back to this today and played with Single Sign-on and Persistent sessions in the hope that might do it. Does anyone out there have this working? Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Persistent User Login
Thanks. I should have mentioned that I am running Tomcat 4.1.24 with jdk1.3.0_02. I did want to make use of the Tomcat features for authentication (i.e. FROM method, Realm using user/roles DB tables, web.xml configuration etc.) to replace existing code that I wrote for the task. I'm losing the will to do this now though. Anyone done it with this set up? J2EE 1.4 SDK (which contains Tomcat 5) uses the Single Sign on feature and it is working fine. So just add the SingleSignOn valve in your server.xml. -- Jeanfrancois - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Warning of session timeout.
I guess you could get the desired result using JavaScript locally to count down from when the page is last sent. Just a suggestion. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat DataSources in non-Tomcat programs.
Hi, Just a quickie. Can I use the DataSources I have set up in my Server.xml/Web.xml files for my web application in standalone/command line java apps? Assuming Tomcat is running of course. Or do I have to set up a separate JNDI thing for this (I'm new to JNDI - can you tell?). Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet sendRedirect() to j_security_check problem (remember me)
Tomcat-Users (Cc:Matt/Adam), I've just tried doing a redirect to j_security_check using the commons package org.apache.commons.httpclient. The error I get from the code is [INFO] HttpMethodBase - -Redirect requested but followRedirects is disabled statusCode : 302 Any clues given my code below (which is more than a bit similar to Matt's ;o) ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static private final String authURL = j_security_check; snip HttpClient client = new HttpClient(); client.getHostConfiguration().setHost( request.getServerName(), request.getServerPort(), request.getScheme() ); PostMethod authPost = new PostMethod( request.getContextPath() + / + authURL ); NameValuePair user = new NameValuePair( j_username, username ); NameValuePair pass = new NameValuePair( j_password, password ); authPost.setRequestBody( new NameValuePair[] { user, pass } ); client.executeMethod(authPost); authPost.releaseConnection(); int statusCode = authPost.getStatusCode(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - I'm think I've either got the authURL wrong or I need to do something in web.xml. Any light cast on this would be great. Many thanks as always, Chris It's standard container managed security stuff - I first invoke a protected URL - in index.jsp - I redirect to mainMenu.do - and *.do is protected. Based on security constraints in web.xml, I'm presented with a form-login-page login.jsp - rather than having action=j_security_check in this form, I have action=/security/authorize - which is mapped to my own LoginServlet. In the LoginServlet, I encrypt the password (optionally based on an init-parameter), set some cookies and do an HTTP Post to j_security_check. Works on Tomcat 4-5 and Resin 3.x. Matt On Dec 3, 2003, at 4:21 PM, Adam Hardy wrote: Matt, are you really managing to post a form to j_security_check without invoking it first, or is that some sort of black magic you've cooked up? Or have I just misunderstood what Chris said? Adam On 12/03/2003 09:24 PM Matt Raible wrote: Chris, I found your post at http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/ msg111700.html and I'm cc'ing the list in case anyone else is interested in this info (I'm not subscribed). I've actually improved the Remember Me feature a fair amount since I posted to the Tomcat User list. The sendRedirect works, however, it (in some browsers) puts the URL (with password) into the address bar. This isn't a big deal IMO since it's the user that just logged in and they don't mind seeing their own passwords. However, the URL tends to show up in server log files which can be a security hole. Because of this, I changed to using an HTTP Post with Jakarta Common's HttpClient. I also moved my form-login-page and form-error-page into a security folder and then set my cookies for the /appname/security path rather than / - this makes it so the user/pass cookies are more secure and can only be retrieved when logging in, rather than for any URL in the site. That being said, I've updated one of my sample apps with these changes and you can download it if you'd like: http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse Here's my updated LoginServlet that does an Http Post instead of a Get: http://tinyurl.com/xl80 HTH, Matt On Dec 3, 2003, at 12:52 PM, Chris Ward wrote: Hi Matt, Sorry for sending unsolicited email but I've been looking at some of your postings to Tomcat-User and wondered if I could ask a couple of questions. I've tried posting to list but had no response from anyone there. Specifically, it's regarding your remember me login stuff. If this is a pain feel free to ignore this email. Best regards Chris p.s. My question the list was under the subject servlet sendRedirect() to j_security_check problem -- struts 1.1 + tomcat 5.0.14 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: servlet sendRedirect() to j_security_check problem (remember me)
Thanks for the extra info Matt ( Adam) I'm going to try to continue with my login work next week - the newer version of Matt's Remember-me JSP/Servlet/Filter seems to have a lot going on in there. I feel a little daunted to be honest. But I shall play around with it some more. Thanks again for all the good advice guys - I'll probably be in touch next week. Best regards, Chris -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 December 2003 13:02 To: Tomcat Users List; Matt Raible Subject: Re: servlet sendRedirect() to j_security_check problem (remember me) That's a fairly circuitous route for a login. I guess you do what you have to do though. I was wondering whether I could adapt it to allow an SSL login form to be used to login to non-SSL pages, but I think the httpClient would leave the j_security_check post in plain text on the net - unless it never leaves the server, but I'm not sure that would be possible. Adam On 12/04/2003 12:52 AM Matt Raible wrote: It's standard container managed security stuff - I first invoke a protected URL - in index.jsp - I redirect to mainMenu.do - and *.do is protected. Based on security constraints in web.xml, I'm presented with a form-login-page login.jsp - rather than having action=j_security_check in this form, I have action=/security/authorize - which is mapped to my own LoginServlet. In the LoginServlet, I encrypt the password (optionally based on an init-parameter), set some cookies and do an HTTP Post to j_security_check. Works on Tomcat 4-5 and Resin 3.x. Matt On Dec 3, 2003, at 4:21 PM, Adam Hardy wrote: Matt, are you really managing to post a form to j_security_check without invoking it first, or is that some sort of black magic you've cooked up? Or have I just misunderstood what Chris said? Adam On 12/03/2003 09:24 PM Matt Raible wrote: Chris, I found your post at http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/ msg111700.html and I'm cc'ing the list in case anyone else is interested in this info (I'm not subscribed). I've actually improved the Remember Me feature a fair amount since I posted to the Tomcat User list. The sendRedirect works, however, it (in some browsers) puts the URL (with password) into the address bar. This isn't a big deal IMO since it's the user that just logged in and they don't mind seeing their own passwords. However, the URL tends to show up in server log files which can be a security hole. Because of this, I changed to using an HTTP Post with Jakarta Common's HttpClient. I also moved my form-login-page and form-error-page into a security folder and then set my cookies for the /appname/security path rather than / - this makes it so the user/pass cookies are more secure and can only be retrieved when logging in, rather than for any URL in the site. That being said, I've updated one of my sample apps with these changes and you can download it if you'd like: http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse Here's my updated LoginServlet that does an Http Post instead of a Get: http://tinyurl.com/xl80 HTH, Matt On Dec 3, 2003, at 12:52 PM, Chris Ward wrote: Hi Matt, Sorry for sending unsolicited email but I've been looking at some of your postings to Tomcat-User and wondered if I could ask a couple of questions. I've tried posting to list but had no response from anyone there. Specifically, it's regarding your remember me login stuff. If this is a pain feel free to ignore this email. Best regards Chris p.s. My question the list was under the subject servlet sendRedirect() to j_security_check problem -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
servlet sendRedirect() to j_security_check problem
Dear all, I'm implementing remember me login functionality using FORM authentication, a LoginServlet and a Filter. It's very much based on the code in an earlier posting to this list From: Raible, Matt Subject: RE: Form based security and Remember Me Date: Fri, 21 Feb 2003 07:33:22 -0800 My set up works fine when my FORM uses j_security_check as it's action but using a redirect from a servlet seems to fail with a 403 error. I've debugged the servlet so I know it's getting to it and doing what I expect. In the original mail, Matt's servlet call is... - - - - - - - - - - - - - - - - - - - - - - - - - - String username = request.getParameter(j_username).toLowerCase(); String password = request.getParameter(j_password); ... String req = j_security_check?j_username= + RequestUtils.encodeURL(username) + j_password= + RequestUtils.encodeURL(password); response.sendRedirect(response.encodeRedirectURL(req)); - - - - - - - - - - - - - - - - - - - - - - - - - - I don't have the RequestUtils.encodeURL() in my version. a) Do I need them? - the html form seems for work even if the password field is plain text when the action is set to j_security_check. b) Where do I get these methods? Aren't they somewhere in Struts? Do I really have to bring down all of that stuff? For completeness here's my code... - - - - - - - - - - - - - - - - - - - - - - - - - - String req = j_security_check?j_username= + request.getParameter(j_username) + j_password= + request.getParameter(j_password); response.sendRedirect(response.encodeRedirectURL(req)); - - - - - - - - - - - - - - - - - - - - - - - - - - Any help would be fantastic. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Intermittent failures using DataSources
I'm not sure if it makes a difference but try putting the ResourceLinks before the Realm definition in server.xml. Liem Thanks for the suggestion Liem - doesn't seem to make any difference. I'm still getting the same response in my browesr... org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: Cannot load JDBC driver class 'null' at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:254) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) Any further suggestions would be great. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Intermittent failures using DataSources
Hi, For the record, I solved my problem regarding the message... org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: Cannot load JDBC driver class 'null' ... from my JSPs. For anyone who is interested, here's what worked for me... I was not always invoking them with my context in the URL. Since I had set my default context's docBase the same as my properly configured one, it *appeared* to be executing the JSP in the same way. In fact, this seems okay for getting to static html pages, but the JSPs were not picking up the DataSources Resource or ResourceLink settings. Example. Bad : http: //{my server}/apps/admin/MyApplication/myJSP.jsp Tries to process JSP, fails with above exception. Good : http: //{my server}/MY_CONTEXT/apps/admin/MyApplication/myJSP.jsp Does the business. Of course, now I feel dumb. But I hope this may help some other poor soul from blowing a day and a half. Best regards Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Intermittent failures using DataSources
Hi all, Please excuse any going over of old ground with this question, I have searched every archive I can find. I have recently started using DataSources from JSPs using the JSTL taglib (I think this is a Tomcat rather than taglib question). I've got a Context for my apps and initially had my bunch of DataSources set up within the Context. No problems. Happy, happy. Anyway - a few days ago I set up the required database tables to support a DataSourceRealm for FORM authentication and I moved all my DataSource config up to the GlobalNamingResources since I'm sure I read somewhere that this had to be done. That initially caused me problems until I added a ResourceLink to my Context for each DataSource . . . . . . Context path=/hal docBase=hal debug=0 privileged=true reloadable=true Logger className=org.apache.catalina.logger.FileLogger prefix=HAL. suffix=.txt timestamp=true/ !-- DataSources moved from here to GlobalNamingResources area -- Realm className=org.apache.catalina.realm.DataSourceRealm debug=99 dataSourceName=jdbc/Id userTable=HAL_UserId userNameCol=Name userCredCol=Password userRoleTable=HAL_UserRole roleNameCol=Role / ResourceLink name=jdbc/Id global=jdbc/Id type=javax.sql.DataSource/ ResourceLink name=jdbc/Static global=jdbc/Static type=javax.sql.DataSource/ ResourceLink name=jdbc/Params global=jdbc/Params type=javax.sql.DataSource/ ResourceLink name=jdbc/Control global=jdbc/Control type=javax.sql.DataSource/ ResourceLink name=jdbc/SelmaData global=jdbc/SelmaData type=javax.sql.DataSource/ ResourceLink name=jdbc/BartData global=jdbc/BartData type=javax.sql.DataSource/ ResourceLink name=jdbc/Beauchamp global=jdbc/Beauchamp type=javax.sql.DataSource/ /Context . . . . . . All the DataSources are set up along these lines.. . . . . . . Resource name=jdbc/Id auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/Id parameter nameusername/name value{deleted in mail}/value /parameter parameter namepassword/name value{deleted in mail}/value /parameter parameter namedriverClassName/name valuecom.inet.tds.TdsDriver/value /parameter parameter nameurl/name value{deleted in mail}/value /parameter /ResourceParams . . . . . . So I think everthing looks okay. Problems 1) With the above setup I get... ServerLifecycleListener: createMBeans: MBeanException java.lang.Exception: ManagedBean is not found with DataSourceRealm at org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:642) In my Tomcat console, unless I comment out these lines in server.xml Listener className=org.apache.catalina.mbeans.ServerLifecycleListener debug=0/ Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=0/ If I *do* comment them out the Tomcat Admin tool will complain. 2) Sometimes my JSPs just start failing with this message... org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: Cannot load JDBC driver class 'null' at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:254) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) even though they may have been running fine beforehand. Any help would be great. Sorry for the length of the message, it's driving me crazy! Many thanks, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do I detect alive sessions at this moment?
Not sure if Tomcat will take care of this automaticly for you. What I do is have the object I set in the session add it's self to a list in the sever context, and remove it's self when the session expires. Then you will have a list of all sessions in one place. Chris -Original Message- From: Henry [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 6:24 AM To: Tomcat Users List Subject: how do I detect alive sessions at this moment? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Single Servlet vs Multiple Servlet
If you are XML based, how about the Apache Cocoon project. I have only read about it, not tried it. Chris -Original Message- From: Robert Simmons [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 11:04 AM To: Tomcat Users List Subject: Re: Single Servlet vs Multiple Servlet Actually I don't intend to use JSP at all. The resulting document from the call to the servlet is XML, not HTML or XHTML or JSP. Just XML. I'm not sure learning a JSP framework would be worth my time. -- Robert - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, January 24, 2003 5:46 PM Subject: RE: Single Servlet vs Multiple Servlet Yes, I think there's no reason why you should implement your application hand-coding a servlet for each command you need. There are several frameworks around the web that you can use... Apache Struts, JCorporate Expresso (that now is integrated to Struts) and others. Personally, I'm developing some applications using my own framework, that consists of taglibs (I don't use scriptlets at all), special classes to handle your commands (or actions in Struts), database abstraction layer, etc... I personally like to make one by myself, even if just for fun (and to learn how to do it), but mainly because of time constraints probably you'll need some of these frameworks found in the web. On Fri, 2003-01-24 at 14:39, Shapira, Yoav wrote: Howdy, In all there will be about 50 commands that can be done to this servlet. If I put them all in one file it would violate my sense of object oriented engineering. So I thought of either making the various commands actually be in different classes and the servlet routing the requests to the proper command. The alternative is to make individual command servlets that have a common base class and sit on separate URLs. The problem with option two is that the servlet connects to EJB on the back end and could potentially hold onto allot of resources. The problem with option two, possibly, is federation. If there are hundreds of requests coming, will tomcat federate the servlet or pipe everything through one hole? 1. Take a look at struts. It will handle the direction of the request to the proper resource based on the 50 actions (which you call commands above) you define. 2. Simply put: don't worry about federation. Let tomcat worry about how many instances of the servlet it needs, how many request processing threads it needs, etc. Tomcat does a good job at this, and some of the relevant parameters (maxProcessors etc.) are user-tunable as well. We, as well as many other people on this list, run tomcat instances that handle thousands of requests. Also, you can always switch containers if you find tomcat doesn't handle your traffic volume as well as you'd like... Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Forward to ROOT context?
I have more than one app, each in their own context, with a single secure login in the ROOT context. The web site has one domain name, and it points to ROOT. I have been able to get to other contexts, but I can't seem to 'get back' to my login page in the ROOT context. This is the code I have tried: ServletContext otherContext = getServletContext().getContext(/ROOT/index.html); RequestDispatcher rd = otherContext.getRequestDispatcher(/index.html); rd.forward( request, response ); The 'otherContext' that gets returned does not appear to be a valid context. If anyone knows how to get the ROOT context, or a different what to get to another context, I would appreciate it. Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Tomcat vs JServ
JServ is dead code. Don't use it. Tomcat is that same code's successor. Also, you'll need "mod_jk" to glue Tomcat to Apache. I only mention it because I spent two days finding this out! Most of that time was spent hunting for mod_jserv. D'oh! Look at http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/mod_jk-howto.htm l for specifics. Chris
Pentium IV - any known problems?????
Hi, I've been looking for anything in the archive but couldn't see anything to help me. Feel free to ignore this but I'm puzzled so anything would be a step forward! Basically, I'm trying to get Tomcat up and running on a Pentium IV PC - does anyone know of any reason why this would fail? I only ask because my Visual Cafe 4.0 was unsupported on P IV and that spooked me. I've got jdk13 installed and my "HelloWorld" test works. I've set JAVA_HOME and TOMCAT_HOME but runing "startup" brings up a dos window that then disappears without any error. I followed the installation guide I found here, www.onjava.com/lpt/a/729 maybe it misses something out. I'm currently eyeballing the startup scripts Thanks for your time, Chris
RE: Pentium IV - any known problems?????
Ignore me - I was being an idiot. All better now! Thanks anyway, Chris
RE: Pentium IV - any known problems?????
Thanks for this suggestion. I had been doing just this then someone suggested a Restart of my PC. Since I had not done this since installing my new Visual Cafe, the PC was confused about the Java environment. The restart sorted it all out. Thanks again, Chris -Original Message- From: Benot Jacquemont [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 17 April 2001 16:02 To: [EMAIL PROTECTED] Subject: RE: Pentium IV - any known problems? First of all, open a dos window, go to your TOMCAT_HOME (cd TOMCAT_HOME), go to the bin, and execute tomcat run instead of double clicking on the startup.bat script. It is a every-day-repeated trick to see what is the error when the window is closing. So please write it down somewhere ! (;-) ). Benot Hi, I've been looking for anything in the archive but couldn't see anything to help me. Feel free to ignore this but I'm puzzled so anything would be a step forward! Basically, I'm trying to get Tomcat up and running on a Pentium IV PC - does anyone know of any reason why this would fail? I only ask because my Visual Cafe 4.0 was unsupported on P IV and that spooked me. I've got jdk13 installed and my "HelloWorld" test works. I've set JAVA_HOME and TOMCAT_HOME but runing "startup" brings up a dos window that then disappears without any error. I followed the installation guide I found here, www.onjava.com/lpt/a/729 maybe it misses something out. I'm currently eyeballing the startup scripts Thanks for your time, Chris
RE: Pentium IV - any known problems?????
Just for closure on this - my problem was a failure to restart my machine after upgrading my Visual Cafe to the P IV friendly version earlier in the process. The restart did the trick and things seem fine. I was trying to fix a problem that was not there! Thanks to everyone for their help. Chris -Original Message- From: Randy Layman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 17 April 2001 15:29 To: [EMAIL PROTECTED] Subject: RE: Pentium IV - any known problems? As to the PIV - I am currently using one without problem, though Sun does recommend only certain versions of their JDKs for the PIV. As to your startup problem - instead of running "startup", try running "tomcat run" - this will start Tomcat in the current DOS window instead of spawning a new one and the error will be displayed and persist for you to read and solve. Usually this is either a badly configured TOMCAT/JAVA_HOME or something else is using one of Tomcat's ports (8080 and 8007 by default). Randy -Original Message----- From: Chris Ward [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 10:53 AM To: Tomcat Users (E-mail) Subject: Pentium IV - any known problems? Hi, I've been looking for anything in the archive but couldn't see anything to help me. Feel free to ignore this but I'm puzzled so anything would be a step forward! Basically, I'm trying to get Tomcat up and running on a Pentium IV PC - does anyone know of any reason why this would fail? I only ask because my Visual Cafe 4.0 was unsupported on P IV and that spooked me. I've got jdk13 installed and my "HelloWorld" test works. I've set JAVA_HOME and TOMCAT_HOME but runing "startup" brings up a dos window that then disappears without any error. I followed the installation guide I found here, www.onjava.com/lpt/a/729 maybe it misses something out. I'm currently eyeballing the startup scripts Thanks for your time, Chris
RE: errors displaying graphics
These errors are coming from html pages, or a JSP page in the case of the applet class, with the propper html tags. Some of these images are then displaying correctly under JSP pages. Chris -Original Message- From: Chris Ward [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 9:18 AM To: Tomcat-User Subject: errors displaying graphics I am getting a strange error from the tomcat window (Win2000). It looks like this : 2001-02-19 08:40:03 - Ctx( ): IOException in: R( + /images/rbanner.gif + null) Connection aborted by peer: socket write error 2001-02-19 08:40:03 - Ctx( ): IOException in: R( + /images/464_pict2.gif + nul l) Connection aborted by peer: socket write error 2001-02-19 08:40:04 - Ctx( ): IOException in: R( + /IBSMenu1.class + null) Con nection aborted by peer: socket write error 2001-02-19 08:49:33 - Ctx( ): IOException in: R( + /images/lbanner.gif + null) Connection aborted by peer: socket write error 2001-02-19 08:49:33 - Ctx( ): IOException in: R( + /images/rbanner.gif + null) Connection aborted by peer: socket write error 2001-02-19 08:50:38 - Ctx( ): IOException in: R( + /images/lbanner.gif + null) Connection aborted by peer: socket write error 2001-02-19 08:50:38 - Ctx( ): IOException in: R( + /images/rbanner.gif + null) Connection aborted by peer: socket write error The images are all there, and they display, and the class for the applet works, but I keep getting theses error messages. The page that displays these images is an HTML page at the base of my context. The class is called from most JSP pages in /JSP. Does anyone know what causes these error messages? Chris -- Chris Ward - Developer @ integral business solutions tel: 651.631.3144 fax: 651.631.2544 email: [EMAIL PROTECTED] web: www.go-integral.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: jsp could not be loaded on winnt
Make sure that your classpath is being set up properly, and that any of your own classes are in a directory that is in your classpath. I had this, but can't remember exactly which thing I had to add to the classpath. Chris -Original Message- From: Mariano Kamp (by way of Mariano Kamp [EMAIL PROTECTED]) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 4:25 PM To: [EMAIL PROTECTED] Subject: jsp could not be loaded on winnt Hi there, hopefully I am not repeating a already asked questions, but I couldn't find it in the archives. Tomcat 3.2.1. is working fine on our linux boxes, but we also need to setup tomcat on a notebook for demonstrations. The strange thing is, it is not working. We are using Sun's JDK 1.3 and WIN 2K. When trying to access a servlet we get a Null Pointer Exception and when looking at the stack trace it seems to be related to to the class loading (adaptiveClassloader). Is there anyway to start Tomcat in debug mode? I'd like to see what class is missing or whatever reason there is?! Btw. When starting up tomcat right before establishing the handlers it reports that the jsp servlect could not be loaded and displays a count to 357. I have never seen this on Linux?! Any ideas? Mariano -- mariano kamp codamax ag hessenring 89 61348 bad homburg v.d.h. germany phone +49 6172 182 473 fax+49 6172 182 475 mobile +49 173 300 8564 (changed!) -- mariano kamp codamax ag hessenring 89 61348 bad homburg v.d.h. germany phone +49 6172 182 473 fax+49 6172 182 475 mobile +49 173 300 8564 (changed!) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
how to use JavaDoc with ANT?
What is ANT supposed to do with the creation of JavaDocs. Is it creating them from the java files, or is it expecting them to be there. I have an application that builds correctly, but doesn't have any JavaDocs created, and ANT appears to load my Build.bat file, and generate a bunch of errors. How can I set this up to actually created to documentation. Chris -- Chris Ward - Developer @ integral business solutions tel: 651.631.3144 fax: 651.631.2544 email: [EMAIL PROTECTED] web: www.go-integral.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
how to write servlet to use multiple contexts
The servlets and JSP pages that I have written all work fine if I have it running under the webapps/ROOT context. I would also like to have another version running that I can modify, running in webapps/test. I have set up the contexts, but because the url's in the jsp pages all point to "/myservlet", it always runs from the webapps/ROOT context, even if it was called from a html page under webapps/test that I got to from www.my.server/test/index.html. Do I have to code something in the jsp pages to make them context aware? Chris ------ Chris Ward - Developer @ integral business solutions tel: 651.631.3144 fax: 651.631.2544 email: [EMAIL PROTECTED] web: www.go-integral.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: to switch contexts, do you have to change all your JSP URL's?
Is that the only way? I understand how that would be implemented, but I have inherited an application that was not set up that way, and would require a fix on every JSP and servlet. Chris -Original Message- From: CPC Livelink Admin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 06, 2001 1:32 PM To: [EMAIL PROTECTED] Subject: RE: to switch contexts, do you have to change all your JSP URL's? HttpRequest.getContextPath() returns the portion of the request URI that indicates the context of the request. -Original Message- From: John Golubenko [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 06, 2001 2:26 PM To: [EMAIL PROTECTED] Subject: Re: to switch contexts, do you have to change all your JSP URL's? %= request.getRequestURI() % will return current URL. Original Message On 2/6/01, 11:18:04 AM, "Chris Ward" [EMAIL PROTECTED] wrote regarding to switch contexts, do you have to change all your JSP URL's?: Is there a way to code the URL's in the JSP pages so that they don't care what the context is? If I have contexts for webapps/foo1 and webapps/foo2, how do I write the URL's so that I don't have to change the URL from "foo1/myservlet" to "foo2/servlet" if I change the context that it is run from, or want to have both running? Chris ------ Chris Ward - Developer @ integral business solutions tel: 651.631.3144 fax: 651.631.2544 email: [EMAIL PROTECTED] web: www.go-integral.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] NOTICE: This communication may contain confidential or other privileged information. If you are not the intended recipient, or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, or otherwise use the information. Also, please indicate to the sender that you have received this email in error, and delete the copy you received. Any communication that does not relate to official Columbia business is that of the sender and is neither given nor endorsed by Columbia. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
how to USE differnet contexts
I have set up two contexts. One runs from webapps/ROOT, the other from webapps/test. The contexts appear to be set up correctly. My application runs fine from webapps/ROOT. The problem is running from webapps/test. The main servlet calls JSP pages, which redirect to the main servlet again. The JSP pages just reference /myServlet. They do not specify a context, such as test/mysServlet, or ROOT/myServlet. I don't want to have to change every JSP page to run this application in a different context. What do I need to do this, so context is independent? Chris -- Chris Ward - Developer @ integral business solutions tel: 651.631.3144 fax: 651.631.2544 email: [EMAIL PROTECTED] web: www.go-integral.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
JSP pages in webapps/ROOT will not 'recompile'
I am trying to run an application in ROOT, and have changed several JSP pages to look at a different images directory, but none of them have actually changed. I noticed that there is no context for ROOT in server.xml, which is where I thought that maybe the reloadable=false was set. Any ideas? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]