Tomcat and SapDB
I am trying to configure Tomcat 4.0.4 and SapDB JDBCRealm In server.xml file I write these lines: Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=com.sap.dbtech.jdbc.DriverSapDB connectionURL=jdbc:sapdb:database?user=usr;password=psw userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name / but I get error: Catalina.start: LifecycleException: Exception opening database connection: com.sap.dbtech.jdbc.exceptions.SQLExceptionSapDB: no password given Can anybody help me? Thanx. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
new to tomcat
hello I am very new to Tomcat4.0. I have successfully installed tomcat4.0 on my machine but can not able to run simple HelloWorld.jsp file. I have put it in folder C:\Tomcat4.0\webaaps\TestJSP\Helloworld.jsp On brower .. http://localhost:8080/TestJSP/Helloworld.jsp My O.S is windows 2000 professional i have JDK1.3 installed. Can anyone help me Regards Amit Luktuke
Re: new to tomcat
Possibly : You should have called the dir webapps not webaaps Although this is probably just a typo in your email :) Amit Luktuke wrote: hello I am very new to Tomcat4.0. I have successfully installed tomcat4.0 on my machine but can not able to run simple HelloWorld.jsp file. I have put it in folder C:\Tomcat4.0\webaaps\TestJSP\Helloworld.jsp webapps On brower .. http://localhost:8080/TestJSP/Helloworld.jsp My O.S is windows 2000 professional i have JDK1.3 installed. Can anyone help me Regards Amit Luktuke -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: new to tomcat
Hello Ben.. That was my type error only.. I have created HelloWorld.jsp compile it When i put it in ROOT folder of Tomcat4.0 view in browse .. http://localhost:8080/HelloWorld.jsp it works. But when i create TESTJSP directory under Tomcat4.0 - webapps --- TESTJSP --- HelloWorld.jsp try to view in browser .. http://localhost:8080/TESTJSP/HelloWorld.jsp it gives error saying HTTP 404 error .. requested resources are not available.. Can u tell me what type of error is it? regards Amit Luktuke - Original Message - From: Ben Walding [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Saturday, August 10, 2002 1:40 PM Subject: Re: new to tomcat Possibly : You should have called the dir webapps not webaaps Although this is probably just a typo in your email :) Amit Luktuke wrote: hello I am very new to Tomcat4.0. I have successfully installed tomcat4.0 on my machine but can not able to run simple HelloWorld.jsp file. I have put it in folder C:\Tomcat4.0\webaaps\TestJSP\Helloworld.jsp webapps On brower .. http://localhost:8080/TestJSP/Helloworld.jsp My O.S is windows 2000 professional i have JDK1.3 installed. Can anyone help me Regards Amit Luktuke -- 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]
Newbie to Tomcat on IIS
hi all I am new to tomcat 4.04 has installed tomcat on Win NT 4.0 with IIS. Want to know a few things 1.Is in necessary to deploy your website under the Webapps directory. 2.My directory name is intranet' so what will be the context. and what all I need to change. so that JSP and Beans are configured Please help me I am unable to grasp from the docs. if any one can give me the step by step help I would me very grateful. Thanks Regards Vishal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: new to tomcat
Amit Luktuke wrote: hello I am very new to Tomcat4.0. I have successfully installed tomcat4.0 on my machine but can not able to run simple HelloWorld.jsp file. I have put it in folder C:\Tomcat4.0\webaaps\TestJSP\Helloworld.jsp You must register your application in file c:\Tomcat4.0\conf\server.xml by adding such line: Context path=/TestJSP docBase=TestJSP debug=0 reloadable=true / or read this manual: http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html On brower .. http://localhost:8080/TestJSP/Helloworld.jsp My O.S is windows 2000 professional i have JDK1.3 installed. Can anyone help me Regards Amit Luktuke -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: help with data insertion on postgresql on tomcat4/apache2
Error messages, please. Paul Dear Paul, Thanks for your consideration, please find attached the text file that is used to generate the jsp I am having problems with. It is saved as updateTREES.jsp in the tomcat4 /examples/jsp directory of machine with jdk1.4/Apache2/Tomcat4.04 The problem seems to be with line 35 namely:- Enumeration parameters = request.getParameterNames(); When trying to execute the jsp from http://host/examples/jsp/updateTREES.jsp The error reported in Konqueror and Mozilla browser is as folows: /opt/tomcat4/work/Standalone/localhost/examples/jsp/updateTrees$.jsp.java:62 Class org.apache.jsp.Enumeration not fount Enumeration parameters = request.getParameterNames(); ^ 1 error, 1 warning If you could provide some help it would be appreciated. regards sibu On Saturday 10 August 2002 02:47, Paul Yunusov wrote: On Friday 09 August 2002 10:59 pm, sibusiso xolo wrote: Greetings, I am using tomcat4.04 on SuSE8/postgresql7.2.1 with source compiled jdbc driver. I am able to do SELECTS and other queries on database tables (with jsp and servlets) but unable to do data UPDATES and INSERTS.. . Help would be appreciated. regards sibu Error messages, please. Paul // to be saved as updateTrees.jsp with html tag HTML HEADTITLEUsing a jsp to Update a pgsql database table/TITLE/HEAD BODY (PUpdata Database Table Content FORM ACTION=updateTrees.jsp method = Post Tree_Name: INPUT TYPE = TEXT NAME =tree_nameParamBR Average_Height_metres: INPUT TYPE = TEXT NAME =av_height_mParamBR Average_Diameter_cm: INPUT TYPE = TEXT NAME =av_diameter_cmParamBR Average_Lifespan_years: INPUT TYPE = TEXT NAME =av_lifespan_yrsParamBR Found_in: INPUT TYPE = TEXT NAME =found_inParamBR /FORM HR P The TREES table contents: Table Border = 1 Cellpadding=0 CELLSPACING=0 TRTDTreeName/TD TDAverage_Height_metres/TD TDAverage_Diameter_cm/TD TDAverage_Lifespan_yrs/TD TDFound_in/TD/TR % Class.forName(org.postgresql.Driver); java.sql.Connection connection = java.sql.DriverManager.getConnection(jdbc:postgresql://limpopo.b-lux.balls:5432/database,user,password); java.sql.Statement statement = connection.createStatement(); Enumeration parameters = request.getParameterNames(); if(parameters.hasMoreElements()) { String Tree_NameValue = request.getParameter(tree_nameParam); String Average_Height_metresValue = request.getParameter(av_height_mParam); String Average_diameter_cmValue = request.getParameter(av_diameter_cmParam); String Average_Lifespan_yrsValue = request.getParameter(av_lifespan_yrsParam); String Found_inValue = request.getParameter(found_inParam); statement.executeUpdate(INSERT INTO TREES(Tree_Name, Average_Height_metres, Average_Diameter_cm, Average_Lifespan_yrs, Found_in ) VALUES (Tree_NameValue, Average_Height_metresValue, Average_diameter_cmValue, Average_Lifespan_yrsValue, Found_inValue ) ); } java.sql.ResultSet columns = statement.executeQuery( SELECT * from TREES); while (columns.next()) { String Tree_Name = columns.getString(tree_name); String Average_Height_metres = columns.getString(av_height_m); String Average_Diameter_cm = columns.getString(av_diameter_cm); String Average_Lifespan_yrs = columns.getString(av_lifespan_yrs); String Found_in = columns.getString(found_in); % TR TD %= Tree_Name % /TD TD %= Average_Height_metres % /TD TD %= Average_Diameter_cm % /TD TD %= Average_Lifespan_yrs % /TD TD %= Found_in % /TD /TR % } % /TABLE /BODY /HTML -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: new to tomcat
Hello Marius Thank u very much.. I am developing web application from scratch using tomcat/stuts... will need ur help from time to time.. regards Amit - Original Message - From: Marius Urbietis [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Saturday, August 10, 2002 4:51 PM Subject: Re: new to tomcat Amit Luktuke wrote: hello I am very new to Tomcat4.0. I have successfully installed tomcat4.0 on my machine but can not able to run simple HelloWorld.jsp file. I have put it in folder C:\Tomcat4.0\webaaps\TestJSP\Helloworld.jsp You must register your application in file c:\Tomcat4.0\conf\server.xml by adding such line: Context path=/TestJSP docBase=TestJSP debug=0 reloadable=true / or read this manual: http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html On brower .. http://localhost:8080/TestJSP/Helloworld.jsp My O.S is windows 2000 professional i have JDK1.3 installed. Can anyone help me Regards Amit Luktuke -- 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: help with data insertion on postgresql on tomcat4/apache2
On Saturday 10 August 2002 08:27 am, you wrote: Error messages, please. Paul Dear Paul, Thanks for your consideration, please find attached the text file that is used to generate the jsp I am having problems with. It is saved as updateTREES.jsp in the tomcat4 /examples/jsp directory of machine with jdk1.4/Apache2/Tomcat4.04 The problem seems to be with line 35 namely:- Enumeration parameters = request.getParameterNames(); When trying to execute the jsp from http://host/examples/jsp/updateTREES.jsp The error reported in Konqueror and Mozilla browser is as folows: /opt/tomcat4/work/Standalone/localhost/examples/jsp/updateTrees$.jsp.java:6 2 Class org.apache.jsp.Enumeration not fount Enumeration parameters = request.getParameterNames(); ^ 1 error, 1 warning If you could provide some help it would be appreciated. regards sibu Use java.util.Enumeration instead of Enumeration. You can also import this interface using a page directive. Paul -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Tomcat and IIS
Hi all, please I hear you can run tomcat on iis, but that one needs a couple of dll's can any one tell where i can get these dynamic link libraries and how to install them, i have a couple of web apps that i have tested and tried on other servlet/jsp enable servers now the problem is how to mIgrate them to my clients IIS Scenario: run jsp and servlets on IIS 5.0 on win2000 OS thanks in advance yours Edward Banfa Afrione Nigeria Ltd - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs
Re: help with data insertion on postgresql on tomcat4/apache2
Use java.util.Enumeration instead of Enumeration. You can also import this interface using a page directive. Paul Thanks a millionm it worked first time. On Saturday 10 August 2002 12:16, Paul Yunusov wrote: On Saturday 10 August 2002 08:27 am, you wrote: Error messages, please. Paul Dear Paul, Thanks for your consideration, please find attached the text file that is used to generate the jsp I am having problems with. It is saved as updateTREES.jsp in the tomcat4 /examples/jsp directory of machine with jdk1.4/Apache2/Tomcat4.04 The problem seems to be with line 35 namely:- Enumeration parameters = request.getParameterNames(); When trying to execute the jsp from http://host/examples/jsp/updateTREES.jsp The error reported in Konqueror and Mozilla browser is as folows: /opt/tomcat4/work/Standalone/localhost/examples/jsp/updateTrees$.jsp.java :6 2 Class org.apache.jsp.Enumeration not fount Enumeration parameters = request.getParameterNames(); ^ 1 error, 1 warning If you could provide some help it would be appreciated. regards sibu Use java.util.Enumeration instead of Enumeration. You can also import this interface using a page directive. Paul -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Fwd: Re: help with data insertion on postgresql on tomcat4/apache2
Use java.util.Enumeration instead of Enumeration. You can also import this interface using a page directive. Paul On Saturday 10 August 2002 10:39 am, sibusiso xolo [EMAIL PROTECTED] wrote: Thanks a millionm it worked first time. I would be gratrful for more info (on or off list) on how the page directive is used if you have the time. This is really off-topic for this list. Check the J2EE tutorial at http://java.sun.com/j2ee/tutorial/ Paul Note: please reply directly to the list. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Default context
Hi. I'm having a problem with my Tomcat-4.0.4 running on solaris. I want Tomcat to create a default context for every user who has a .public_dw3/tomcat in their home dir. To accomplish that, I have edited server.xml and added the following lines in the host-tag: Listener className=org.apache.catalina.startup.UserConfig directoryName=.public_dw3/tomcat homeBase=/user/ userClass=org.apache.catalina.startup.HomesUserDatabase/ DefaultContext reloadable=true /DefaultContext This works to a certain extend. That is, if a user has the mentioned directories in his home dir when Tomcat is launched, then he will get a default context and everything is right. If a user adds the directories when Tomcat is running, then they will not get a context - thus I am forced to restart Tomcat every time this happens. Can anyone please help? Thanks in advance, Henrik -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Command line jspc throws NPE for page using JSTL
From the original note: Here's index.jsp: %@ page language=java % %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % html headtitleJSPC Test/title/head bodyh1Welcome to the JSPC test page/h1/body /html Here's web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list /web-app All I'm doing is referencing the taglib URI in the directive. Jasper should be doing the work of generating the path through an implicit taglib map entry, right? This does work when the app is actually run within a container. Here are some of the args passed to the TagLibraryInfoImpl constructor: prefix: c uriIn:http://java.sun.com/jstl/core location: { /WEB-INF/lib/standard.jar, META-INF/c.tld } And here's the test that causes the leading / to get stripped (path = location[0] = /WEB-INF/lib/standard.jar): if (ctxt.getClassLoader() != null URLClassLoader.class.equals(ctxt.getClassLoader().getClass()) path.startsWith(/)) Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Kris Schneider wrote: Date: Fri, 09 Aug 2002 23:11:48 -0400 From: Kris Schneider [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Command line jspc throws NPE for page using JSTL I mucked around with the Jasper source a bit to get some exception info dumped: java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not start with '/' Have you verified that your application's use of the path to the taglib URL, in web.xml or in a %@ taglib % directive of a JSP page, do not use this kind of invalid reference? Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ smime.p7s Description: S/MIME Cryptographic Signature
RE: Tomcat and IIS
Instructions and files can be located here. http://www.getnet.net/~rbarr/TomcatOnIIS/default.htm - Andrew -Original Message- From: ed banfa [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 10, 2002 9:11 AM To: Tomcat Users List Subject: Tomcat and IIS Hi all, please I hear you can run tomcat on iis, but that one needs a couple of dll's can any one tell where i can get these dynamic link libraries and how to install them, i have a couple of web apps that i have tested and tried on other servlet/jsp enable servers now the problem is how to mIgrate them to my clients IIS Scenario: run jsp and servlets on IIS 5.0 on win2000 OS thanks in advance yours Edward Banfa Afrione Nigeria Ltd - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Newbie to Tomcat on IIS
Directions can be found here http://www.getnet.net/~rbarr/TomcatOnIIS/default.htm - Andrew -Original Message- From: Vishal Mukherjee [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 10, 2002 6:05 AM To: Tomcat Users List Subject: Newbie to Tomcat on IIS Importance: High hi all I am new to tomcat 4.04 has installed tomcat on Win NT 4.0 with IIS. Want to know a few things 1.Is in necessary to deploy your website under the Webapps directory. 2.My directory name is intranet' so what will be the context. and what all I need to change. so that JSP and Beans are configured Please help me I am unable to grasp from the docs. if any one can give me the step by step help I would me very grateful. Thanks Regards Vishal -- To unsubscribe, e-mail: mailto:tomcat-user- [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: unpacking of WAR
Craig, I was under the impression that the WAR would only be expanded if there was no existing Context of that name. Is this correct? - Andrew -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 10, 2002 1:01 AM To: Tomcat Users List Subject: Re: unpacking of WAR On Fri, 9 Aug 2002, Paul Phillips wrote: Date: Fri, 09 Aug 2002 22:49:00 -0500 From: Paul Phillips [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: unpacking of WAR I worked on deploying my first webapp to another server today. I packaged it up as a war, transferred it to the other tomcat server, added the one line context element in the server.xml, and restarted. Nothing - the logs said that the webapp that was referenced by the context statement was not available or in a readable format. In fact, the war did not expand into the file system. So, I removed the context element, and restarted. With the context gone, the WAR expanded properly. Then I added the context back in, and it worked fine. Is this normal? Depends on what you specified for the docBase parameter in the Context element. This needs to be the absolute or relative (to $CATALINA_HOME/webapps) name of the WAR file. Craig -- To unsubscribe, e-mail: mailto:tomcat-user- [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]
[4.1.9] New test milestone released
A new test milestone of Tomcat 4.1 has just been released. Downloads: http://jakarta.apache.org/builds/jakarta-tomcat-4.0/test/v4.1.9/ Significant changes over 4.1.8 Beta include: - Jasper 2 bugfixes - Catalina classloader bugfixes - Coyote HTTP/1.1 fixes - Updated commons-dbcp connection pool The list of changes is available in the release notes. Remy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problems with url-pattern*
What I need to be able to do is to make sure, that every request, for any page has enought rights to view the page and use it, So i thought of using a servlet as a controller. If I understand correctly what you talked about in this and your previous post, using the servlet mapping to / will not work at some point. I'm not that experienced yet in these matters, could you ilustrate to me a bit why this won't cut it? Thank you! On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Todd Kaplinger wrote: Date: Fri, 09 Aug 2002 17:43:36 -0400 From: Todd Kaplinger [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* define a servlet mapping of just /. this is the default servlet mapping. That's still not going to work for what the proposed use case was -- because you've just disabled the default file-serving servlet that serves static content. Craig -- 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: NetBeans + Tomcat 4.0.4
I checked the link out and actually found out that it's possible to do the same by just starting tomcat with./catalina.sh jpda start... One thing the link mentions is that he uses the context with reload so that tomcat doesn't have to be restarted. How do you go about doing that? The tomcat site talks about using the administration apps to achieve that but a quick google search on how to set it up (not through the admin apps) didn't get me what I was looking for. Thanks! On Fri, 2002-08-09 at 23:01, Larry Meadors wrote: Look here: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg30523.html Instructions on how to set up tomcat and netbeans with the JPDA debugger. Larry [EMAIL PROTECTED] 08/09/02 15:59 PM Does anyone here use NetBeans with tomcat 404? I'm using it, and use a small class to start tomcat from netbeans (instead of using the internal one that's 3.2), it works great when I want to debug servlets. But no JSP works, they all give error 500, even the ones in /exaples. But if i start it manually (i can't debug then, or is there a way?) the jsps work fine. The root couse starts with: java.lang.NoSuchMethodError: javax.servlet.ServletResponse.resetBuffer() Any clues? -- 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: unpacking of WAR
On Sat, 10 Aug 2002, Andrew wrote: Date: Sat, 10 Aug 2002 12:18:50 -0400 From: Andrew [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: unpacking of WAR Craig, I was under the impression that the WAR would only be expanded if there was no existing Context of that name. Is this correct? That's true. And any auto-expanded directory will *not* be modified if you update the WAR and restart Tomcat. That's because people would still modify the deployed files (in the expanded directory) instead of going back to their original sources, and get annoyed when their in-place updates got wiped out. Personally, I never use the webapps directory any more -- the custom Ant install and deploy tasks (Tomcat 4.1.x) are really cool. My normal development cycle for a webapp: * Start Tomcat and just leave it running (if not already started) * Run ant compile to build my webapp into a build/webapp subdirectory * Run ant install to dynamically install it on Tomcat, passing the directory name of my build/webapp directory. * If I need to modify something, I do it and run ant compile reload to reload the app. * To clean up, ant remove. There's a fully worked out build.xml file that supports all of this in the Application Developer's Guide document that ships with Tomcat 4.1. http://localhost:8080/tomcat-docs/appdev/ The 4.1.x codebase is nearing release quality; you should really start playing with the new features if you haven't yet. You'll never go back to the webapps directory again :-). - Andrew Craig -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 10, 2002 1:01 AM To: Tomcat Users List Subject: Re: unpacking of WAR On Fri, 9 Aug 2002, Paul Phillips wrote: Date: Fri, 09 Aug 2002 22:49:00 -0500 From: Paul Phillips [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: unpacking of WAR I worked on deploying my first webapp to another server today. I packaged it up as a war, transferred it to the other tomcat server, added the one line context element in the server.xml, and restarted. Nothing - the logs said that the webapp that was referenced by the context statement was not available or in a readable format. In fact, the war did not expand into the file system. So, I removed the context element, and restarted. With the context gone, the WAR expanded properly. Then I added the context back in, and it worked fine. Is this normal? Depends on what you specified for the docBase parameter in the Context element. This needs to be the absolute or relative (to $CATALINA_HOME/webapps) name of the WAR file. Craig -- To unsubscribe, e-mail: mailto:tomcat-user- [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: Problems with url-pattern*
On 10 Aug 2002, Alexander Wallace wrote: Date: 10 Aug 2002 12:17:03 +0100 From: Alexander Wallace [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* What I need to be able to do is to make sure, that every request, for any page has enought rights to view the page and use it, So i thought of using a servlet as a controller. If I understand correctly what you talked about in this and your previous post, using the servlet mapping to / will not work at some point. I'm not that experienced yet in these matters, could you ilustrate to me a bit why this won't cut it? Using a *servlet* for your purpose (checking access rights) will not work at all -- see my previous post for why you should use a Filter instead. The problem with the / mapping in particular is that this mapping is assigned, by default, to a servlet that serves static content. So, when you make a request to a URL like: http://localhost:8080/myapp/index.html you generally won't have a servlet mapped to this -- and Tomcat assigns it to the default file-serving servlet, which serves the /index.html static resource from your web application for you. If you map a servlet to /, you have just *replaced* the standard processing, because Tomcat will map the request to your servlet instead of the standard one. Now, let's assume that the user has the rights they need to access that resource and you want to let them have it. What should your rights-checking servlet do? That's right ... you're stuck. There is no way to ask Tomcat to serve the resource, because there is no longer any mapping for the default file-serving servlet. The answer is to use a Filter instead, because a Filter can examine a request *before* it is given to a servlet, and either intercept it (not enough access rights) or pass it on (access rights are fine). Do some google searches on servlet filter and you will find pointers to some articles about how they work. Thank you! Craig On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Todd Kaplinger wrote: Date: Fri, 09 Aug 2002 17:43:36 -0400 From: Todd Kaplinger [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* define a servlet mapping of just /. this is the default servlet mapping. That's still not going to work for what the proposed use case was -- because you've just disabled the default file-serving servlet that serves static content. Craig -- 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: Problems with url-pattern*
Ok, but what I mean by access rights are a set of very custom permissions (existing in a database table) givent to different roles asigned to users of my web app, is that also handled by filters? Also, at this point I my servlet does receive requests (let's say /login) and checks if the users (in this case by providing an id in the url) is trying to log in into a valid company in the web app, and if so, I use a forward to a jsp that actually shows the login form and let's them log in. I'm not sure if you meant I was not going to be able to serve anyghing from my servlet, but i do. I'm I all confused then? I'm sorry if i sound too newbie... I am tho :/ On Sat, 2002-08-10 at 18:59, Craig R. McClanahan wrote: On 10 Aug 2002, Alexander Wallace wrote: Date: 10 Aug 2002 12:17:03 +0100 From: Alexander Wallace [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* What I need to be able to do is to make sure, that every request, for any page has enought rights to view the page and use it, So i thought of using a servlet as a controller. If I understand correctly what you talked about in this and your previous post, using the servlet mapping to / will not work at some point. I'm not that experienced yet in these matters, could you ilustrate to me a bit why this won't cut it? Using a *servlet* for your purpose (checking access rights) will not work at all -- see my previous post for why you should use a Filter instead. The problem with the / mapping in particular is that this mapping is assigned, by default, to a servlet that serves static content. So, when you make a request to a URL like: http://localhost:8080/myapp/index.html you generally won't have a servlet mapped to this -- and Tomcat assigns it to the default file-serving servlet, which serves the /index.html static resource from your web application for you. If you map a servlet to /, you have just *replaced* the standard processing, because Tomcat will map the request to your servlet instead of the standard one. Now, let's assume that the user has the rights they need to access that resource and you want to let them have it. What should your rights-checking servlet do? That's right ... you're stuck. There is no way to ask Tomcat to serve the resource, because there is no longer any mapping for the default file-serving servlet. The answer is to use a Filter instead, because a Filter can examine a request *before* it is given to a servlet, and either intercept it (not enough access rights) or pass it on (access rights are fine). Do some google searches on servlet filter and you will find pointers to some articles about how they work. Thank you! Craig On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Todd Kaplinger wrote: Date: Fri, 09 Aug 2002 17:43:36 -0400 From: Todd Kaplinger [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* define a servlet mapping of just /. this is the default servlet mapping. That's still not going to work for what the proposed use case was -- because you've just disabled the default file-serving servlet that serves static content. Craig -- 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: Problems with url-pattern*
| -Original Message- | From: Alexander Wallace [mailto:[EMAIL PROTECTED]] | Sent: Saturday, August 10, 2002 7:56 AM | To: Tomcat Users List | Subject: Re: Problems with url-pattern* | | Ok, but what I mean by access rights are a set of very custom | permissions (existing in a database table) givent to different roles | asigned to users of my web app, is that also handled by filters? You will want to look at using a JdbcRealm which will take care of that for you. Realms are the new standard for handling user roles. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html#JDBCRea lm Otherwise you can do a filter like Craig mentioned which acts as an intermediary before requests hit your servlet or pages in the first place. http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html | | Also, at this point I my servlet does receive requests (let's say | /login) and checks if the users (in this case by providing an id in the | url) is trying to log in into a valid company in the web app, and if | so, I use a forward to a jsp that actually shows the login form and | let's them log in. I'm not sure if you meant I was not going to be able | to serve anyghing from my servlet, but i do. I think the assumption was that you were binding to just / not /login. If you just do / then you will run into major issues as Craig mentioned. | | I'm I all confused then? I'm sorry if i sound too newbie... I am tho :/ -Jake | | On Sat, 2002-08-10 at 18:59, Craig R. McClanahan wrote: | | | On 10 Aug 2002, Alexander Wallace wrote: | | Date: 10 Aug 2002 12:17:03 +0100 | From: Alexander Wallace [EMAIL PROTECTED] | Reply-To: Tomcat Users List [EMAIL PROTECTED] | To: Tomcat Users List [EMAIL PROTECTED] | Subject: Re: Problems with url-pattern* | | What I need to be able to do is to make sure, that every request, for | any page has enought rights to view the page and use it, So i thought | of | using a servlet as a controller. If I understand correctly what you | talked about in this and your previous post, using the servlet mapping | to / will not work at some point. | | I'm not that experienced yet in these matters, could you ilustrate to | me | a bit why this won't cut it? | | | Using a *servlet* for your purpose (checking access rights) will not | work | at all -- see my previous post for why you should use a Filter instead. | | The problem with the / mapping in particular is that this mapping is | assigned, by default, to a servlet that serves static content. So, when | you make a request to a URL like: | |http://localhost:8080/myapp/index.html | | you generally won't have a servlet mapped to this -- and Tomcat assigns | it | to the default file-serving servlet, which serves the /index.html | static | resource from your web application for you. | | If you map a servlet to /, you have just *replaced* the standard | processing, because Tomcat will map the request to your servlet instead | of | the standard one. Now, let's assume that the user has the rights they | need to access that resource and you want to let them have it. What | should your rights-checking servlet do? | | That's right ... you're stuck. There is no way to ask Tomcat to serve | the | resource, because there is no longer any mapping for the default | file-serving servlet. | | The answer is to use a Filter instead, because a Filter can examine a | request *before* it is given to a servlet, and either intercept it (not | enough access rights) or pass it on (access rights are fine). | | Do some google searches on servlet filter and you will find pointers | to | some articles about how they work. | | Thank you! | | Craig | | | | On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: | | |On Fri, 9 Aug 2002, Todd Kaplinger wrote: | | Date: Fri, 09 Aug 2002 17:43:36 -0400 | From: Todd Kaplinger [EMAIL PROTECTED] | Reply-To: Tomcat Users List [EMAIL PROTECTED], | [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Subject: Re: Problems with url-pattern* | | define a servlet mapping of just /. this is the default servlet | mapping. | |That's still not going to work for what the proposed use case was -- |because you've just disabled the default file-serving servlet that | serves |static content. | |Craig | | |-- |To unsubscribe, e-mail: mailto:tomcat-user- | [EMAIL PROTECTED] |For additional commands, e-mail: mailto:tomcat-user- | [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:tomcat-user- | [EMAIL PROTECTED] | For additional commands, e-mail: mailto:tomcat-user- | [EMAIL PROTECTED] | | | | | -- | To unsubscribe, e-mail: mailto:tomcat-user- | [EMAIL PROTECTED] | For
Re: Problems with url-pattern*
On 10 Aug 2002, Alexander Wallace wrote: Date: 10 Aug 2002 13:56:15 +0100 From: Alexander Wallace [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* Ok, but what I mean by access rights are a set of very custom permissions (existing in a database table) givent to different roles asigned to users of my web app, is that also handled by filters? Also, at this point I my servlet does receive requests (let's say /login) and checks if the users (in this case by providing an id in the url) is trying to log in into a valid company in the web app, and if so, I use a forward to a jsp that actually shows the login form and let's them log in. I'm not sure if you meant I was not going to be able to serve anyghing from my servlet, but i do. I'm I all confused then? I'm sorry if i sound too newbie... I am tho :/ Lets assume that you map your access-checking servlet to /*. Your user asks for the URL: http://localhost:8080/myapp/foo/bar.jsp and, because of the mapping, it is sent to your servlet. Your servlet receives a servletPath of and a pathInfo of /foo/bar.jsp, so you check the access restrictions for that page and say OK, go for it. Now, you try something like this: String pathInfo = request.getPathInfo(); ... validate that accessing pathInfo is ok ... RequestDispatcher rd = getServletContext().getRequestDispatcher(pathInfo); rd.forward(request, response); So what happens when you execute this? If you think it's going to execute your JSP page, you're going to be very unpleasantly surprised. Why? Because the /foo/bar.jsp path is mapped back to your access control servlet, due to the /* mapping. You end up with an infinite loop, terminating ultimately in a stack overflow. This is why any attempt to use a servlet for access checking, followed by a forward, is doomed to failure. PLEASE go read up about filters -- this is one of the things that filters were designed to enable. Craig On Sat, 2002-08-10 at 18:59, Craig R. McClanahan wrote: On 10 Aug 2002, Alexander Wallace wrote: Date: 10 Aug 2002 12:17:03 +0100 From: Alexander Wallace [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* What I need to be able to do is to make sure, that every request, for any page has enought rights to view the page and use it, So i thought of using a servlet as a controller. If I understand correctly what you talked about in this and your previous post, using the servlet mapping to / will not work at some point. I'm not that experienced yet in these matters, could you ilustrate to me a bit why this won't cut it? Using a *servlet* for your purpose (checking access rights) will not work at all -- see my previous post for why you should use a Filter instead. The problem with the / mapping in particular is that this mapping is assigned, by default, to a servlet that serves static content. So, when you make a request to a URL like: http://localhost:8080/myapp/index.html you generally won't have a servlet mapped to this -- and Tomcat assigns it to the default file-serving servlet, which serves the /index.html static resource from your web application for you. If you map a servlet to /, you have just *replaced* the standard processing, because Tomcat will map the request to your servlet instead of the standard one. Now, let's assume that the user has the rights they need to access that resource and you want to let them have it. What should your rights-checking servlet do? That's right ... you're stuck. There is no way to ask Tomcat to serve the resource, because there is no longer any mapping for the default file-serving servlet. The answer is to use a Filter instead, because a Filter can examine a request *before* it is given to a servlet, and either intercept it (not enough access rights) or pass it on (access rights are fine). Do some google searches on servlet filter and you will find pointers to some articles about how they work. Thank you! Craig On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Todd Kaplinger wrote: Date: Fri, 09 Aug 2002 17:43:36 -0400 From: Todd Kaplinger [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* define a servlet mapping of just /. this is the default servlet mapping. That's still not going to work for what the proposed use case was -- because you've just disabled the default file-serving servlet that serves static content. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands,
Reading from files in servlet from Tomcat-4.0.4
Hi all, I am trying to read from a file : filename Where should i put this file in tomcat 4.0.4 directory structure? I tried putting the file in directories: webapps/ROOT, webapps/ROOT/WEB-INF, webapps/ROOT/WEB-INF/classes in each instance i get the error message The system cannot find the file specified I used following statement in servlet code. bufferin = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); Thanks Khozaima _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Reading from files in servlet from Tomcat-4.0.4
Your best bet is to put them in webapps/WEBAPP/bob.txt Then read them using servletContext.getResourceAsStream(/bob.txt); This will still work when the application is packaged up as a WAR file. khozaima shakir wrote: Hi all, I am trying to read from a file : filename Where should i put this file in tomcat 4.0.4 directory structure? I tried putting the file in directories: webapps/ROOT, webapps/ROOT/WEB-INF, webapps/ROOT/WEB-INF/classes in each instance i get the error message The system cannot find the file specified I used following statement in servlet code. bufferin = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); Thanks Khozaima _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
server.xml guru needed for tomcat 4 on apache 1.3 issue
So here's the deal: I've got several virtual hosts running under apache 1.3 each with it's own tomcat JVM. No issues there. The problem is that I am attempting to get them all to work with mod_ssl. Even worse, I've only got one IP to work with and SSL is IP-based so I can only define one virtual host on port 443 in apache's httpd.conf. The solution I've concocted uses mod_rewrite to map SSL requests based on the host name in the HTTP request. This actually works quite well. (And yes I've got mod_rewrite working fine with mod_webapp, took a bit of hacking though.) I am able to direct these requests to the appropriate tomcat instances as well, only it doesn't quite work as expected. What happens is that for SSL requests, the server name in the VirtualHost _default_:443 section in httpd.conf does not match the defaultHost attribute for the Engine element in tomcat's server.xml. Oddly enough adding an additional matching Host to the Engine appears to have no effect. In fact everything works except tomcat is apparently using a different instance of the servlet being accessed for the SSL request vs the non-SSL request, which is highly problematic for various reasons. I'd be happy to forward config files etc. to anyone who thinks they might know what's going on. Suggestions for things I haven't tried yet are also most welcome. Thanks, Dan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Command line jspc throws NPE for page using JSTL
Problem's still there in 4.1.9. Is this something I should move to the dev list? Has anyone gotten command line jspc to work for tag libraries packaged similarly to JSTL? Struts demonstrates the same problem (same web.xml): index.jsp: %@ page language=java % %@ taglib prefix=struts-html uri=http://jakarta.apache.org/struts/tags-html-1.0.2; % html headtitleJSPC Test/title/head bodyh1Welcome to the JSPC test page/h1/body /html TagLibraryInfoImpl constructor args: prefix: struts-html uriIn:http://jakarta.apache.org/struts/tags-html-1.0.2 location: { /WEB-INF/lib/struts.jar, META-INF/tlds/struts-html.tld } Kris Schneider wrote: From the original note: Here's index.jsp: %@ page language=java % %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % html headtitleJSPC Test/title/head bodyh1Welcome to the JSPC test page/h1/body /html Here's web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list /web-app All I'm doing is referencing the taglib URI in the directive. Jasper should be doing the work of generating the path through an implicit taglib map entry, right? This does work when the app is actually run within a container. Here are some of the args passed to the TagLibraryInfoImpl constructor: prefix: c uriIn:http://java.sun.com/jstl/core location: { /WEB-INF/lib/standard.jar, META-INF/c.tld } And here's the test that causes the leading / to get stripped (path = location[0] = /WEB-INF/lib/standard.jar): if (ctxt.getClassLoader() != null URLClassLoader.class.equals(ctxt.getClassLoader().getClass()) path.startsWith(/)) Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Kris Schneider wrote: Date: Fri, 09 Aug 2002 23:11:48 -0400 From: Kris Schneider [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Command line jspc throws NPE for page using JSTL I mucked around with the Jasper source a bit to get some exception info dumped: java.net.MalformedURLException: Path 'WEB-INF/lib/standard.jar' does not start with '/' Have you verified that your application's use of the path to the taglib URL, in web.xml or in a %@ taglib % directive of a JSP page, do not use this kind of invalid reference? Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ smime.p7s Description: S/MIME Cryptographic Signature
RE: Problems with url-pattern*
Thank you! I will read the info in those links. I hope i can handle it! This is all very new and sometimes confusing to me. I do have url-pattern//url-pattern But if i type /whatever, i'm checking in my servlet for that and doing a forward to my desired jsp or whatever. Although this seems to be working now ( i do get the content of my jsps and all that), I guess I should follow your advice, since that's what thos things (realms and filters) are made for. Thankyou again! On Sat, 2002-08-10 at 20:27, Jacob Hookom wrote: | -Original Message- | From: Alexander Wallace [mailto:[EMAIL PROTECTED]] | Sent: Saturday, August 10, 2002 7:56 AM | To: Tomcat Users List | Subject: Re: Problems with url-pattern* | | Ok, but what I mean by access rights are a set of very custom | permissions (existing in a database table) givent to different roles | asigned to users of my web app, is that also handled by filters? You will want to look at using a JdbcRealm which will take care of that for you. Realms are the new standard for handling user roles. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html#JDBCRea lm Otherwise you can do a filter like Craig mentioned which acts as an intermediary before requests hit your servlet or pages in the first place. http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html | | Also, at this point I my servlet does receive requests (let's say | /login) and checks if the users (in this case by providing an id in the | url) is trying to log in into a valid company in the web app, and if | so, I use a forward to a jsp that actually shows the login form and | let's them log in. I'm not sure if you meant I was not going to be able | to serve anyghing from my servlet, but i do. I think the assumption was that you were binding to just / not /login. If you just do / then you will run into major issues as Craig mentioned. | | I'm I all confused then? I'm sorry if i sound too newbie... I am tho :/ -Jake | | On Sat, 2002-08-10 at 18:59, Craig R. McClanahan wrote: | | | On 10 Aug 2002, Alexander Wallace wrote: | | Date: 10 Aug 2002 12:17:03 +0100 | From: Alexander Wallace [EMAIL PROTECTED] | Reply-To: Tomcat Users List [EMAIL PROTECTED] | To: Tomcat Users List [EMAIL PROTECTED] | Subject: Re: Problems with url-pattern* | | What I need to be able to do is to make sure, that every request, for | any page has enought rights to view the page and use it, So i thought | of | using a servlet as a controller. If I understand correctly what you | talked about in this and your previous post, using the servlet mapping | to / will not work at some point. | | I'm not that experienced yet in these matters, could you ilustrate to | me | a bit why this won't cut it? | | | Using a *servlet* for your purpose (checking access rights) will not | work | at all -- see my previous post for why you should use a Filter instead. | | The problem with the / mapping in particular is that this mapping is | assigned, by default, to a servlet that serves static content. So, when | you make a request to a URL like: | |http://localhost:8080/myapp/index.html | | you generally won't have a servlet mapped to this -- and Tomcat assigns | it | to the default file-serving servlet, which serves the /index.html | static | resource from your web application for you. | | If you map a servlet to /, you have just *replaced* the standard | processing, because Tomcat will map the request to your servlet instead | of | the standard one. Now, let's assume that the user has the rights they | need to access that resource and you want to let them have it. What | should your rights-checking servlet do? | | That's right ... you're stuck. There is no way to ask Tomcat to serve | the | resource, because there is no longer any mapping for the default | file-serving servlet. | | The answer is to use a Filter instead, because a Filter can examine a | request *before* it is given to a servlet, and either intercept it (not | enough access rights) or pass it on (access rights are fine). | | Do some google searches on servlet filter and you will find pointers | to | some articles about how they work. | | Thank you! | | Craig | | | | On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: | | |On Fri, 9 Aug 2002, Todd Kaplinger wrote: | | Date: Fri, 09 Aug 2002 17:43:36 -0400 | From: Todd Kaplinger [EMAIL PROTECTED] | Reply-To: Tomcat Users List [EMAIL PROTECTED], | [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Subject: Re: Problems with url-pattern* | | define a servlet mapping of just /. this is the default servlet | mapping. | |That's still not going to work for what the proposed use case was -- |because you've just disabled the
Re: Problems with url-pattern*
Thankyou criag, your explanation is very clear. I have url-pattern//url-pattern right now, and though I seem to be getting the result I was expecting (I see the requested url with servletPath, and when i do the forward to the jsp, I do get the content of the jsp), I think i should follow your advice, i don't want to run into trouble later. I should check out filters and realms... I hope is not too hard :/ Thanks again! On Sat, 2002-08-10 at 21:06, Craig R. McClanahan wrote: On 10 Aug 2002, Alexander Wallace wrote: Date: 10 Aug 2002 13:56:15 +0100 From: Alexander Wallace [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* Ok, but what I mean by access rights are a set of very custom permissions (existing in a database table) givent to different roles asigned to users of my web app, is that also handled by filters? Also, at this point I my servlet does receive requests (let's say /login) and checks if the users (in this case by providing an id in the url) is trying to log in into a valid company in the web app, and if so, I use a forward to a jsp that actually shows the login form and let's them log in. I'm not sure if you meant I was not going to be able to serve anyghing from my servlet, but i do. I'm I all confused then? I'm sorry if i sound too newbie... I am tho :/ Lets assume that you map your access-checking servlet to /*. Your user asks for the URL: http://localhost:8080/myapp/foo/bar.jsp and, because of the mapping, it is sent to your servlet. Your servlet receives a servletPath of and a pathInfo of /foo/bar.jsp, so you check the access restrictions for that page and say OK, go for it. Now, you try something like this: String pathInfo = request.getPathInfo(); ... validate that accessing pathInfo is ok ... RequestDispatcher rd = getServletContext().getRequestDispatcher(pathInfo); rd.forward(request, response); So what happens when you execute this? If you think it's going to execute your JSP page, you're going to be very unpleasantly surprised. Why? Because the /foo/bar.jsp path is mapped back to your access control servlet, due to the /* mapping. You end up with an infinite loop, terminating ultimately in a stack overflow. This is why any attempt to use a servlet for access checking, followed by a forward, is doomed to failure. PLEASE go read up about filters -- this is one of the things that filters were designed to enable. Craig On Sat, 2002-08-10 at 18:59, Craig R. McClanahan wrote: On 10 Aug 2002, Alexander Wallace wrote: Date: 10 Aug 2002 12:17:03 +0100 From: Alexander Wallace [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Problems with url-pattern* What I need to be able to do is to make sure, that every request, for any page has enought rights to view the page and use it, So i thought of using a servlet as a controller. If I understand correctly what you talked about in this and your previous post, using the servlet mapping to / will not work at some point. I'm not that experienced yet in these matters, could you ilustrate to me a bit why this won't cut it? Using a *servlet* for your purpose (checking access rights) will not work at all -- see my previous post for why you should use a Filter instead. The problem with the / mapping in particular is that this mapping is assigned, by default, to a servlet that serves static content. So, when you make a request to a URL like: http://localhost:8080/myapp/index.html you generally won't have a servlet mapped to this -- and Tomcat assigns it to the default file-serving servlet, which serves the /index.html static resource from your web application for you. If you map a servlet to /, you have just *replaced* the standard processing, because Tomcat will map the request to your servlet instead of the standard one. Now, let's assume that the user has the rights they need to access that resource and you want to let them have it. What should your rights-checking servlet do? That's right ... you're stuck. There is no way to ask Tomcat to serve the resource, because there is no longer any mapping for the default file-serving servlet. The answer is to use a Filter instead, because a Filter can examine a request *before* it is given to a servlet, and either intercept it (not enough access rights) or pass it on (access rights are fine). Do some google searches on servlet filter and you will find pointers to some articles about how they work. Thank you! Craig On Sat, 2002-08-10 at 00:40, Craig R. McClanahan wrote: On Fri, 9 Aug 2002, Todd Kaplinger wrote: Date:
Re: REPOST (+more comments) - Classloading problems with JNI
Thanks Michael while this is not the solution it does give me some clues as to where to look. Looking at my over two year old JNI code I see that I do pass a reference to the JVM as initialization parameter to the C++ code. In order to find the classes for the callback I do the following JNIEnv* env; m_jvm-GetEnv(reinterpret_castvoid**(env),JNI_VERSION_1_2); // m_jvm is the cached JVM Clearly the Java environment I am getting is not the one I thought it was. And I thought DLL hell was a problem ! Shimon I've done no work with JNI, but have read a little on it. My understanding is that when making calls from native to java, the native code often instantiates a new JVM. If your are doing this then I would suspect that this is your problem. Your newly instantied JVM would not have access to the classes loaded in the Tomcat JVM instance. Even if you included these in your CLASSPATH (as you mentioned with Jetty) then you'd be accessing java classes in a JVM seperate from the one that Tomcat is using (which is not what I think you want to do). It seems that you'd somehow need to, first make a java-C++ call to your native code to give it a handle to the Tomcat JVM instance, and from there use this handle in your native code to access or invoke the java classes/objects that you so desire. Michael LeValle -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Shared Drives
I had mentioned before that I was looking to access my network within a servlet. Someone had mentioned that I need to run tomcat as a service under the user that has the mapped drive. ServerA -Win2k Login: Administrator Mapped: F:/ to ServerB via 'TomcatUser' login Running: Tomcat 4.1 Service as user Administrator ServerB -Win2k Login: Administrator Sharing: C:/ with full permissions for 'TomcatUser' Code: File source = new File(F:/); if (!source.exists()) log.error(Cannot Access Share); And it logs that it cannot access the share. Do I need to look at editing my policy file? Best Regards, Jacob Hookom Comprehensive Computer Science University of Wisconsin, Eau Claire --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]