Re: How to read and save a simple file?!?
Regarding the classloader: The read and save methods, respectively, reside in two different classes. The read method is static and called like ReadClass.GetProperties (i.e. without an object). The save method is part of a servlet class and is not static. May this cause problems? I know practically nothing about classloaders et al, and I do not tamper with them anywhere else in the web app. Jan Andersson Senior Software Engineering Specialist IBM Rational Brand Services +46 (0)70-793 23 02 Oddegatan 5 164 92 Stockholm ALEX HYDE [EMAIL PROTECTED] 2005-11-14 16:46 To Jan Andersson/Sweden/[EMAIL PROTECTED] cc Subject Re: How to read and save a simple file?!? Hi Jan, This is one of things that's given me a headache in the past. Take what I say with a pinch of salt as I'm no expert. I would guess that (if your file is not at the root of the class path) you might need to specify a full path to the file relative to the root of the classpath. I'm afraid this is just a guess. For example if your properties file was located: mydir/ReqProFPHubNotifier.properties then you might need to try referencing it like: cl.getResource(mydir/ReqProFPHubNotifier.properties) or (absolutely) cl.getResource(/mydir/ReqProFPHubNotifier.properties) I'm afraid I'm guessing. I think I fudged this once just through trial and error. Good luck ps: you are referencing the class loader via different classes in each case so I'm not sure if this might have an effect. --- Jan Andersson [EMAIL PROTECTED] wrote: Hi all! This is a simple question, which should have a simple answer. I have a servlet in my webapp that reads a file with properties and displays them. You can change the properties and then hit Save, which makes the servlet write the properties to a file. The problem I'm experincing is that when saving the properties, the file is not found. The code for writing goes like this. ClassLoader cl = ReqProPropConfig.class.getClassLoader(); URL propsURL = cl.getResource(ReqProFPHubNotifier.properties); FileOutputStream out = new FileOutputStream(propsURL.getPath()); PrintStream printOut = new PrintStream(out); and then a series of printOut.println writes the properties, one at a time, to the file. And the code for reading: ClassLoader cl = ReqProInitializer.class.getClassLoader(); Properties properties = new Properties(); String path = cl.getResource(ReqProFPHubNotifier.properties).getPath(); String decodedPath = URLDecoder.decode(path); InputStream in2 = new FileInputStream(decodedPath); properties.load(in2); in2.close(); return properties; I use the classloader to be able to find the file without having to point out exactly where it is. (As I've been told, the classloader uses the classpath to find the file.) The code as it stands today (e.g. the use of URLDecoder) is mainly a result of trial-and-error. That is, it used to work but not anymore (which probably is due to testing in the real production environment, which isn't exactly what I used when I tested it.) If there's another way to read and write a file with properties (relocationability of the property file preserved, relative path ok) I'm VERY interested to hear. As you understand, I'm pretty new to both to Java and Tomcat, although I have some ten years experience of professional programming. So this questions in its simplicity is really annoying me. One doesn't think of reading and saving a simple text file as something that should be complicated. Please help! Jan Andersson Senior Software Engineering Specialist IBM Rational Brand Services +46 (0)70-793 23 02 Oddegatan 5 164 92 Stockholm ___ Yahoo! Model Search 2005 - Find the next catwalk superstars - http://uk.news.yahoo.com/hot/model-search/
tomcat and wbs
Hi all, Could someone explain me or point me to an explanation of how tomcat initialize web services? I'd like to initialize them automatically at tomcat start-up instead of just before their invocation. Thanx, --mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to disable Tomcat Admin directory
Ok. This only makes sense if you have a connector like mod_jk or the isapi_redirector mapping contexts from Apache or IIS back to tomcat. In that case, review your config and unmount the tomcat admin context from your front-end web server. --David Mark, The \conf\catalina\localhost directory is empty and there isn't an admin folder at \server\webapps. The admin interface is not installed, I'm only trying to get Tomcat to stop responding when I hit the WEB_ROOT/admin folder from a web browser. The reason being Tomcat is keeping users from getting to the real /admin folder on our server. Thanks for your help. [EMAIL PROTECTED] Bruno Georges wrote: Hi Jarrold If I understood your question correctly you will have to edit the conf/server.xml file and proceed as indicated: !-- Comment these entries out to disable JMX MBeans support used for the administration web application -- Listener className=org.apache.catalina.mbeans.ServerLifecycleListener / Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener / Listener className=org.apache.catalina.storeconfig.StoreConfigLifecycleListener/ Hope this helps. Bruno Georges This won't disable the admin application. Assuming Novell haven't messed about with the config too much, you will need to do the following: 1. Delete %CATALINA_HOME%\conf\Catalina\localhost\admin.xml 2. Delete %CATALINA_HOME%\server\webapps\admin 3. Restart Tomcat 2. isn't strictly necessary but it prevents any enthusiastic admins easily re-enabling it. Mark - 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: request.getSession(false) incorrectly creates a session
If you are using jsp - you need [EMAIL PROTECTED] session='false'% in your page otherwise - a session is created for your whether you use it or not. -Tim Andy wrote: Hi, When I deploy my web app and call request.getSession(false), according to the javadoc, if a session does not exist null is returned. However I'm getting an object returned when I have not created a session myself. The object is an instance of this class - org.apache.catalina.session.StandardSessionFacade As a result my unit tests, using mock objects, all work fine, but when I deploy my application it breaks because a session is created incorrectly, it seems to me. I'm using Tomcat 5.5. Anybody care to enlighten me? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Asking Again: How to create multiple context's linked to the same webapp, without instantiating multiple webapp instances
asking again... any ideas, anyone? thanx leon On 11/15/05, Leon Rosenberg [EMAIL PROTECTED] wrote: Hi, I have following situation: Business wishes (God knows why) to have a proxy proxying 6 different context's on our server and fetching context from another server: http://ourserver/foo/bla.html (internally fetched from ) http://anotherserver/ourname/foo/bla.html http://ourserver/bar/bla.html - http://anotherserver/ourname/bar/bla.html ...and so on. I wrote a small webapp (1 servlet, 1 url-fetcher) which maps the context and path, fetches the content of the url and delivers it to the user. Let's say it's xxx webapp. I didn't want to make a copy of it for any of foo,bar, etc context's, so I droped following xml files into my $catalina_home/conf/Catalina/localhost: foo.xml with content: Context path=/foo docBase=xxx/, bar.xml with content: Context path=/bar docBase=xxx/, and so on, for each context. Everything is working fine, except, that the webapp is loaded once per context which makes 6 times for now and probably 60 in half year. I think it's a waste of resources and am searching for another solution. Note that I already have a ROOT webapp (otherwise I'd place it under root with servlet mapping instead of contexts) which I'd like not to touch, because of different release cycles of both applications. What is the best strategy to achieve my goal (having multiple context mappings to one instantiated webapp) ? Virtual hosts? URL Rewriting Filter in ROOT webapp? Something else? Thanx in advance :-) Regards Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Asking Again: How to create multiple context's linked to the same webapp, without instantiating multiple webapp instances
If the servlet is that simple. I would 1) rewrite it as a filter 2) Put it in the root webapp 3) Map the filter to all requests 4) Use a config file to handle all your mappings 5) make the filter smart enough to re-read the config file (servletContext.getResourceAsStream()) to detect changes so you don't have to restart the webapp. Timing on how often to detect for changes is your call. 6) Done If you can keep the config file used by the filter as a file outside of the webapp root - then you can replace the config file without touching the webapp. -Tim Leon Rosenberg wrote: asking again... any ideas, anyone? thanx leon On 11/15/05, Leon Rosenberg [EMAIL PROTECTED] wrote: Hi, I have following situation: Business wishes (God knows why) to have a proxy proxying 6 different context's on our server and fetching context from another server: http://ourserver/foo/bla.html (internally fetched from ) http://anotherserver/ourname/foo/bla.html http://ourserver/bar/bla.html - http://anotherserver/ourname/bar/bla.html ...and so on. I wrote a small webapp (1 servlet, 1 url-fetcher) which maps the context and path, fetches the content of the url and delivers it to the user. Let's say it's xxx webapp. I didn't want to make a copy of it for any of foo,bar, etc context's, so I droped following xml files into my $catalina_home/conf/Catalina/localhost: foo.xml with content: Context path=/foo docBase=xxx/, bar.xml with content: Context path=/bar docBase=xxx/, and so on, for each context. Everything is working fine, except, that the webapp is loaded once per context which makes 6 times for now and probably 60 in half year. I think it's a waste of resources and am searching for another solution. Note that I already have a ROOT webapp (otherwise I'd place it under root with servlet mapping instead of contexts) which I'd like not to touch, because of different release cycles of both applications. What is the best strategy to achieve my goal (having multiple context mappings to one instantiated webapp) ? Virtual hosts? URL Rewriting Filter in ROOT webapp? Something else? Thanx in advance :-) Regards Leon - 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]
Net Disk Failure in JSP with Tomcat 5.5.9
Hi, I made a Net Disk named P:\ The file ' test.jsp ' as following: - %@ page import=java.io.File % % String net = P:\\; java.io.File netDir=new java.io.File(net); out.print(net+ exist = +netDir.exists()+br); out.print(net+ is Directory = +netDir.isDirectory()+br); % - I got the following result when I use Apache Tomcat 5.5.9 Server : P:\ exist = false P:\ is Directory = false * But I got the following when I use Tomcat 5.0.18 : `` P:\ exist = true P:\ is Directory = true `` Can Anybody advise how to do to get net disk available using Tomcat 5.5.9 ! Thanks NanFei
RE: advice on auto logout servlet
From: Mark [mailto:[EMAIL PROTECTED] So there is no way to provide this functionality using just servlets :( You could sort-of hack something together using meta-refresh directives on the pages so that the browser knew to refresh the page just as the server timed out the session, but you need to tell the browser *something* in order for it even to request the page from the server. HTTP is a pull technology, not a push technology; a browser has to ask for content. - Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: advice on auto logout servlet
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I would suggest that you do this by using somethinglike JSON or AJAX. See jasonspec: http://www.crockford.com/JSON/index.html You could make the client query your server, in some interval and check the session state. hope it helps - -reynir Mark wrote: Is there any way to allow servlets to auto-logout a user when the timeout has been reached. Right now, I have tomcat configured for a 20 minute session timeout. When the session times out, the user gets no notification of this event. Is there any way to show the user that they have logged out? Thank you. -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDeeqn19KgIQihNwgRAqT8AJ9ijf9kZZlldgjRTcAEtua+89enKQCgnqjm iuCZACbq4A/JkmtB5yiIc8M= =HSCq -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: advice on auto logout servlet
Hi Mark, Is there any way to allow servlets to auto-logout a user when the timeout has been reached. We solved the problem slightly different. We use a rather small timeout for the session (say 10 minutes) and put a small iframe (nearly hidden, just changing colors) on the page where we use a javascript which refresh this little page (meta refresh might do it too) every minute. Due to this ping the session wont expire as long as the browser is open. Once the user closed the browser those pings are absent and the session will be destroyed. No need to put the user on a you have been logged out page as the browser window for to the corresponding session is no longer existent. Should I patent this? ;-) --- Mario - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: issue tomcat and special characters
IMO, it's a bad idea to still use Latin-1 these days. The best way is to find out why you can't insert those characters. Well, I don't know why you can't do so. Maybe there's because the MySQL provided by EasyPHP is quite old. By the way, since you use EasyPhp, that implies you're using Windows. You could very well forget about EasyPHP and download an official MySQL. You don't use either Apache or Php from EasyPHP, right? If yes, there's no reason to still keep it. Go here and download the community edition: http://dev.mysql.com/downloads/ While you're there, you could also download the Connector/J. As to configuring MySQL, it's quite intuitive and there's not much to say. I'm making web pages explaining how to make MySQL+Tomcat to work but it's still under construction, so I can't show you. But if you like, here's a little detail (b.d. means you could just choose the parameters by default): After a complete installation of MySQL, there's the Setup Wizard. Skip sign-up if you want next Detailed Configuration (b.d.) next Developer Machine (b.d.) next Multifunctional Database (b.d.) next Tablespace (b.d.) next Decision Support (b.d.) next TCP/IP Strict Mode (b.d.) next Here, you'd better choose Best Support for Multilingualism option next (b.d.) and better choose Include Bin Directory in Path next specify your password and Enable root access from remote machine if you want. That's it! I would suggest you to download the Administrator and Query Browser from the same download page which you would find very useful and intuitive. But their use is off-topic to this mailing-list and to avoid flame, send me private mail if you need more help on them. Seak Seak, Teng-Fong wrote: ary martini wrote: Hi Seak, thank you for your response. 1) mysql has charset Latin I would like to use ISO-8859-1 as encoding, as I can then insert special characters like è and à. For some reason it does not work for UTF-8 in my case Do you know How I can change the charset on mysql? I cannot locate any config file etc. I use Easyphp containing mysql 4.0 Thank you very much for your input Ary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Eclipse setup questions
Hello All, i am posting this question to the tomcat user group assuming people in this group are familiar with eclipse IDE. I am new to eclipse IDE. I have a question on the setup. I have 3 different packages built in ecplise. I want to be able to direct the ouput of these packages to 3 different folders that are outside my workspace. Do you know how I can do that ? Thanks a lot.
Re: Asking Again: How to create multiple context's linked to the same webapp, without instantiating multiple webapp instances
thanks tim. What is the benefit of using Filter instead of servlet? The only thing I see, is that I can reconfigure it without changing the web.xml and therefore without restarting the server. Anything else? I wanted to keep this functionallity out of the root webapp, not to save the server from a restart, but to keep the release process simplier. It's quite easy to release a one servlet webapp, as to release our root webapp with all the tagging, testing and so. But I think, I have no other choice :-) Btw. can I rewrite url with a filter, so that the request goes to another webapp? regards Leon On 11/15/05, Tim Funk [EMAIL PROTECTED] wrote: If the servlet is that simple. I would 1) rewrite it as a filter 2) Put it in the root webapp 3) Map the filter to all requests 4) Use a config file to handle all your mappings 5) make the filter smart enough to re-read the config file (servletContext.getResourceAsStream()) to detect changes so you don't have to restart the webapp. Timing on how often to detect for changes is your call. 6) Done If you can keep the config file used by the filter as a file outside of the webapp root - then you can replace the config file without touching the webapp. -Tim Leon Rosenberg wrote: asking again... any ideas, anyone? thanx leon On 11/15/05, Leon Rosenberg [EMAIL PROTECTED] wrote: Hi, I have following situation: Business wishes (God knows why) to have a proxy proxying 6 different context's on our server and fetching context from another server: http://ourserver/foo/bla.html (internally fetched from ) http://anotherserver/ourname/foo/bla.html http://ourserver/bar/bla.html - http://anotherserver/ourname/bar/bla.html ...and so on. I wrote a small webapp (1 servlet, 1 url-fetcher) which maps the context and path, fetches the content of the url and delivers it to the user. Let's say it's xxx webapp. I didn't want to make a copy of it for any of foo,bar, etc context's, so I droped following xml files into my $catalina_home/conf/Catalina/localhost: foo.xml with content: Context path=/foo docBase=xxx/, bar.xml with content: Context path=/bar docBase=xxx/, and so on, for each context. Everything is working fine, except, that the webapp is loaded once per context which makes 6 times for now and probably 60 in half year. I think it's a waste of resources and am searching for another solution. Note that I already have a ROOT webapp (otherwise I'd place it under root with servlet mapping instead of contexts) which I'd like not to touch, because of different release cycles of both applications. What is the best strategy to achieve my goal (having multiple context mappings to one instantiated webapp) ? Virtual hosts? URL Rewriting Filter in ROOT webapp? Something else? Thanx in advance :-) Regards Leon - 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: tomcat and wbs
Thanx Reynir, it helps ... although I wouldn't mind if you could give me more details ;-) I have many web services that are initialised only when invoked the first time. I must admit that this init part looks a bit confused to me. Any example based on servlet or singleton would be very much appreciated ;-) Thanx, --mike Reynir Hubner wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 there are several implementations of webservices available. the one most successfull is axis from apache, you should read all about it on the axis website.. http://ws.apache.org/axis/ of course it dependes on what you are going to do, but starting some service at application-startup can be done via web.xml (of your application) either by a custom listener or servlet loading up your service, sometimes done by using a singleton. hope it helps - -reynir Michael Niemaz wrote: Hi all, Could someone explain me or point me to an explanation of how tomcat initialize web services? I'd like to initialize them automatically at tomcat start-up instead of just before their invocation. Thanx, --mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDeetw19KgIQihNwgRAmSBAKCM/ZFtnt7a8Ip649tGAvAWr7570QCeK2IR mLhfN4I+EAi4N5K6wI92qSw= =EIXW -END PGP SIGNATURE- - 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: tomcat and wbs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi, you need to insert something like this : listener listener-class com.your.package.YourContextListener /listener-class /listener your servlet class might look something like this : import javax.servlet.*; public final class MyContextListener implements ServletContextListener { private ServletContext context = null; public void contextInitialized(ServletContextEvent event) { this.context = event.getServletContext(); yourService.start(); } public void contextDestroyed(ServletContextEvent event) { this.context = null; yourService.stop(); } } hope it helps - -reynir Michael Niemaz wrote: Thanx Reynir, it helps ... although I wouldn't mind if you could give me more details ;-) I have many web services that are initialised only when invoked the first time. I must admit that this init part looks a bit confused to me. Any example based on servlet or singleton would be very much appreciated ;-) Thanx, --mike Reynir Hubner wrote: there are several implementations of webservices available. the one most successfull is axis from apache, you should read all about it on the axis website.. http://ws.apache.org/axis/ of course it dependes on what you are going to do, but starting some service at application-startup can be done via web.xml (of your application) either by a custom listener or servlet loading up your service, sometimes done by using a singleton. hope it helps -reynir Michael Niemaz wrote: Hi all, Could someone explain me or point me to an explanation of how tomcat initialize web services? I'd like to initialize them automatically at tomcat start-up instead of just before their invocation. Thanx, --mike - 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] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDegnk19KgIQihNwgRAnOAAKCU3U9jaTj0swmjKQyesb/Suzn+fACgxRLS D/gYAtomCIdqnmqZK201ULk= =EdDB -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_jk bug serving up flash on non 2003 servers?
Hi Mark, Yes, as I mentioned, we can access non-swf files without a problem. We have exactly the same setup, I believe, for 2003 Server and XP Sp2 - it runs from the same installer, which has no checking to distinguish between the two. We also have Apache talking to Tomcat via mod_jk quite happily, except for swf files. Can you verify that you can access swf files on your setup? I believe we work fine with XP sp1. Anything else I can check, or info I can provide? How can I do any kind of debugging? cheers, David x54680 |-+ | | Mark Thomas | | | [EMAIL PROTECTED]| | | | | || | | 11/14/2005 06:08 | | | PM | | | Please respond to| | | Tomcat Users| | | List| | || |-+ -| | | | To: Tomcat Users List users@tomcat.apache.org | | cc: | | Subject: Re: mod_jk bug serving up flash on non 2003 servers? | -| [EMAIL PROTECTED] wrote: I tried doing that before but got no response; but I'll happily try again. Everything works great on Windows 2003 Server. I have apache fronting numerous Tomcats, with mod_jk. We are using Laszlo, so the pages served up are actually swf files. On 2003 server we see no issues, but with Windows XP SP 2 we don't receive any data. We can access the individual tomcats without any problem, however. And we can access non-swf files without a problem, so the setup seems to be correct. Please advise on what further information I can provide, and where to find it. Best guess is a difference in config. Are the following all the same between your 2003 setup and your win xp set up? Apache version Tomcat version mod_jk version http.conf workers.properties mime.types AJP connector elements in server.xml I have Apache talking to Tomcat via mod_jk quite happily so I doubt this is a bug. Can you confirm that you XP setup works via Apache for html, jsp etc but not swf? Mark - 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: Asking Again: How to create multiple context's linked to the same webapp, without instantiating multiple webapp instances
A filter can trap all requests before the servlet is invoked. Thats why I like them better for this situation (in the root webapp). You can use a filter to rewrite the request to another context with the same code as you would do it with a servlet. (Via a cross context forward) -Tim Leon Rosenberg wrote: thanks tim. What is the benefit of using Filter instead of servlet? The only thing I see, is that I can reconfigure it without changing the web.xml and therefore without restarting the server. Anything else? I wanted to keep this functionallity out of the root webapp, not to save the server from a restart, but to keep the release process simplier. It's quite easy to release a one servlet webapp, as to release our root webapp with all the tagging, testing and so. But I think, I have no other choice :-) Btw. can I rewrite url with a filter, so that the request goes to another webapp? regards Leon On 11/15/05, Tim Funk [EMAIL PROTECTED] wrote: If the servlet is that simple. I would 1) rewrite it as a filter 2) Put it in the root webapp 3) Map the filter to all requests 4) Use a config file to handle all your mappings 5) make the filter smart enough to re-read the config file (servletContext.getResourceAsStream()) to detect changes so you don't have to restart the webapp. Timing on how often to detect for changes is your call. 6) Done If you can keep the config file used by the filter as a file outside of the webapp root - then you can replace the config file without touching the webapp. -Tim Leon Rosenberg wrote: asking again... any ideas, anyone? thanx leon On 11/15/05, Leon Rosenberg [EMAIL PROTECTED] wrote: Hi, I have following situation: Business wishes (God knows why) to have a proxy proxying 6 different context's on our server and fetching context from another server: http://ourserver/foo/bla.html (internally fetched from ) http://anotherserver/ourname/foo/bla.html http://ourserver/bar/bla.html - http://anotherserver/ourname/bar/bla.html ...and so on. I wrote a small webapp (1 servlet, 1 url-fetcher) which maps the context and path, fetches the content of the url and delivers it to the user. Let's say it's xxx webapp. I didn't want to make a copy of it for any of foo,bar, etc context's, so I droped following xml files into my $catalina_home/conf/Catalina/localhost: foo.xml with content: Context path=/foo docBase=xxx/, bar.xml with content: Context path=/bar docBase=xxx/, and so on, for each context. Everything is working fine, except, that the webapp is loaded once per context which makes 6 times for now and probably 60 in half year. I think it's a waste of resources and am searching for another solution. Note that I already have a ROOT webapp (otherwise I'd place it under root with servlet mapping instead of contexts) which I'd like not to touch, because of different release cycles of both applications. What is the best strategy to achieve my goal (having multiple context mappings to one instantiated webapp) ? Virtual hosts? URL Rewriting Filter in ROOT webapp? Something else? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat and Web Services
Hi I have question concerning Tomcat and Web Services. I have a web services running on a server named 'DTJAS' under tomcat with JWSDP 1.6, that sits behind a firewall. I would like to publish this to the outside, so we came up with a name of LLOYDS, we have a web server sitting outside the firewall with the internal IP for DTJAS and external IP of LLOYDS. So an externally user can see our WSDL through the browser, which goes to the web server, running APACHE, passing the request to DTJAS. It works fine, the problem occurs with the soap:address location= line in the WSDL. Instead of referring to the LLOYDS address it refers to the DTJAS address. So when the externally user try to call the web service they try to go to DTJAS which of course can not be hit from outside our firewall. So here is my question, how do I tell Tomcat to put the LLOYDS address in the WSDL. I have tried 'REPLACE_WITH_ACTUAL_URL in the WSDL, changing the host file on DTJAS, and even putting LLOYDS in the address and recompiling, but it always shows as DTJAS, the name of the server. Any help would be greatly appreciated. Thanks Michael Michael Brohm Space Imaging [EMAIL PROTECTED] *** This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify Space Imaging immediately. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_jk bug serving up flash on non 2003 servers?
have you looked at the mod-jk and apache log files? On 15-Nov-05, at 11:19 AM, [EMAIL PROTECTED] wrote: Hi Mark, Yes, as I mentioned, we can access non-swf files without a problem. We have exactly the same setup, I believe, for 2003 Server and XP Sp2 - it runs from the same installer, which has no checking to distinguish between the two. We also have Apache talking to Tomcat via mod_jk quite happily, except for swf files. Can you verify that you can access swf files on your setup? I believe we work fine with XP sp1. Anything else I can check, or info I can provide? How can I do any kind of debugging? cheers, David x54680 |-+ | | Mark Thomas | | | [EMAIL PROTECTED]| | | | | || | | 11/14/2005 06:08 | | | PM | | | Please respond to| | | Tomcat Users| | | List| | || |-+ -- ---| | | | To: Tomcat Users List users@tomcat.apache.org | | cc: | | Subject: Re: mod_jk bug serving up flash on non 2003 servers?| -- ---| [EMAIL PROTECTED] wrote: I tried doing that before but got no response; but I'll happily try again. Everything works great on Windows 2003 Server. I have apache fronting numerous Tomcats, with mod_jk. We are using Laszlo, so the pages served up are actually swf files. On 2003 server we see no issues, but with Windows XP SP 2 we don't receive any data. We can access the individual tomcats without any problem, however. And we can access non-swf files without a problem, so the setup seems to be correct. Please advise on what further information I can provide, and where to find it. Best guess is a difference in config. Are the following all the same between your 2003 setup and your win xp set up? Apache version Tomcat version mod_jk version http.conf workers.properties mime.types AJP connector elements in server.xml I have Apache talking to Tomcat via mod_jk quite happily so I doubt this is a bug. Can you confirm that you XP setup works via Apache for html, jsp etc but not swf? Mark - 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: mod_jk bug serving up flash on non 2003 servers?
Have checked and can't see anything...do you know how to turn up logging to the maximum to really see what's going on? cheers, David x54680 |-+ | | Ryan McDonald| | | [EMAIL PROTECTED]| | | brand.com | | || | | 11/15/2005 12:35 | | | PM | | | Please respond to| | | Tomcat Users| | | List| | || |-+ -| | | | To: Tomcat Users List users@tomcat.apache.org | | cc: | | Subject: Re: mod_jk bug serving up flash on non 2003 servers? | -| have you looked at the mod-jk and apache log files? On 15-Nov-05, at 11:19 AM, [EMAIL PROTECTED] wrote: Hi Mark, Yes, as I mentioned, we can access non-swf files without a problem. We have exactly the same setup, I believe, for 2003 Server and XP Sp2 - it runs from the same installer, which has no checking to distinguish between the two. We also have Apache talking to Tomcat via mod_jk quite happily, except for swf files. Can you verify that you can access swf files on your setup? I believe we work fine with XP sp1. Anything else I can check, or info I can provide? How can I do any kind of debugging? cheers, David x54680 |-+ | | Mark Thomas | | | [EMAIL PROTECTED]| | | | | || | | 11/14/2005 06:08 | | | PM | | | Please respond to| | | Tomcat Users| | | List| | || |-+ -- ---| | | | To: Tomcat Users List users@tomcat.apache.org | | cc: | | Subject: Re: mod_jk bug serving up flash on non 2003 servers?| -- ---| [EMAIL PROTECTED] wrote: I tried doing that before but got no response; but I'll happily try again. Everything works great on Windows 2003 Server. I have apache fronting numerous Tomcats, with mod_jk. We are using Laszlo, so the pages served up are actually swf files. On 2003 server we see no issues, but with Windows XP SP 2 we don't receive any data. We can access the individual tomcats without any problem, however. And we can access non-swf files without a problem, so the setup seems to be correct. Please advise on what further information I can provide, and where to find it. Best guess is a difference in config. Are the following all the same between your 2003 setup and your win xp set up? Apache version Tomcat version mod_jk version http.conf workers.properties mime.types AJP connector elements in server.xml I have Apache talking to Tomcat via mod_jk quite happily so I doubt this is a bug. Can you confirm that you XP setup works via Apache for html, jsp etc but not swf? Mark - 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]
mod_jk and url encoding
Okay, i'm using tomcat 5.5 and mod_jk with apache 2. It looks like I've got jk set up okay for the most part. I'm able to use the site as I did before switching to mod_jk except for one thing. When I try to access the following url I got a 404 from apache and tomcat never gets a chance to touch the url (I have a request dump valve in there dumping all requests): /sdirect/_sp=Shomesp=Sadmin%2FHome/admin/Home, $AdminBorder.$Nav.link.html now the problem is the %2F. If I replace that with a / like this it works fine: /sdirect/_sp=Shomesp=Sadmin/Home/admin/Home,$AdminBorder.$Nav.link.html I even tried adding JkOptions +ForwardUIREscaped to my httpd.conf with no luck. Any ideas on why this is not making it to tomcat when %2F is used?? I am really befuddled with this one. -- Dan Adams Software Engineer Interactive Factory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_jk and url encoding
got it. needed AllowEncodedSlashes On. On Tue, 2005-11-15 at 14:35 -0500, Dan Adams wrote: Okay, i'm using tomcat 5.5 and mod_jk with apache 2. It looks like I've got jk set up okay for the most part. I'm able to use the site as I did before switching to mod_jk except for one thing. When I try to access the following url I got a 404 from apache and tomcat never gets a chance to touch the url (I have a request dump valve in there dumping all requests): /sdirect/_sp=Shomesp=Sadmin%2FHome/admin/Home, $AdminBorder.$Nav.link.html now the problem is the %2F. If I replace that with a / like this it works fine: /sdirect/_sp=Shomesp=Sadmin/Home/admin/Home,$AdminBorder.$Nav.link.html I even tried adding JkOptions +ForwardUIREscaped to my httpd.conf with no luck. Any ideas on why this is not making it to tomcat when %2F is used?? I am really befuddled with this one. -- Dan Adams Software Engineer Interactive Factory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using Authentication/Authorization
Hiya, I am using Tomcat and Apache to host a simple website. I need to have some security on the site. At least to start with. Eventually I need to have security, period. :) So, following the documentation and several walk-thrus from many sources, I cannot get tomcat to cooperate. I am running Mac OS X 10.4.3 and am using Java 1.5.0, apache 1.3, and tomcat 5.5.12 and am connecting apache and tomcat with the ajp13 connector (using mod_jk version 1.2.14). At this point, I'm think I'm bypassing Apache/JKconnectors and going straight to the webapp via port 8080... When I set up the web.xml file for using, say, basic security, and then attempt to access the constrained resources, tomcat gives me the error that the requested resource is not availabe. When I remove all attempts (in the web.xml file) at security, I can access the resource just fine. I tried using the UserDatabase realm and also the MemoryRealm, but to no avail either way. Next, when I go to the default tomcat page, http://localhost:8080, and try to go to the Administrator section, it asks for my login and password. (I've configured the tomcat-users.xml file to add an admin and manager role to one of the users and restarted the server.) But when I attempt to log in, I get the error: The requested resource (/ admin/j_security_check) is not available. I know j_security_check is the action you enter for a form authentication, but this is what came with tomcat.. nothing of my creation, so I don't think I'm the problem. This link worked on my tomcat version 5.0. I upgraded today and now it doesn't work... so now seeings how I can't seem to get security running on my webapp and I can't log in to the administration section of the server, I'm wondering if there is some funk going on out of my scope. I downloaded the binaries for mac.. maybe something is wrong? If anyone has any idea, please let me know.. I am at a total loss. Thankyou, Jess Ryan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Authentication/Authorization
Can you supply the relevant sections of your web.xml? I am using FORM-based authentication--tested with both the Memory and JAAS realms--but maybe this will give you some hints: ... security-constraint web-resource-collection web-resource-namehome page/web-resource-name url-pattern/index.jsp/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint role-namemyrole/role-name /auth-constraint /security-constraint login-config auth-methodFORM/auth-method form-login-config form-login-page/login.jsp/form-login-page form-error-page/loginError.jsp/form-login-page /form-login-config /login-config security-role role-namemyrole/role-name /security-role ... On 11/15/05 1:49 PM, Jess [EMAIL PROTECTED] wrote: Hiya, I am using Tomcat and Apache to host a simple website. I need to have some security on the site. At least to start with. Eventually I need to have security, period. :) So, following the documentation and several walk-thrus from many sources, I cannot get tomcat to cooperate. I am running Mac OS X 10.4.3 and am using Java 1.5.0, apache 1.3, and tomcat 5.5.12 and am connecting apache and tomcat with the ajp13 connector (using mod_jk version 1.2.14). At this point, I'm think I'm bypassing Apache/JKconnectors and going straight to the webapp via port 8080... When I set up the web.xml file for using, say, basic security, and then attempt to access the constrained resources, tomcat gives me the error that the requested resource is not availabe. When I remove all attempts (in the web.xml file) at security, I can access the resource just fine. I tried using the UserDatabase realm and also the MemoryRealm, but to no avail either way. Next, when I go to the default tomcat page, http://localhost:8080, and try to go to the Administrator section, it asks for my login and password. (I've configured the tomcat-users.xml file to add an admin and manager role to one of the users and restarted the server.) But when I attempt to log in, I get the error: The requested resource (/ admin/j_security_check) is not available. I know j_security_check is the action you enter for a form authentication, but this is what came with tomcat.. nothing of my creation, so I don't think I'm the problem. This link worked on my tomcat version 5.0. I upgraded today and now it doesn't work... so now seeings how I can't seem to get security running on my webapp and I can't log in to the administration section of the server, I'm wondering if there is some funk going on out of my scope. I downloaded the binaries for mac.. maybe something is wrong? If anyone has any idea, please let me know.. I am at a total loss. Thankyou, Jess Ryan - 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: Building tc 5.0.28 on Sol 9 gives gzip error for mx4j-2.0.1.zip
I found an archived email on the dev list that shows the latest version being mx4j-2.1.0.tar.gz. This did work. --- Creeping Death [EMAIL PROTECTED] wrote: I am trying to build tomcat 5.0.28 on a Sun 410 with Solaris 9. I downloaded the source, setup ant and have tried to build. I get the following error: downloadgz: [get] Getting: http://telia.dl.sourceforge.net/sourceforge/mx4j/mx4j-2.0.1.zip [get] To: /usr/share/java/file.tar.gz [gunzip] Expanding /usr/share/java/file.tar.gz to /usr/share/java/file.tar BUILD FAILED /export/home/aaldous/tc/jakarta-tomcat-5.0.28-src/build.xml:49: The following error occurred while executing this line: /export/home/aaldous/tc/jakarta-tomcat-5.0.28-src/jakarta-tomcat-5/build.xml:1601: The following error occurred while executing this line: /export/home/aaldous/tc/jakarta-tomcat-5.0.28-src/jakarta-tomcat-5/build.xml:1694: Problem expanding gzip Not in GZIP format I get the same problem when I try build tomcat using mx4j-1.1.1.tar.gz. I've tried unziping the file manually and get a different error depending on which version of the file I use. For mx4j-1.1.1.tar.gz I get: Problem expanding gzip Not in GZIP format. For mx4j-2.0.1.zip I get: gunzip: file.tar.gz has more than one entry -- unchanged. What am I doing wrong? Has anyone else seen this? If so, how did you get around this? Thanks Aaron Aldous __ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Asking Again: How to create multiple context's linked to the same webapp, without instantiating multiple webapp instances
thanx again :-) On 11/15/05, Tim Funk [EMAIL PROTECTED] wrote: A filter can trap all requests before the servlet is invoked. Thats why I like them better for this situation (in the root webapp). You can use a filter to rewrite the request to another context with the same code as you would do it with a servlet. (Via a cross context forward) -Tim Leon Rosenberg wrote: thanks tim. What is the benefit of using Filter instead of servlet? The only thing I see, is that I can reconfigure it without changing the web.xml and therefore without restarting the server. Anything else? I wanted to keep this functionallity out of the root webapp, not to save the server from a restart, but to keep the release process simplier. It's quite easy to release a one servlet webapp, as to release our root webapp with all the tagging, testing and so. But I think, I have no other choice :-) Btw. can I rewrite url with a filter, so that the request goes to another webapp? regards Leon On 11/15/05, Tim Funk [EMAIL PROTECTED] wrote: If the servlet is that simple. I would 1) rewrite it as a filter 2) Put it in the root webapp 3) Map the filter to all requests 4) Use a config file to handle all your mappings 5) make the filter smart enough to re-read the config file (servletContext.getResourceAsStream()) to detect changes so you don't have to restart the webapp. Timing on how often to detect for changes is your call. 6) Done If you can keep the config file used by the filter as a file outside of the webapp root - then you can replace the config file without touching the webapp. -Tim Leon Rosenberg wrote: asking again... any ideas, anyone? thanx leon On 11/15/05, Leon Rosenberg [EMAIL PROTECTED] wrote: Hi, I have following situation: Business wishes (God knows why) to have a proxy proxying 6 different context's on our server and fetching context from another server: http://ourserver/foo/bla.html (internally fetched from ) http://anotherserver/ourname/foo/bla.html http://ourserver/bar/bla.html - http://anotherserver/ourname/bar/bla.html ...and so on. I wrote a small webapp (1 servlet, 1 url-fetcher) which maps the context and path, fetches the content of the url and delivers it to the user. Let's say it's xxx webapp. I didn't want to make a copy of it for any of foo,bar, etc context's, so I droped following xml files into my $catalina_home/conf/Catalina/localhost: foo.xml with content: Context path=/foo docBase=xxx/, bar.xml with content: Context path=/bar docBase=xxx/, and so on, for each context. Everything is working fine, except, that the webapp is loaded once per context which makes 6 times for now and probably 60 in half year. I think it's a waste of resources and am searching for another solution. Note that I already have a ROOT webapp (otherwise I'd place it under root with servlet mapping instead of contexts) which I'd like not to touch, because of different release cycles of both applications. What is the best strategy to achieve my goal (having multiple context mappings to one instantiated webapp) ? Virtual hosts? URL Rewriting Filter in ROOT webapp? Something else? - 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: How to disable Tomcat Admin directory
Jarrod Holder wrote: Mark, The \conf\catalina\localhost directory is empty and there isn't an admin folder at \server\webapps. The admin interface is not installed, I'm only trying to get Tomcat to stop responding when I hit the WEB_ROOT/admin folder from a web browser. The reason being Tomcat is keeping users from getting to the real /admin folder on our server. Just found this. Whilst looking at something else entirely. Does the following file exist? If so delete it. \webapps\ROOT\admin Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to disable Tomcat Admin directory
Mark, I found and deleted the admin folder you mentioned. However, I'm still not getting the real admin folder on my web server. Tomcat is still responding but with a 404 - The requested resource (/admin/) is not available. I even tried killing the entire webapps\ROOT folder, but that didn't help either. Thanks again for your help on this. [EMAIL PROTECTED] Jarrod Holder wrote: Mark, The \conf\catalina\localhost directory is empty and there isn't an admin folder at \server\webapps. The admin interface is not installed, I'm only trying to get Tomcat to stop responding when I hit the WEB_ROOT/admin folder from a web browser. The reason being Tomcat is keeping users from getting to the real /admin folder on our server. Just found this. Whilst looking at something else entirely. Does the following file exist? If so delete it. \webapps\ROOT\admin Mark - 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: problem on running tomcat as windows services
Thanks a lot, it worked... =) Longson, Robert [EMAIL PROTECTED] wrote: lalyne, Either a) edit service.bat and change the PR_CLASSPATH to include your stuff then type service remove followed by service install. or b) run tomcat5w.exe //ES//tomcat, go to the java tab and edit the Java Classpath. restart tomcat and it should work. Best regards Robert. -Original Message- From: wendy [mailto:[EMAIL PROTECTED] Sent: 15 November 2005 09:40 To: users@tomcat.apache.org Subject: problem on running tomcat as windows services Hi, I would like to ask about my observation on Tomcat run on different ways. First, I run Tomcat on the command-line. I encountered no errors and I can access my webapp succesfully. Then, I try to re-run Tomcat as Windows service. I execute the ff command: C:\Tomcat\binNET START Tomcat5 The Apache Tomcat service is starting. The Apache Tomcat service was started successfully. Then I access the url of my webapp. I got HTTP Status 500- error, saying: javax.servlet.ServletException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Unable to find file: shared/header.xsl My xsl files were located at TOMCAT_HOME/webapps/MyApp/xsl. I put this line on my setclasspath.bat: set CLASSPATH=%JAVA_HOME%\lib\tools.jar set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\webapps\MyApp\xsl;%CATALINA_HOME%\webapps\MyApp\xml Basically, that's the only change I made on my Tomcat instance' config files, and it run successfully when I'm runnin my Tomcat on the command-line. Why is it that i got an HTTP error when I'm running the same webapp on Tomcat, which is started as a Windows service? Is there anything I have to set for me to run it as a Windows service, successfully? I really need a reply. I'm getting confused. Thanks a lot. lalyne Send instant messages to your online friends http://uk.messenger.yahoo.com The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] never argue with idiots, they'll take you down to their level, and beat you with experience Send instant messages to your online friends http://uk.messenger.yahoo.com
Re: Load balancing with apache + mod_jk
Mirek Kopriva wrote: Not sure if I'm sending this question to the right forum, but Thanks a lot for any help. #properties workers.ajp13.1.host=127.0.0.1 workers.ajp13.1.port=8009 workers.ajp13.2.host=xx.xx.xx.xx (other server IP) workers.ajp13.2.port=8009 worker.list=loadbalancer, ajp13.1, ajp13.2 There is a 'big red' statement in the JK documentation: http://tomcat.apache.org/connectors-doc/config/workers.html So, your worker names are invalid. They MUST NOT contain dots! Regards, Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]