Re: Session Objects
Hi! Is it really necessary to hold all active session objects in a global variable? I can't imagine a situation that would require this! Tex Jagadeesha T wrote: Thanks for responding. To manage session between an apllication and web servers. Is there any way to get that worked in clustered enviornment? Thanks Jagga "Dale, Matt" <[EMAIL PROTECTED]> wrote: Yes it will, this won't work accross a cluster. You need to use the regular session manager. Is there any reason why you put the sessions in a singleton? Ta Matt -Original Message- From: Jagadeesha T [mailto:[EMAIL PROTECTED] Sent: 08 February 2005 17:25 To: tomcat-user@jakarta.apache.org Subject: Session Objects Hi all, I' am storing session objects in a SINGLEON class object to keep all active sessions. Does it give any problems in clustered enviornment since singleton is a static referrence. Regards, Jagga __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com Any opinions expressed in this E-mail may be those of the individual and not necessarily the company. This E-mail and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this E-mail in error and that any use or copying is strictly prohibited. If you have received this E-mail in error please notify the beCogent postmaster at [EMAIL PROTECTED] Unless expressly stated, opinions in this email are those of the individual sender and not beCogent Ltd. You must take full responsibility for virus checking this email and any attachments. Please note that the content of this email or any of its attachments may contain data that falls within the scope of the Data Protection Acts and that you must ensure that any handling or processing of such data by you is fully compliant with the terms and provisions of the Data Protection Act 1984 and 1998. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? All your favorites on one personal page – Try My Yahoo! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where is jmx.jar
JMX is now part of J2SE 5.0. Best regards, Tex Phillip Qin wrote: I am trying to build tomcat 5.5 manager app. Where can I find jmx.jar? It used to be in ${catalina.home}/bin. Regards, PQ Going to war for peace is like having sex for virginity - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get english messages on a German Windows-XP?
This system properties do not exist per default (that's why you have to set them if you want to change the default behaviour). See also: http://java.sun.com/j2se/corejava/intl/reference/faqs/index.html#set-default-locale Tex Zsolt Koppany wrote: Thank you for this interesting info but in javadoc for jvm-1.4.2 I found only the follow system properties: user.name User's account name user.home User's home directory user.dirUser's current working directory Zsolt -Original Message- From: Mario Winterer [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 6:30 PM To: Tomcat Users List Subject: Re: How to get english messages on a German Windows-XP? I think Java uses the Locale from your operating system. So to switch to english, you should either: + switch the locale of your operating system + tell Java to use another locale via system.properties at tomcat startup (jvm-property): -Duser.language= -Duser.country= -Duser.variant= e.g.: -Duser.language=en -Duser.country=US Best regards, Tex Zsolt Koppany schrieb: Hi, This is probably a java and not a tc question, but I would like to know how to get English java error messages when I start tc on a German windows XP box. Zsolt - 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: JTDS help
I do not think, jsp compilation is the problem - well, the first request will last long, but after the jsp is compiled, subsequent calls will not be remarkable slower than executing pure compiled servlet code. (Charles, I hope you did not measure the time for the first request only - which indeed includes compilation time, but for subsequent calls too). So to me opening the connection is the major problem. Because the code itself contains html-output, I think using jsp is quite ok. The code would be much cleaner, if Charles used the JSTL tag-library: <%@ page language="java"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %> <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql"; %> Best regards, Tex David Smith wrote: Ok. You're doing this in a jsp. That means Tomcat is: 1) Compiling your jsp to a servlet class. 2) Building a connection from scratch as opposed to picking up a pooled connection 3) Running the query. Of these, the first one is the most expensive operation followed by two. If you want fast, try doing this with a pooled connection and from compiled servlet code. --David Charles P. Killmer wrote: Network results Ping statistics for *.*.*.*: Packets: Sent = 140, Received = 140, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms Query Analyzer returns 85 rows in 0 seconds. I modified it to only return Name and ID and it still runs slow. So it cant be row size, network latency, hardware should be ruled out by the fact that it runs super fast through query analyzer, and PHP and ASP.NET. Its only when I write the code in JSP for Tomcat that it slows down. Charles -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 11:37 AM To: Tomcat Users List Subject: RE: JTDS help Hi, There's no real reason relating to Tomcat or jTDS that this would run slow. You are more likely to find answers with your hardware, network latency, database load or row size and other environmental factors. Allistair. -Original Message- From: Charles P. Killmer [mailto:[EMAIL PROTECTED] Sent: 07 February 2005 17:34 To: Tomcat Users List Subject: JTDS help I am trying to get Tomcat talking to my database quickly. This code takes about 2-3 seconds to load. Anyone got any idea's why? Or if you run this in your environment, how well does it run? <%@ page language="java" import="java.sql.*"%> <% Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://*.*.*.*:143 3/dbname;u ser=**;password=***"); Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs; rs = stmt.executeQuery("SELECT * FROM accounts"); out.println(""); String name; String ID; while (rs.next()) { name = rs.getString("Name"); ID = rs.getString("ID"); out.println("" + ID + ""+name+"" ); } out.println( "" ); conn.close(); %> This is just a JSP script, nothing is compiled. I know it is better to compile, but I am trying to chase down this DB slowness first. Charles Killmer Netgain Technology [EMAIL PROTECTED] Office: (320) 251-4700 ext 107 --- QAS Ltd. Developers of QuickAddress Software http://www.qas.com";>www.qas.com Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- - 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: JTDS help
I think the main time is spent on opening the database connection! So you better use connection pooling - then this expensive operation is just execute once (or at least not so often) Have a look at the Tomcat documentation (Section on JNDI-DataSources) Tex Charles P. Killmer wrote: I am trying to get Tomcat talking to my database quickly. This code takes about 2-3 seconds to load. Anyone got any idea's why? Or if you run this in your environment, how well does it run? <%@ page language="java" import="java.sql.*"%> <% Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://*.*.*.*:1433/dbname;u ser=**;password=***"); Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs; rs = stmt.executeQuery("SELECT * FROM accounts"); out.println(""); String name; String ID; while (rs.next()) { name = rs.getString("Name"); ID = rs.getString("ID"); out.println("" + ID + ""+name+"" ); } out.println( "" ); conn.close(); %> This is just a JSP script, nothing is compiled. I know it is better to compile, but I am trying to chase down this DB slowness first. Charles Killmer Netgain Technology [EMAIL PROTECTED] Office: (320) 251-4700 ext 107 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get english messages on a German Windows-XP?
I think Java uses the Locale from your operating system. So to switch to english, you should either: + switch the locale of your operating system + tell Java to use another locale via system.properties at tomcat startup (jvm-property): -Duser.language= -Duser.country= -Duser.variant= e.g.: -Duser.language=en -Duser.country=US Best regards, Tex Zsolt Koppany schrieb: Hi, This is probably a java and not a tc question, but I would like to know how to get English java error messages when I start tc on a German windows XP box. Zsolt - 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: [SOLVED] Form Auth + xml users database
Hi! I'm happy you could solve your problem now! Seems the reason was the missing Realm-definition in your context.xml. To Question 1) Tomcat offers a separate JNDI-namespace for each web application (so if you have 4 web applications you will have 4 namespaces). These namespaces are configured in the -elements of the corresponsing web-applications. To define resources, you have to nest a -element in your -element (which should be in context.xml). A resource that is defined in the namespace of a web application cannot be seen by other web applications (because the namespaces are separated from each other). Sometimes, a resource may be required by more than one web application. To avoid configuring this resource several times - once per context - tomcat offers another namespace that is global and exists only once per tomcat instance. If you define a resource there, you can use it in each web application, that is allowed to use it. So how can you allow a web application to use a global resource? Simply "link" the global resource into the local JNDI-namespace of the web-application! This can be done by nesting a element in the element of the web-application that should be allowed to use the resource. When defining a -element, you must specify, which global resource you want to link into the namespace (attribut "global"), which type the resource is that you want to link (attribut "type"), and which name it should have in the local namespace (attribut "name") - this name can be equal to the global name. So the server.xml and context.xml hierarchy could look like the following (sorry for the "text-art" - use a fixed width font for "best results"): +- Server | +- GlobalNamingResources | +- Resource GlobResA | +- Resource GlobResB | +- Service +- Engine +- Realm X +- Host www.A.org | +- Context /A1 (defined in context.xml) | | +- ResourceLink to GlobResA, name: LocResA | | | +- Context /A2 (defined in context.xml) | | +- ResourceLink to GlobResA, name: LocResA | | +- ResourceLink to GlobResB, name: LocResB | | | +- Context /A3 (defined in context.xml) | +- Resource, name LocalResA | +- Host www.B.org +- Context /B1 | +- ResourceLink to GlobResA, name: LocResA | +- Context /B2 +- ResourceLink to GlobResB, name: LocResB Question 2) If you do not want to change server.xml (e.g. because you want to deploy your application to a foreign server and you cannot modify server.xml there), you could define a local JNDI-Resource in the -element of your web-application instead of the GlobalNamingResource (simply move the resource-definition from into your -element). If you do this, of course you do not need the any more! So you do not have to touch server.xml because all configurations can be done inside context.xml which is in the meta-inf directory of your web application. I hope, my explanations where understandable! Best regards, Tex Omar Adobati wrote: changes in server.xml: === name="PhotoAlbum"/> factory org.apache.catalina.users.MemoryUserDatabaseFactory pathname conf/Catalina/photoalbum.localhost/photoalbum-users.xml === changes in [context].xml === === Question 1) Also if I've red the tomcat site docs I cant understand so good what ResourceLink does. Does anyone can explain me? Question 2) Using this approach I have changed the server.xml manually. So, if I need/want to deploy my own webapp using a war file, which approach I have to use? (I'm sorry fot my bad english...) On Sun, 6 Feb 2005 20:00:04 +0100, Omar Adobati <[EMAIL PROTECTED]> wrote: But did you "connect" the UserDatabase with the web-application by specifying a realm in your context? (context.xml or server.xml) How can I set the Realm in my Context to specity an xml database? (maybe this is the main problem because it actually not exist) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form Auth + xml users database
You are right! I'm sorry for any confusion! I thought is just for environment variables (similiar to env-entry). I should have read the docu to its end... ;-) Nevertheless, I think this resource reference is not required for servlet-security. Tex sven morales schrieb: Hi, It is not wrong to have that resource-env-ref within his web.xml. Look at the manager/WEB_INF/web.xml for a working application ("manager") and you will see exact elements. aka_sergio --- Mario Winterer <[EMAIL PROTECTED]> wrote: Hi again! I've noticed one thing in your configuration - but I do not know if this is the reason for your problem: Remove the entries from web.xml. You do not need a JNDI-reference to your user database here! (Apart from that this is wrong - it should be a -element instead.) Apart from that: You've specified a UserDatabase that holds your login-data. You've specified which resources of your web-application should be accessible by whom. But did you "connect" the UserDatabase with the web-application by specifying a realm in your context? (context.xml or server.xml) Best regards, Tex Omar Adobati schrieb: Good Morning, I'm trying to set up an authentication task using the form method and an xml files to store the users and their roles. Now, I've add this to the web.xml file: == [...] PhotoUsers org.apache.catalina.UserDatabase Photoalbum Security Constraints Photoalbum /controlPanel.jsp /photoUpload.jsp /login.jsp DELETE GET POST PUT photoalbum admin FORM PhotoUsers /login.jsp /error.jsp photoalbum admin [...] == then I've added the following lines to the between the context tag of the webapplication: == docBase="." relodable="true" privileged="true"> className="org.apache.catalina.valves.AccessLogValve" directory="logs/photoalbum/" fileDateFormat="-MM-dd" prefix="photoalbum_access_log." suffix=".txt"/> type="java.lang.Integer" name="simpleValue"/> type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" auth="Container" name="PhotoUsers"/> factory org.apache.catalina.users.MemoryUserDatabaseFactory pathname /photoalbum-users.xml == and I have putted the file photoalbum-users.xml in the same folder as the previous file. Now, this seems to not work... does' anyone can help me? Omar - 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] __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - 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: Form Auth + xml users database
Hi! So when you try to access one of the protected resources via browser, are these resources protected (I mean can you access them, or does tomcat redirect you to your login-page, or do you get a "access denied" page?) Tex Omar Adobati schrieb: I'm very sorry, "don't seems to work" mean that I can use the authentication procedure with the names I have stored in my xml database... this is what I mean saying that it's not works hope this should be more helpfully On Sun, 06 Feb 2005 18:43:45 +0100, Mario Winterer <[EMAIL PROTECTED]> wrote: Hi! What does "Now, this seems to not work..." mean??? Please go more into detai! We cannot tell you how to fix it if you do not tell us WHAT is going wrong! (e.g.: Tomcat can't start; Tomcat starts but web-app. can't start; Tomcat starts, webapp starts but you get exceptions each time you request your web-app; Everything fine but the specified resource is not secured; Everything fine and the specified resource is secured but even when I enter the correct username/password I can't access it; ...). Best regards, Tex Omar Adobati wrote: Good Morning, I'm trying to set up an authentication task using the form method and an xml files to store the users and their roles. Now, I've add this to the web.xml file: == [...] PhotoUsers org.apache.catalina.UserDatabase Photoalbum Security Constraints Photoalbum /controlPanel.jsp /photoUpload.jsp /login.jsp DELETE GET POST PUT photoalbum admin FORM PhotoUsers /login.jsp /error.jsp photoalbum admin [...] == then I've added the following lines to the between the context tag of the webapplication: == factory org.apache.catalina.users.MemoryUserDatabaseFactory pathname /photoalbum-users.xml == and I have putted the file photoalbum-users.xml in the same folder as the previous file. Now, this seems to not work... does' anyone can help me? Omar - 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: tutorial for fast settings of Tomcat
Hi! Adding a context.xml is a nice thing and every good web-application should have one, but it is not required if you just want to have a simple working web-application - you even do not need a web.xml!. All you need is a WEB-INF directory inside your context-directory. As soon as tomcat's auto-deploy-mechanism detects a WEB-INF directory, the manager-application displays the web-app ("available"-flag is "true"). Best regards, Tex sven morales schrieb: Hi, There is missing a step on Mario's response. You have to add a at $CATALINA_HOME/conf/server.xml or a separate context file ending in .xml to be located at $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. See this link: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html aka_sergio --- Mario Winterer <[EMAIL PROTECTED]> wrote: Hi! If you are already familiar with programming JSPs and you just want to know what you must do to set up a web-application that can handle JSPs - you're glad, because that is almost done. Have a look at the tomcat-docu at http://localhost/tomcat-docs/appdev/index.html In short: 1) create a directory below %TOMCAT_HOME%/webapps The directory you've created is the root-directory of your web-application's context. (For the next steps, I assume the name of the directory is "test".) 2) create a directory "WEB-INF" below %TOMCAT_HOME%/webapps/test This is the directory that contains all the settings of your web-application. That's it! Now you can put your jsp-files inside your web-application's context directory (%TOMCAT_HOME%/webapps/test) or any subdirectories except "WEB-INF". (This is the only directory, that is never accessible from outside). You do not need to restart Tomcat if auto-deploy is enabled (which is the default setting). You can access your files using a web browser via the url "http://:/test" (if you are sitting in front of the computer, tomcat is installed on and you use default installation without overriding the port: http://localhost:8080/test) 3) [optional] If your JSPs need any classes or libraries that are not part of the JDK or Tomcat/commons (e.g. self-written classes etc.), do the following: + put classes inside WEB-INF/classes/ + put libraries (.jar-files) inside WEB-INF/lib The WEB-INF/classes directory and every jar-file inside WEB-INF/lib will be in the scope of your web application's classloader. 4) [optional] If you want to have more control over your web-application, write a deployment descriptor: Create a file "web.xml" in %TOMCAT_HOME%/webapps/test/WEB-INF. (your deployment descriptor) 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"> Test application Test application Best regards, Tex P.M schrieb: Hi, I'm new to tomcat server for JSP and i'm reading for now a very huge book for knowing how to configure tomcat 5.x to make WEB JSP application works correctly. I would like to know if someone knows a good tutorial about tomcat because till now i just read 10 % of book in 2 days...and i would like to perform a little JSP test before 3 weeks (end of reading book) thx, Maileen __ Do you Yahoo!? All your favorites on one personal page Try My Yahoo! http://my.yahoo.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] __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail - 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: Form Auth + xml users database
Hi again! I've noticed one thing in your configuration - but I do not know if this is the reason for your problem: Remove the entries from web.xml. You do not need a JNDI-reference to your user database here! (Apart from that this is wrong - it should be a -element instead.) Apart from that: You've specified a UserDatabase that holds your login-data. You've specified which resources of your web-application should be accessible by whom. But did you "connect" the UserDatabase with the web-application by specifying a realm in your context? (context.xml or server.xml) Best regards, Tex Omar Adobati schrieb: Good Morning, I'm trying to set up an authentication task using the form method and an xml files to store the users and their roles. Now, I've add this to the web.xml file: == [...] PhotoUsers org.apache.catalina.UserDatabase Photoalbum Security Constraints Photoalbum /controlPanel.jsp /photoUpload.jsp /login.jsp DELETE GET POST PUT photoalbum admin FORM PhotoUsers /login.jsp /error.jsp photoalbum admin [...] == then I've added the following lines to the between the context tag of the webapplication: == factory org.apache.catalina.users.MemoryUserDatabaseFactory pathname /photoalbum-users.xml == and I have putted the file photoalbum-users.xml in the same folder as the previous file. Now, this seems to not work... does' anyone can help me? Omar - 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: Form Auth + xml users database
Hi! What does "Now, this seems to not work..." mean??? Please go more into detai! We cannot tell you how to fix it if you do not tell us WHAT is going wrong! (e.g.: Tomcat can't start; Tomcat starts but web-app. can't start; Tomcat starts, webapp starts but you get exceptions each time you request your web-app; Everything fine but the specified resource is not secured; Everything fine and the specified resource is secured but even when I enter the correct username/password I can't access it; ...). Best regards, Tex Omar Adobati wrote: Good Morning, I'm trying to set up an authentication task using the form method and an xml files to store the users and their roles. Now, I've add this to the web.xml file: == [...] PhotoUsers org.apache.catalina.UserDatabase Photoalbum Security Constraints Photoalbum /controlPanel.jsp /photoUpload.jsp /login.jsp DELETE GET POST PUT photoalbum admin FORM PhotoUsers /login.jsp /error.jsp photoalbum admin [...] == then I've added the following lines to the between the context tag of the webapplication: == factory org.apache.catalina.users.MemoryUserDatabaseFactory pathname /photoalbum-users.xml == and I have putted the file photoalbum-users.xml in the same folder as the previous file. Now, this seems to not work... does' anyone can help me? Omar - 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: tutorial for fast settings of Tomcat
Sorry, I've forgotten the first and basic step: 0) Install tomcat! ;-) Tex Mario Winterer schrieb: Hi! If you are already familiar with programming JSPs and you just want to know what you must do to set up a web-application that can handle JSPs - you're glad, because that is almost done. Have a look at the tomcat-docu at http://localhost/tomcat-docs/appdev/index.html In short: 1) create a directory below %TOMCAT_HOME%/webapps The directory you've created is the root-directory of your web-application's context. (For the next steps, I assume the name of the directory is "test".) 2) create a directory "WEB-INF" below %TOMCAT_HOME%/webapps/test This is the directory that contains all the settings of your web-application. That's it! Now you can put your jsp-files inside your web-application's context directory (%TOMCAT_HOME%/webapps/test) or any subdirectories except "WEB-INF". (This is the only directory, that is never accessible from outside). You do not need to restart Tomcat if auto-deploy is enabled (which is the default setting). You can access your files using a web browser via the url "http://:/test" (if you are sitting in front of the computer, tomcat is installed on and you use default installation without overriding the port: http://localhost:8080/test) 3) [optional] If your JSPs need any classes or libraries that are not part of the JDK or Tomcat/commons (e.g. self-written classes etc.), do the following: + put classes inside WEB-INF/classes/ + put libraries (.jar-files) inside WEB-INF/lib The WEB-INF/classes directory and every jar-file inside WEB-INF/lib will be in the scope of your web application's classloader. 4) [optional] If you want to have more control over your web-application, write a deployment descriptor: Create a file "web.xml" in %TOMCAT_HOME%/webapps/test/WEB-INF. (your deployment descriptor) 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"> Test application Test application Best regards, Tex P.M schrieb: Hi, I'm new to tomcat server for JSP and i'm reading for now a very huge book for knowing how to configure tomcat 5.x to make WEB JSP application works correctly. I would like to know if someone knows a good tutorial about tomcat because till now i just read 10 % of book in 2 days...and i would like to perform a little JSP test before 3 weeks (end of reading book) thx, Maileen __ Do you Yahoo!? All your favorites on one personal page – Try My Yahoo! http://my.yahoo.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tutorial for fast settings of Tomcat
Hi! If you are already familiar with programming JSPs and you just want to know what you must do to set up a web-application that can handle JSPs - you're glad, because that is almost done. Have a look at the tomcat-docu at http://localhost/tomcat-docs/appdev/index.html In short: 1) create a directory below %TOMCAT_HOME%/webapps The directory you've created is the root-directory of your web-application's context. (For the next steps, I assume the name of the directory is "test".) 2) create a directory "WEB-INF" below %TOMCAT_HOME%/webapps/test This is the directory that contains all the settings of your web-application. That's it! Now you can put your jsp-files inside your web-application's context directory (%TOMCAT_HOME%/webapps/test) or any subdirectories except "WEB-INF". (This is the only directory, that is never accessible from outside). You do not need to restart Tomcat if auto-deploy is enabled (which is the default setting). You can access your files using a web browser via the url "http://:/test" (if you are sitting in front of the computer, tomcat is installed on and you use default installation without overriding the port: http://localhost:8080/test) 3) [optional] If your JSPs need any classes or libraries that are not part of the JDK or Tomcat/commons (e.g. self-written classes etc.), do the following: + put classes inside WEB-INF/classes/ + put libraries (.jar-files) inside WEB-INF/lib The WEB-INF/classes directory and every jar-file inside WEB-INF/lib will be in the scope of your web application's classloader. 4) [optional] If you want to have more control over your web-application, write a deployment descriptor: Create a file "web.xml" in %TOMCAT_HOME%/webapps/test/WEB-INF. (your deployment descriptor) 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"> Test application Test application Best regards, Tex P.M schrieb: Hi, I'm new to tomcat server for JSP and i'm reading for now a very huge book for knowing how to configure tomcat 5.x to make WEB JSP application works correctly. I would like to know if someone knows a good tutorial about tomcat because till now i just read 10 % of book in 2 days...and i would like to perform a little JSP test before 3 weeks (end of reading book) thx, Maileen __ Do you Yahoo!? All your favorites on one personal page – Try My Yahoo! http://my.yahoo.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]
Re: order of creation of JNDI datasource from context.xml and Filter.init() using it
Hi Jeroen! Two weeks ago I (almost) exactly did what you want to do - make hibernate use a JNDI-DataSource defined as a GlobalNamingResource! The differences: My database is Oracle and I didn't configure hibernate directly because I use the spring-framework in between. I experienced problems similar than yours, but after cleaning out some "old" stuff it worked! Unfortunately, I do not know, what exactly the problem was, but I can give you some hints that may help you! Assuming you use Tomcat 5.5, do the following 1) Skip the "factory"-attribute in your Resource-definition! It is not required because tomcat has a built-in connection pool and automatically uses it for JNDI-DataSources. 2) Define your JNDI-DataSource in the GlobalNamingContext 3) The -element in meta-inf/context.xml must specify the name of the global resource (attribute "global") AND the name, the resource should have when linked into the lokal JNDI-context (attribute "name"). This (internal) name must match the name specified in your hibernate config! I guess that's what you got wrong! Your code: (You specified "My Database" as internal JNDI-name, but jdbc/mydb in hibernate.cfg.xml!!!) Better: (That matches the name you used in your hibernate.cfg.xml: "java:env/jdbc/mydb") 4) Remove the context-definition file in conf//. At deployment time, tomcat copies the context.xml file from the meta-inf-directory of your web-application into the conf//-directory (and renames it to avoid conflicts). 5) The PostgreSQL-driver must be in common/lib. Make sure it is NOT in WEB-INF/lib too! As I've said in top 3, I think the chief cause of your problem is the resourcelink-element! (Apart from that: I've seen you wrote your own HibernateSessionFilter. I also did that first, but then I decided to use the OpenSessionInViewFilter from the spring-framework instead. It works great! I'm sure your filter-implementation is not the cause of your problems, but maybe the spring-framework is interesting to you!) Best regards, Tex Jeroen Kransen schrieb: Hello, My problem is so basic that I have no doubt other people have experienced it. Still, I can't find any solutions on the web. I want Tomcat to provide my webapp with DataSources through JNDI. I want Hibernate to use these DataSources. Nothing exciting so far. I configured the BasicDataSourceFactory in the META-INF/context.xml like this: In the web.xml I put: HibernateSessionFilter nl.kransen.mywebapp.context.HibernateSessionFilter HibernateSessionFilter /* ... My database jdbc/mydb javax.sql.DataSource Container In the hibernate.cfg.xml I make a JNDI reference to the datasource: java:comp/env/jdbc/mydb net.sf.hibernate.dialect.PostgreSQLDialect true Now I created a HibernateSessionFilter that will filter any request to the webapp and provide it with a Hibernate Session. In the init() the Hibernate SessionFactory is configured by doing a lookup on JNDI for a DataSource. My problem is that Hibernate can't find the JNDI datasource: 17:44:14,745 INFO [nl.kransen.mywebapp.context.HibernateSessionFilter] Failed to initialize Hibernate! net.sf.hibernate.HibernateException: Could not find datasource: java:comp/env/jdbc/mydb Instead, I tried to put the Datasource in the of the server.xml. In the context.xml I put: The error I get then is: 20:31:09,550 WARN [net.sf.hibernate.cfg.SettingsFactory] Could not obtain connection metadata org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) Instead of initializing the Hibernate SessionFactory in the Filter's init() method, I do it the first time the doFilter() is called. Then I get a similar error: 20:42:35,324 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] Cannot open connection org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) ... Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59) at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:289) ... 54 more Caused by: java.lang.NullPointerException at java.util.StringTokenizer.(StringTokenizer.java:182) at org.postgresql.Driver.parseURL(Driver.java:251) at org.postgresql.Driver.acceptsURL(Driver.java:159) at java.sql.Driv
HTTPS: more than one certificate
Hi! Just because I'm interested: If I had more than one certificate in my keystore, which certificate would be used by tomcat for https? Is there a way to specify which certificate to use? Thanks, Tex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: virtualhost and deployment applications
Hi! I think, there's something wrong with your context-definition or server.xml. Make sure each of your hosts have a webapplication base directory for their own!!! Do not use one single webapps-directory for all of your hosts! My directory structure looks as follows: /Tomcat/hosts// Inside server.xml, where the hosts are defined, each host's appBase-attribute points to the correspoding host-directory. Apart from that: If your tomcat's auto-deploy feature is activated, you can deploy a web-application by simply copying the war file into your webapps-directory (or any other directory that you specified in server.xml). Best regards, Tex Carlos Gabriel Arce wrote: But when I deploy a local .war in the administration page www.domain1.com/manager/html this war gets replicated in other virtualhosts. Mario Winterer escribió: Of course! That's Tomcat's default behaviour - and in fact, it is difficult to make it behave different! Have a look at server.xml of your tomcat's default installation (you need a host-element for each virtual host). More information can be found at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/index.html. Best regards, Tex Carlos Gabriel Arce schrieb: Good Day I have a question. Is possible deploy an application per virtualhost, where the deployed applications per virtualhost could'nt see them each other? Thanks in advance. - 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: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory
Hi Greg, hi David! Sure, there is anoter factory you could use: The tomcat-built-in datasource factory. Unfortunately I do not know the classname of this factory, but I think it is somewhere in the library naming-factory-dbcp.jar which is located in common/lib. (The Tomcat-guys didn't want to add the complete jakarta-commons-pool and jakarta-commons-dbcp libraries because most of the classes inside these libraries are not needed by tomcat. So they extracted the required classes only and repacked them thogether with some other classes into naming-factory-dbcp.jar. To avoid confusions and errors, they also modified the package names - thats why you get a ClassNotFoundException when you configure the JNDI-context to use the "org.apache.commons.dbcp.BasicDataSourceFactory"). But I'm not sure if it is a good idea to extend one of those tomcat-internal datasource factories! This would REALLY tie your code close to tomcat! Apart from that: If you implement/extend an existing DataSource factory, you have to put your implementation inside the common/classes directory - otherwise tomcat won't find it when it initializes the JNDI-context! So why not put the commons-pool and commons-dbcp jars into common/lib too? So my suggestion: Extend BasicDataSourceFactory from commons-dbcp and put the two jars mentioned above into common/lib. Best regards, Tex Greg Guerin schrieb: Hi David, Mario, We actually specify the factory parameter because we extend the BasicDataSourceFactory so we can encrypt passwords in the resource definition. My question is: Is there already a way to do that using another factory I'm unaware of? It works fine, but we have to include the jars that Mario mentioned and it'd be nice to not have to tie our code that close to the container. Greg -----Original Message- From: Mario Winterer [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 4:37 PM To: Tomcat Users List Subject: Re: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory Hi David! I think, you do not need to explicitely define a bean factory because Tomcat 5 automatically uses dbcp for JNDI-DataSources (I think tomcat looks at the type of resource - in your case a javax.sql.DataSource - and uses the tomcat-internal dbcp-factory). In my project, I've configured a JNDI-DataSource using the Oracle thin driver and it works perfectly without specifying a bean factory and without adding any special libraries to my tomcat installation (apart from the oracle database driver which is in commons/lib). So try the following configuration: type="javax.sql.DataSource" maxActive="20" maxIdle="10" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" driverClassName="com.ibm.as400.access.AS400JDBCDriver" url="jdbc:as400://a53pb3;naming=system;libraries=,pgmdbt,caelib;errors=full" username="userid" password="password" /> Again: You do not need any additional commons-libraries! Best regards, Tex Hi Mario, Thanks for getting back to me. Below is the context I set up. After doing my own digging, I realized I was missing some jakarta commons jar files. After getting these jars and restarting Tomcat the ClassNotFoundExceptions went away. What I find really puzzling though is why I didn't get the same ClassNotFoundException on my local machine that was running the same version of Tomcat but on Windows XP profession. type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="10" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" driverClassName="com.ibm.as400.access.AS400JDBCDriver" url="jdbc:as400://a53pb3;naming=system;libraries=,pgmdbt,caelib;errors=full " username="userid" password="password"/> Mario Winterer <[EMAIL PROTECTED]> 02/02/2005 07:19 PM Please respond to "Tomcat Users List" To Tomcat Users List cc Subject Re: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory Hi! How did you define your JDBC DataSource? As far as I know, the original jakarta-commons-dbcp and jakarta-commons-pool-libraries are not included with Tomcat. Instead, just a subset of the required classes with modified package names (starting with 'org.apache.tomcat.dbcp') are packed in 'naming-factory-dbcp.jar' that can be found in commons/lib. But if you configure your JDBC DataSource correctly, this should not bother. Please post you
Re: Problem in war deployment
Hi Doug! I think eilnet.xml IS the context.xml file you mentioned! To Manoj: As Dough said, try the following: 1) Remove eilnet.xml from .../conf/{engine}/manoj.eilnet.effectsoft.local 2) Rename eilnet.xml to context.xml 3) Put it into your war-file (into the manifest directory) Make sure context.xml is configured correctly and that your context is not configured twice (e.g. in server.xml)! Best regards, Tex Parsons Technical Services wrote: Is there a reason you are using an external eilnet.xml with a war file? Do you have a context.xml in the war file? Are you sure the app is not running? If you find it is then Tomcat is trying to deploy it twice. There are some notes in the docs on this. Post the eilnet.xml and the context.xml(if exists). Also post the server.xml. Sounds like Tomcat is trying to deploy the app from the war file but the path info in the context element is wrong. Off the wall guess. Need to see the files. Doug - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Thursday, February 03, 2005 7:44 AM Subject: Problem in war deployment Hello all!, I am deploying my web application on tomcat5.0.27 using war. It is working fine when I deploy it first time. When I restart the tomcat it is unable to deploy the web application. I am using "deployOnStartup = true" in server.xml, according to the specification it should reploy it automatically. I am keeping eilnet.xml (eilnet is application name) and manager.xml file in $CATALINA_HOME/CONF/{ENGINE}/manoj.eilnet.effectsoft.local directory and war file is in /srv/vhosts/name/manoj.eilnet.effectsoft.local/webapps directory. It displays the following message, if some one knows the solution, please let us know : 2005-02-03 10:32:11 StandardContext[/manager]Manager: install: Installing web application at '/eilnet' from 'file:///vhome/manoj/vhosts/eilnet/webapps/eilnet.war' 2005-02-03 11:04:26 Have created expansion directory /srv/vhosts/name/manoj.eilnet.effectsoft.local/webapps/eilnet 2005-02-03 11:04:26 StandardHost[manoj.eilnet.effectsoft.local]: Error deploying application at context path null java.util.zip.ZipException: No such file or directory at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566) at org.apache.commons.digester.Digester.startElement(Digester.java:1276) at org.apache.catalina.util.CatalinaDigester.startElement(CatalinaDigester.java:65) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1567) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488) at org.apache.catalina.core.StandardHost.install(StandardHost.java:863) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:482) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:968) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) at org.apache.catalina.core.StandardService.start(StandardService.java:480) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) at org.apache.catalina.startup.Catalina.start(Catalina.java:556) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.start
Re: isUserInRole question
Hi Denny! Which Realm do you use in server.xml? What are your web.xml-settings? Please post your configurations!!! Tex Hello, Thanks for your reply. When I use IE to bring up the page I get a dialogbox asking for user name and password. If I put in a user name and password of a user on the workstation I can login. The page shows the correct user name and says that I have successfully logged in. But I get 2 false for the isUserInRole statements. I don't know why that is the case. Thanks. - Hi! I'm not sure, but I think your code is OK. The question is: How did you configure your security realm in web.xml and server.xml. (request.isUserInRole only works, if the user has already been authenticated against the web server.) Best regards, Tex Hello, I am trying to use isUserInRole in an app within Tomcat. The problem is that I consistently get false as the return regardless of what I pass in. I am using J2SE 1.4.2_06 and Tomcat 5.0. Here is the code and any help would be great: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class NtlmHttpAuthExample extends HttpServlet { public void doGet( HttpServletRequest req, HttpServletResponse resp ) throws IOException, ServletException { PrintWriter out = resp.getWriter(); resp.setContentType( "text/html" ); out.println( "NTLM HTTP Authentication Example" ); out.println( "NTLM HTTP Authentication Example" ); out.println( req.getRemoteUser() + " successfully logged in" ); out.println(req.isUserInRole("admin")); out.println("-"); out.println(req.isUserInRole("Administrators")); out.println( "Please submit some form data using POST" ); out.println( "" ); out.println( "" ); out.println( "" ); out.println( "" ); out.println( "field1 = " + req.getParameter( "field1" )); out.println( "" ); } public void doPost( HttpServletRequest req, HttpServletResponse resp ) throws IOException, ServletException { doGet( req, resp ); } } - 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 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory
Hi David! I think, you do not need to explicitely define a bean factory because Tomcat 5 automatically uses dbcp for JNDI-DataSources (I think tomcat looks at the type of resource - in your case a javax.sql.DataSource - and uses the tomcat-internal dbcp-factory). In my project, I've configured a JNDI-DataSource using the Oracle thin driver and it works perfectly without specifying a bean factory and without adding any special libraries to my tomcat installation (apart from the oracle database driver which is in commons/lib). So try the following configuration: type="javax.sql.DataSource" maxActive="20" maxIdle="10" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" driverClassName="com.ibm.as400.access.AS400JDBCDriver" url="jdbc:as400://a53pb3;naming=system;libraries=,pgmdbt,caelib;errors=full" username="userid" password="password" /> Again: You do not need any additional commons-libraries! Best regards, Tex Hi Mario, Thanks for getting back to me. Below is the context I set up. After doing my own digging, I realized I was missing some jakarta commons jar files. After getting these jars and restarting Tomcat the ClassNotFoundExceptions went away. What I find really puzzling though is why I didn't get the same ClassNotFoundException on my local machine that was running the same version of Tomcat but on Windows XP profession. type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="10" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" driverClassName="com.ibm.as400.access.AS400JDBCDriver" url="jdbc:as400://a53pb3;naming=system;libraries=,pgmdbt,caelib;errors=full" username="userid" password="password"/> Mario Winterer <[EMAIL PROTECTED]> 02/02/2005 07:19 PM Please respond to "Tomcat Users List" To Tomcat Users List cc Subject Re: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory Hi! How did you define your JDBC DataSource? As far as I know, the original jakarta-commons-dbcp and jakarta-commons-pool-libraries are not included with Tomcat. Instead, just a subset of the required classes with modified package names (starting with 'org.apache.tomcat.dbcp') are packed in 'naming-factory-dbcp.jar' that can be found in commons/lib. But if you configure your JDBC DataSource correctly, this should not bother. Please post your resource-configuration! Best regards, Tex I'm running Tomcat 5.5.4 on Windows 2000 Server and encountered the below error on Tomcat startup: Feb 2, 2005 10:50:49 AM org.apache.catalina.core.NamingContextListener addResource WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory, ClassNotFoundException:org.apache.commons.dbcp.BasicDataSourceFactory My webapp uses JDBC DataSource's and the BasicDataSourceFactory for pooling so this problem of "ClassNotFoundException" is causing my webapp to not work properly. I have Tomcat 5.5.4 also installed on my local maching which has Windows XP on it, and there is absolutely no problem on startup and and my webapp. Does anyone no what's happening here? Why does Tomcat register the BasicDataSourceFactory with no problems in Tomcat 5.5.4 on Windows XP and not on Windows 2000 Server? - 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: virtualhost and deployment applications
Of course! That's Tomcat's default behaviour - and in fact, it is difficult to make it behave different! Have a look at server.xml of your tomcat's default installation (you need a host-element for each virtual host). More information can be found at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/index.html. Best regards, Tex Carlos Gabriel Arce schrieb: Good Day I have a question. Is possible deploy an application per virtualhost, where the deployed applications per virtualhost could'nt see them each other? Thanks in advance. - 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: Accessing static variable from different webapps
For more information on tomcat's classloading concept have a look at: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html As you can see there, Tomcat instantiates a classloader for each web application. So if you put a class - let's say "Global" - inside the "WEB-INF/classes" directory of each of two of your web applications, it will be loaded twice. As a fact, a static variable of the "Global" class - let's say Global.myVar - will exist twice too! But if you put your "Global" class into the %TOMCAT_HOME%/shared/classes directory ONLY (important: you must remove all occurences of your "Global" class from the webapps-classes directories to make this work!), it will be loaded by the "shared"-classloader. Because of the fact that the shared classloader is the parent classloader of all webapp-classloaders, every web-application can access the classes loaded by the shared classloader. But holding resources in static variables inside the shared/classes directory there is not recommmended! Better add a JNDI-resource to your Tomcat's JNDI-context! This is done in server.xml inside the -element* *(see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/globalresources.html). Best regards, Tex Thanks for your reply. I think JVM rules said that there should be 1 reference per JVM for a static variable. Tomcat class loader creates separate instance of a static variable for each webapps. I am just trying to understand how class loader works in tomcat. Thanks, Anshaj On Thu, 03 Feb 2005 06:41:29 -0500, Tim Funk <[EMAIL PROTECTED]> wrote: Put the class in the common or shared classloader. -Tim Anshaj Mathur wrote: Dear group, I have public class which contains a static variable type integer. I am running different webapps inside single instance of tomcat. I initiated this class in different webapps. I increased the count from a webapp and tried to see it from different webapp. I found that count was not increased in other webapp. It was showing the original count. Am I braking any laws of tomcat security. - 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: Hiding resources
Thanks David, I think, your second suggestion will not work, because it is not possible to map a servlet or filter to "*/CVS/*". According to the servlet-specs, only filters of the form "anything/*" or "*.extension" are supported (and I really do not want to add a servlet-mapping for every single CVS directory). I've already thought on a filter using regular expressions for filtering out certain requests. But I'm not sure if this is secure enough. Just think of "modified" request-urls using hex numbers for escaping ascii characters (e.g. ".../%43VS/..." instead of ".../CVS/..."). Are those urls normalized by tomcat, i.e. does request.getRequestURL() return ".../CVS/..." in both cases? Tex Just a thought or two -- 1) Setup a request filter that detects when the URL contains the pattern CVS/ and redirects to a default or error page. -or- 2) Setup a servlet mapping for any of the potential CVS URLs and have them map to a servlet that responds with an error or redirect. --David Mario Winterer wrote: Thanks for your and Nix' advice - I know that what I do is not the clean and nice approach. If I were you, I'd challenge my solution too! But: In fact - we do have local CVS sandboxes on the development PCs - and we do have a separate development webserver for testing. And we do use this system when we are developing, testing and bugfixing our web application. But while we are developing, several people need to maintain static resources. Not a big thing, just updating a handful of HTML pages. To make things easier this changes are done directly on the "real" webserver (please do not challenge that - this approach is OK for us). By using CVS on the "real" webserver, we kill two birds with one stone: 1) The static content is versioned 2) By using branches, we can easily merge the content of the "real" server (the HEAD-branch) and the development version (the development-branch) from time to time. All that without a big deployment process (that makes it difficult for the handful of people that just want to do some minor updates of their web pages). So our CVS solution is the best one for our needs - I think. But back to my question: Is there a (good and secure) way to protect my CVS resources? Best regards, Tex How about doing your development in a different area, and do your your deployment via export? You could also frontend your Tomcat wtih Apache and deny access with Apache. Just a couple of random thoughts . . . /mde/ __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail - 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: AW: Login filter
Hi Ben! You cannot hook in the login validation process without touching tomcat code. But usually, this is not necessary. Just write a filter and map it to "/" - every request will be directed to your filter - except requests to "j_security_check". But this should not bother you, because your filter will be invoked right after a successful login process. Inside your filter code, check if a certain session-attribute is set. If not, it is the first time after session creation that your filter is called. If this is the case, do whatever you intend to do and set the session-attribute to ensure that your code is only run once. In pseudo-code (inside your filter's doFilter()-method): if (request.getRemoteUser() == null) { // user is not logged in: clear session attribute if set session.removeAttribute("login"); } else if (session.getAttribute("login") == null) { // user is logged in but this filter has not been called since // set the session attribute to avoid that the "special code" above is called twice: session.setAttribute("login", "true"); } Best regards, Tex Hi Tim, Apologies for hassling you again with this. Any idea without getting inside of the TC source, how I can write some code just b4 and after the user login validation into the webapp with using the TC Realm and j_security_check ?? or must I go inside of the source :-( regards Ben p.s. I got this idea from a ibm websphere help doc, where it is possible ! -Ursprungliche Nachricht- Von: Tim Funk [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 3. Februar 2005 12:41 An: Tomcat Users List Betreff: Re: Login filter Filters cannot be run on j_security_check. -Tim Ben Bookey wrote: Dear List, I would like to perform an action after the user logs in to our app. We are using the tomcat Realm security model, with an Oracle database. So therefoer I am trying to implement a filter in Tomcat 4.1.27, which checks for all requests on the url /j_security_check I know my filter is initialised because I do a out.println to a logfile. But for some reason when I do a successful login it doesnt perform the doFilter() method, so I suspect its something to with the mapping below. Any hints? regards '=== Here is the entry to the web.xml LoginFilter Performs pre-login and post-login operation com.myorg.myapp.filter.LoginFilter LoginFilter /j_security_check '=== == - 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: Hiding resources
Thanks for your and Nix' advice - I know that what I do is not the clean and nice approach. If I were you, I'd challenge my solution too! But: In fact - we do have local CVS sandboxes on the development PCs - and we do have a separate development webserver for testing. And we do use this system when we are developing, testing and bugfixing our web application. But while we are developing, several people need to maintain static resources. Not a big thing, just updating a handful of HTML pages. To make things easier this changes are done directly on the "real" webserver (please do not challenge that - this approach is OK for us). By using CVS on the "real" webserver, we kill two birds with one stone: 1) The static content is versioned 2) By using branches, we can easily merge the content of the "real" server (the HEAD-branch) and the development version (the development-branch) from time to time. All that without a big deployment process (that makes it difficult for the handful of people that just want to do some minor updates of their web pages). So our CVS solution is the best one for our needs - I think. But back to my question: Is there a (good and secure) way to protect my CVS resources? Best regards, Tex How about doing your development in a different area, and do your your deployment via export? You could also frontend your Tomcat wtih Apache and deny access with Apache. Just a couple of random thoughts . . . /mde/ __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail - 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]
Hiding resources
Hi! I'm running a web application that is under CVS, which means my web application contains a lot of CVS-related directories (for the CVS-metadata). Is there a possibility to tell Tomcat to hide or protect all those "CVS" directories? More general, what I need is a way to hide/protect all files or directories with the name pattern "*/CVS/*". As far as I know, neither a servlet/filter-mapping nor a security constraint support this type of pattern (with two wildcards). So I think, the only way to protect my resources is to implement a custom filter that is mapped against "/" and checks every incoming request. Is there a better approach? Best regards, Tex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory
Hi! How did you define your JDBC DataSource? As far as I know, the original jakarta-commons-dbcp and jakarta-commons-pool-libraries are not included with Tomcat. Instead, just a subset of the required classes with modified package names (starting with 'org.apache.tomcat.dbcp') are packed in 'naming-factory-dbcp.jar' that can be found in commons/lib. But if you configure your JDBC DataSource correctly, this should not bother. Please post your resource-configuration! Best regards, Tex I'm running Tomcat 5.5.4 on Windows 2000 Server and encountered the below error on Tomcat startup: Feb 2, 2005 10:50:49 AM org.apache.catalina.core.NamingContextListener addResource WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory, ClassNotFoundException:org.apache.commons.dbcp.BasicDataSourceFactory My webapp uses JDBC DataSource's and the BasicDataSourceFactory for pooling so this problem of "ClassNotFoundException" is causing my webapp to not work properly. I have Tomcat 5.5.4 also installed on my local maching which has Windows XP on it, and there is absolutely no problem on startup and and my webapp. Does anyone no what's happening here? Why does Tomcat register the BasicDataSourceFactory with no problems in Tomcat 5.5.4 on Windows XP and not on Windows 2000 Server? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cross-context
In Tomcat 5.x, you can define the default settings for application contexts in %TOMCAT_HOME%/conf/context.xml. (I'm not sure if Tomcat versions prior to 5.x support this.) Best regards, Tex Tomcat Users - We are distributing a servlet application that relies on the application's element's 'cross-context' attribute to be set to 'true'. Is it possible to set the 'cross-context' in the application's web.xml? This would simplify the configuring of this application for clients as the value could come already configured. Eric Murphy Software Developer (NFIS) [EMAIL PROTECTED] tel/tél: 250-363-6038 fax / télécopieur 250-363-6004 Natural Resources Canada Pacific Forestry Centre 506 West Burnside Road Victoria BC V8Z 1M5 Ressources naturelles Canada Centre de foresterie du Pacifique 506 rue Burnside ouest Victoria, Colombie-Britanique V8Z 1M5 - 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: idle connections
Hi! the parameter "maxIdle" is the maximum number of idle connections that can retain in the pool. That means it is ok for the pool to have 50 connections waiting for usage - you told him to do so! So what different behaviour did you expect? Best regards, Tex Hey, wondering if someone could help me out on this. I'm using: Tomcat 5 RedHat Oracle 9i I'm using jdbc and dbcp connection pooling and am trying to tune my app for more scalability. I have my maxActive set to 0 (infinite) and my maxIdle set to 50. When I load test and then look at oracle statistics I find out that there are exactly 50 connections just sitting there inactive. After waiting 2 days they don't go away. I have the removeAbandonded params set to true and 60 seconds but its not "reclaiming" (which I take to mean eliminating) those "inactive" connections. Can someone help me figure out what's going on? - 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: isUserInRole question
Hi! I'm not sure, but I think your code is OK. The question is: How did you configure your security realm in web.xml and server.xml. (request.isUserInRole only works, if the user has already been authenticated against the web server.) Best regards, Tex Hello, I am trying to use isUserInRole in an app within Tomcat. The problem is that I consistently get false as the return regardless of what I pass in. I am using J2SE 1.4.2_06 and Tomcat 5.0. Here is the code and any help would be great: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class NtlmHttpAuthExample extends HttpServlet { public void doGet( HttpServletRequest req, HttpServletResponse resp ) throws IOException, ServletException { PrintWriter out = resp.getWriter(); resp.setContentType( "text/html" ); out.println( "NTLM HTTP Authentication Example" ); out.println( "NTLM HTTP Authentication Example" ); out.println( req.getRemoteUser() + " successfully logged in" ); out.println(req.isUserInRole("admin")); out.println("-"); out.println(req.isUserInRole("Administrators")); out.println( "Please submit some form data using POST" ); out.println( "" ); out.println( "" ); out.println( "" ); out.println( "" ); out.println( "field1 = " + req.getParameter( "field1" )); out.println( "" ); } public void doPost( HttpServletRequest req, HttpServletResponse resp ) throws IOException, ServletException { doGet( req, resp ); } } - 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: sharing session across s
Hi! Do you want to share some kind of global variables or session information? Global variables should exist only once while session information is stored for each user (to be more correct: for each user-session). I think you want to share session-information, but using a class-variable from a class that is loaded by the shared-classloader is nothing else but sharing a global variable. So if you really want to do that: Your solution might work, but it is not recommended. I think using a directory service is the better way! Tomcat has a built-in JNDI context where you can put such global things. (For more information have a look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html). But as I said: All you do is sharing global information that exists only once! Best regards, Tex So... If I create some class, SessionHolder.java, compile it (SessionHolder.class) and put it in shared/lib, I could then set variables and then retrieve them from this class? Charlie Caldarale, Charles R said the following on 2/2/2005 5:00 PM: From: Mark Winslow [mailto:[EMAIL PROTECTED] Subject: Re: sharing session across s I imagine creating a static variable would be global to the JVM. Not quite. It's global to the classloader, not the JVM. Since each web app has its own classloader, you would have to put such a class in a location serviced by a more global loader, such as shared/lib. Now, of course, you've introduced dependency issues... - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - 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: compiling and deployment in tomcat
Hi, it is not possible to make Tomcat automatically compile and deploy your servlets. Usually this is not necessary. If you use a good IDE, it is no great effort to compile your servlets. Deployment could be done by using an Ant script - just copy the servlet-binaries in the correct directory and reload your web application (if auto-reloading is disabled). The required Ant-tasks are included in the tomcat binaries. The entry in web.xml must be done by hand, but you have to do that just once. So the cases where auto-compile and -deploy are required are really rare! Best regards, Tex Hi, I've just installed Tomcat 5.5 and I have two main doubts and I hope someone may help me. 1. Do I really have to compile a servlet manually using javac (or using another tool) or may I save it in a specific folder so Tomcat compiles it to me? 2. Do I really have to register my servlets in web.xml file or this process can be done automatically by Tomcat? When I did the test with jsp pages, it was not necessary compile or register the file (Tomcat did everything to me) so I expect the same with servlets. Thanks, Julio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]