RE: Web App Classloader..How?
Hi Haytham, I am pretty new to Tomcat myself but I think this will help you. Modify your setclasspath.bat file in your %TOMCAT%\bin dir to have your files added to the CLASSPATH env variable. In this case as long as the sun.misc.Launcher$AppClassLoader class loader is called to load the files (which I am pretty sure it will be called) your classes can be loaded from whichever location you like. I hope that helps. ~Sumit -Original Message- From: Haytham Samad [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 1:53 PM To: Tomcat Users List Subject: Web App Classloader..How? I have a question regarding how the web application loader works. Especially when my application is not deployed under tomcat home/webapps in Tomcat 4.1.x. This is the situation. Tomcat is installed on drive C: on the server and I have my application deployed on drive D. This is the a requirement. In my application, I have 2 jsp's that are under WEB-INF\jsp. They can only be accessed through forwards from other resources on the server. In these jsp's, I make use of classes that are under WEB-INF\classes in my application. Now, when the jsp compiler attempts to compile the jsp's (create servlet classes and then compile them) how does it know where to look for the classes. I would like to know how that works and how I can control it (change the class loading behavior) to help with the following issue: When I hit one of the jsp's, I get a compilation error saying that the calsses I imported and attempted to use in my jsp cannot be found? It also shows that it is looking under a directory that is under the C drive and not under my application's WEB-INF\classes directory. I have the server.xml configuration as follows: Context path=/MyApp docBase=D:\Webfiles\TomcatApps\MyApp debug=0 Logger className=org.apache.catalina.logger.FileLogger directory=D:\Webfiles\LogFiles prefix=MyApp timestamp=true / /Context I am using STRUTS, but that should not be a big deal since I have the jsp's mapped correctly. This all works fine when I deploy under Tomcat Home\webapps. It is just when I deploy as described above (production deployment) does this happen. I would appreciate any direction on this and if possible some good description (or a pointer to where I can find one) as to how to control the class loader. Another option I tried was compiling the jsp's and loading them up compiled in org/apache/jsp. This worked but with frequent updates to the site and more jsp's, this will become a hassle. Thanks for the help. Haytham - 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: Web App Classloader..How?
Hi Haytham, I dont think Tomcat will allow you to load classes from any directory below the %TOMCAT% home dir. If it does then it would be a great security concern..by changing the classpath env variable it is the java classloader that is loading the files for you and not the apache classloaders.. Yoav, I think the WAR files need to be installed in the webapps folder in order for tomcat to install them.. Regards, ~Sumit -Original Message- From: Haytham Samad [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 3:37 PM To: Tomcat Users List Subject: RE: Web App Classloader..How? Yoav, I was deploying using WARs with an ant task. Pretty cool. But when I move the files to the directory I am deploying in, it does not open the WAR. So now I am unpacking the war in that directory. This deploy is not in webapps!! Or is there a way to make Tomcat open up WAR files in virtual directories? Another thing, the issue is not the deploy format!? The issue with this deployment is the classpath and class loading when my jsp pages are compiled. Unless, you mean that just packing my app in a WAR will take care of this issue even if I am not deploying in tomcat's webapps directory? Not sure this is the case though... Thanks -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 2:19 PM To: Tomcat Users List Subject: RE: Web App Classloader..How? Howdy, The configuration should allow me to enter the context in server.xml and be able to update my code under my application context (on the other drive) without having to touch anything in the Tomcat installation. Any ideas!! Here's an idea that can be summarized in three letters: WAR. Package and deploy your application as a war file. No symlinks, not shortcuts, no messing around with setclasspath or other variations of the environment $CLASSPATH variable. Write an ant task that builds, packages, and deploys your application. It's trivial to write these ant tasks, and they execute very quickly. The end result will be a portable, self-contained web application. It will go along with the letter and the spirit of the specification. It will save you, your coworkers, your server administrators, and your customers many headaches. You will not have to touch anything in the tomcat installation. You will not have to repeat many configuration steps for every server, and every new version of every server, every time you want to deploy from scratch. Yoav Shapira Millennium ChemInformatics - 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]
Tomcat4.1.x under JDK1.3 vs JDK1.4
Hi All, Are there any differences in using Tomcat4.1.x running under JDK1.3 and under JDK1.4. If any please do let me know. Thanks, ~Sumit -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: HTTPS to HTTP
Craig, I agree with you 100% but there can be a simple solution to the problem that you just raised..and that is that a new session id is created and mapped in some table when moving from https--http this way user B can not get access to the admin page. ~Sumit On Thu, 9 Jan 2003, John Holman wrote: Date: Thu, 09 Jan 2003 12:56:16 + From: John Holman [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: HTTPS to HTTP Yes, that is clearly a risk. The *whole* web application needs have no risks in order to allow http access to any of it - any sensitive link and it must all be https. (And of course if SSO is enabled *all* web applications for the virtual host must be considered safe). Otherwise I'm not convinced that session stealing is really a problem - though open to counter-arguements. Consider a scenario where you have admin pages that require SSL, and normal pages that can run on either. Assume Tomcat were modified to migrate your session back. Consider the following course of events: * User A logs on, selects link for an admin function, and is switched to SSL for that part. * User A then switches back to non-SSL. Among other things, this means that the session id is now visible in plaintext on the wire. * User B snoops the network, acquires the session id, and submits an SSL request (with the stolen session id) to an admin function. * Server blithely executes the forged request, because login identity is attached to the session id (which is now plaintext -- it wouldn't be if the session had been created under SSL and never allowed to switch back). Once an application has switched from HTTP to HTTPS for a session, it should be programmed to never go back again. John Craig Ralph Einfeldt wrote: But be aware that quite simple changes in the configuration of tomcat can lead to big security holes. Guess what happens if you or somebody else someday decides to switch from basic authentification to form authentifcation and the sysadmin visits the user side and somebody steals the sysadmins session ...) -Original Message- From: David Hemingway [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 12:08 PM To: Tomcat Users List Subject: Re: HTTPS to HTTP Thats is my exact situation. The sysadmin section of teh site is 100% https. but the on the user side there is nothing that sensitive and little harm they could be cause stealing someones session. It would not be worth going to the trouble of stealing the session for the benefit you would get. -- 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Log on Tomcat
Yes add these loggers Logger className=org.apache.catalina.logger.SystemErrLogger / Logger className=org.apache.catalina.logger.SystemOutLogger / ~Sumit -Original Message- From: Lindomar [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 11:44 AM To: Tomcat Users List Subject: Log on Tomcat Hi everybody! Is it possible put on log what i write with System.out.println in my classes? Thanks in advanced. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: new user: servlets dont run in new apps
Do you have a servlet-mapping in your web.xml Something like this might do for you(Change the MyClass value accordingly) ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2.2.dtd; web-app display-nameMyClass/display-name servlet servlet-nameMyClass/servlet-name servlet-classMyClass/servlet-class /servlet servlet-mapping servlet-nameMyClass/servlet-name url-pattern/servlet/MyClass/url-pattern /servlet-mapping /web-app ~Sumit -Original Message- From: George Metz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 4:35 PM To: [EMAIL PROTECTED] Subject: new user: servlets dont run in new apps what simple thing am i missing ? (probably something in the documentation, but i havent found it so far) PROBLEM: cannot get servlets to run in a NEW webapp. the ones that come with tomcat work ok, except for the sample servlet in the Developer's Guide. this built-in one doesnt run either: http://127.0.0.1:8080/tomcat-docs/appdev/sample/web/hello (gives: HTTP Status 404 The requested resource (/tomcat-docs/appdev/sample/web/hello) is not available As for my new apps: - a simple html page in webapps\george runs ok - a tomcat example jsp i modified and dropped into webapps/george/Jsp runs fine. called thusly: http://127.0.0.1:8080/george/Jsp/geo_hello.jsp?yakittyyak - i successfully copied/renamed/modified/compiled and ran a servlet under examples\WEB-INF\classes, even referenced it successfully in examples\WEB-INF\web.xml like so : servlet servlet-namegeorghe/servlet-name servlet-classGeorgeHello/servlet-class /servlet works like a champ when called thusly: http://127.0.0.1:8080/examples/servlet/GeorgeHello?username=CletusT or http://127.0.0.1:8080/examples/servlet/georghe?username=CletusT BUT same GeorgeHello class servlet placed under webapps\george\WEB-INF\classes wont run. gives the dreaded 404 HTTP Status 404 The requested resource (/george/servlet/GeorgeHello) is not available Have same problem with David Flanagan's (OReilly) javaexamples2 app (installed it from a .war file, tomcat extracted it). JSPs run fine, servlets dont. (george app directories were set up manually, but carefully. have checked permissions/properties on the directories several times. look the same as the examples app to me. ) thanks! George -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Tomcat Still Doesn't Display Servlet!
its the web.xml that you edit...see my last post today for an example -Original Message- From: Steve R Burrus [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 5:45 PM To: [EMAIL PROTECTED] Subject: Tomcat Still Doesn't Display Servlet! Hello all, maybe I am beating a dead horse or something about trying/attempting to see or view a servlet/JSP in my favorite web browser, but I STILL CANNOT DO IT!!! Is it just me, am I the only one among all of the rest of you out there who just flat doesn't get it about being to see a servlet???!! I have tried to edit the C:\[TOMCAT-ROOT]\conf\server.xml file to enable me to do so, but so far, without any success whatsoever! I looked over the big old configuration file for the Context-Manager/Context-Manager tag where one book I have on server-side Java programming instructed me to put the context path for the servlet, but couldn't find it at all. I do remember one member of our group told me some time ago NOT to edit the server.xml, saying that Tomcat would somehow know how to handle this context path. Any last moment suggestions for me from anyone about this problem would be appreciated right before i abandon the idea forever of getting it right with this. It IS the server.xml file that I edit, and NOT the web.xml, right? I leave you with that softball quesion which anyone can answer, I'm sure. __ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com -- 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]
Reading Property files...related to servlets
Hi All, My application is a servlet and it uses another application that tries to read a property file. Now the problem is that this application was never designed to work along with a servlet and does not read its property file using a method like getServletContext().getResourceAsStream(/foo.html); Now the question that I have for you bright folks out there is how am I supposed to go about feeding this application its property file:) Thanks, -Sumit -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 9:07 AM To: Tomcat Users List Subject: RE: Relative paths in servlets? Hi, Did you try getServletContext().getResourceAsStream(/foo.html); ? Yoav Shapira Millennium ChemInformatics -Original Message- From: Øyvind Hvamstad [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 8:36 AM To: [EMAIL PROTECTED] Subject: Relative paths in servlets? Hi, could anyone tell me how to access files using relative paths from a servlet? Say, if servlet is mapped to /bar and the file foo.html is in the webapps top dir. How do I access the foo.html file from the servlet. I tried ../foo.html, /foo.html and even getServletContext().getRealPath(/bar)+/../foo.html but none works. Any pointers? -- Øyvind Hvamstad -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [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]
RE: Reading Property files...related to servlets
This is a good idead Wendy but I can't change their code.. Sumit wrote: Now the question that I have for you bright folks out there is how am I supposed to go about feeding this application its property file:) Will this do? ClassLoader cl = YourClassName.class.getClassLoader(); Properties props = new Properties(); props.load( cl.getResourceAsStream( some.properties ) ) ; -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management
RE: Reading Property files...related to servlets
Hi Yoav, Well of all that I know of this application is that it reads a file from a directory structure Something like com/apps/Application/sample.prop and the application is also in the same package whereas my application resides in the package com/apps/MyApp/MyService Now, this very same setup works great when I use Tomcat 3.3 but with Tomcat4.1.18 the application fails to read its property file. Any Ideas.. -Sumit Hi, That depends entirely on the application. Its documentation should indicate how it can be configured to read the file. Chances are for one of the following: - The app has some configuration file where you can specify the file path - The app can take a runtime CLI parameter, e.g. -DappConfigFile=... that you can use - The app uses Classloader's getResource() calls, in which case you just need to put the file in the proper place on the classpath for the app to find it. If the app isn't well documented, do you have its source code? Or do you have support for the app that can tell you this? Yoav Shapira Millennium ChemInformatics -Original Message- From: Shrotriya, Sumit [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 9:35 AM To: 'Tomcat Users List' Subject: Reading Property files...related to servlets Hi All, My application is a servlet and it uses another application that tries to read a property file. Now the problem is that this application was never designed to work along with a servlet and does not read its property file using a method like getServletContext().getResourceAsStream(/foo.html); Now the question that I have for you bright folks out there is how am I supposed to go about feeding this application its property file:) Thanks, -Sumit -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 9:07 AM To: Tomcat Users List Subject: RE: Relative paths in servlets? Hi, Did you try getServletContext().getResourceAsStream(/foo.html); ? Yoav Shapira Millennium ChemInformatics -Original Message- From: Øyvind Hvamstad [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 8:36 AM To: [EMAIL PROTECTED] Subject: Relative paths in servlets? Hi, could anyone tell me how to access files using relative paths from a servlet? Say, if servlet is mapped to /bar and the file foo.html is in the webapps top dir. How do I access the foo.html file from the servlet. I tried ../foo.html, /foo.html and even getServletContext().getRealPath(/bar)+/../foo.html but none works. Any pointers? -- Øyvind Hvamstad -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [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]
RE: Reading Property files...related to servlets
Thanks Yoav. that helped...I was running after the wrong horse:) Regards, -Sumit -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 10:31 AM To: Shrotriya, Sumit Subject: RE: Reading Property files...related to servlets Hi, It looks like the configuration file is read OK. The problem is with the JNDI context name binding. The JNDI implementation in tomcat 4 is completely different from tomcat 3. Without a more thorough knowledge of this 3rd party application, no one will be able to help you ;( If this app has any support, I suggest you contact them. Thanks, Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Console output in Tomcat
Vlad, Unfortunately no. The output from System.err doesnt get logged not with Tomcat4.1.12. I had run in the same problem a couple of days before and the only alternative was to install cygwin and redirect the output to a file. Sumit -Original Message- From: Vladimer Shioshvili [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 8:37 AM To: Tomcat Users List Subject: Re: Console output in Tomcat Raj, This is what happens with Windows (i am not sure how is it in Linux environment). If using tomcat as a service, output goes to a log file stdout.log (it's defined by default in the service configuration) located in %tomcat_home%\logs folder. Along with that you will find sterr.log that has System.err.out(..) output. Vlad At 01:15 PM 12/31/2002 +0530, you wrote: Hi all, When I used Java Web Server, it ran in the console, and if I had a statement like System.out.println(someValue) in my servlet, I was able to see the output on the console. Where does all this output go in Tomcat? I am not able to see anything printed by System.out.println(). Thanks, Raj -- 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]
RE: Console output in Tomcat
Vlad, Yes you are right on that. When running as a service your output does get logged to those files but when trying to run Tomcat as an application it doesn't log the output. My comments in my previous mail were not to get into an argument of any sort. I take any words back if you felt anything like that. Cheers, Sumit Sumit, i am not trying to get into an argument and plus i haven't dealt with 4.1.12 (i checked both 4.0.6 and 4.1.18). The only difference is that i am talking about running tomcat as an NT service and if your System.out File and System.err File values are set in the service properties in the registry (they are there by default) then all of the System.err and System.out output is logged in the appropriate file. Again, i am not sure about non-NT service. cheers Vlad At 09:31 AM 12/31/2002, you wrote: Vlad, Unfortunately no. The output from System.err doesnt get logged not with Tomcat4.1.12. I had run in the same problem a couple of days before and the only alternative was to install cygwin and redirect the output to a file. Sumit -Original Message- From: Vladimer Shioshvili [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 8:37 AM To: Tomcat Users List Subject: Re: Console output in Tomcat Raj, This is what happens with Windows (i am not sure how is it in Linux environment). If using tomcat as a service, output goes to a log file stdout.log (it's defined by default in the service configuration) located in %tomcat_home%\logs folder. Along with that you will find sterr.log that has System.err.out(..) output. Vlad At 01:15 PM 12/31/2002 +0530, you wrote: Hi all, When I used Java Web Server, it ran in the console, and if I had a statement like System.out.println(someValue) in my servlet, I was able to see the output on the console. Where does all this output go in Tomcat? I am not able to see anything printed by System.out.println(). Thanks, Raj -- 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] Vladimer Shioshvili QRC Division of Macro International Inc. 7315 Wisconsin Avenue, Suite 400W Bethesda, MD 20814 Phone: (301) 657 3077 ext. 155 -- 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]
Reading property files from a package hierarchy in Tomcat4.1.12
Hi All, I am trying to read a property file from a package hierarchy. i.e. I have a service(that I don't have much control over) that reads a property file for a location such as com/sample/property/some.prop This worked fine when I was using Tomcat 3.3 but does not work with Tomcat4.1.12.Any ideas why?? and how should I go about solving the problem?? Regards, Sumit -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]