tomcat.policy, SSL and SQL -> AccessControlException
hi all, i have troubles configuring the tomcat.policy file. my application reads some data from a mysql database running on port 3306, localhost. i use the org.gjt.mm.mysql classes to connect to it and everything run fine. i also use basic authentification with tomcat, the user data are also in the mysql database. now i want make everything secure. i tried a lot and i got nearly everything working fine. but i am not able to set the tomcat.policy, that the org.gjt.mm.mysql classes within my servlets are allowed to connect to the mysql database. tomcat.policy: //java. the org.gjt.mm.mysql jars are in jdk1.2.2/jre/lib/ext. grant codeBase "file:d:/jdk1.2.2/lib/-" {permission java.security.AllPermission;}; grant codeBase "file:d:/jdk1.2.2/jre/lib/-" {permission java.security.AllPermission;}; grant codeBase "file:d:/jdk1.2.2/jre/lib/ext/-" {permission java.security.AllPermission;}; // Tomcat gets all permissions. grant codeBase "file:d:/tomcat/lib/-" {permission java.security.AllPermission;}; grant codeBase "file:d:/tomcat/classes/-" {permission java.security.AllPermission;}; //my application directory grant codeBase "file:d:/tomcat/webapps/shv_wb/WEB-INF/classes/-" {permission java.security.AllPermission;}; grant codeBase "file:d:/tomcat/webapps/shv_wb/WEB-INF/lib/-" {permission java.security.AllPermission;}; it is realy confusing, because tomcat is able to read the authority-data for the basic authentification out of the database, but my servlets are not allowed to do this. i get this message from tomcat: java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:195) at java.security.AccessController.checkPermission(AccessController.java:403) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1019) at java.net.InetAddress.getAllByName0(InetAddress.java:565) at java.net.InetAddress.getAllByName0(InetAddress.java:546) at java.net.InetAddress.getByName(InetAddress.java:455) at java.net.Socket.(Socket.java:98) at org.gjt.mm.mysql.MysqlIO.(MysqlIO.java:114) at org.gjt.mm.mysql.Connection.(Connection.java:229) at org.gjt.mm.mysql.Driver.connect(Driver.java:126) at java.sql.DriverManager.getConnection(DriverManager.java:457) at java.sql.DriverManager.getConnection(DriverManager.java:137) at KMAnmeldungen.doGet(KMAnmeldungen.java:65) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:479) can anyone help? tanks a lot, gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
defining secure / non secure content
hi, is it (or where is it) possible to define parts of an directory as secure (SSL) or non secure content? f.e. i want one servlet to be accessable via ssl only and another one (in the same directory) via the http protocol. is there a way? thanks, gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Logging errors on Tomcat Startup
see server.xml in tomcat/conf :add path="logs/tomcat.log" to Hi,I have problem during the start of TomCat servertomcat start After few seccond, >TomCut write some errors on the screen and then that window desappear. I can not see >what is the problem. My question is: Can I see log of those errors??? Thanks!!! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Start as service WITH SECURITY MANAGER
Has anyone set up tomcat to run as a service and with the security manager? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
memory and/or ms problem
Hi tomcat-users, I am having some memory related troubles with my servlets running on tomcat 3.2.1 on an win nt 4 workstation machine. I read all previous messages in the list with the term "memory" in it, but everything i try does not help. problem: the memory consumption of the java.exe increases slightly, the over all memory consumption of the system increases fast and memory is not released. after a week (and about 400 hits or so) the server runs out of memory (tomcat gives a OutOfMemoryError and quits). what i did: - set java max heap size (nothing changed) - set max_threads (30), max_spare_threads(20) and min_spare_threads(5) for both http and https ConnectionHandler - set session-timeout to 1 Minute - added System.gc() to end of every servlet my application uses servlets and mysql, i close every mysql connection and i am not able to find anything i could change to get the memory freed. I also use ms-stresstool and i can simulate this memory-problem. could anyone give me some assistance please? thanks, Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re[2]: memory and/or ms problem
Hi Randy, Thursday, March 01, 2001, 1:15:06 PM, you wrote: RL> Look at your code. My experience has been that Tomcat doesn't leak RL> any memory. Check that you haven't set your sessions to never time out RL> (otherwise each session will continue to collect digital dust). Also check RL> that you don't have any structures in memory of static classes that continue RL> to grow with each request (in-memory logs that flush to disk when some event RL> happens would one example of a place to look). Did some additional test and: you are rigth, something in my code is the reason for the growing memory consumption.but i can't imagine what it is. so the test i did was: stress a servlet that just writes a text. i stressed it really and nothing happend, the memory consumption growed, but gc brought it down to starting level. wondering... Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: How can I change PORT!!
Hi Choak, Friday, March 02, 2001, 10:48:45 AM, you wrote: CV> hi all, CV> I'm new user of TOMCAT, I wanna change jsp path from webapps to others. When I try it, I can't run my jsp files any more how can I create new port for my new site? CV> thanks for advance. CV> choak server.xml : Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re[3]: memory and/or ms problem
hi all, i found the reason for the growing memory consumption of my servlets. preconditions: i use servlets to get data out and in a mysql database and generate html pages with PrintWriter.print(...) statements. my servlets often use: ... Statement Stmt = C.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from .."); while (RS.next()) { //do something with data out.println(); } ... each request an instance of a servlet is created and the servlet starts reading data out of the database and writes it in the PrintWriter stream. But what happens if the PrintWriter has no target (because the user sends another request or more then one other requests)? I am not sure, but it seems that the servlet tries to write to the PrintWriter stream and has no success. the result is a growing amount of instances of a servlet which try to write to a PrintWriter and have no success. and it seems they keep try writing (and consuming memory) a long time ... my solution is to check the error state of a Printwriter before writing in it. so the code from above looks like this: ... Statement Stmt = C.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from .."); while (RS.next()) { if (out.checkError()) break; //do something with data out.println(); } ... for my application it seems to work, but i think there must be a better way, any ideas? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re[3]: memory and/or ms problem
hi all, i found the reason for the growing memory consumption of my servlets. preconditions: i use servlets to get data out and in a mysql database and generate html pages with PrintWriter.print(...) statements. my servlets often use: ... Statement Stmt = C.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from .."); while (RS.next()) { //do something with data out.println(); } ... each request an instance of a servlet is created and the servlet starts reading data out of the database and writes it in the PrintWriter stream. But what happens if the PrintWriter has no target (because the user sends another request or more then one other requests)? I am not sure, but it seems that the servlet tries to write to the PrintWriter stream and has no success. the result is a growing amount of instances of a servlet which try to write to a PrintWriter and have no success. and it seems they keep try writing (and consuming memory) a long time ... my solution is to check the error state of a Printwriter before writing in it. so the code from above looks like this: ... Statement Stmt = C.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from .."); while (RS.next()) { if (out.checkError()) break; //do something with data out.println(); } ... for my application it seems to work, but i think there must be a better way, (why does the write statement throws an exception and the print statement not?) any ideas? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re[3]: memory and/or ms problem
hi randy, thanks for your tips! i think i found the reason for the growing memory consumption of my servlets. preconditions: i use servlets to get data out and in a mysql database and generate html pages with PrintWriter.print(...) statements. my servlets often use: ... Statement Stmt = C.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from .."); while (RS.next()) { //do something with data out.println(); } ... on each request an instance of a servlet is created and the servlet starts reading data out of the database and writes it in the PrintWriter stream. But what happens if the PrintWriter has no target (because the user sends another request or more then one other requests)? I am not sure, but it seems that the servlet tries to write to the PrintWriter stream and has no success. the result is a growing amount of instances of a servlet which try to write to a PrintWriter and have no success. and it seems they keep try writing (and consuming memory) a long time ... my solution is to check the error state of a Printwriter before writing in it. so the code from above looks like this: ... Statement Stmt = C.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from .."); while (RS.next()) { if (out.checkError()) break; //do something with data out.println(); } ... for my application it seems to work, but i think there must be a better way, (why does the write statement throws an exception and the print statement not?) any ideas? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
setContentType / File download
Hi tomcat-user, i have some troubles using the setContentType method. I want to generate a CSV file of my database data and send it to the browser. the browser should then say "save file as filenam.csv" ... what i do is: response.setContentType("application/msexcel;name=\"TUInventory.csv\"\nContent-Disposition: attachment;filename=TUInventory.csv;"); this works for netscape browsers, but ie wants to save index.html. any tips? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: AW: setContentType / File download
Andreas Mecky, Wednesday, March 14, 2001, 1:14:45 PM, you wrote: > Hi, > try this: > response.setContentType(application/msexcel); > response.setHeader("Content-Disposition","inline; filename="here goes my > filename"); > this works for me in IE and NS. yes, this works. thanks! gerd
Re: Two requests when sending rtf files
Had the same troubles with csv file: try this: Andreas Mecky, Wednesday, March 14, 2001, 1:14:45 PM, wrote: response.setContentType(application/msexcel); response.setHeader("Content-Disposition","inline; filename=filename"); this works for me in IE and NS. gerd Reto Badertscher, Monday, March 26, 2001, 9:44:30 AM, you wrote: > When generating and sending a rtf file from a servlet, the browser ask for > - display from current location > - saving the document > When "display from current location" is chosen by the user, the servlet > receives a second request (that means the file will be generated a second > time), when "saving the document" no additional request is sent to the > servlet. > The following parameters are set for sending the rtf document: > aRes.setContentType("application/rtf"); > aRes.setHeader("Content-disposition","attachement;filename = > myDocument.doc"); > I appreciate any hint/idea to avoid the additional request. > Thanks in advance > Reto Badertscher Gerd