Runtime created files not accessible.Please help.
Hello everyone! I have developed a jsf(java server faces) web application running on tomcat 6.0 . Maybe my questions will be a bit naive, but i kindly ask for your help since i am not able to find solution myself. The problem is this: My web server needs to create new folders and write files in the folders so that the end user will b able to download later. The files I download or I create though, and save in my new folders created at runtime, are not available for tomcat... I get HTTP Status 404 , and I am unable to open them at runtime back from the local disk. So, what should I do to make the newly created folders and files instantly available in Tomcat without restarting??? And what is the proper place for someone to put his application folder?? Thank you very much for your help... Andreas, Greece.
Re: Runtime created files not accessible.Please help.
Hello and many thnx for interest and help. Yes, I do see the folders/files created by Java code during runtime with file viewers, they seem all fine. But tomcat won't open/see them, and even if i try to put the URL in my browser I get HTTP Status 404. The code is pretty much basic, Java.IO , FileReader/Writer and so on. Tell me please if i can be more specific or I should post something more. Thanx a lot, Best Regards, Andreas, Greece. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:28 PM Subject: RES: Runtime created files not accessible.Please help. Hi Andreas, We do pretty much the same here and it is working fine. Could you please post some parts of your code, so that we can see how you specify your physical folders? Can you see the folders/files created using a file viewer ? Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 10:22 Para: users@tomcat.apache.org Assunto: Runtime created files not accessible.Please help. Hello everyone! I have developed a jsf(java server faces) web application running on tomcat 6.0 . Maybe my questions will be a bit naive, but i kindly ask for your help since i am not able to find solution myself. The problem is this: My web server needs to create new folders and write files in the folders so that the end user will b able to download later. The files I download or I create though, and save in my new folders created at runtime, are not available for tomcat... I get HTTP Status 404 , and I am unable to open them at runtime back from the local disk. So, what should I do to make the newly created folders and files instantly available in Tomcat without restarting??? And what is the proper place for someone to put his application folder?? Thank you very much for your help... Andreas, Greece. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Runtime created files not accessible.Please help.
mmm, I am not sure i got what you mean by "listed", but I will try to describe to you the situation. catalina home: C:\Program Files\Apache Software Foundation\Tomcat 6.0 my project folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9 (i build-deploy-run it through NetBeans 6.0.1) web folder of project(containing pages) : C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web usersessions folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions an istance of a created folder at runtime is this: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008 and here is where i put everything the user downloads or creates, so that he will b able to retrieve it after the end of session. If by chance you would like to warn me for the dots '.' in the path name or the capital letters , I could say tha I have tried to create simple path names without any dots or special characters and i had the same problem. Thnx so much. Andreas. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:44 PM Subject: RES: Runtime created files not accessible.Please help. Could you please list the part of your code where you list the created files? Where are they located, inside your webapp folder? Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 10:39 Para: Tomcat Users List Assunto: Re: Runtime created files not accessible.Please help. Hello and many thnx for interest and help. Yes, I do see the folders/files created by Java code during runtime with file viewers, they seem all fine. But tomcat won't open/see them, and even if i try to put the URL in my browser I get HTTP Status 404. The code is pretty much basic, Java.IO , FileReader/Writer and so on. Tell me please if i can be more specific or I should post something more. Thanx a lot, Best Regards, Andreas, Greece. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:28 PM Subject: RES: Runtime created files not accessible.Please help. Hi Andreas, We do pretty much the same here and it is working fine. Could you please post some parts of your code, so that we can see how you specify your physical folders? Can you see the folders/files created using a file viewer ? Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 10:22 Para: users@tomcat.apache.org Assunto: Runtime created files not accessible.Please help. Hello everyone! I have developed a jsf(java server faces) web application running on tomcat 6.0 . Maybe my questions will be a bit naive, but i kindly ask for your help since i am not able to find solution myself. The problem is this: My web server needs to create new folders and write files in the folders so that the end user will b able to download later. The files I download or I create though, and save in my new folders created at runtime, are not available for tomcat... I get HTTP Status 404 , and I am unable to open them at runtime back from the local disk. So, what should I do to make the newly created folders and files instantly available in Tomcat without restarting??? And what is the proper place for someone to put his application folder?? Thank you very much for your help... Andreas, Greece. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Runtime created files not accessible.Please help.
Hello Marcus, Hello all. Thank you very for ur help,although i dont seem to get any solution and it's just completely frustrating... Marcus, when you say regular servlet you mean..?? simple JSP ? I am not sure I got it. Coz I also tested through a simple JSP and I got the same problems... Best Regards, Andreas. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 5:33 PM Subject: RES: Runtime created files not accessible.Please help. Andreas, Can you read the created files/folder using a regular servlet? If you can do it so, I would advice you to dispatch download requests to this servlet, read the requested file and then write it in response. Something like this (in your doPost or doGet): response.setContentType("application/x-msdownload"); String filePath = getServletContext().getRealPath("/") + "your-correct-path" + request.getParameter("fileName"); File requestedFile = new File(filePath); response.addHeader("Content-Disposition", "attachment; filename=" + requestedFile.getName()); if (!requestedFile.exists()) { logger.error("file doesnt exist : " + filePath); } ServletOutputStream out = null; RandomAccessFile inputFile = null; try { inputFile = new RandomAccessFile(requestedFile, "r"); Long contentLength = Long.valueOf(inputFile.length()); response.setContentLength(contentLength.intValue()); out = response.getOutputStream(); byte[] buffer = new byte[4096]; int read = 0; int totalRead = 0; try { while ((read = inputFile.read(buffer)) > 0) { out.write(buffer, 0, read); totalRead += read; out.flush(); } } catch (EOFException e) { out.flush(); out.close(); } finally { if (out != null) { out.flush(); out.close(); } if (inputFile != null) { inputFile.close(); } } } catch (IOException e) { logger.error(e.getMessage(), e); } finally { filePath = null; requestedFile = null; out = null; inputFile = null; } I hope it helps you finding a way to solve your problem... Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 11:14 Para: Tomcat Users List Assunto: Re: Runtime created files not accessible.Please help. mmm, I am not sure i got what you mean by "listed", but I will try to describe to you the situation. catalina home: C:\Program Files\Apache Software Foundation\Tomcat 6.0 my project folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9 (i build-deploy-run it through NetBeans 6.0.1) web folder of project(containing pages) : C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web usersessions folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions an istance of a created folder at runtime is this: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008 and here is where i put everything the user downloads or creates, so that he will b able to retrieve it after the end of session. If by chance you would like to warn me for the dots '.' in the path name or the capital letters , I could say tha I have tried to create simple path names without any dots or special characters and i had the same problem. Thnx so much. Andreas. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:44 PM Subject: RES: Runtime created files not accessible.Please help. Could you please list the part of your code where you list the created files? Where are they located, inside your webapp folder? Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 10:39 Para: Tomcat Users List Assunto: Re: Runtime created files not accessible.Please help. Hello and many thnx for interest and help. Yes, I do see the folders/files created by Java code during runtime with file viewers, they seem all fine. But tomcat won't open/see them, and even if i try to put the URL in my browser I get HTTP Status 404. The code is pretty much basic, Java.IO , FileReader/Writer and so on. Tell me please if i can be more specific or I should post something more. Thanx a lot, Best Regards, Andreas, Greece. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:28 PM Subject: RES: Runtime created files not accessible.Please help. Hi Andreas, We do pretty much the same here and it is working fine. Could you please post some parts of your code, so that we can see how you specify your physical folders? Can you see the folders/files created using a file viewer ? Yours, Marcus Milanez -Mensagem original- De:
Re: Runtime created files not accessible.Please help.
By the way, do the newly created files have to be in some place specific for tomcat to "see" them??? - Original Message - From: "Andreas" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 11:05 PM Subject: Re: Runtime created files not accessible.Please help. Hello Marcus, Hello all. Thank you very for ur help,although i dont seem to get any solution and it's just completely frustrating... Marcus, when you say regular servlet you mean..?? simple JSP ? I am not sure I got it. Coz I also tested through a simple JSP and I got the same problems... Best Regards, Andreas. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 5:33 PM Subject: RES: Runtime created files not accessible.Please help. Andreas, Can you read the created files/folder using a regular servlet? If you can do it so, I would advice you to dispatch download requests to this servlet, read the requested file and then write it in response. Something like this (in your doPost or doGet): response.setContentType("application/x-msdownload"); String filePath = getServletContext().getRealPath("/") + "your-correct-path" + request.getParameter("fileName"); File requestedFile = new File(filePath); response.addHeader("Content-Disposition", "attachment; filename=" + requestedFile.getName()); if (!requestedFile.exists()) { logger.error("file doesnt exist : " + filePath); } ServletOutputStream out = null; RandomAccessFile inputFile = null; try { inputFile = new RandomAccessFile(requestedFile, "r"); Long contentLength = Long.valueOf(inputFile.length()); response.setContentLength(contentLength.intValue()); out = response.getOutputStream(); byte[] buffer = new byte[4096]; int read = 0; int totalRead = 0; try { while ((read = inputFile.read(buffer)) > 0) { out.write(buffer, 0, read); totalRead += read; out.flush(); } } catch (EOFException e) { out.flush(); out.close(); } finally { if (out != null) { out.flush(); out.close(); } if (inputFile != null) { inputFile.close(); } } } catch (IOException e) { logger.error(e.getMessage(), e); } finally { filePath = null; requestedFile = null; out = null; inputFile = null; } I hope it helps you finding a way to solve your problem... Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 11:14 Para: Tomcat Users List Assunto: Re: Runtime created files not accessible.Please help. mmm, I am not sure i got what you mean by "listed", but I will try to describe to you the situation. catalina home: C:\Program Files\Apache Software Foundation\Tomcat 6.0 my project folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9 (i build-deploy-run it through NetBeans 6.0.1) web folder of project(containing pages) : C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web usersessions folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions an istance of a created folder at runtime is this: C:\Program Files\Apache Software Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008 and here is where i put everything the user downloads or creates, so that he will b able to retrieve it after the end of session. If by chance you would like to warn me for the dots '.' in the path name or the capital letters , I could say tha I have tried to create simple path names without any dots or special characters and i had the same problem. Thnx so much. Andreas. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:44 PM Subject: RES: Runtime created files not accessible.Please help. Could you please list the part of your code where you list the created files? Where are they located, inside your webapp folder? Yours, Marcus Milanez -Mensagem original- De: Andreas [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 24 de abril de 2008 10:39 Para: Tomcat Users List Assunto: Re: Runtime created files not accessible.Please help. Hello and many thnx for interest and help. Yes, I do see the folders/files created by Java code during runtime with file viewers, they seem all fine. But tomcat won't open/see them, and even if i try to put the URL in my browser I get HTTP Status 404. The code is pretty much basic, Java.IO , FileReader/Writer and so on. Tell me please if i can be more specific or I should post something more. Thanx a lot, Best Regards, Andreas, Greece. - Original Message - From: "Milanez, Marcus" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, April 24, 2008 4:28 PM Subject: RES: Runtim
Re: Runtime created files not accessible.Some progress.
One big thnx to all of you who have shown interest in my situation. There has been some "progress"... Marcus, I didnt try your code, since the problem doesnt occur just with java, but also if i manually create a new folder/file in windows while the server is up. I get same problem. The other thing I noticed is that, if i create new folder/file in windows environment, in the ROOT context path, where there are already applications running on the server, then the server DOES SEE THEM. for example, there is this path:C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT and i create the folder a and the file b.txt, then i can give the url: http://localhost:8080/a/b.txt and tomcat DOES OPEN IT!!! The problem exists with all kind of web applications created with NetBEans!! Not particularly JSF, since I also had it with simple JSP... Any idea what kind of configuration and in which file could cause this thing...??? Could it be that i dont form the URL properly maybe??? Thank you all very very much. Andreas. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Runtime created files not accessible.SOLUTION FINALLY!!!
ONCE AGAIN THNX TO ALL! It turned out that NetBeans deployment in Tomcat was destroying everything The solution was to clean and build the project with Netbeans, but manuall deploy the war file from the Tomcat Manager... Now everything works as it should... I just can't believe the frustration and waste of time NetBeans stupuid deploying mechanisms have caused me... So to anyone who might have the same situation, be careful... Take care all and keep up the good work and the healthy supporting IT community that saves people's lives :) Best Regards, Andreas, Greece. - Original Message - From: "Andreas" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Friday, April 25, 2008 10:38 AM Subject: Re: Runtime created files not accessible.Some progress. One big thnx to all of you who have shown interest in my situation. There has been some "progress"... Marcus, I didnt try your code, since the problem doesnt occur just with java, but also if i manually create a new folder/file in windows while the server is up. I get same problem. The other thing I noticed is that, if i create new folder/file in windows environment, in the ROOT context path, where there are already applications running on the server, then the server DOES SEE THEM. for example, there is this path:C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT and i create the folder a and the file b.txt, then i can give the url: http://localhost:8080/a/b.txt and tomcat DOES OPEN IT!!! The problem exists with all kind of web applications created with NetBEans!! Not particularly JSF, since I also had it with simple JSP... Any idea what kind of configuration and in which file could cause this thing...??? Could it be that i dont form the URL properly maybe??? Thank you all very very much. Andreas. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 6.0.20, JDK1.6.0_14 and security manager
Hi! Have anyone beside me had any issues with the software versions mentioned in the subject line? First I thought it was my wacky setup, so I tried to "vanilla" directly from tomcat.apache.org, and it still fails. NOTE : Running the same tomcat installation with JDK1.6.0_12 produces no errors. This is what I get in 'catalina.out' with JDK1.6.0_14; Could not load Logmanager "org.apache.juli.ClassLoaderLogManager" java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at java.security.AccessController.checkPermission(AccessController.java:546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.Thread.setContextClassLoader(Thread.java:1351) at java.util.logging.LogManager$Cleaner.(LogManager.java:204) at java.util.logging.LogManager$Cleaner.(LogManager.java:198) at java.util.logging.LogManager.(LogManager.java:235) at org.apache.juli.ClassLoaderLogManager.(ClassLoaderLogManager.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at java.util.logging.LogManager$1.run(LogManager.java:164) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.(LogManager.java:156) at java.util.logging.Logger.getLogger(Logger.java:273) at org.apache.juli.logging.DirectJDKLog.(DirectJDKLog.java:71) at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:178) at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170) at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:242) at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:297) at org.apache.catalina.startup.Bootstrap.(Bootstrap.java:54) Can't load log handler "1catalina.org.apache.juli.FileHandler" java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.util.logging.LogManager$3.run(LogManager.java:383) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.addLogger(LogManager.java:376) at java.util.logging.LogManager$1.run(LogManager.java:180) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.(LogManager.java:156) at java.util.logging.Logger.getLogger(Logger.java:273) at org.apache.juli.logging.DirectJDKLog.(DirectJDKLog.java:71) at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:178) etc etc.. for all of the entries in 'logging.properties'. My platform is Linux and the 64-bit version of the SUN JDK. tomcat is started with; JAVA_HOME=/opt/jdk1.6.0_14 bin/catalina.sh start -security Something happened in the latest JDK-release, question is what... :) Thanks... - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 6.0.20, JDK1.6.0_14 and security manager
Indeed it does. But I wonder what this means in terms of security? I admit that my knowledge of the policy files and security-permissions is very weak, and granting permissions to something that I do not understand scares me a bit. Maybe I should file a bug about this and let it get investigated by someone who knows. Caldarale, Charles R wrote: > > I just verified that does correct the problem. > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Context Dependency Injection with Tomcat 7.0 x / 8.0 x
Weld http://weld.cdi-spec.org/ Andreas On Thu, 06 Oct 2016 10:25:46 +0930 Christopher Schultz wrote > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Kiran, > > On 10/5/16 8:15 PM, Kiran Badi wrote: > > I wanted to check if their is a way to do CDI with Tomcat for 7x > > and 8x version as per JEE spec ? > > What part of the JEE spec includes CDI? > > > I have a project for which I wanted to use CDI the way spring does > > it. > > You can certainly use Spring for that. > > > Appreciate if someone can suggest something. > > There are many CDI frameworks., but Spring seems to have taken over > the world when it comes to CDI. > > - -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Thread-safety of javax.servlet.Servlet#getServletConfig()
On Fri, 25 Nov 2016 23:02:00 +0930 Péter Gergely Horváth wrote >Hi All, > >I am wondering why calling javax.servlet.Servlet#getServletConfig() is >thread safe: if you check the implementation in > javax.servlet.GenericServlet from servlet API 3.0.1, you see the following: > >package javax.servlet; > >// lines omitted > >public abstract class GenericServlet > implements Servlet, ServletConfig, java.io.Serializable >{ > // lines omitted > > private transient ServletConfig config; > > // lines omitted > > public void init(ServletConfig config) throws ServletException { > this.config = config; > this.init(); > } > > // lines omitted > > public ServletConfig getServletConfig() { > return config; > } > // lines omitted >} > > >The field config is written in init(ServletConfig) without any >synchronization, locking or config being volatile, while getServletConfig() >could be called anytime from any later worker thread of the servlet >container. I took a quick look into Tomcat/Catalina code base, however I >see no indication of the servlet container performing any magic, which >would guarantee thread safe access to field config through >getServletConfig() from e.g. >javax.servlet.GenericServlet#service(ServletRequest, ServletResponse) and >the corresponding methods in javax.servlet.http.HttpServlet. > >Am I missing something here? What will guarantee that if Thread A is used >to init(ServletConfig) then Thread B calling getServletConfig() will see >the correct state of the field config (Java "happens-before"), and not e.g. >null? > >I am asking this because I have seen some legacy code, where a servlet >stored something into a field inside the init() method, which was then used >from within a javax.servlet.http.HttpServlet#doGet or >javax.servlet.http.HttpServlet#doPost method, without synchronization of >any kind like this: > >public class FoobarServlet extends HttpServlet { > > private FoobarService foobarService; > > @Override > public void init() throws ServletException { >this.foobarService = // ... acquire foobarService > } > protected void doGet(HttpServletRequest request, HttpServletResponse >response) throws ServletException, IOException { > List foobars = this.foobarService.getFoobars(); // read the >field WITHOUT synchronization > // ... > } > // ... >Is this approach (having no synchronization, locking or the field being >volatile) correct? I assumed it is not, seeing something like that in the >servlet API is quite confusing. > > >What do you think? > >Thanks, >Peter A Servlet will process requests only if it is fully initialized, i.e. init has been executed. The init method gets called only once and the servlet config won't change afterwards. I don't think there is need for synchronization. The same is probably valid for your own objects. Problems arise when individual requests change the state of these objects. Andy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Update form 8.5.56 to newer 8.5.x
Hello, we have Tomcat 8.5.56 on a Windows server. We woul like to update to a newer 8.6.x release, but I found only documents on how to migrate from 8.x to 9.x. Can anyone please send me a link to documentation on how to update in the same release Thank you very much Andreas Institut für den sozialen Wohnbau des Landes Südtirol Istituto per l’edilizia sociale della Provincia autonoma di Bolzano 39100 Bozen Horazstraße 14 / 39100 Bolzano via Orazio, 14 wobi.bz.it ipes.bz.it Dies ist eine vertrauliche Nachricht und nur für den Adressaten bestimmt. Sollten Sie diese Nachricht irrtümlich erhalten haben, bitten wir um Ihre diesbezügliche Benachrichtigung und um die Löschung der Nachricht. Eine Veröffentlichung oder Verbreitung des Inhaltes sowie jegliche anderweitige Verwendung sind untersagt. Il contenuto di questa e-mail è rivolto esclusivamente al destinatario della stessa e deve intendersi riservato e personale. Laddove questa e-mail Le fosse pervenuta per errore, Le chiediamo di comunicarci l’errata notifica e di cancellarne il contenuto. Sono sempre vietate la pubblicazione o diffusione del contenuto, nonché l'utilizzo per qualsiasi altro scopo.
Antwort: Re: Update form 8.5.56 to newer 8.5.x
Thank you very much Andreas Von:"Mark Thomas" An: users@tomcat.apache.org Datum: 09.01.2023 10:51 Betreff:Re: Update form 8.5.56 to newer 8.5.x On 09/01/2023 09:47, andreas.moro...@wobi.bz.it wrote: > Hello, > > we have Tomcat 8.5.56 on a Windows server. > We woul like to update to a newer 8.6.x release, but I found only > documents on how to migrate from 8.x to 9.x. > Can anyone please send me a link to documentation on how to update in > the same release https://tomcat.apache.org/migration-85.html#Upgrading_8.5.x Mark > > Thank you very much > Andreas > > Institut für den sozialen Wohnbau des Landes Südtirol > Istituto per l’edilizia sociale della Provincia autonoma di Bolzano > 39100 Bozen Horazstraße 14 / 39100 Bolzano via Orazio, 14*_ > _**_wobi.bz.it_* <https://www.wobi.bz.it/de/default.asp>***_ipes.bz.it_* > <https://www.ipes.bz.it/it/default.asp>* > > > ** > > * > Dies ist eine vertrauliche Nachricht und nur für den Adressaten > bestimmt. Sollten Sie diese Nachricht irrtümlich erhalten haben, bitten > wir um Ihre diesbezügliche Benachrichtigung und um die Löschung der > Nachricht. Eine Veröffentlichung oder Verbreitung des Inhaltes sowie > jegliche anderweitige Verwendung sind untersagt. > > Il contenuto di questa e-mail è rivolto esclusivamente al destinatario > della stessa e deve intendersi riservato e personale. Laddove questa > e-mail Le fosse pervenuta per errore, Le chiediamo di comunicarci > l’errata notifica e di cancellarne il contenuto. Sono sempre vietate la > pubblicazione o diffusione del contenuto, nonché l'utilizzo per > qualsiasi altro scopo. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Institut für den sozialen Wohnbau des Landes Südtirol Istituto per l’edilizia sociale della Provincia autonoma di Bolzano 39100 Bozen Horazstraße 14 / 39100 Bolzano via Orazio, 14 wobi.bz.it ipes.bz.it Dies ist eine vertrauliche Nachricht und nur für den Adressaten bestimmt. Sollten Sie diese Nachricht irrtümlich erhalten haben, bitten wir um Ihre diesbezügliche Benachrichtigung und um die Löschung der Nachricht. Eine Veröffentlichung oder Verbreitung des Inhaltes sowie jegliche anderweitige Verwendung sind untersagt. Il contenuto di questa e-mail è rivolto esclusivamente al destinatario della stessa e deve intendersi riservato e personale. Laddove questa e-mail Le fosse pervenuta per errore, Le chiediamo di comunicarci l’errata notifica e di cancellarne il contenuto. Sono sempre vietate la pubblicazione o diffusione del contenuto, nonché l'utilizzo per qualsiasi altro scopo.
Intermittent error 404
Hello we use Apache Tomcat/8.5.99. Last week I changed the user of the Tomcat services. When I refresh teh page then every second time the page appears correctly and the other 50% I get the error No I get intermittent error 404 The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on the index.jsp The user has the rights to read the index.jsp The fact that sometimes it works and the next time it doesn't confuses me. If it were due to the rights, it should probably never work. Can someone kindly help me? Greetings Andreas Institut für den sozialen Wohnbau des Landes Südtirol Istituto per l’edilizia sociale della Provincia autonoma di Bolzano 39100 Bozen Horazstraße 14 / 39100 Bolzano via Orazio, 14 wobi.bz.it ipes.bz.it Dies ist eine vertrauliche Nachricht und nur für den Adressaten bestimmt. Sollten Sie diese Nachricht irrtümlich erhalten haben, bitten wir um Ihre diesbezügliche Benachrichtigung und um die Löschung der Nachricht. Eine Veröffentlichung oder Verbreitung des Inhaltes sowie jegliche anderweitige Verwendung sind untersagt. Il contenuto di questa e-mail è rivolto esclusivamente al destinatario della stessa e deve intendersi riservato e personale. Laddove questa e-mail Le fosse pervenuta per errore, Le chiediamo di comunicarci l’errata notifica e di cancellarne il contenuto. Sono sempre vietate la pubblicazione o diffusione del contenuto, nonché l'utilizzo per qualsiasi altro scopo.
JMX remote with JMXMP
Hello everyone, I'd like to remotely access my MBeans by using the JMXMP protocol. JMXMP is an alternative to the default RMI protocol and aims to be much more firewall friendly. I already have downloaded the JMX remote reference implementation and thus have got hold of jmxremote_optional.jar. I know how I can get jconsole to talk JMXMP instead of RMI, but I don't know how to tell Tomcat 5.5 and/or the JVM 1.5 to expose MBeans with JMXMP instead of RMI. Can you help? Regards, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 6.0.20 "unable to create new native thread"
Original-Nachricht > Datum: Wed, 19 May 2010 13:42:28 +0100 > Von: Peter Crowther > An: Tomcat Users List > Betreff: Re: Tomcat 6.0.20 "unable to create new native thread" > On 19 May 2010 13:26, wrote: > > java.lang.OutOfMemoryError: unable to create new native thread first. Thank you all for your fast responses. > > OK, so one possibility is that the Windows thread table is full. Is there any way to calculate the max threadcount our system can handle? Or is there any way to expand the thread table that windows can handle more threads? > > > - maxThreads for HTTP: 450 > > - maxThreads for jk: 3000 > > That's a huge number of threads for one process. > > > - MaxThreads for HTTP: 800 > > - MaxThreads for jk: 450 > > That's merely massive. > > > - all connections shown by netstat -an (not filtered): 4595 > > - connections in state close_wait: 3152 > > That has nothing to do with threads. > > > On the other hand: Shouldn't windows start to swap if the ram is full? > > Yes. But that's not the error you're getting. > > > In which memory-area does windows handle the memory which is used for > the threads? Is it shown in the taskmanager? > > Task manager, Processes tab, View, Select Columns..., tick "Thread Count". > > > Can the OS take the mem which is still unused by the JVM > (memMax-memTotal) for handling threads or is it reserved for the JVM after > starting > tomcat? > > You are reserving heap and permgen memory when the JVM starts. Thread > memory, and kernel resources for threads, are outside of this total. > ok, I will analyse the max mem usage of both tomcats and will decrase the jvm max mem a bit. Hopefully the OS has more mem for threadhandling. > > Due to problems with one of our webapps which sometimes does not close > the threads completely (they stuck in close_wait-state) we increased the max > threads of windows: > > > > > http://publib.boulder.ibm.com/infocenter/pvcvoice/51x/index.jsp?topic=/com.ibm.websphere.wvs.doc/wvs/tun_conwin.html > > That has nothing to do with threads (and CLOSE_WAIT is a feature of > TCP, not of threads). That link contains no information about > increasing the maximum number of threads in Windows. It links to > TCP/IP tuning. Wrong link, or wrong assumption? > > > maxUserPorts have been set to about 30k if i remember correctly. > > That has nothing to do with threads. > Sorry, i meant we increased the max count of available ports, not threads. But i thought every connection from apache to tomcat results in a thread within tomcat (jk-connector). But I don't know yet, if the threads of tomcat itself and of the connectors are still alive when the connection is in close_wait or if the threads are destroyed. > > Does anyone have an idea to get rid of the exception? > > *Decrease* the number of threads in use in Tomcat 1. If you set the > HTTP and JK maxima to the same as Tomcat 2 (which is still very > large), what happens? Why? It should be safe to decrease the max-threads for http (maybe to 10 or so because it is only used for administration and monitoring). After the last downtime 800 jk-threads have been full, thats why I increased it. But i could try to go down to 1200 or 1500. Also i can try to decrease the max threads of tomcat 2. Question to the max-Threads defined for tomcat-conectors: Is the virtual memory for all defined threads allocated when starting tomcat? The TaskManager shows 514 threads for Tomcat 1 while in sum 3450 threads for connections are as max defined in its configuration. But i will change the config today as told above. Within the next days we will see if the problem is solved. Many thanks again, Andreas -- "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat 6 / Apache 2.2 integration problem (no images, no css loaded)
Hi, I am trying to use my tomcat 6 over Apache 2.2. I have deployed a war called sw-builder.war into the webapps folder of the tomcat instance. After restarting tomcat and apache Tomcat extracts the war into the webapps folder and into the temp folder (temp/0-sw-builder). The directory structure of sw-builder is : sw-builder login.jsp |_ images |_ css Now I have the problem, that when I call http://localhost/sw-builder/login.jsp no images will be displayed. Here the error log entries. [Wed Mar 19 14:57:10 2008] [notice] Child 4384: Child process is running [Wed Mar 19 14:57:10 2008] [notice] Child 4384: Acquired the start mutex. [Wed Mar 19 14:57:10 2008] [notice] Child 4384: Starting 64 worker threads. [Wed Mar 19 14:57:10 2008] [notice] Child 4384: Starting thread to listen on port 80. [Wed Mar 19 14:57:27 2008] [error] [client 127.0.0.1] client denied by server configuration: E:/server/apache-tomcat-6.0/temp/0-sw-builder/images/blank.gif, referer: http://localhost/sw-builder/login.jsp [Wed Mar 19 14:57:27 2008] [error] [client 127.0.0.1] client denied by server configuration: E:/server/apache-tomcat-6.0/temp/0-sw-builder/ci.css, referer: http://localhost/sw-builder/login.jsp I am using the auto configuration of tomcat which creates following mod_jk.conf: localhost:/sw-builder # Static files Alias /sw-builder "E:/server/apache-tomcat-6.0/temp/0-sw-builder" Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.jsp # Deny direct access to WEB-INF and META-INF # AllowOverride None deny from all AllowOverride None deny from all # # Use Directory too. On Windows, Location doesn't work unless casematches # AllowOverride None deny from all AllowOverride None deny from all JkMount /sw-builder/*.jsp ajp13 JkMount /sw-builder/*.jspx ajp13 JkMount /sw-builder/student/actionServlet ajp13 JkMount /sw-builder/actionServlet ajp13 The workers.properties looks like this: worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 In my http.conf I added the following lines: ... Include E:\server\apache-tomcat-6.0\conf\auto\mod_jk.conf Order allow,deny Allow from all ... Can anybody help me with that problem? Thanks -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 6 / Apache 2.2 integration problem (no images, no css loaded)
The other thing why the auto generated mod_jk.conf is using the extracted webapp in the temp folder. If I would configure it by myself, why I shouldn't use the folder in catalina_home/webapps/sw-builder? - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 6 / Apache 2.2 integration problem (no images, no css loaded)
Andreas: where are the files actually? Why do you use inconsistent paths in the config? The files are int the temp and in the webapp dir. Tomcat extracts the war file into webapps and on startup tomcat also extracts it to the temp dir. For me it is a little bit strange to add a directory in a temp folder to my configuration. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom SSL client auth
Hi there, i have to use SSL with client auth for my webservice running on tomcat 5.5 using axis2. The Problem is, that i have to validate the client certificates using some customized classes. I tried to write a custome TrustManager, TrustManagerFactory and a Provider returning registering ("TrustManagerFactory.TSL", "myClass") and edit the java.security file to use my Provider and to use "TSL" as standard TrustManager.Algo. Is this the right way? I wasn´t able to get this running. Are there anything else I have to do? andy - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Handshake problem with Tomcat 6.0.16 on IBM JDK5 / AIX
Hi, I am trying to setup a Tomcat 6.0.16.0/Axis2 1.3 combination using HTTPS connectivity. The machine is running on AIX with an IBM JDK5... After configuring HTTPS in server.xml by: The keystore is properly generated and gets read upon Tomcat starting up: *** found key for : tomcat chain [0] = [ [ Version: V3 Subject: CN=hostname, OU=Unknown, O=Some Company, L=Frankfurt, ST=Germany, C=DE Signature Algorithm: SHA1withDSA, OID = 1.2.840.10040.4.3 Key: IBMJCE DSA Public Key: 1101875205480948287113762571182603954171081492294072340935647672002184786011003216506042732219085256508724886035809875598372032797071912523681226049632332697 29313007298780303022913848325612157676219396023035090034471325854025863722427785141790280802270182659236245978325266744766279713673387084071498707580084 Validity: [From: Wed Jun 04 09:46:09 GMT+01:00 2008, To: Thu Jun 04 09:46:09 GMT+01:00 2009] Issuer: CN=hostname, OU=Unknown, O=Some Company, L=Frankfurt, ST=Germany, C=DE SerialNumber: [1212569169] ] Algorithm: [SHA1withDSA] Signature: : 30 2c 02 14 7b 08 ac 5d 5c ac de 55 7d e6 46 22 0..U..F. 0010: 61 e1 e1 94 ca c6 63 01 02 14 2e 01 af 24 e8 c8 a.c. 0020: 98 8d 9e dc 0d 6d c9 75 f5 ea fc 10 a6 34.m.u.4 ] I tried accessing the server under https://hostname:8080/ and keep getting the following error in catalina.out (Firefox reports not being able to find common encryption algorithms): http-8080-1, setSoTimeout(2) called http-8080-1, READ: SSL v2, contentType = Handshake, translated length = 83 *** ClientHello, SSLv3 RandomCookie: GMT: 0 bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 165, 36, 210, 22, 2, 241, 22, 187, 73, 139, 255, 223, 69, 154, 9 } Session ID: {} Cipher Suites: [SSL_DHE_RSA_WITH_AES_256_CBC_SHA, SSL_DHE_DSS_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_AES_256_CBC_SHA, SSL_DHE_RSA_WITH_AES_128_CBC_SHA, SSL_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_AES_128_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_FIPS_WITH_DES_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_RSA_EXPORT1024_WITH_RC4_56_SHA, SSL_RSA_EXPORT1024_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5] Compression Methods: { 0 } *** http-8080-1, SEND TLSv1 ALERT: fatal, description = handshake_failure http-8080-1, WRITE: TLSv1 Alert, length = 2 http-8080-1, called closeSocket() http-8080-1, handling exception: javax.net.ssl.SSLHandshakeException: Client requested protocol SSLv3 not enabled or not supported http-8080-1, called close() http-8080-1, called closeInternal(true) Changing the SSL protocols used in Firefox did not help at all... I am at my wits end here and would really appreciate any help. Rgds, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Authenticate with X509 certification
Ok, you know, that you have to use ssl/tsl or some challenge-response protocol to ensure that the owner of the certificate also owns the corresponding private key? So the best way might be to use ssl with client auth and an all trusting trustmanager which accepts every certificate but checks for knowledge of the private key. This also forces the client to send a certificate. andreas Luis Pascual Forner schrieb: No, because I want that the certificate was required ONLY when I acces to some pages. In fact, this is how now works, but sometimes the method getAttribute("javax.servlet.request.X509Certificate") returns null. Finally, I store the certificate in the session, and get it from there when I need it. thanks, Luis ahuelsing escribió: Hi, you have to set clientAuth="true" andreas Luis Pascual Forner schrieb: Thanks, Bill, I use the JIO connector. That's my server.xml: className="org.apache.catalina.core.AprLifecycleListener" /> className="org.apache.catalina.mbeans.ServerLifecycleListener" /> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> value="30"/> factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="2" disableUploadTimeout="true" /> disableUploadTimeout="true" keystoreFile="/X/x.p12" keystorePass="XX" keystoreType="PKCS12" port="8443" scheme="https" secure="true" sslProtocol="TLS" truststoreFile="/XXX/trustcacerts" truststorePass="XXX" truststoreType="JKS"/> enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> allowLinking="true" /> Bill Barker escribió: "Luis Pascual Forner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I need autheticate ONLY with client certificate (i.e., I don't want to check any user's database) . I did that follow: 1. I write a "X509Realm", with a method "authenticate" that only check the validity of each certificate in the certification's chain (don't check if the user exists in any database). 2. Declare this new class in "org/apache/catalina/realm/mbeans-descriptors.xml" and "rg/apache/catalina/mbeans/mbeans-descriptors.xml". 3. Edit "server.xml" and configure the realm. 4. Edit "web.xml" to set the auth-method to "CLIENT-CERT" 5. Put "X509Realm.class" and "mbeans-descriptors.xml" in "server/classes", with the correct path. 6. Restart Tomcat. Now, I can authenticate with X509 certificate, and get the client certificate with getAttribute("javax.servlet.request.X509Certificate"). But, sometimes, this method returns null. Why? Almost certainly means that the client didn't send a cert. But more info on your setup would get a better response. For example are you using the APR or the JIO Connector? regards - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Authenticate with X509 certification
Hi Luis, sorry, at this point I can't help you. Never done sth. similar. andreas Luis Pascual Forner schrieb: Hi, Andreas I think that I did'nt explained correctly. What I would is to have some pages that requires authentication, and others not (as in Apache server, where is possible to set SSLVerifyClient at directory level). Because the "clientAuth" attribute is at the "Connector" level, I do'nt want to set it to "true". I set the auth-method to "CLIENT-CERT" to force some pages to require authentication. With the standards realms, the authenticate user needs to exists in the users database (conf/tomcat-users.xml, by example). I want only that the users have a valid certificate. So, I used a custom realm, that only checks the validity of the certificate's chain. This works, and the certificate is required only in those pages but, sometimes, the getAttribute("javax.servlet.request.X509Certificate") returns null. The first time a user access a page from the context, the certificate is asked. As a work-around, I store the certificate in the session the first time the page is accessed, and reuse after. Thanks, and sorry for my poor english. I do my best. Regards, Luis Andreas Huelsing escribió: Ok, you know, that you have to use ssl/tsl or some challenge-response protocol to ensure that the owner of the certificate also owns the corresponding private key? So the best way might be to use ssl with client auth and an all trusting trustmanager which accepts every certificate but checks for knowledge of the private key. This also forces the client to send a certificate. andreas Luis Pascual Forner schrieb: No, because I want that the certificate was required ONLY when I acces to some pages. In fact, this is how now works, but sometimes the method getAttribute("javax.servlet.request.X509Certificate") returns null. Finally, I store the certificate in the session, and get it from there when I need it. thanks, Luis ahuelsing escribió: Hi, you have to set clientAuth="true" andreas Luis Pascual Forner schrieb: Thanks, Bill, I use the JIO connector. That's my server.xml: className="org.apache.catalina.core.AprLifecycleListener" /> className="org.apache.catalina.mbeans.ServerLifecycleListener" /> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> value="30"/> factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="2" disableUploadTimeout="true" /> disableUploadTimeout="true" keystoreFile="/X/x.p12" keystorePass="XX" keystoreType="PKCS12" port="8443" scheme="https" secure="true" sslProtocol="TLS" truststoreFile="/XXX/trustcacerts" truststorePass="XXX" truststoreType="JKS"/> enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> allowLinking="true" /> Bill Barker escribió: "Luis Pascual Forner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I need autheticate ONLY with client certificate (i.e., I don't want to check any user's database) . I did that follow: 1. I write a "X509Realm", with a method "authenticate" that only check the validity of each certificate in the certification's chain (don't check if the user exists in any database). 2. Declare this new class in "org/apache/catalina/realm/mbeans-descriptors.xml" and "rg/apache/catalina/mbeans/mbeans-descriptors.xml". 3. Edit "server.xml" and configure the realm. 4. Edit "web.xml" to set the auth-method to "CLIENT-CERT" 5. Put "X509Realm.class" and "mbeans-descriptors.xml" in "server/classes", with the correct path. 6. Restart Tomcat. Now, I can authenticate with X509 certificate, and get the client certificate with getAttribute("javax.servlet.request.X509Certificate"). But, sometimes, this method returns null. Why? Almost certainly means that the client didn't send a cert. But more info on your setup would get a better response. For example are you using the APR or the
Re: Comet implimentation
Bala chandra wrote: > Im wondering if it is possible to implement a Comet using Tomcat6. if so > could somebody point me over the implementation please. https://atmosphere.dev.java.net/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Could not load META-INF/services/javax.xml.parsers
Hello, I am trying to develop a web application in Java, using NetBeans 6.5.1. NetBeans installed Tomcat 6.0.18. I am using java 1.6 update 11. In my application I have a thread that loops and reads a configuration file and if it finds any changes in configuration it takes some action. The configuration file is in XML form and it is being accessed (read/write) using java.util.Properties class. When the thread starts, an object of the Properties class is created with the following code: Properties props = new Properties(); File file = new File("a file"); if (file.exists()) { try { props.loadFromXML(new FileInputStream(file)); } catch (Exception e) { System.out.println(e.getMessage()); } At the moment that props.loadFromXML method is called I get the following output on the console: May 3, 2009 11:18:43 PM org.apache.catalina.core.StandardContext reload INFO: Reloading this Context has started May 3, 2009 11:18:43 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate destroy INFO: WSSERVLET15: JAX-WS servlet destroyed May 3, 2009 11:18:43 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextDestroyed INFO: WSSERVLET13: JAX-WS context listener destroyed Context Initialized.. May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader findResourceInternal INFO: Illegal access: this web application instance has been stopped already. Could not load META-INF/services/javax.xml.parsers.DocumentBuilderFactory. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:111) at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:146) at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:233) at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123) at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75) at java.util.XMLUtils.load(XMLUtils.java:57) at java.util.Properties.loadFromXML(Properties.java:852) May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at com.sun.org.apache.xerces.internal.parsers.ObjectFactory.findProviderClass(ObjectFactory.java:393) at com.sun.org.apache.xerces.internal.parsers.ObjectFactory.newInstance(ObjectFactory.java:348) at com.sun.org.apache.xerces.internal.parsers.ObjectFactory.createObject(ObjectFactory.java:154) at com.sun.org.apache.xerces.internal.parsers.ObjectFactory.createObject(ObjectFactory.java:97) at com.sun.org.apache.xerces.internal.parsers.DOMParser.(DOMParser.java:125) at com.sun.org.apache.xerces.internal.parsers.DOMParser.(DOMParser.java:109) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.(DocumentBuilderImpl.java:115) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:72) at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:81) at java.util.XMLUtils.load(XMLUtils.java:57) at java.util.Properties.loadFromXML(Properties.java:852) May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalS
Re: Could not load META-INF/services/javax.xml.parsers
What do you mean by asking where I put the file? If you mean the path, I have the following: *private static final String propertyFileLocation = "D:/ProjectConf/IDbConf.xml";* File file = new File(DbConfiguration.propertyFileLocation); if (file.exists()) { try { Properties props.loadFromXML(new FileInputStream(file)); } catch (Exception e) { System.out.println(e.getMessage()); } On Mon, May 4, 2009 at 2:12 PM, Pid wrote: > Andreas Vasiliou wrote: > > Hello, > > > > I am trying to develop a web application in Java, using NetBeans 6.5.1. > > NetBeans installed Tomcat 6.0.18. > > I am using java 1.6 update 11. > > > > In my application I have a thread that loops and reads a configuration > file > > and > > if it finds any changes in configuration it takes some action. > > > > The configuration file is in XML form and it is being accessed > (read/write) > > using java.util.Properties class. > > > > When the thread starts, an object of the Properties class is created with > > the > > following code: > > > > Properties props = new Properties(); > > File file = new File("a file"); > > if (file.exists()) { > > try { > > props.loadFromXML(new FileInputStream(file)); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > Where, exactly, are you putting the file? > > p > > > > > At the moment that props.loadFromXML method is called I get the following > > output on the console: > > > > > > > > May 3, 2009 11:18:43 PM org.apache.catalina.core.StandardContext reload > > INFO: Reloading this Context has started > > May 3, 2009 11:18:43 PM > > com.sun.xml.ws.transport.http.servlet.WSServletDelegate > > destroy > > INFO: WSSERVLET15: JAX-WS servlet destroyed > > May 3, 2009 11:18:43 PM > > com.sun.xml.ws.transport.http.servlet.WSServletContextListener > > contextDestroyed > > INFO: WSSERVLET13: JAX-WS context listener destroyed > > > > > > Context Initialized.. > > > > > > May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader > > findResourceInternal > > INFO: Illegal access: this web application instance has been stopped > > already. > > Could not load > META-INF/services/javax.xml.parsers.DocumentBuilderFactory. > > The > > eventual following stack trace is caused by an error thrown for debugging > > purposes as well as to attempt to terminate the thread which caused the > > illegal > > access, and has no functional impact. > > May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader > > loadClass > > INFO: Illegal access: this web application instance has been stopped > > already. > > Could not load > > com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl. The > > eventual following stack trace is caused by an error thrown for debugging > > purposes as well as to attempt to terminate the thread which caused the > > illegal > > access, and has no functional impact. > > java.lang.IllegalStateException > > at > > > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273) > > at > > > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) > > at > > javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:111) > > at > > javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:146) > > at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:233) > > at > > > javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123) > > at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75) > > at java.util.XMLUtils.load(XMLUtils.java:57) > > at java.util.Properties.loadFromXML(Properties.java:852) > > > > May 3, 2009 11:18:47 PM org.apache.catalina.loader.WebappClassLoader > > loadClass > > INFO: Illegal access: this web application instance has been stopped > > already. > > Could not load > > > com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration. > > > > The eventual following stack trace is caused by an error thrown for > > debugging > > purposes as well as to attempt to terminate the thread which caused the > > illegal > > access, and has no functional impact. > > java.lang.IllegalStateException > > at > > > org.apache.catalina.lo
Making Apache httpd fallback to local file after receiving 404 from backend Tomcat?
Hi all I'm setting up a website using Apache webserver 2.2.11 / mod_jk 1.2.28 (Windows Server 2000) that connects to two backend Apache Tomcat 6.0.18 server (Windows Server 2003) with load balancing. The webserver also uses mod_proxy to forward some requests to an IIS5 server running on the same server but on a different port. The IIS5 hosts an Episerver 3 installation. To speed things up, Apache webserver is serving the /images folder used by Episerver using an Alias directive Alias /images "E:/Inetpub/EPiServer3/root/images" Order deny,allow Allow from all For mod_jk, the uriworkermap.properties -file specifies that all requests to /images/... should be sent to Apache Tomcat since the webapp contains a lot of images with that path /images/*=wlb Is there some way to achieve any of the following behaviours?: 1. A request for /images/logo.jpg is processed by Apache webserver (This file is located on the Apache webserver, in E:/Inetpub/EPiServer3/root/images) 2. Mod_jk forwards the request to an Apache Tomcat server which returns a 404 since logo.jpg does not exist on the server 3. Apache webserver detects this 404 response and fetches logo.jpg from E:/Inetpub/EPiServer3/root/images and returns it Alternative 1. Same as above 2. Apache webserver returns logo.jpg from E:/Inetpub/EPiServer3/root/images (3. In the case that logo.jpg is not found in E:/Inetpub/EPiServer3/root/images, an attempt is made to send the request to the Apache Tomcat server using mod_jk) I have done some research and came accross the mod_jk option ForwardDirectories but it doesnt seem to handle any of the above scenarios? It seems more related to directory indexing?! (I'm quite new with Apache Webserver / Apache Tomcat :-) ) Thank you for your attention! Best Regards /Andreas Imner - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
SV: Making Apache httpd fallback to local file after receiving 404 from backend Tomcat?
Thanks for the reply and the thoughts about my question. Med vänlig hälsning Andreas Imner Systemutvecklare KG Knutsson AB Autokatalogen Tel: +46 8 92 34 37 Mobil: +46 70 606 34 37 andreas.im...@kgk.se -Ursprungligt meddelande- Från: Pid [mailto:p...@pidster.com] Skickat: den 20 maj 2009 11:14 Till: Tomcat Users List Ämne: Re: Making Apache httpd fallback to local file after receiving 404 from backend Tomcat? Imner, Andreas wrote: > Hi all > > I'm setting up a website using Apache webserver 2.2.11 / mod_jk 1.2.28 > (Windows Server 2000) that connects to two > backend Apache Tomcat 6.0.18 server (Windows Server 2003) with load > balancing. > The webserver also uses mod_proxy to forward some requests to an IIS5 server > running on the same server but on a > different port. > The IIS5 hosts an Episerver 3 installation. > > To speed things up, Apache webserver is serving the /images folder used by > Episerver using an Alias directive > > Alias /images "E:/Inetpub/EPiServer3/root/images" > > Order deny,allow > Allow from all > > > For mod_jk, the uriworkermap.properties -file specifies that all requests to > /images/... should be sent to > Apache Tomcat since the webapp contains a lot of images with that path > > /images/*=wlb So the short version is that you have two images directories, with the same external path and you want overlapping mappings? Inventing some complex solution to resolve it seems like a poor choice to me. If you have control of one or either of the applications I'd adjust the path to the images instead. Otherwise you're probably looking at individually mapping each image file, which would be tedious. A simple solution will be better in the long run. p > Is there some way to achieve any of the following behaviours?: > > 1.A request for /images/logo.jpg is processed by Apache webserver (This > file is located on the Apache webserver, in > E:/Inetpub/EPiServer3/root/images) > 2.Mod_jk forwards the request to an Apache Tomcat server which returns a > 404 since logo.jpg does not exist > on the server > 3.Apache webserver detects this 404 response and fetches logo.jpg from > E:/Inetpub/EPiServer3/root/images and returns it > > Alternative > > 1.Same as above > 2.Apache webserver returns logo.jpg from E:/Inetpub/EPiServer3/root/images > (3. In the case that logo.jpg is not found in > E:/Inetpub/EPiServer3/root/images, an attempt is made to send the request to > the Apache Tomcat server using mod_jk) > > I have done some research and came accross the mod_jk option > ForwardDirectories but it doesnt seem to handle any of the above > scenarios? It seems more related to directory indexing?! (I'm quite new with > Apache Webserver / Apache Tomcat :-) ) > > Thank you for your attention! > > Best Regards > /Andreas Imner > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Why do stacktraces from servlets print to stdout, when the other end up in the log4j -log file?
My companys web application uses log4j 1.2.8 for logging and have just recently switched from Weblogic to Tomcat 6.0.18. Since the we switched to Tomcat, when we do some logging within a servlet " private static final Log log = LogFactory.getLog(ExceptionHandlerServlet.class); log.error("some message, throwable); " The "some message" -line is written to the file specified by log4j, but why does the stacktrace gets written to Tomcats stdout.log? This behaviour is for servlets only. For the other Java classes in the webapp, both the "some message" -line and the stacktrace is written to the file specified by log4j. ___ Extra info The log -settings of Tomcat is the standard setup This is our log4j.properties file " log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.MaxBackupIndex=20 log4j.appender.A1.MaxFileSize=10MB log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %-5p %X{ak} [%c{1}] %m%n log4j.rootLogger=ERROR, A1 log4j.category.se=INFO # All System.out.println is redirected to stdout logger, INFO level log4j.category.stdout=INFO # All System.err.println (includes Exception.printStackTrace() is redirected to stderr logger, INFO level log4j.category.stderr=INFO " - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Why do stacktraces from servlets print to stdout, when the other end up in the log4j -log file?
Hi The Servlet does not propegate the error. This perticular servlet is one we use for handling "unhandled" exceptions and displaying an unexpected-error page to the user. _ From web.xml exceptionHandler se.kgk.webshop.web.general.ExceptionHandlerServlet errorPageURL goto.do?forward=error 3 exceptionHandler /error java.lang.Throwable /error The servlet code looks something like this private static final Log log = LogFactory.getLog(ExceptionHandlerServlet.class); protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException { try { Throwable throwable = null; ( Some code to extract the throwable, the requestURI etc... ) log.error("Exception while handling request: " + requestURI, throwable); request.getRequestDispatcher(errorPageURL).forward(request, response); } catch (final Throwable t) { t.printStackTrace(); } } If we run the webapp in Weblogic, both the "Exception while handling..." message and the stacktrace gets printed to the log file specified by log4j If we run exactly the same webapp in Tomcat, the "Exception while handling..." message is printed to the log4j -logfile but the stacktrace gets printed to stdout.log!?! Note that this only applies to log calls from within this servlet. Then doing the exact same log4j-call from within one of our filter -classes, everything works as expected. I suspect something is different with the servlet load sequence or log settings when using Tomcat, but what? Med vänlig hälsning Andreas Imner Systemutvecklare KG Knutsson AB Autokatalogen Tel: +46 8 92 34 37 Mobil: +46 70 606 34 37 andreas.im...@kgk.se -Ursprungligt meddelande- Från: Christopher Schultz [mailto:ch...@christopherschultz.net] Skickat: den 9 juni 2009 21:57 Till: Tomcat Users List Ämne: Re: Why do stacktraces from servlets print to stdout, when the other end up in the log4j -log file? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas, On 6/9/2009 3:31 PM, Imner, Andreas wrote: > My companys web application uses log4j 1.2.8 for logging and have > just recently switched from Weblogic to Tomcat 6.0.18. > > Since the we switched to Tomcat, when we do some logging within a > servlet > > " private static final Log log = > LogFactory.getLog(ExceptionHandlerServlet.class); > log.error("some message", throwable); > " > > The "some message" -line is written to the file specified by log4j, > but why does the stacktrace gets written to Tomcats stdout.log? That depends on what else is going on in your servlet. If you let the exception propagate (by re-throwing it or throwing a new exception) and nobody else catches it, then Tomcat's request processing thread code will catch it and log it to stdout. > This is our log4j.properties file > > " > log4j.appender.A1=org.apache.log4j.RollingFileAppender > log4j.appender.A1.MaxBackupIndex=20 > log4j.appender.A1.MaxFileSize=10MB > > log4j.appender.A1.layout=org.apache.log4j.PatternLayout > > log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %-5p %X{ak} [%c{1}] > %m%n > log4j.rootLogger=ERROR, A1 > > log4j.category.se=INFO > > # All System.out.println is redirected to stdout logger, INFO level > log4j.category.stdout=INFO > > # All System.err.println (includes Exception.printStackTrace() is redirected > to stderr logger, INFO level > log4j.category.stderr=INFO > " The code you provided does not show any use of the "stdout" category, but it doesn't really matter because the stdout category does not actually log to stdout :) Check to see that your code is not allowing exceptions to propagate. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkouvpkACgkQ9CaO5/Lv0PDwrACgsjUoqePn7xzDy5qVoBukKdOz iboAn2qKdOJxCDKQ+/mtp5vDnbv1v5ZN =AvA2 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
SV: Why do stacktraces from servlets print to stdout, when the other end up in the log4j -log file?
My bad, I did not debug my servlet properly. If had done that earlier I would have seen that it was the extraction of the exception from the request object that failed. When running the webapp in Weblogic as we did earlier, the following code worked as expected and the exception was properly fetched: Object obj = request.getAttribute("javax.servlet.jsp.jspException"); When the webapp is running in Tomcat (version 6.0.18, running on Windows server 2003 as a service, standard "package" downloaded from Tomcat homepage, standard Tomcat log settings) the call resulted in "obj" being set to null. When I changed the code to, Object obj = request.getAttribute("javax.servlet.error.exception"); ... The exception is properly fetched and everyting works as expected also in Tomcat /Andreas -Ursprungligt meddelande- Från: Imner, Andreas [mailto:andreas.im...@kgk.se] Skickat: den 10 juni 2009 11:09 Till: Tomcat Users List Ämne: RE: Why do stacktraces from servlets print to stdout, when the other end up in the log4j -log file? Hi The Servlet does not propegate the error. This perticular servlet is one we use for handling "unhandled" exceptions and displaying an unexpected-error page to the user. _ From web.xml exceptionHandler se.kgk.webshop.web.general.ExceptionHandlerServlet errorPageURL goto.do?forward=error 3 exceptionHandler /error java.lang.Throwable /error The servlet code looks something like this private static final Log log = LogFactory.getLog(ExceptionHandlerServlet.class); protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException { try { Throwable throwable = null; ( Some code to extract the throwable, the requestURI etc... ) log.error("Exception while handling request: " + requestURI, throwable); request.getRequestDispatcher(errorPageURL).forward(request, response); } catch (final Throwable t) { t.printStackTrace(); } } If we run the webapp in Weblogic, both the "Exception while handling..." message and the stacktrace gets printed to the log file specified by log4j If we run exactly the same webapp in Tomcat, the "Exception while handling..." message is printed to the log4j -logfile but the stacktrace gets printed to stdout.log!?! Note that this only applies to log calls from within this servlet. Then doing the exact same log4j-call from within one of our filter -classes, everything works as expected. I suspect something is different with the servlet load sequence or log settings when using Tomcat, but what? -Ursprungligt meddelande- Från: Christopher Schultz [mailto:ch...@christopherschultz.net] Skickat: den 9 juni 2009 21:57 Till: Tomcat Users List Ämne: Re: Why do stacktraces from servlets print to stdout, when the other end up in the log4j -log file? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas, On 6/9/2009 3:31 PM, Imner, Andreas wrote: > My companys web application uses log4j 1.2.8 for logging and have > just recently switched from Weblogic to Tomcat 6.0.18. > > Since the we switched to Tomcat, when we do some logging within a > servlet > > " private static final Log log = > LogFactory.getLog(ExceptionHandlerServlet.class); > log.error("some message", throwable); > " > > The "some message" -line is written to the file specified by log4j, > but why does the stacktrace gets written to Tomcats stdout.log? That depends on what else is going on in your servlet. If you let the exception propagate (by re-throwing it or throwing a new exception) and nobody else catches it, then Tomcat's request processing thread code will catch it and log it to stdout. > This is our log4j.properties file > > " > log4j.appender.A1=org.apache.log4j.RollingFileAppender > log4j.appender.A1.MaxBackupIndex=20 > log4j.appender.A1.MaxFileSize=10MB > > log4j.appender.A1.layout=org.apache.log4j.PatternLayout > > log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %-5p %X{ak} [%c{1}] > %m%n > log4j.rootLogger=ERROR, A1 > > log4j.category.se=INFO > > # All System.out.println is redirected to stdout logger, INFO level > log4j.category.stdout=INFO > > # All System.err.println (includes Exception.printStackTrace() is redirected > to stderr logger, INFO level > log4j.category.stderr=INFO > " The code you provided does not show any use of the "stdout" category, but it doesn
jnlp-file doesn't work
Hi Tomcat Users, I'm struggling with a Java Web Start application. My application and the jnlp file are both correct. Everything works fine if I use a different server. But if I use Tomcat, I'll get the following error: JNLParseException[ Could not parse launch file. Error at line 0.] and java.io.EOFException: encoding.error.not.xml It seems to be the case that the file gets delivered, but not recognized as an valid xml-file for JWS. I use Tomcat 6 and the mime-type has already been set properly. I created therefore a servlet which generates exactly the same output and made it available as a *.jnlp file via the web.xml: PrintWriter output = null; response.setContentType("application/x-java-jnlp-file"); response.setCharacterEncoding(UTF8); ... And now everything works fine! But it shouldn't be neccessary to write a servlet for such a simple task. The fault must be somewhere in my config files for the Tomcat. Does anybody know where the problem may be? Andreas ---- Andreas Junius, Computer Specialist (Dipl.-Inf.) 8 Laurence Street Rostrevor SA 5073 P: +61 (0) 8 7226 6430 M: +61 (0) 4 3543 9521 www.java-nerd.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Error opening zip file /usr/bin/build-classpath
Hello! I wrote a Java/Spring application and it works on my local SLES 10 testing vm and all other test systems perfectly. If I deploy it on another SLES 10 SP2 (x86_64) server with Tomcat 5.0.28 and java-1_5_0-ibm-1.5.0_sr7 it also works at first view, but if I want to view some pages of the app I get the following error on the screen: Compile failed; see the compiler error output for details. org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:933) org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407) org.apache.jasper.compiler.Compiler.compile(Compiler.java:497) org.apache.jasper.compiler.Compiler.compile(Compiler.java:476) org.apache.jasper.compiler.Compiler.compile(Compiler.java:464) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5 11) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 95) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilt er(FilterChainProxy.java:378) ... In the log file: 2009-09-25 09:28:25,596 [http-8080-Processor25] ERROR org.apache.jasper.compiler.Compiler - Env: Compile: javaFileName=/srv/www/tomcat5/base/work/Catalina/localhost/myapp//org/apache /jsp/WEB_002dINF/jsp/myjsp_jsp.java classpath=/srv/www/tomcat5/base/webapps/myapp/WEB-INF/classes/:...:/usr/shar e/tomcat5/common/classes/:/usr/share/java/xerces-j2-2.7.1.jar:/usr/share/jav a/xerces-j2-2.7.1.jar:/usr/share/tomcat5/common/lib/naming-resources.jar:/us r/share/tomcat5/common/lib/jasper-compiler.jar:/usr/share/tomcat5/common/lib /jasper-runtime.jar:/usr/share/tomcat5/common/lib/naming-common.jar:/usr/sha re/tomcat5/common/lib/naming-factory.jar:/usr/share/tomcat5/common/lib/namin g-java.jar:/usr/share/java/ant-1.6.5.jar:/usr/share/java/jakarta-commons-col lections-3.1.jar:/usr/share/java/jakarta-commons-dbcp-1.2.1.jar:/usr/share/j ava/jakarta-commons-pool-1.2.jar:/usr/share/java/jakarta-commons-logging-api -1.0.4.jar:/usr/share/java/jakarta-commons-el-1.0.jar:/usr/share/java/jaf-1. 0.2.jar:/usr/share/java/jta-1.0.1.jar:/usr/share/java/javamail/mailapi-1.3.3 _01.jar:/usr/share/java/javamail/imap-1.3.3_01.jar:/usr/share/java/javamail/ imap-1.3.3_01.jar:/usr/share/java/javamail/pop3-1.3.3_01.jar:/usr/share/java /javamail/mailapi-1.3.3_01.jar:/usr/share/java/javamail/smtp-1.3.3_01.jar:/u sr/share/java/javamail/pop3-1.3.3_01.jar:/usr/share/java/javamail/smtp-1.3.3 _01.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/server.jar:/usr/shar e/java/mx4j/mx4j-jmx-1.1.1.jar:/usr/share/java/jspapi-5.0.18.jar:/usr/share/ java/servletapi5-5.0.18.jar:/usr/share/java/log4j-1.2.12.jar:/usr/lib64/jvm/ java-1_5_0-ibm-1.5.0_sr7/jre/lib/core.jar:/usr/share/java/servletapi5-5.0.18 .jar:/usr/share/java/jspapi-5.0.18.jar:/usr/share/java/ant-1.6.5.jar:/usr/sh are/java/jakarta-commons-collections-3.1.jar:/usr/share/java/jakarta-commons -dbcp-1.2.1.jar:/usr/share/java/jakarta-commons-pool-1.2.jar:/usr/share/java /jakarta-commons-logging-api-1.0.4.jar:/usr/share/java/jakarta-commons-el-1. 0.jar:/usr/share/java/jaf-1.0.2.jar:/usr/share/java/jta-1.0.1.jar:/usr/share /java/javamail/mailapi-1.3.3_01.jar:/usr/share/java/javamail/imap-1.3.3_01.j ar:/usr/share/java/javamail/imap-1.3.3_01.jar:/usr/share/java/javamail/pop3- 1.3.3_01.jar:/usr/share/java/javamail/mailapi-1.3.3_01.jar:/usr/share/java/j avamail/smtp-1.3.3_01.jar:/usr/share/java/javamail/pop3-1.3.3_01.jar:/usr/sh are/java/javamail/smtp-1.3.3_01.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/ jre/lib/server.jar:/usr/share/java/mx4j/mx4j-jmx-1.1.1.jar:/usr/share/java/j spapi-5.0.18.jar:/usr/share/java/servletapi5-5.0.18.jar:/usr/share/java/log4 j-1.2.12.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/core.jar:/usr/l ib64/jvm/java-1_5_0-ibm-1.5.0_sr7/lib/tools.jar:/usr/share/tomcat5/bin/boots trap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/bin/build-class path:/%20error:/%20JVM_LIBDIR%20/usr/lib64/jvm-exports/java-1%20does%20not%2 0exist%20or%20is%20not%20a%20directory:/usr/bin/build-classpath:/%20error:/% 20JVM_LIBDIR%20/usr/lib64/jvm-exports/java-1%20does%20not%20exist%20or%20is% 20not%20a%20directory:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/dt fj-interface.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/CmpCrmf .jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/ibmcmsprovider.jar: /usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/dtfj.jar:/usr/lib64/jvm/ java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/IBMKeyManagementServer.jar:/usr/lib64/j vm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/gskikm.jar:/usr/lib64/jvm/java-1_5_0 -ibm-1.5.0_sr7/jre/lib/ext/ibmjceprovider.jar:/usr/lib64/jvm/java-1_5_0-ibm- 1.5.0_sr7/jre/lib/ext/ibmjcefips.jar:
Auto-deploying WAR file with arbitrary filename, defining the URL context in meta file
Hello list, I have actually cross-posted this on ServerFault. My problem is that I'd like to auto-deploy a WAR file with a fixed filename "specialfilename.war" (because it includes a special identifier that I need). With Tomcat 6, the WAR filename has to be "my#url#context.war" in order to auto-deploy it to "/my/url/context". Adding a custom "META-INF/context.xml" file doesn't seem to change anything, the site is still deployed to "/specialfilename" (in this example). Please also refer to the more detailed question on ServerFault (http://serverfault.com/questions/242399/auto-deploy-war-to-arbitrary-url-on-tomcat). Andreas - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Auto-deploying WAR file with arbitrary filename, defining the URL context in meta file
On 04.03.2011 16:28, Caldarale, Charles R wrote: > >> My problem is that I'd like to auto-deploy a WAR file with a fixed >> filename "specialfilename.war" (because it includes a special identifier >> that I need). With Tomcat 6, the WAR filename has to be >> "my#url#context.war" in order to auto-deploy it to "/my/url/context". > Don't put your .war file in the 's appBase directory. Instead, locate > it outside of Tomcat's directory structure, and create a file > conf/Catalina/[host]/my#url#context.xml containing a element with a > docBase attribute pointing to the location of specialfilename.war. > > - Chuck > That solution works for me, thank you very much. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Different DelegatingResultSet.getDelegate() between Tomcat 6.0.26 and 6.0.29
Hi, I am using Tomcat 6.0.26 under Eclipse 3.6. I have configured a data source in server.xml: To save BLOBs with Oracle I have to access the OracleResultSet (unfortunatelly) which I extract as delegate from the DelegatingResultSet provided by the connection pool implementation: ResultSet rs = stmt.executeQuery(); org.apache.tomcat.dbcp.dbcp.DelegatingResultSet drs = (DelegatingResultSet) rs; OracleResultSet oracleResultSet = (OracleResultSet) drs.getDelegate(); Then I switched to use Tomcat 6.0.29. I just changed the server runtime in Eclipse. The above cast to OracleResultSet now fails because the DelegatingResultSet contains another DelegatingResultSet which again contains the OracleResultSet. So I had to change the code like this: OracleResultSet oracleResultSet = (OracleResultSet) ((DelegatingResultSet) drs.getDelegate()).getDelegate(); Why do these two versions of Tomcat differ so much? I thought that the third part of the version (26 or 29) is just a patch level. Why do I have to adjust the application code if I migrate to another patch level? Thank you and best regards Andreas - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Disable Caching for JNDI Object Factories?
Andreas Schildbach wrote: currently, if I locate a resource (EJB Home) from Tomcat's JNDI Context, and I have configured an Object Factory for that location, the factory is only exactly queried once. For the records: I finally filed a bug about this one. http://issues.apache.org/bugzilla/show_bug.cgi?id=42494 Regards, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JKMountFile ignored
Hello, i'm trying to use JKMountFile to "announce" my mount-points to apache. Apache does not redirect the specified addresses to tomcat and returns an 404 error message. With JKMount everything works fine. JKMountFile is inside a virtualhost-section. To debug the problem i raised JkLogLevel to debug (or trace) and looked inside the logfile (JkLogFile). There is no line containing the name of the mount-file. How can i debug my problem? Should there be an entry in the logfile, where i can see, that apache is accessing the mount-file? WHat could be my problem? Thanks for your help Andreas PS: JkMountCopy Off is set -- Telefonieren Sie schon oder sparen Sie noch? NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 5.5.12 less robust than 5.0.28?
Hi, yesterday I switched our web app from Tomcat 5.0.28 with Java 1.4.2 to Tomcat 5.5.12 with Java 1.5. We have two applications, each with 250 users. Tomcat 5.0.28 is a little slow, but has no problem to handle 500 users. With Tomcat 5.5.12/JVM 1.5 the limit is 100 - 130 users. Any additional user gets an error. Even tomcat manager doesn't work anymore. Both Tomcat versions share the same configuration: connectionTimeout="2" compression="on" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" JvmMx = 1536 With more maxThreads (250, 450, 500) Tomcat has the same problem. Avarage used threads is 20. Tomcat eats 15 - 25% cpu, it's not the limit. We have 4 GB RAM and 4 Xeon-HAT, should be enough for 500 users. The server runs under Windows 2003 Enterprise. I (temporarily) switched back to 5.0.28. How to get Tomcat 5.5.12 working? Tanks in advance Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom Authenticator in tomcat 4 ?
Hi, Is it possible to have a custom Authenticator in tomcat 4.1? I can't find any information about it, only for 5x. I have tried configuring a WEB-INF/context.xml with a valve referencing my authenticator class, works well in tomcat 5.5, but not in 4.1 (which is currently the version we are running in production). Do I have to upgrade to make this work? Thanks /Andreas
Tomcat loadbalancing howto
Hi, in the thread "Tomcat-5.5.12 less robust than 5.0.28" I told about problems with the scaling of tomcat. We have more incoming calls to tomcat than tomcat can handle. Windows 2003 seems to have problems to distribute the threads to the cpu if the number of threads is bigger than 50. The cpu load is 15 % or less and Tomcat is not able to serve web pages anymore. The only solution is to force the load sharing with horizontal cluster and loadbalacing. I want to share my experience with you and wrote a short howto. Introduction: This howto describes how to implement loadbalancing with Apache httpd, Tomcat and JK. I assume that you have a web application with mostly dynamic content and use of sessions. I refer to an installation on Windows, but the basic configuration applies to other operating systems as well. Software: Apache httpd 2.0.55: http://mirror.serversupportforum.de/apache/httpd/binaries/win32/apache_2 .0.55-win32-x86-no_ssl.msi Tomcat 5.5.15: http://mirrorspace.org/apache/tomcat/tomcat-5/v5.5.15/bin/apache-tomcat- 5.5.15.zip JK 1.2.15: http://netmirror.org/mirror/apache.org/tomcat/tomcat-connectors/jk/binar ies/win32/jk-1.2.15/mod_jk-apache-2.0.55.so APR 1.1.1: http://tomcat.heanet.ie/native/1.1.1/binaries/win32/tcnative-1.dll Installation: First install Apache 2.0. httpd to "", e.g. "D:\Apache". The installer creates a directory named "Apache 2". Copy the "mod_jk-apache-2.0.55.so" as "mod_jk.so" in the directory "\modules". Extract Tomcat files to the directory "\apache-tomcat-5.5.15" and copy it to "\apache-tomcat-5.5.15-1", "\apache-tomcat-5.5.15-2", "\apache-tomcat-5.5.15-3" and "\apache-tomcat-5.5.15-4". Copy "tcnative-1.dll" to all four tomcat "bin" directories. Deploy your web applications to all Tomcat instances. Configuration: We'll start with Apache httpd. Insert the following lines in your "httpd.conf": <--- > ### Loadbalancer Tomcat # LoadModule jk_module modules/mod_jk.so JkWorkersFile /Apache2/conf/workers.properties JkLogFile D:/Apache/Apache2/logs/mod_jk.log # [debug/error/info] JkLogLevel error JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkRequestLogFormat "%w %V %T" JkMount / loadbalancer JkMount //* loadbalancer JkMount / loadbalancer JkMount //* loadbalancer # jkstatus JkMount /jkstatus jkstatus # Deny direct access /WEB-INF/"> AllowOverride None deny from all /META-INF/"> AllowOverride None deny from all /WEB-INF/"> AllowOverride None deny from all /META-INF/"> AllowOverride None deny from all <--- > "" and "" are your web applications. Don't forget to deny the access to all directories that should not be accessed via HTTP. Now we have to configure JK. Create the following "workers.properties" in "\Apache\conf": <--- > worker.list=loadbalancer,jkstatus worker.tomcat1.port=8109 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor=1 worker.tomcat1.socket_timeout=1800 worker.tomcat1.recycle_timeout=1800 worker.tomcat1.cache_timeout=1800 worker.tomcat2.port=8209 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor=1 worker.tomcat2.socket_timeout=1800 worker.tomcat2.recycle_timeout=1800 worker.tomcat2.cache_timeout=1800 worker.tomcat3.port=8309 worker.tomcat3.host=localhost worker.tomcat3.type=ajp13 worker.tomcat3.lbfactor=1 worker.tomcat3.socket_timeout=1800 worker.tomcat3.recycle_timeout=1800 worker.tomcat3.cache_timeout=1800 worker.tomcat4.port=8409 worker.tomcat4.host=localhost worker.tomcat4.type=ajp13 worker.tomcat4.lbfactor=1 worker.tomcat4.socket_timeout=1800 worker.tomcat4.recycle_timeout=1800 worker.tomcat4.cache_timeout=1800 worker.loadbalancer.type=lb worker.loadbalancer.sticky_sessions=true worker.loadbalancer.sticky_session_force=false worker.loadbalancer.balance_workers=tomcat1,tomcat2,tomcat3,tomcat4 worker.jkstatus.type=status <--- > We have a round robin loadbalancer with four Tomcats. "sticky_sessions" is set to true to ensure persistent sessions. Here is a basic "server.xml" for Tomcat. You have to modify the server port (8105, 8205, 8305, 8405), the HTTP connector port (8180, 8280, 8380, 8480) and the AJP connector port (8109, 8209, 8309, 8409). <--- > <--- > With the HTTP connector you can access the installed web applications directly, e.g. the tomcat manager application. Add "CATALINA_HOME=\apache-tomcat-5.5.15-1", "CATALINA_HOME=\apache-tomcat-5.5.15-2", ... to "startup.bat", "shutdown.bat", "tool-wrapper.bat", "version
Problem precompiling jsps, please help
Hi, I'm in the process of upgrading my tc 4.1 to 5.5 and I discover that my maven goals for precompiling jsps does not work any more eventough I referenced the new libs for jasper etc. I get java.lang.ClassCastException in the jsp-compiler.. doen't say more than that unfortunately. Funny thing is that when I run the exact same code with Ant it works!?? Has anybody run into this problem before? My ant/maven code is pretty much ripped directly from http://tomcat.apache.org/tomcat-5.5-doc/printer/jasper-howto.html All advice appreciated! /Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logfile sharing
Hi, is it possible to share logfiles between different web applications running on different tomcat instances? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat caching
Hi everybody, I just wanted to ask, if tomcat does caching of static contents like html pages or images, and if yes, how the size of this cache can be set. regards Andreas Haufler - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
per-webapp logging problem with Tomcat 5.5
Hello everyone, I despair of configuring per-webapp logging for Tomcat 5.5, something that was easily possible with swallowOutput on pre-5.5 Tomcats. I've got 2 hosts (app1.de, app2.de), containing one context each. In addition, there is also the localhost context from the example server.xml. My conf/logging.properties looks like this (sorry about the wrapping): # Handler specific properties. # Describes specific configuration info for Handlers. 1catalina.org.apache.juli.FileHandler.level = FINE 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 1catalina.org.apache.juli.FileHandler.prefix = catalina. 2localhost.org.apache.juli.FileHandler.level = FINE 2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 2localhost.org.apache.juli.FileHandler.prefix = localhost. 3app1.org.apache.juli.FileHandler.level = FINE 3app1.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 3app1.org.apache.juli.FileHandler.prefix = app1. 4app2.org.apache.juli.FileHandler.level = FINE 4app2.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 4app2.org.apache.juli.FileHandler.prefix = app2. java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter # Facility specific properties. # Provides extra control for each logger. .handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler org.apache.catalina.core.ContainerBase.[Catalina].[app1.de].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[app1.de].handlers = 3app1.org.apache.juli.FileHandler org.apache.catalina.core.ContainerBase.[Catalina].[app2.de].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[app2.de].handlers = 4app2.org.apache.juli.FileHandler My problem is, there is no logging going to any logfile. What am I doing wrong? Do I need to have unique numbers as a prefix to app1 and app2? (could I use 0app1 and 0app2?) Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Hello Boris, thanks for your answer. I could not see any error but one: handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3app1.org.apache.juli.FileHandler, 4app2.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler as first line (aside from comments) of your logging.properties. What is that line good for? How is it different to the ".handlers" line I've already got in my logging.properties? When I insert your line, the following happens: Some events are indeed logged to app1.xxx.log and app2.xxx.log. However, most events are logged to catalina.xxx.log. Here is what goes to the correct log: Feb 26, 2006 11:41:21 AM org.apache.catalina.core.ApplicationContext log INFO: Loading Spring root WebApplicationContext Feb 26, 2006 11:42:02 AM org.apache.catalina.core.ApplicationContext log INFO: Loading WebApplicationContext for Spring FrameworkServlet 'front_controller' Feb 26, 2006 11:44:27 AM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Feb 26, 2006 11:44:27 AM org.apache.catalina.core.ApplicationContext log INFO: Closing WebApplicationContext of Spring FrameworkServlet 'front_controller' Here are some examples of what goes to the wrong log: Feb 26, 2006 11:41:22 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/webContext.xml] or Feb 26, 2006 11:41:34 AM org.springframework.orm.hibernate3.LocalSessionFactoryBean afterPropertiesSet INFO: Building new Hibernate SessionFactory Could it be that all libraries I use go to the wrong log? >> Do I need to have unique numbers as a prefix to app1 and app2? (could >> I use 0app1 and 0app2?) Do you have an answer for this question? Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Remy Maucherat wrote: Could it be that all libraries I use go to the wrong log? All your libraries, like Spring, will use their own logger names. All these loggers are not defined in your configuration, so will all use the handlers for the root logger (".handlers"). org.apache.catalina.core.ContainerBase.[Catalina].[app2.de] is only used for logging the container logs for the specified host. Could you tell me if it's possible to redirect logging of "own logger names" to the webapps logs? I want true per-webapp/context logging, including Spring/Hibernate and the like (actually those a far more important for me than the container log). The documentation describes how to specify per webapp logging (with an example). You should read it. I have read http://tomcat.apache.org/tomcat-5.5-doc/logging.html over and over again during the last months. I must admit that I don't understand it entirely; for example it is nowhere mentioned that I have to list all handlers in the "handlers" property. It is also not clear what the digits in the prefixes mean, and if they have to be unique or in an ascending order without gaps. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Boris Unckel wrote: Could it be that all libraries I use go to the wrong log? This depends on the common and shared classloader. Please put any JAR which is not delivered by Tomcat and already there in a default installation in your WEB-INF/lib folder. Test again. I don't understand. The jars I've put into common/lib are: - database driver, dbcp... as I am using DataSource injection via JNDI, it is not recommended to add database drivers to the application itself (it should remain independant of the actual database used. - javamail... same, I am using JNDI for that. Also, javamail does not log in non-debug mode AFAIK. - JSTL... I could move them to the application (actually it belongs there until J2EE 5.0), but they don't do any logging at all. The libraries whose logging goes to the wrong log are already all in my application (e.g. Spring & Hibernate). If that does not help: It may also be usefull to have a logging.properties per webapp (put it into WEB-INF/classes) This is not an option, as I would have to hardcode my applications loglevels. This is something the deployer will do, and he may not change the application. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Boris Unckel wrote: You want to have a _one_ central place for your log configuration _and_ the correct logging just for that application - currently impossible. I would not necessarely say that logging has to be configured in one central place/file, but I think putting logging config _into_ the applications is a bad idea. Let me elaborate why: The idea of a webapp is that you can deploy it on any spec-conforming server without changes (to the webapp). Thus, good webapps need to stay independant of specific implementations. As "Juli" is very Tomcat-specific, placing logging.properties into the webapp would create a dependancy to Tomcat 5.5 (for example ruling out Tomcat 5.0 as a possible container for the same Servlet 2.4 app). Furthermore, webapps should not (must not?) refer to files outside of their webapp directory, so refering to ${catalina.base}/logs is really bad practise (actually I'm surprised that it works). How can a webapp know that their container has got that environment variable, and I can it know that it points to a directory which contains a directory called "logs"? logging.properties also contains the log levels, something that is usually container instance specific. For example, production environments have different logging requirements than integration or development environments, even if they use the same container implementation. Would logging.properties be inside the application, you'd have to customize log levels for each deployment. I don't know if the widely used Eclipse/Web Tools Project combinations even allows for automatic customizations during deployment. Surely you could write complicated Ant scripts for deployment, but that's cumbersome and old-school. Thanks for your explanation about why real per-webapp logging is currently not possible with Tomcat 5.5 and Juli/java.util.logging. Is it the same with Log4J? Personally I feel this is a big regression from Tomcat 5.0/4.1: With the swallowOutput option, it was possible to do per-webapp logging _and_ "logging configuration outside of webapp" quite easily. I know swallowOutput was just a hack for lazy System.out.println() coders, but it had the nice side-effect of solving the problem very elegant and efficiently. And there was nothing wrong with the option, just with the habit of the lazy coders. As far as I know, swallowOutput is not there any more. Could it be re-activated? Is there anything else planned to support per-webapp logging? Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Boris Unckel wrote: I have a workaround: You provide a logging.properties in your webapp. All relevant parameters are controlled per system -D properties. A workaround for what? Providing a logging.properties in my webapp is exactly what I'm trying to avoid. What's the relevant parameters, and how can I control them using system properties? I'm sorry for this lot of questions. If your workaround works, I'm happy. Otherwise, I'll take the bitter pill of customizing my webapps after deployment. I'm thinking of creating a batch in one central place that creates the configs. Either way, I plan to file an enhancement request at SUN. Logging on the server side is flawed from the beginning to the end, and I think the next servlet spec should do away with that. I'll keep this list posted. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Remy Maucherat wrote: Very funny. Funny what? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: per-webapp logging problem with Tomcat 5.5
Hi Boris, I have now switched my server to "one-properties-per-webabb" (inside webapp dir). It's not nice, but it works. Thanks a lot for your help. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JMX via SSH tunnel does not work?
Hello everyone, I have set up the JMX server of JDK 1.5.0_06/Tomcat 5.5.15. It works fine locally, I'm testing with "jconsole". However, if I tunnel the JMX port over SSH, it does not work. I can connect to the port, but there is no flow of data. "jconsole" is hanging around for a minute, and then the connect dialog pops up. What is going wrong here? Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JMX via SSH tunnel does not work?
Hello Mikolaj, I have set up the JMX server of JDK 1.5.0_06/Tomcat 5.5.15. It works fine locally, I'm testing with "jconsole". However, if I tunnel the JMX port over SSH, it does not work. I can connect to the port, but there is no flow of data. "jconsole" is hanging around for a minute, and then the connect dialog pops up. What is going wrong here? http://forum.java.sun.com/thread.jspa?threadID=565139&tstart=30 http://forum.java.sun.com/thread.jspa?threadID=289869&messageID=1242288 I understand the problem, but do not know how to solve it. Can you give an example how the java.rmi.server.hostname and java.rmi.server.useLocalHostname properties on the client and the server should be set in this case? Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 4.1.30/5.0.28 empty responses - return code "200 -"
Hi Sporadically, I experience that the layout of my application is messed up. I found out that this is based on missing GIFs and CSS. In the access logs, there are a number of entries with the HTTP status code "200 -". So the response is OK, but no content length is logged, and no content is sent to the browser. Example: 192.168.11.11 - - [05/Jan/2007:11:23:59 +0100] "GET /ebanking/css/custom.css HTTP/1.1" 200 - "https://some.bank.ch/ebanking/login"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)" According to RFC 2616, the server should send back content: - GET an entity corresponding to the requested resource is sent in the response; - POST an entity describing or containing the result of the action; I've checked the Tomcat doc, FAQ, Google ('tomcat empty reply', 'tomcat "200 -"' 'access log "200 -"'), the mailing lists at MARC (same keywords) and Nabble (same keywords), to no avail. The problem turns up regardless of the load on the server, but only with static files. The systems: Server OS: Solaris 9 Tomcat: 4.1.30 and 5.0.28 Server JDK: 1.4.2_06 Server: Ultra10, V120, other Client: Probably irrelevant, occurred at least on Firefox/Win, Firefox/debian, IE/Win, all through a reverse proxy. Since nobody else seems to have this problem, I seem to do sth wrong. Can someone give me a hint? Thanks Andy Deller -- [EMAIL PROTECTED] Tel +41 44 268 89 61 Fax +41 44 261 27 50 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich http://www.ergon.ch __ e r g o nsmart people - smart software smime.p7s Description: S/MIME Cryptographic Signature
HTTP response code "200 -" in access log
Hi I posted this unsuccessfully a week ago under 'Tomcat 4.1.30/5.0.28 empty responses - return code "200 -"', so I rephrase and shorten my question. OS: Solaris & Debian, Tomcat version 4.1.30 and 5.0.28. In the access logs, there are a number of entries with the HTTP status code "200 -". So the client never sees the contents of these files, resulting in incorrect layout (the problem just turns up with static files). I've tried the Tomcat doc, Google, FAQ, mailing lists to no avail. What am I doing wrong? Thanks Andy Deller smime.p7s Description: S/MIME Cryptographic Signature
Re: HTTP response code "200 -" in access log
Hi A typical entry looks like this: 192.168.11.11 - - [05/Jan/2007:11:23:59 +0100] "GET /ebanking/css/custom.css HTTP/1.1" 200 - "https://some.bank.ch/ebanking/login"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)" This results in the client getting back a 200, but no contents for that specific request. With 'static files' I mean that this only happens when the client requests a static file like JPG or CSS. If it calls a servlet, that response is always returned correctly; just the embedded static files sporadically show this '200 -' problem. Regards Andy Pid wrote: Andreas Deller wrote: Hi I posted this unsuccessfully a week ago under 'Tomcat 4.1.30/5.0.28 empty responses - return code "200 -"', so I rephrase and shorten my question. OS: Solaris & Debian, Tomcat version 4.1.30 and 5.0.28. In the access logs, there are a number of entries with the HTTP status code "200 -". So the client never sees the contents of these files, resulting in incorrect layout (the problem just turns up with static files). I've tried the Tomcat doc, Google, FAQ, mailing lists to no avail. What am I doing wrong? Thanks Andy Deller Can't see your original message in the list i'm afraid. I don't understand your question either - you're saying that you see a 200 in the logs, the server returns a static file (do you mean an empty file?). Can you, perhaps, explain in more detail? p smime.p7s Description: S/MIME Cryptographic Signature
Re: HTTP response code "200 -" in access log
Andreas Deller wrote: Hi A typical entry looks like this: 192.168.11.11 - - [05/Jan/2007:11:23:59 +0100] "GET /ebanking/css/custom.css HTTP/1.1" 200 - "https://some.bank.ch/ebanking/login"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)" This results in the client getting back a 200, but no contents for that specific request. With 'static files' I mean that this only happens when the client requests a static file like JPG or CSS. If it calls a servlet, that response is always returned correctly; just the embedded static files sporadically show this '200 -' problem. The 200 status code simply means that the server thinks the file is correctly delivered. (All HTTP requests, regardless of success or failure have a numeric status code associated with the result. You should not have any custom error pages configured for this code.) I agree with the meaning of 200, but normally, the bytes delivered are written after the 200 (e.g. '[...] GET /css/default.css 200 27221 [...]'). According to RFC2616, GET should always receive a message body. I only have error pages for 400, 404, 500, 503, so this shouldn't interfere. What is your setup? Tomcat alone, or Tomcat + Apache HTTPD? Tomcat alone; tested with 4.1.30 and 5.0.28 on Debian and Solaris 9. Can you request the CSS or image independently of the servlet in which it is referenced? Have you sanity checked all of the files to make sure they're where you expect them to be? The files are all correct, since they most of the time are delivered and displayed correctly. They can be requested independently. Regards Andy Pid wrote: Andreas Deller wrote: Hi I posted this unsuccessfully a week ago under 'Tomcat 4.1.30/5.0.28 empty responses - return code "200 -"', so I rephrase and shorten my question. OS: Solaris & Debian, Tomcat version 4.1.30 and 5.0.28. In the access logs, there are a number of entries with the HTTP status code "200 -". So the client never sees the contents of these files, resulting in incorrect layout (the problem just turns up with static files). I've tried the Tomcat doc, Google, FAQ, mailing lists to no avail. What am I doing wrong? Thanks Andy Deller Can't see your original message in the list i'm afraid. I don't understand your question either - you're saying that you see a 200 in the logs, the server returns a static file (do you mean an empty file?). Can you, perhaps, explain in more detail? p smime.p7s Description: S/MIME Cryptographic Signature
Re: HTTP response code "200 -" in access log
Hi A typical entry looks like this: 192.168.11.11 - - [05/Jan/2007:11:23:59 +0100] "GET /ebanking/css/custom.css HTTP/1.1" 200 - "https://some.bank.ch/ebanking/login"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)" The files are all correct, since they most of the time are delivered and displayed correctly. They can be requested independently. Curious. Can you replicate the problem, or is it intermittent? Unfortunately, it's very rare (at least in our development environment), which makes it difficult to track. You may find using the IE equivalent of Firefox's LiveHttpHeaders plugin useful in examining what the browser is sending and receiving. Good idea. I'll keep LiveHeaders on at all times. Also, try enabling the request dumper valve to get a closer look at what's happening on the server. http://tomcat.apache.org/tomcat-5.0-doc/config/valve.html Thanks for the hint; I'll try this out! Regards Andy Pid wrote: Andreas Deller wrote: Hi I posted this unsuccessfully a week ago under 'Tomcat 4.1.30/5.0.28 empty responses - return code "200 -"', so I rephrase and shorten my question. OS: Solaris & Debian, Tomcat version 4.1.30 and 5.0.28. In the access logs, there are a number of entries with the HTTP status code "200 -". So the client never sees the contents of these files, resulting in incorrect layout (the problem just turns up with static files). I've tried the Tomcat doc, Google, FAQ, mailing lists to no avail. What am I doing wrong? Thanks Andy Deller Can't see your original message in the list i'm afraid. I don't understand your question either - you're saying that you see a 200 in the logs, the server returns a static file (do you mean an empty file?). Can you, perhaps, explain in more detail? p smime.p7s Description: S/MIME Cryptographic Signature
Re: HTTP response code "200 -" in access log
Hi I have activated LiveHttpHeaders and the RequestDumperValve and fortunately ran into the problem in my development environment. Sorry for the long posting, but it seems necessary to me. Important notes: - Between the client and the server, there is a reverse proxy. - After all, this is *one* sample of the case; this might not be representative. But because the problem occurs rarely, it's difficult to obtain data from another such case. The server was not under heavy load. I observed the following points: 1. catalina_log: the log order of the request dumper value sections seems to be out of order/interlaced with another request. - Expected: 2007-01-22 10:07:04 RequestDumperValve[Catalina]: === 2007-01-22 10:07:04 RequestDumperValve[Catalina]: REQUEST URI =/evalblappl/img/german/logo_bank.gif [...] 2007-01-22 10:07:04 RequestDumperValve[Catalina]: isSecure=false 2007-01-22 10:07:04 RequestDumperValve[Catalina]: --- 2007-01-22 10:07:04 RequestDumperValve[Catalina]: --- 2007-01-22 10:07:04 RequestDumperValve[Catalina]: authType=null 2007-01-22 10:07:04 RequestDumperValve[Catalina]: contentLength=1131 2007-01-22 10:07:04 RequestDumperValve[Catalina]:contentType=image/gif [...] 2007-01-22 10:07:04 RequestDumperValve[Catalina]: === - Observed: 2007-01-22 09:52:36 RequestDumperValve[Catalina]: === 2007-01-22 09:52:36 RequestDumperValve[Catalina]: REQUEST URI =/evalblappl/img/invis.gif [...] 2007-01-22 09:52:36 RequestDumperValve[Catalina]: isSecure=false 2007-01-22 09:52:36 RequestDumperValve[Catalina]: --- 2007-01-22 09:52:36 RequestDumperValve[Catalina]: REQUEST URI =/evalblappl/img/german/logo_bank.gif [...] 2007-01-22 09:52:36 RequestDumperValve[Catalina]: isSecure=false 2007-01-22 09:52:36 RequestDumperValve[Catalina]: --- 2007-01-22 09:52:36 RequestDumperValve[Catalina]: --- 2007-01-22 09:52:36 RequestDumperValve[Catalina]: authType=null 2007-01-22 09:52:36 RequestDumperValve[Catalina]: contentLength=45 2007-01-22 09:52:36 RequestDumperValve[Catalina]:contentType=image/gif [...] 2007-01-22 09:52:36 RequestDumperValve[Catalina]: === 2007-01-22 09:52:36 RequestDumperValve[Catalina]: --- 2007-01-22 09:52:36 RequestDumperValve[Catalina]: authType=null 2007-01-22 09:52:36 RequestDumperValve[Catalina]: contentLength=-1 2007-01-22 09:52:36 RequestDumperValve[Catalina]:contentType=null [...] 2007-01-22 09:52:36 RequestDumperValve[Catalina]: === 2. liveheaders: The GIF is returned with return code 200 but content length 0 (should be 1131). Plus: the content type is text/html insted of text/gif. - Expected: HTTP/1.x 200 OK Date: Mon, 22 Jan 2007 09:07:04 GMT Server: Apache Content-Length: 1131 Etag: W/"1131-116921672" Last-Modified: Fri, 19 Jan 2007 14:25:20 GMT Keep-Alive: timeout=2, max=498 Connection: Keep-Alive Content-Type: image/gif - Observed: HTTP/1.x 200 OK Date: Mon, 22 Jan 2007 08:52:36 GMT Server: Apache Content-Length: 0 Keep-Alive: timeout=2, max=498 Connection: Keep-Alive Content-Type: text/html The observed values are not the same as in LiveHttpHeaders. This is probably because there is a reverse proxy between the server and the client. 3. localhost_access: The return code is "200 -" (should be "200 1131"). (Note: IP & domain have been anonymized, parameters after '?' have been left out). - Expected: 192.168.1.25 - - AFC9F2376CB7CE72614B7134DA6B7074 [22/Jan/2007:10:07:04 +0100] HTTP/1.1 GET /evalblappl/img/german/logo_bank.gif 200 1131 https://mybank.company.ch/finnojet-blappl/defAccountStatementOfAccount.account Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1 - Observed: 192.168.1.25 - - AFC9F2376CB7CE72614B7134DA6B7074 [22/Jan/2007:09:52:36 +0100] HTTP/1.1 GET /evalblappl/img/german/logo_bank.gif 200 - https://mybank.company.ch/finnojet-blappl/defAccountAssetOverview.account Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1 Does that help for further analysis? Andy Andreas Deller wrote: Hi A typical entry looks like this: 192.168.11.11 - - [05/Jan/2007:11:23:59 +0100] "GET /ebanking/css/custom.css HTTP/1.1" 200 - "https://some.bank.ch/ebanking/login";
Re: HTTP response code "200 -" in access log
Pid wrote: Andreas Deller wrote: Hi I have activated LiveHttpHeaders and the RequestDumperValve and fortunately ran into the problem in my development environment. Sorry for the long posting, but it seems necessary to me. Important notes: - Between the client and the server, there is a reverse proxy. RDV is reporting that the file is has content length and type null. It's likely that the content type seen, 'text/html' is just a being set as a default. Looks like Tomcat is having trouble getting the file off the disk. Which version of Tomcat (you mentioned two) did this occur under? 5.0.28 on Linux (Debian) and Solaris 9. It also occurred with 4.1.30. Are you using APR/tcnative? No, I haven't installed any of them. (Actually not sure if this is works for TC5.0, anyone list?) I think that the problem is more rare using JDK 1.5.0_09 than 1.4.2_06, but of course I couldn't measure this. smime.p7s Description: S/MIME Cryptographic Signature
Re: HTTP response code "200 -" in access log
Pid wrote: Andreas Deller wrote: Pid wrote: Andreas Deller wrote: Hi I have activated LiveHttpHeaders and the RequestDumperValve and fortunately ran into the problem in my development environment. Sorry for the long posting, but it seems necessary to me. Important notes: - Between the client and the server, there is a reverse proxy. RDV is reporting that the file is has content length and type null. It's likely that the content type seen, 'text/html' is just a being set as a default. Looks like Tomcat is having trouble getting the file off the disk. Which version of Tomcat (you mentioned two) did this occur under? 5.0.28 on Linux (Debian) and Solaris 9. It also occurred with 4.1.30. Are you using APR/tcnative? No, I haven't installed any of them. APR offers a worthwhile performance improvement for OS native operations like serving static files. It also might offer an route around any Java issues, if you're able to use the OS 'sendfile' function. Thanks for the optimization hint, although we don't encounter performance problems so far. (Actually not sure if this is works for TC5.0, anyone list?) I think that the problem is more rare using JDK 1.5.0_09 than 1.4.2_06, but of course I couldn't measure this. If the problem occurs with both JVMs and both versions of Tomcat, you may have encountered a rare but unknown error condition, or it's not Java/Tomcat... In the former case, I'd try to eliminate the room for error between versions by standardising JVM/Tomcat versions. That surely sounds like a good idea. I wasn't aware that there are such recommendations. Can you give me a pointer where to find these JDK/Tomcat pairs standards? I found none in http://tomcat.apache.org/whichversion.html http://tomcat.apache.org/faq/version.html In the latter case, it could be an OS issue. The RD Valve reported no file size, or file data (from which it could determine MIME info), suggesting that Tomcat was unable to read the file data off the disk for some reason. That's possible, but I think it unlikely, because the error occurs both on Debian Linux and Solaris. Try checking the disk for capacity, damage issues. I think I can rule this out as it happens in three totally different environments. If it's always the same directory, I'd create a fresh copy of the directory by uploading all of the files to a new dir, and symlinking/altering the old path to the new one. Since the application already runs in different environments (and gets rebuilt after every clean), this has already been done. The image files aren't being served off a network file share or something are they? Yes, they are served from a NAS, at least in two environments. Could this be a problem? smime.p7s Description: S/MIME Cryptographic Signature
Problem with static files served from NAS
Hi This is a side/follow-up thread to 'HTTP response code "200 -" in access log'. One contributor hinted that files being served from a NAS could cause problems = files not being able to be read sometimes. This could yield the access log entries with HTTP code 200 but no content length ('200 -'), as observed for static files. Does anyone have (bad) experience using NAS for a tomcat instance that also serves static files? No httpd and no APR involved. Tomcat 5.0.28/JDK1.4.2_06 on Solaris 9 and Debian. Thanks Andy -- -- [EMAIL PROTECTED] Tel +41 44 268 89 61 Fax +41 44 261 27 50 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich http://www.ergon.ch __ e r g o nsmart people - smart software smime.p7s Description: S/MIME Cryptographic Signature
Re: Tomcat and MySQL sync problems
Hi We had a simliar problem with Oracle and Tomcat 4.1.30 and a firewall in between and I don't remember the exact error message, so I'm not sure if this helps: The problem was that Tomcat held the DB connection open infinitely, and the firewall after a while decided it wanted to drop the connection. For a new request, Tomcat just used one of its connections from its pool and took a long time to recognize that the firewall had closed its connection. Solution: set an explicit timeout in server.xml: ... timeBetweenEvictionRunsMillis6 numTestsPerEvictionRun5 minEvictableIdleTimeMillis60 Andy Chris Long wrote: Hello, I'm having a problem where it seems Tomcat and MySQL go out of sync and I am no longer able to connect to the MySQL database. The only way I've found to be able to reconnect to my database is to restart Tomcat. This generally seems to happen some time over the course of the night and I notice the problem when I check on things in the morning, but it doesn't seem to happen every time. Does anyone have any idea what may be causing this and how to fix it? Here is a list of what I'm using: Tomcat 5.5.17 MySQL 14.12 Hibernate 3.2 mysql-connector-java-5.0.4 JAVA 1.5 Windows XP Pro [Jan 29 2007 (Mon)9:30:56 EST] ERROR [http--Processor20]( org.hibernate.util.JDBCExceptionReporter) - No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error: ** BEGIN NESTED EXCEPTION ** com.mysql.jdbc.CommunicationsException MESSAGE: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Software caused connection abort: socket write error STACKTRACE: java.net.SocketException: Software caused connection abort: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java :65) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2637) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665) at com.mysql.jdbc.Connection.execSQL(Connection.java:3176) at com.mysql.jdbc.PreparedStatement.executeInternal( PreparedStatement.java:1153) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java :1266) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java :186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1778) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections( Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2211) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095) at org.hibernate.loader.Loader.list(Loader.java:2090) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388) at org.hibernate.hql.ast.QueryTranslatorImpl.list( QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java :172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.impl.AbstractQueryImpl.uniqueResult( AbstractQueryImpl.java:804) at com.tne.nres.projectTracker.ProjectTrackerServlet.validateUser(Unknown Source) at com.tne.nres.projectTracker.ProjectTrackerServlet.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke( ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke( StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service( CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection (Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool
Re: [OT] GET-then-redirect 'reload' behavior
Zitat der eMail vom 06.04.2007 um 12:41 Uhr: > I recently discovered that a redirect-after-GET does not offer this > protection. I have a link on one page that duplicates the current > record, then does a redirect to the "view record" page displaying the > new record. > Any other ideas or thoughts? As far as I know, with this kind of action performed on a GET request, you always have the possibility of unintentionally duplicated records. I think the HTTP spec says that there should be _no_ change of status performed on a GET request - GET should alwasy be repeatable without danger. For actions like yours, that's what other HTTP commands like POST and PUT are for. Because of that, some browser or cache utility may always prefetch pages reachable per GET request - resulting in unwanted action on your side. Even search engines will trigger actions if such a page is public. Or think of someone setting up a local search engine also... Just keep that in mind or correct me if I'm wrong. Andreas signature.asc Description: PGP signature
OutOfMemory problem on Tomcat 5.5.20 and Java 1.5
Hi all, I'm one of the developers working on JIRA <http://www.atlassian.com/software/jira>. We've currently got a problem, where Tomcat seems to be running out of heap space, when running JIRAs functional tests. Here are all the relevant system properties: *JDK: *java version "1.5.0_09" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01) Java HotSpot(TM) Server VM (build 1.5.0_09-b01, mixed mode) *Tomcat:* v.5.5.20 *JVM args:* -Xmx256m -XX:+HeapDumpOnOutOfMemoryError The functional tests simply run a number of HTTP requests to the web-server, simulating form submissions, button clicks, URL requests, etc (and obviously assert that the correct text is shown in the response). About a week ago, this test started failing with OutOfMemory errors. I realize that increasing the maximum memory will probably get rid of this problem, but we've never had problems running the func tests with 256MB in the past, and we want to make sure we haven't introduced a memory leak. We examined the heapdump produced, and it looks like a large amount of the memory is retained by the org.apache.jasper.compiler.JspRuntimeContext (138 MB to be exact). I've attached a screenshot of the JspRuntimeContext in YourKit. It seems that the 'jsps' SynchronizedMap is taking up all the space. The problem does NOT occur on Java 1.6. Any ideas, if it is normal behavior for the JspRuntimeContext to take up this much memory? I'm happy to make more information available if needed. The heap dump is about 65MB in size when zipped. Cheers, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory problem on Tomcat 5.5.20 and Java 1.5
Hi Mark, Sorry about the attachment, I wasn't aware that they get stripped out when e-mailing this list. I've opened an issue on http://jira.atlassian.com now for this: http://jira.atlassian.com/browse/JRA-12524 Mark Thomas wrote: Andreas Knecht wrote: About a week ago, this test started failing with OutOfMemory errors. Obvious question. What changed before it started failing? Difficult to say, as this is happening on our continuous integration and the version being built is the 'bleeding edge' of JIRA (i.e. the latest version from the source repository). However, we've had a look through the memory held by JIRA classes in the heapdump, and there doesn't seem to be anything out of the ordinary. I will however go through most of the commits since this issue started occurring and try to see if we introduced anything problematic. I've attached a screenshot of the JspRuntimeContext in YourKit. The attachement didn't come through. Can you make it availalbe via a URL? Done. It's availabel here: http://jira.atlassian.com/browse/JRA-12524 The problem does NOT occur on Java 1.6. Hmm. That points more to a jvm issue rather than a Tomcat one although there isn't enough info to rule out Tomcat entirely at this point. Can you try with the latest 1.5 jvm? I'll give that a go. Any ideas, if it is normal behavior for the JspRuntimeContext to take up this much memory? I'm happy to make more information available if needed. The heap dump is about 65MB in size when zipped. 138MB seems rather high. The screenshot would help here. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory problem on Tomcat 5.5.20 and Java 1.5
Just a quick addition. The memory dump is now available here: http://repository.atlassian.com/temp/java_pid27558.hprof.gz Cheers, Andreas Mark Thomas wrote: Andreas Knecht wrote: About a week ago, this test started failing with OutOfMemory errors. Obvious question. What changed before it started failing? I've attached a screenshot of the JspRuntimeContext in YourKit. The attachement didn't come through. Can you make it availalbe via a URL? The problem does NOT occur on Java 1.6. Hmm. That points more to a jvm issue rather than a Tomcat one although there isn't enough info to rule out Tomcat entirely at this point. Can you try with the latest 1.5 jvm? Any ideas, if it is normal behavior for the JspRuntimeContext to take up this much memory? I'm happy to make more information available if needed. The heap dump is about 65MB in size when zipped. 138MB seems rather high. The screenshot would help here. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Disable Caching for JNDI Object Factories?
Hello everyone, currently, if I locate a resource (EJB Home) from Tomcat's JNDI Context, and I have configured an Object Factory for that location, the factory is only exactly queried once. This is very problematic if the connection to the server has been broken (for example by an EJB server restart), as this renders the handle invalid and there is no way to get another handle on the same bean again (apart from restarting Tomcat). This is on Tomcat 5.5.17. Is there any way to disable JNDI resource caching only for Object Factories or completely? Is there another way around this problem? Best regards, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory problem on Tomcat 5.5.20 and Java 1.5
Hi Mark, Thanks for your input. Tomcat is started up via cargo with all its default options. This is how we've always run our functional tests. It appears that by adding new functionality (read: more JSPs, etc) we've simply reached a threshold now where we need to run the functional tests with more memory. I'm also a little baffled why this doesn't occur on JVM 1.6 however. I verified that we also use -Xmx256m on the 1.6 JVM. (all the settings are exactly the same and the server is also started up by Cargo. The only difference is the version of the JVM) I suppose the good thing about this is that, while analyzing these heapdumps we did find some memory inefficiencies in JIRA however. Especially to do with small leaks of the VelocityEngine (about 90Mb are taken up by the velocity engine) by JIRA code. Initially we thought this was normal, as velocity also caches the rendered velocity templates, however it looks like in very rare circumstance we're leaking the entire VelocityEngine object. We're not 100% sure yet how this happens, but we're investigating it at the moment. We had a look at http://issues.apache.org/bugzilla/show_bug.cgi?id=37793 with Jeff Turner, but it doesn't seem that this is the major cause of the problem. Thanks again for your help. Cheers, Andreas Mark Thomas wrote: Andreas Knecht wrote: Just a quick addition. The memory dump is now available here: http://repository.atlassian.com/temp/java_pid27558.hprof.gz Cheers, Andreas You appear to be running Tomcat in development mode. (http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html) This means that source of every JSP is held in memory to provide detailed messages in the event of an error. If you have large JSPs this will hurt. It looks like this accounts for 50MB+ The compiled JSPs account for 80MB+. I am guess there is a lot of text in some of these JSPs. This doesn't explain why you don't see the error on a 1.6 jvm. Are you sure you are still using 256MB of RAM with the 1.6 jvm? 27% of your memory is used by char[]. Have you read http://issues.apache.org/bugzilla/show_bug.cgi?id=37793 ? It might offer some insight. HTH, Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to setup wildcard host
Hello, how can I setup a host in server.xml so it will listen on all hosts "*.sub.domain.tld" ? I can't find any documentation about the name syntax for a host. Thanks, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What happened to MailSessionFactory?
Russ Bonsall wrote: We just moved from Tomcat 5.5.17 to 5.5.20. Our application uses the JavaMail Session as a resource configured in the server.xml. When sending an email in our application I was getting the following exception: > =20 javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: I've got the same problem. Is there any solution? Regards, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat server.xml config for wildcard host
Hello, I'm looking for a solution to have only one Host configured in server.xml with is listening for a hostname pattern like *.sub.domain.tld. I'cant take a host just on the IP address because I need 2 or 3 similar hostname pattern on the same tomcat: *.sub.domain1.tld -> Host 1 *.sub.domain2.tld -> Host 2 *.sub.domain2.tld -> Host 3 A servlet will take the real hostname and deliver the real content for a particular hostname. e.g: user1.sub.domain1.tld user2.sub.domain1.tld ... usern.sub.domain1.tld Every request will call the same servlet with delivers the content requestet for the user. I hope someone can help me how to config these in server.xml Best regards, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tomcat switches off all the time
I`m trying to install the tomcat 5.5.12 version on my computer, but I can not run tomcat automatically by changing the service-properties from manual to automatic. The tomcat service switches off after about 0.5 minutes. Even if i restart the computer, tomcat does not switch on again automatically. Do you have any idea what the bug for this problem is? -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: tomcat switches off all the time
yes, I`m using the Windows Firewall... does a firewall have any influence on the activity of the tomcat-service? Original-Nachricht Datum: Thu, 7 Dec 2006 14:57:56 +0530 Von: "Narayanaswamy, Mohan" <[EMAIL PROTECTED]> An: "Tomcat Users List" Betreff: RE: tomcat switches off all the time > > Is there any firewall running in your machine? > > -Original Message- > From: Andreas Hess [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 07, 2006 5:20 PM > To: users@tomcat.apache.org > Subject: tomcat switches off all the time > > I`m trying to install the tomcat 5.5.12 version on my computer, but I can > not run tomcat automatically by changing the service-properties from manual > to automatic. The tomcat service switches off after about 0.5 minutes. > Even if i restart the computer, tomcat does not switch on again automatically. > > Do you have any idea what the bug for this problem is? > -- > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer > > - > To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, > e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > This email is confidential. If you are not the addressee tell the sender > immediately and destroy this email > without using, sending or storing it. Emails are not secure and may suffer > errors, viruses, delay, > interception and amendment. Standard Chartered PLC and subsidiaries > ("SCGroup") do not accept liability for > damage caused by this email and may monitor email traffic. > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: RE: tomcat switches off all the time
Unfortunately the tomcat still switches off although I turned of the firewall. Original-Nachricht Datum: Thu, 7 Dec 2006 15:10:37 +0530 Von: "Narayanaswamy, Mohan" <[EMAIL PROTECTED]> An: "Tomcat Users List" Betreff: RE: RE: tomcat switches off all the time > > Yes, Turn of the Windows Firewall and test it. Firewall blocks when Tomcat > tries to listen a port. > > Regards, > Mohan > > -Original Message- > From: Andreas Hess [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 07, 2006 5:38 PM > To: Tomcat Users List > Subject: Re: RE: tomcat switches off all the time > > yes, I`m using the Windows Firewall... does a firewall have any influence > on the activity of the tomcat-service? > Original-Nachricht > Datum: Thu, 7 Dec 2006 14:57:56 +0530 > Von: "Narayanaswamy, Mohan" <[EMAIL PROTECTED]> > An: "Tomcat Users List" > Betreff: RE: tomcat switches off all the time > > > > > Is there any firewall running in your machine? > > > > -Original Message- > > From: Andreas Hess [mailto:[EMAIL PROTECTED] > > Sent: Thursday, December 07, 2006 5:20 PM > > To: users@tomcat.apache.org > > Subject: tomcat switches off all the time > > > > I`m trying to install the tomcat 5.5.12 version on my computer, but I > > can not run tomcat automatically by changing the service-properties > > from manual to automatic. The tomcat service switches off after about > 0.5 minutes. > > Even if i restart the computer, tomcat does not switch on again > automatically. > > > > Do you have any idea what the bug for this problem is? > > -- > > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! > > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer > > > > - > > To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, > > e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > This email is confidential. If you are not the addressee tell the > > sender immediately and destroy this email without using, sending or > > storing it. Emails are not secure and may suffer errors, viruses, > > delay, interception and amendment. Standard Chartered PLC and > > subsidiaries > > ("SCGroup") do not accept liability for damage caused by this email > > and may monitor email traffic. > > > > > > - > > To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, > > e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > -- > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer > > - > To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, > e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > This email is confidential. If you are not the addressee tell the sender > immediately and destroy this email > without using, sending or storing it. Emails are not secure and may suffer > errors, viruses, delay, > interception and amendment. Standard Chartered PLC and subsidiaries > ("SCGroup") do not accept liability for > damage caused by this email and may monitor email traffic. > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- "Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht! - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Basic Auth without modification to web.xml?
Hi everyone, Is it possible with Tomcat to "hide" an application behind a Basic Authentication (or something similar), without modifying the web application itself (also not modifying web.xml)? I am thinking about adding a Valve or something to the context.xml. The content to be protected would just be the whole application, and there is only one user/role needed that has access. Is there something like this possible? Regards, Andreas - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Large webapps in 7.0.29 and Annotation Scanning not respecting "metadata-complete"
12061438-3.7.2.jar org.eclipse.datatools.enablement.oracle_1.0.0.v201107221506-3.7.2.jar org.eclipse.datatools.enablement.oracle.dbdefinition_1.0.102.v201107221506-3.7.2.jar org.eclipse.datatools.enablement.postgresql_1.1.0.v201110070445-3.7.2.jar org.eclipse.datatools.enablement.postgresql.dbdefinition_1.0.2.v201110070445-3.7.2.jar org.eclipse.datatools.modelbase.dbdefinition_1.0.2.v201107221519-3.7.2.jar org.eclipse.datatools.modelbase.derby_1.0.0.v201107221519-3.7.2.jar org.eclipse.datatools.modelbase.sql_1.0.5.v201110151330-3.7.2.jar org.eclipse.datatools.modelbase.sql.query_1.1.2.v201110151315-3.7.2.jar org.eclipse.emf_2.6.0.v20120123-1045-3.7.2.jar org.eclipse.emf.common_2.7.0.v20120123-0926-3.7.2.jar org.eclipse.emf.ecore_2.7.0.v20120123-0926-3.7.2.jar org.eclipse.emf.ecore.change_2.7.1.v20120123-0926-3.7.2.jar org.eclipse.emf.ecore.xmi_2.7.0.v20120123-0926-3.7.2.jar org.eclipse.equinox.app_1.3.100.v20110321-3.7.2.jar org.eclipse.equinox.common_3.6.0.v20110523-3.7.2.jar org.eclipse.equinox.preferences_3.4.2.v20120111-2020-3.7.2.jar org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611-3.7.2.jar org.eclipse.osgi_3.7.2.v20120110-1415-3.7.2.jar org.eclipse.osgi.services_3.3.0.v20110513-3.7.2.jar org.eclipse.update.configurator_3.3.100.v20100512-3.7.2.jar org.w3c.css.sac_1.3.0.v200805290154-3.7.2.jar org.w3c.dom.smil_1.0.0.v200806040011-3.7.2.jar org.w3c.dom.svg_1.1.0.v201011041433-3.7.2.jar quartz-1.8.6.jar slf4j-api-1.6.4.jar slf4j-log4j12-1.6.4.jar spring-aop-3.1.2.RELEASE.jar spring-asm-3.1.2.RELEASE.jar spring-beans-3.1.2.RELEASE.jar spring-context-3.1.2.RELEASE.jar spring-context-support-3.1.2.RELEASE.jar spring-core-3.1.2.RELEASE.jar spring-data-commons-core-1.3.0.RELEASE.jar spring-data-jpa-1.1.0.RELEASE.jar spring-expression-3.1.2.RELEASE.jar spring-jdbc-3.1.2.RELEASE.jar spring-ldap-core-1.3.1.RELEASE.jar spring-ldap-core-tiger-1.3.1.RELEASE.jar spring-orm-3.1.2.RELEASE.jar spring-oxm-3.1.2.RELEASE.jar spring-security-acl-3.1.1.RELEASE.jar spring-security-config-3.1.1.RELEASE.jar spring-security-core-3.1.1.RELEASE.jar spring-security-ldap-3.1.1.RELEASE.jar spring-security-taglibs-3.1.1.RELEASE.jar spring-security-web-3.1.1.RELEASE.jar spring-tx-3.1.2.RELEASE.jar spring-web-3.1.2.RELEASE.jar spring-webmvc-3.1.2.RELEASE.jar spring-webmvc-portlet-3.1.2.RELEASE.jar stax-api-1.0.1.jar Tidy-3.7.2.jar validation-api-1.0.0.GA.jar xmlbeans-2.5.0.jar http://java.sun.com/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; metadata-complete="true" version="2.5"> ... // andreas
RE: Large webapps in 7.0.29 and Annotation Scanning not respecting "metadata-complete"
Thank you Mark for explaining this. I'll see if I can get my hands on a 7.0.30 and see how it works out. One thing though, would it be possible to allow Tomcat to _only_ scan for SCI's in WEB-INF/classes and exclude WEB-INF/lib (even for parent classes inherited in the former)? It would be great to have some control over the SCI's as some could be located in any of the dependencies I have added to the application. // andreas > Date: Wed, 1 Aug 2012 08:51:04 +0100 > From: ma...@apache.org > To: users@tomcat.apache.org > Subject: Re: Large webapps in 7.0.29 and Annotation Scanning not respecting > "metadata-complete" > > There are multiple issues going on here. There have been reported > previously and are understood. I'll try and explain the full story. > [...] > > Mark >
Re: Large webapps in 7.0.29 and Annotation Scanning not respecting "metadata-complete"
I have been thinking about this issue all day, and I think the specification needs more work on this area. There is certainly no need for a container to wade through hundreds maybe even thousands of classes in search of something that does not exist. It is an unnecessary task which consumes both time and resources. I am all for making it easier for a developer, and make the container scan everything by default. But there is also an obvious need for a solution to specifically define where a container should look for annotations when we have web applications with very large amount of classes. Even if it has to be an XML-file, such as in Spring where you can instruct the framework where to look for beans, entities, controllers and such. Mark, is there a way we can influence the EG to change this? Thanks. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Updating Tomcat-Server from Version 6.0.16 to 7.0.30
Hello guys, i would like to install the newest stable version of the Apache Tomcat Server. I already got some stuff running on the old Tomcat v.6.0.16 Server. I want to ask you, if it is safe to do this update and if afterwards my v 6 compatible JSP-Files wont cause any problems. Thank you in advance, Andi - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Updating Tomcat-Server from Version 6.0.16 to 7.0.30
Pid wrote: >Try the latest 6.0.x first, then if your app is fine, try 7.0.x. >Things changed in 6 that sometimes catch people out. Okay, thank you! My problem is: I don't know anything about the behave of applications/webservices which the tomcat 6.0.16 is running at the moment. So I am not able to determine whether everything works fine or not after a change to tomcat 7. At least till some users start complaining :D. But my own Web-Project doesn't run under 6.0.16. Therefore I had to upgrade to version 7.0.x. I did it this morning and till now everything went well. I hope this lasts Best regards Andi - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Trusted sign on with IIS 7.5 (64 bit) / Tomcat 6 and isapi -> convert login name to lower case
Hello, i was searching a while but actually I´m not even sure where to ask. I installed a Windows IIS 7.5 (64bit) Server in connection with tomcat 6.0 (via jk isapi). On top i installed trusted sign on based on windows authentication. Everything went well and the system is working as expected with just a little issue. For wahtever reason i get all usernames converted to upper case. Is there any hint how to convert back to lower case (win login was done in lower case). Where to focus my sarch, IIS, Tomcat or connector ? I would really appreciate any helpfull tip ! Thanks in advance
Re: Parameter handling on forward
Did you try: "/page2?foo=&bar=123" Normally parameters come as key/value pairs, separated by an equal sign. On 12/01/16 09:21, Mark Olsson wrote: I'm getting unexpected parameter handling with a request.getRequestDispatcher().forward(). Not sure if this is a bug or I'm using gRD.f wrong, but here's the situation: A POST is made with form data to a servlet (didn't try with a multipart content, just regular) and the servlet decides to redirect to another servlet using request.getRequestDispatcher().forward(), but adds parameters on the new address. Address parameters with a value "asdf=123" *are* sent to the new servlet but parameters without a value *aren't*. Example: 1. POST made to page1 with parameters input1="asdf" and button1 (no value). 2. The servlet handling page1 redirects to page2 and adds 2 parameters: request.getRequestDispatcher("/page2?foo&bar=123").forward(request,response). 3. page2 gets the original parameters input1="asdf", button1, and new bar="123" but not foo. foo is in the browser address and is in the request query string, but it's not one of the parameters sent along with the request object. Neither request.getParameterNames() nor request.getParameter() will find "foo". It also doesn't appear in the list of parameters in Netbeans' server monitor. 4. Changing the order of the parameters (/page2?bar=123&foo) doesn't fix it, but adding a value to foo does (/page2?foo=x&bar=123). So what's up with valueless parameters on a servlet forward? Tomcat: 8.0.26 Java: 1.8.0_60 Oracle OS: Win7 and Linux 3.14.20-20.44.amzn1.x86_64 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Severe errors in log on Tomcat 8.5.5
:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process( AbstractProtocol.java:802) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor. doRun(NioEndpoint.java:1410) at org.apache.tomcat.util.net.SocketProcessorBase.run( SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run( ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run( TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Any advice about what could cause these errors? Regards, Andreas R.
Ajp Nio-thread stuck in loop and consuming a lot of cpu
86778 lastack:1290786767 pacing_rate 134.4Mbps retrans:0/433 rcv_rtt:1.875 rcv_space:28960 CLOSE-WAIT 1 0 10.x.x.x:4831710.x.x.12:41990 cubic wscale:7,7 rto:202 rtt:1.132/0.899 ato:40 mss:1448 cwnd:10 ssthresh:22 bytes_acked:37347221 bytes_received:3346200 segs_out:35273 segs_in:20608 send 102.3Mbps lastsnd:289840681 lastrcv:289730802 lastack:289720796 pacing_rate 204.5Mbps retrans:0/13 reordering:24 rcv_rtt:1.875 rcv_space:28960 CLOSE-WAIT 1 0 10.x.x.x:4831710.x.x.12:60068 cubic wscale:7,7 rto:209 rtt:8.757/14.317 ato:40 mss:1448 cwnd:10 ssthresh:36 bytes_acked:180903401 bytes_received:16401965 segs_out:170017 segs_in:100392 send 13.2Mbps lastsnd:395602314 lastrcv:395602267 lastack:395602257 pacing_rate 26.5Mbps retrans:0/106 rcv_rtt:1.875 rcv_space:28960 CLOSE-WAIT 2 0 10.x.x.x:4831710.x.x.11:50628 cubic wscale:7,7 rto:203 rtt:2.992/4.252 ato:40 mss:1448 cwnd:13 ssthresh:25 bytes_acked:4185335 bytes_received:471220 segs_out:4193 segs_in:2181 send 50.3Mbps lastsnd:1036916135 lastrcv:1036871377 lastack:1036871367 pacing_rate 100.6Mbps retrans:0/1 reordering:26 rcv_rtt:6.375 rcv_space:28960 We are running our Tomcat node behind and Apache server and use Tomcat Connector (mod_jk) as a load balancer. When looking at the hosts running the Apache node the corresponding sockets are closed. To us it seems that Tomcat has not properly closed the underlying socket when Apache/mod_jk initiated a FIN and is instead continuously trying to read from the socket even though it has been closed on the Apache side ? I know that we are one version behind the latest release of Tomcat 8.0.x but I checked the changelog and I could not see any fixed issues matching this problem. Unfortunately we are only seeing this in production and we have not been able to reproduce in test. Has anyone experienced a similar issue like this before ? For reference our connector configuration in server.xml looks like this: And our Tomcat Connector configuration for Apache in workers.properties looks like this: worker.list = status,app # Create workers for app worker.app-1.type=ajp13 worker.app-1.host=host8128.corpdomain.internal worker.app-1.port=48317 worker.app-1.ping_mode=A worker.app-1.connection_pool_timeout=600 worker.app-1.secret=xxx worker.app-2.type=ajp13 worker.app-2.host=host8129.corpdomain.internal worker.app-2.port=48317 worker.app-2.ping_mode=A worker.app-2.connection_pool_timeout=600 worker.app-2.secret=xxx # Create a loadbalancer for app worker.app.type=lb worker.app.sticky_session=1 worker.app.balance_workers=app-1, app-2 Best regards, Andreas Andreas Toom Systemutvecklare/IT TEL: +46 702 03 04 98 [Volvofinans Bank AB]<http://www.volvofinans.se/>
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi André, Thanks for your reply! The Tomcat Connector connection_pool_timeout is specified in seconds and the Tomcat ajp connector connectionTimeout is specified in milliseconds so both sides have the same value. This is the recommended setting. See quote from the link that your provided: https://tomcat.apache.org/connectors-doc/common_howto/timeouts.html "We generally recommend values around 10 minutes, so setting connection_pool_timeout to 600 (seconds). If you use this attribute, please also set the attribute keepAliveTimeout (if it is set explicitly) or connectionTimeout in the AJP Connector element of your Tomcat server.xml configuration file to an analogous value. Caution: keepAliveTimeout and connectionTimeout must be given in milliseconds. So if you set JK connection_pool_timeout to 600, you should set Tomcat keepAliveTimeout or connectionTimeout to 60." Best regards, Andreas -Original Message- From: André Warnier (tomcat) [mailto:a...@ice-sa.com] Sent: den 12 januari 2018 09:57 To: users@tomcat.apache.org Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu On 12.01.2018 07:58, Toom Andreas wrote: > Hi, > > We are having an issue with an application running Apache Tomcat 8.0.47 using > Oracle Jvm 1.8.0.151 on Linux (RHEL 7). The Tomcat process is consuming cpu > at a constant high level even though there is a low amount of incoming > traffic. When inspecting the process health using JMX /JVisualVM CPU Sampler > we see that there are 4 ajp-nio-exec threads together with a > NioBlockingSelector.BlockPoller thread that consume most of the cpu. > > A stack trace of one of the ajp-io-exec threads looks like this: > > "ajp-nio-48317-exec-14233" - Thread t@201195 > java.lang.Thread.State: TIMED_WAITING > at sun.misc.Unsafe.park(Native Method) > - parking to wait for <342fab60> (a > java.util.concurrent.CountDownLatch$Sync) > at > java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328) > at > java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277) > at > org.apache.tomcat.util.net.NioEndpoint$KeyAttachment.awaitLatch(NioEndpoint.java:1400) > at > org.apache.tomcat.util.net.NioEndpoint$KeyAttachment.awaitReadLatch(NioEndpoint.java:1402) > at > org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:185) > at > org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:250) > at > org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:231) > at > org.apache.coyote.ajp.AjpNioProcessor.readSocket(AjpNioProcessor.java:194) > at > org.apache.coyote.ajp.AjpNioProcessor.read(AjpNioProcessor.java:160) > at > org.apache.coyote.ajp.AbstractAjpProcessor.readMessage(AbstractAjpProcessor.java:1091) > at > org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:804) > at > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) > - locked <279cc7f7> (a > org.apache.tomcat.util.net.NioChannel) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) > at java.lang.Thread.run(Thread.java:748) > > Locked ownable synchronizers: > - locked <10e1f474> (a > java.util.concurrent.ThreadPoolExecutor$Worker) > > A stack trace of the NioBlockingSelector.BlockPoller thread looks like this: > > "NioBlockingSelector.BlockPoller-2"
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi Mark, Thanks for the reply! We will try got get some additional info and get back to you as soon as possible! Best regards, Andreas -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: den 12 januari 2018 11:27 To: Tomcat Users List Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu On 12/01/18 06:58, Toom Andreas wrote: > Hi, > > We are having an issue with an application running Apache Tomcat 8.0.47 using > Oracle Jvm 1.8.0.151 on Linux (RHEL 7). The Tomcat process is consuming cpu > at a constant high level even though there is a low amount of incoming > traffic. When inspecting the process health using JMX /JVisualVM CPU Sampler > we see that there are 4 ajp-nio-exec threads together with a > NioBlockingSelector.BlockPoller thread that consume most of the cpu. Are you able to determine the code path of the loop? A single stack trace can point us in the right direction but often the root cause can still be tricky to track down. A profiler such as YourKit in CPU tracing mode should be able to provide enough info to figure this out (and won't require any code changes to your system). Remote debugging is the other option but that is less ideal in production. Mark > > A stack trace of one of the ajp-io-exec threads looks like this: > > "ajp-nio-48317-exec-14233" - Thread t@201195 >java.lang.Thread.State: TIMED_WAITING > at sun.misc.Unsafe.park(Native Method) > - parking to wait for <342fab60> (a > java.util.concurrent.CountDownLatch$Sync) > at > java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328) > at > java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277) > at > org.apache.tomcat.util.net.NioEndpoint$KeyAttachment.awaitLatch(NioEndpoint.java:1400) > at > org.apache.tomcat.util.net.NioEndpoint$KeyAttachment.awaitReadLatch(NioEndpoint.java:1402) > at > org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:185) > at > org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:250) > at > org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:231) > at > org.apache.coyote.ajp.AjpNioProcessor.readSocket(AjpNioProcessor.java:194) > at > org.apache.coyote.ajp.AjpNioProcessor.read(AjpNioProcessor.java:160) > at > org.apache.coyote.ajp.AbstractAjpProcessor.readMessage(AbstractAjpProcessor.java:1091) > at > org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:804) > at > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) > - locked <279cc7f7> (a > org.apache.tomcat.util.net.NioChannel) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) > at java.lang.Thread.run(Thread.java:748) > >Locked ownable synchronizers: > - locked <10e1f474> (a > java.util.concurrent.ThreadPoolExecutor$Worker) > > A stack trace of the NioBlockingSelector.BlockPoller thread looks like this: > > "NioBlockingSelector.BlockPoller-2" - Thread t@17 >java.lang.Thread.State: RUNNABLE > at sun.nio.ch.EPollArrayWrapper.epollWait(Native > Method) > at > sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269) > at > sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93) > at > sun.nio.ch.Selector
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi Mark, We pulled out a CPU Call Tree using JVisualVM instead of YourKit and I have uploaded a screenshot of it here: https://imgur.com/a/mqYxn There is not much extra information compared to the java thread dump in my initial post but it highlights in which code branch/method call most of the cpu time is spent. Perhaps it will give some additional clues ? Let me know if you think that it is worthwhile to use YourKit instead of JVisualVM and I will try to get that for you instead. Best regards, Andreas -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: den 12 januari 2018 11:27 To: Tomcat Users List Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu On 12/01/18 06:58, Toom Andreas wrote: > Hi, > > We are having an issue with an application running Apache Tomcat 8.0.47 using > Oracle Jvm 1.8.0.151 on Linux (RHEL 7). The Tomcat process is consuming cpu > at a constant high level even though there is a low amount of incoming > traffic. When inspecting the process health using JMX /JVisualVM CPU Sampler > we see that there are 4 ajp-nio-exec threads together with a > NioBlockingSelector.BlockPoller thread that consume most of the cpu. Are you able to determine the code path of the loop? A single stack trace can point us in the right direction but often the root cause can still be tricky to track down. A profiler such as YourKit in CPU tracing mode should be able to provide enough info to figure this out (and won't require any code changes to your system). Remote debugging is the other option but that is less ideal in production. Mark > > A stack trace of one of the ajp-io-exec threads looks like this: > > "ajp-nio-48317-exec-14233" - Thread t@201195 >java.lang.Thread.State: TIMED_WAITING > at sun.misc.Unsafe.park(Native Method) > - parking to wait for <342fab60> (a > java.util.concurrent.CountDownLatch$Sync) > at > java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328) > at > java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277) > at > org.apache.tomcat.util.net.NioEndpoint$KeyAttachment.awaitLatch(NioEndpoint.java:1400) > at > org.apache.tomcat.util.net.NioEndpoint$KeyAttachment.awaitReadLatch(NioEndpoint.java:1402) > at > org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:185) > at > org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:250) > at > org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:231) > at > org.apache.coyote.ajp.AjpNioProcessor.readSocket(AjpNioProcessor.java:194) > at > org.apache.coyote.ajp.AjpNioProcessor.read(AjpNioProcessor.java:160) > at > org.apache.coyote.ajp.AbstractAjpProcessor.readMessage(AbstractAjpProcessor.java:1091) > at > org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:804) > at > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) > - locked <279cc7f7> (a > org.apache.tomcat.util.net.NioChannel) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) > at java.lang.Thread.run(Thread.java:748) > >Locked ownable synchronizers: > - locked <10e1f474> (a > java.util.concurrent.ThreadPoolExecutor$Worker) > > A stack trace of the NioBlockingSelector.BlockPoller thread looks like this: > > "NioBlockingSelector.BlockPoller-2" - Thread t@17 >java.lang.Threa
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi Greg, Thanks for looking into this issue. Unfortunately I am 100% sure we are running Tomcat 8.0.47 so the referenced patch/fix is already applied. Best regards, Andreas -Original Message- From: Greg Huber [mailto:gregh3...@gmail.com] Sent: den 18 januari 2018 14:56 To: Tomcat Users List Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu Following this thread, I run the same setup, apache/mod_jk/ tomcat. There was a problem a while back where the cpu went to max for me, as my server is slow and thread blocking more of a possibility. https://bz.apache.org/bugzilla/show_bug.cgi?id=58151 Although this was in version 8.0.23, are you sure your using 8.0.47 jars? Cheers Greg On 18 January 2018 at 13:45, Rainer Jung wrote: > Just an addition to one of Mark's questions: > > Am 17.01.2018 um 22:20 schrieb Mark Thomas: > >> Is it always the same threads generating the load or does it move >> between threads? >> > > Just in case Andreas is not aware: one can check with "top -H -p ". > > Using -H lets top show one line per thread instead of one line per > process. That way you can easily see CPU use per thread. The "-p " > would simply filter to only show the threads in your java process (by > using for the process ID of your Tomcat java process). > > Furthermore the PID column in "top -H" does not actually show the PID, > but instead the thread IDs. If you convert that decimal numbers to hex, e.g. > using the shell commandline > > printf "0x%x\n" > > (and replacing by the respective thread id of the lines that show > high CPU usage), you get a hex number that will point you to the > respective thread in the java thread dump by looking for tid=0x... in > the thread header lines. The association between operating system > thread number as shown in "top -H" and the tid in the Java thread dump > does is stable during the lifetime of the process. > > Regards, > > Rainer > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi Mark, Sorry for the late reply, it has been a couple of busy days. We are running our application on two nodes and we have seen the issue on both nodes. These machines are running quad core cpus. What we have usually seen is that the application jvm process is consuming 100% (basically one core) on one machine and 200% (2 cores) on the other machine. The cpu usage/core usage seems to correlate quite well with the number of looping threads that we can observe via jmx. The load does not move between threads, it is pinned to the looping thread. We have only observed this behavior on one application and only in production. "Unfortunately" we did a deployment this week so both nodes have been restarted which means that at the moment the cpu usage is down to almost 0. We are planning to update to Tomcat 8.5.x in the coming week (planned update, not a forced update related to this issue). Are you aware of any major code changes between the 8.0.x and 8.5.x branches related to this functionality ? Best regards, Andreas -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: den 17 januari 2018 22:20 To: Tomcat Users List Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu On 16/01/18 23:21, Mark Thomas wrote: > On 16/01/18 09:21, Toom Andreas wrote: >> Hi Mark, >> >> We pulled out a CPU Call Tree using JVisualVM instead of YourKit and >> I have uploaded a screenshot of it here: https://imgur.com/a/mqYxn >> >> There is not much extra information compared to the java thread dump in my >> initial post but it highlights in which code branch/method call most of the >> cpu time is spent. Perhaps it will give some additional clues ? Let me know >> if you think that it is worthwhile to use YourKit instead of JVisualVM and I >> will try to get that for you instead. > > Thanks. This has given me a couple of ideas. I need to do some more > testing. I hope to be able to get this done in the next day or so. Unfortunately my ideas didn't pan out. What levels of CPU usage are you observing? Is it always the same threads generating the load or does it move between threads? Can you reproduce this on a system you can attach a remote debugger to? What we really need to do is understand the code path that is being taken and why. I can see the likely code path in the data we have so far but nothing that looks abnormal. Mark > > Mark > > >> >> Best regards, >> Andreas >> >> -Original Message- >> From: Mark Thomas [mailto:ma...@apache.org] >> Sent: den 12 januari 2018 11:27 >> To: Tomcat Users List >> Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu >> >> On 12/01/18 06:58, Toom Andreas wrote: >>> Hi, >>> >>> We are having an issue with an application running Apache Tomcat 8.0.47 >>> using Oracle Jvm 1.8.0.151 on Linux (RHEL 7). The Tomcat process is >>> consuming cpu at a constant high level even though there is a low amount >>> of incoming traffic. When inspecting the process health using JMX >>> /JVisualVM CPU Sampler we see that there are 4 ajp-nio-exec threads >>> together with a NioBlockingSelector.BlockPoller thread that consume most of >>> the cpu. >> >> Are you able to determine the code path of the loop? A single stack trace >> can point us in the right direction but often the root cause can still be >> tricky to track down. >> >> A profiler such as YourKit in CPU tracing mode should be able to provide >> enough info to figure this out (and won't require any code changes to your >> system). >> >> Remote debugging is the other option but that is less ideal in production. >> >> Mark >> >> >>> >>> A stack trace of one of the ajp-io-exec threads looks like this: >>> >>> "ajp-nio-48317-exec-14233" - Thread t@201195 >>>java.lang.Thread.State: TIMED_WAITING >>> at sun.misc.Unsafe.park(Native Method) >>> - parking to wait for <342fab60> (a >>> java.util.concurrent.CountDownLatch$Sync) >>> at >>> java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) >>> at >>> java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037) >>> at >>> java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328) >>> at >
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi Rainer, Thanks for your reply! We did a restart of the application earlier this week and so far the cpu usage is at normal levels. If/when the cpu usage goes up I will check with your suggested parameters! Best regards, Andreas -Original Message- From: Rainer Jung [mailto:rainer.j...@kippdata.de] Sent: den 18 januari 2018 14:46 To: Tomcat Users List Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu Just an addition to one of Mark's questions: Am 17.01.2018 um 22:20 schrieb Mark Thomas: > Is it always the same threads generating the load or does it move > between threads? Just in case Andreas is not aware: one can check with "top -H -p ". Using -H lets top show one line per thread instead of one line per process. That way you can easily see CPU use per thread. The "-p " would simply filter to only show the threads in your java process (by using for the process ID of your Tomcat java process). Furthermore the PID column in "top -H" does not actually show the PID, but instead the thread IDs. If you convert that decimal numbers to hex, e.g. using the shell commandline printf "0x%x\n" (and replacing by the respective thread id of the lines that show high CPU usage), you get a hex number that will point you to the respective thread in the java thread dump by looking for tid=0x... in the thread header lines. The association between operating system thread number as shown in "top -H" and the tid in the Java thread dump does is stable during the lifetime of the process. Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Ajp Nio-thread stuck in loop and consuming a lot of cpu
Hi Mark, Thanks for the info - I think we will focus on migrating to the 8.5.x branch first. If we experience the same issue on that branch I will restart our investigation and might come back with additional debugging information to see if we can identify the root cause. Thanks for your help! Best regards, Andreas -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: den 19 januari 2018 18:46 To: Tomcat Users List Subject: Re: Ajp Nio-thread stuck in loop and consuming a lot of cpu On 19/01/2018 14:35, Toom Andreas wrote: > Hi Mark, > > Sorry for the late reply, it has been a couple of busy days. > > We are running our application on two nodes and we have seen the issue on > both nodes. These machines are running quad core cpus. What we have usually > seen is that the application jvm process is consuming 100% (basically one > core) on one machine and 200% (2 cores) on the other machine. The cpu > usage/core usage seems to correlate quite well with the number of looping > threads that we can observe via jmx. > > The load does not move between threads, it is pinned to the looping thread. > > We have only observed this behavior on one application and only in > production. "Unfortunately" we did a deployment this week so both nodes have > been restarted which means that at the moment the cpu usage is down to almost > 0. > > We are planning to update to Tomcat 8.5.x in the coming week (planned update, > not a forced update related to this issue). Are you aware of any major code > changes between the 8.0.x and 8.5.x branches related to this functionality ? There is a significant refactoring of the connectors between 8.0.x and 8.5.x to reduce code duplication, improve consistency of behaviour between the implementations and to support HTTP/2. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9
Hi, I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the packet size in the AJP connector. It seems like only the default value (8192) works now. If I set it to anything greater than that I'll get 503 Internal Server Error when trying to access a web page. It worked fine in 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed regarding the packet size? Should it still work with values greater than 8192? I use Tomcat Native APR and mod_proxy_ajp in Apache on the other side. /Andreas
RE: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9
Thank's for investigating Mark! I think it's only possible to change the packet size in mod_jk, not in mod_proxy_ajp, right? So either we need to switch to mod_jk or stick with a packet size of 8192. A bit strange though that it worked fine in Tomcat 8.5, maybe it adapted to httpd and still used 8192 as a packet size even though we specified 65536 in Tomcat? /Andreas -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: den 3 maj 2018 11:41 To: Tomcat Users List Subject: Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9 On 03/05/18 10:36, Mark Thomas wrote: > On 03/05/18 09:48, Andreas Bergander wrote: >> Hi, >> >> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the >> packet size in the AJP connector. It seems like only the default value >> (8192) works now. If I set it to anything greater than that I'll get 503 >> Internal Server Error when trying to access a web page. It worked fine in >> 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed >> regarding the packet size? Should it still work with values greater than >> 8192? > > It should work but I can confirm that it currently does not. > Investigating now... That was easy :) You need to remember to change the packet size to be exactly the same value on both Tomcat and httpd. When I changed it just on Tomcat (to 2), I saw 503 errors from httpd. Once I changed them both to be 2, everything worked as expected. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9
Ah, I see! Thank you very much for the quick and helpful answer! /Andreas -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: den 3 maj 2018 13:37 To: Tomcat Users List Subject: Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9 On 03/05/18 10:59, Andreas Bergander wrote: > Thank's for investigating Mark! > > I think it's only possible to change the packet size in mod_jk, not in > mod_proxy_ajp, right? Wrong. ProxyIOBufferSize Mark > So either we need to switch to mod_jk or stick with a packet size of 8192. > > A bit strange though that it worked fine in Tomcat 8.5, maybe it adapted to > httpd and still used 8192 as a packet size even though we specified 65536 in > Tomcat? > > /Andreas > > -Original Message- > From: Mark Thomas [mailto:ma...@apache.org] > Sent: den 3 maj 2018 11:41 > To: Tomcat Users List > Subject: Re: Changing the packetSize in AJP connector causes 503 Internal > Server Error in Tomcat 9 > > On 03/05/18 10:36, Mark Thomas wrote: >> On 03/05/18 09:48, Andreas Bergander wrote: >>> Hi, >>> >>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue regarding the >>> packet size in the AJP connector. It seems like only the default value >>> (8192) works now. If I set it to anything greater than that I'll get 503 >>> Internal Server Error when trying to access a web page. It worked fine in >>> 8.5 but now I get EOFExceptions in the AJP processor. Has anything changed >>> regarding the packet size? Should it still work with values greater than >>> 8192? >> >> It should work but I can confirm that it currently does not. >> Investigating now... > > That was easy :) > > You need to remember to change the packet size to be exactly the same value > on both Tomcat and httpd. > > When I changed it just on Tomcat (to 2), I saw 503 errors from httpd. > Once I changed them both to be 2, everything worked as expected. > > Mark > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9
I don't think I saw any error messages at all in Tomcat. Just in the apache logs. When I debugged I noticed an EOFException in the AJPProcessor. The service method catches all type of IOExceptions and sets the error state but doesn't log anything. /Andreas -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: den 8 maj 2018 18:59 To: users@tomcat.apache.org Subject: Re: Changing the packetSize in AJP connector causes 503 Internal Server Error in Tomcat 9 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Mark, On 5/3/18 5:41 AM, Mark Thomas wrote: > On 03/05/18 10:36, Mark Thomas wrote: >> On 03/05/18 09:48, Andreas Bergander wrote: >>> Hi, >>> >>> I've upgrade from Tomcat 8.5 to 9.0.7 and I've got an issue >>> regarding the packet size in the AJP connector. It seems like only >>> the default value (8192) works now. If I set it to anything greater >>> than that I'll get 503 Internal Server Error when trying to access a >>> web page. It worked fine in 8.5 but now I get EOFExceptions in the >>> AJP processor. Has anything changed regarding the packet size? >>> Should it still work with values greater than 8192? >> >> It should work but I can confirm that it currently does not. >> Investigating now... > > That was easy :) > > You need to remember to change the packet size to be exactly the same > value on both Tomcat and httpd. > > When I changed it just on Tomcat (to 2), I saw 503 errors from > httpd. Once I changed them both to be 2, everything worked as > expected. This bites enough people that it may be worth correcting, or at least changing the behavior when it happens. AJP already encodes the packet-size in the header of each packet. Why not simply compare that to the MaxPacketSize on the Tomcat side and issue a useful error message instead of whatever is currently happening? Andreas, what error message(s) do you see in the log(s) on the Tomcat side when this happens? Or maybe even auto-size the buffer on the Tomcat side to be nice about i t? Oddly enough, the AJP documentation[1] says that the practical limit of the packet size is 8k, though I and probably many others have happily been using higher values for quite some time. - -chris [1] http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrx12IACgkQHPApP6U8 pFgtAw/+I0Wv4uMERn01xjvuokEnv5daGe0QKTV7Gw6QYMQqb0hJM29yseRmMzDm NXMFyyaKb5URdrTcxk9Mt5nQVPl0vc8Qmf7CbK8rqntrUN//eGfSdsXxWi987SR6 9bF5/C0+b/KcXlPuT2FRejBsZBwI/mnktWyuBBJ5UHl23q6pL6WmuTjz7PrEVF9O QfzA6ztlZN3LzICaNVC/h4zmMm+rwR7zL32v/lO3wve9AvrlZIpNI83e0bhYHdm3 TWaF3PCwQGgRKoWPFRw4Hv4Y+VHyMyaNtjc4nKRszk5SwyO9vgiU/VzdRiX+0Lw4 B716nX7E3ETUYYHMr7d02MRhhNoxttc0WhKCqhMMjRskwvCljbtkhyvt7NYR2Zsc xmMxcPRNjUCxKz01ZWLakZ73s0CvuKSBClRAjDxWoYBmOpz88PHr4YeO4l9ME0Du fwcnMuRvyNlbsZMz6jAQqDEwfqybvmWTdDGDFlj4+SQxX+Qf5wytbQ4tgTXvYPmx UiyCjjRi/hLCxxkNvMf0mOcN8nair56Qly6Z1T+JR6ztbSugRAhmZAx8oHtL8HKF QrR5yVuGJyBdysbkxq1q29bHt9bGHpnzHsifZjHGNk3tQiLWZ5aKkguv0CizmPm8 y7tAAYL9feAkaybeUw7BBb13gANLOpfIQi1NC6iavnrOsG13gBU= =rEkE -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Is tomcat UserDatabaseRealm buggy?
Hello, I think I found the following bug in tomcat 7/8 with the following setup: We use tomcat 7.0.42 (but I tried 7.0.55 and 8.0.15 without success) and deployed a web service with jersey 1.18.2. Additionally we set up HTTP authentication. In our case DIGEST authentication, but I tried BASIC authentication the observed behavior is the same. We have a web service with login and logout methods, as well as some other methods which could only be invoked if a login request was made previously. Authentication works fine, till some point in time. At this point the client receives a HTTP response 401 Unauthorized. I double checked that the client sends correct credentials and nonce values. On server side I enabled logging (see attached log file). The log shows two web service calls, the first one returns successfully the last one reports the 401 error. As one could see in line 12 and 13 FEIN: Calling authenticate() Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase authenticate Tomcat delegates the authentication request to RealmBase class logs some stuff and returns with FEIN: Successfully passed all security constraints But in case of my error just these three lines are logged: FEIN: Calling authenticate() Nov 18, 2014 2:58:25 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: Failed authenticate() test My server.xml is as follows: <… <… I also tried to remove the LockOutRealm, but without success. As far as I understand with this setup class org.apache.catalina.realm.CombinedRealm.java is invoked to handle authentication. If I further understand correctly, then method authenticate(String username, String clientDigest, String nonce, String nc, String cnonce, String qop, String realmName, String md5a2) is also invoked. This method iterates over all configured Realms. It seems to me that, in case of the 401 error, the list of realms (Line 51) is empty and thus authentication fails. The error only occurs after many calls to the webservice. I was unable to identify any pattern, but it seems related to the nonce timeout, somehow. Could one verify this bug? Best Regards, Andreas ___ Andreas Kehlenbach Software Engineer, SWD PROSTEP AG Dolivostrasse 11, D-64293 Darmstadt Tel.: +49 6151 9287 332 Fax: +49 6151 9287 326 Email: andreas.kehlenb...@prostep.com _ PROSTEP AG, Dolivostraße 11, D-64293 Darmstadt HR: Amtsgericht Darmstadt, HRB 8383 Vorstand: Dr. Bernd Pätzold (Vorsitz), Reinhard Betz Aufsichtsrat: Dr. Heinz-Gerd Lehnhoff (Vorsitz) Nov 18, 2014 2:58:25 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: Security checking request POST /OpenPDMSmarTeamOUCAConnectorServer/rest/is-session-alive Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase findSecurityConstraints FEIN: Checking constraint 'SecurityConstraint[OpenPDM OUCA REST WebServices]' against POST /rest/is-session-alive --> true Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase findSecurityConstraints FEIN: Checking constraint 'SecurityConstraint[OpenPDM CAD Controller REST WebServices]' against POST /rest/is-session-alive --> false Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase findSecurityConstraints FEIN: Checking constraint 'SecurityConstraint[OpenPDM OUCA REST WebServices]' against POST /rest/is-session-alive --> true Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase findSecurityConstraints FEIN: Checking constraint 'SecurityConstraint[OpenPDM CAD Controller REST WebServices]' against POST /rest/is-session-alive --> false Nov 18, 2014 2:58:25 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: Calling hasUserDataPermission() Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase hasUserDataPermission FEIN: User data constraint has no restrictions Nov 18, 2014 2:58:25 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: Calling authenticate() Nov 18, 2014 2:58:25 PM org.apache.catalina.realm.RealmBase authenticate FEIN: Digest : d747e0dabf284059948a2ad40c0abc72 Username:openpdmadmin ClientSigest:d747e0dabf284059948a2ad40c0abc72 nonce:1416319056468:b83d03daeeeb6aac9233fc67b072b75d nc:002f cnonce:92633461 qop:auth realm:OpenPDMmd5a2:46ee17ed4949e254dc7072fc6da7fab7 Server digest:d747e0dabf284059948a2ad40c0abc72 Nov 18, 2014 2:58:25 PM org.apache.catalina.authenticator.AuthenticatorBase register FEIN: Authenticated 'openpdmadmin' with type 'DIGEST' Nov 18, 2014 2:58:25 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: Calli
AW: [bulk]: Re: Is tomcat UserDatabaseRealm buggy?
Hey Chris, Yes I know that BASIC authentication doesn't use nonces, thus I don't think that this is the root cause. Just forget about the nonce timout. For full information: I played around with the timeout and used values of 1, 5, 20 minutes. But as I discovered that also the 401 appears with BASIC authentication I would suggest to test with this. I reconfigured tomcat, because the configuration differs. That’s what I did to test both cases. I hope I could create a small test case tomorrow. Thank you for your answer, Andreas > -Ursprüngliche Nachricht- > Von: Christopher Schultz [mailto:ch...@christopherschultz.net] > Gesendet: Mittwoch, 26. November 2014 17:20 > An: Tomcat Users List > Betreff: [bulk]: Re: Is tomcat UserDatabaseRealm buggy? > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Andreas, > > On 11/26/14 5:42 AM, Kehlenbach, Andreas wrote: > > I think I found the following bug in tomcat 7/8 with the following > > setup: > > > > We use tomcat 7.0.42 (but I tried 7.0.55 and 8.0.15 without > > success) and deployed a web service with jersey 1.18.2. > > Additionally we set up HTTP authentication. In our case DIGEST > > authentication, but I tried BASIC authentication the observed behavior > > is the same. We have a web service with login and logout methods, as > > well as some other methods which could only be invoked if a login > > request was made previously. Authentication works fine, till some > > point in time. At this point the client receives a HTTP response 401 > > Unauthorized. I double checked that the client sends correct > > credentials and nonce values. On server side I enabled logging (see > > attached log file). The log shows two web service calls, the first one > > returns successfully the last one reports the > > 401 error. As one could see in line 12 and 13 FEIN: Calling > > authenticate() Nov 18, 2014 2:58:25 PM > > org.apache.catalina.realm.RealmBase authenticate Tomcat delegates the > > authentication request to RealmBase class logs some stuff and returns > > with FEIN: Successfully passed all security constraints > > > > But in case of my error just these three lines are logged: FEIN: > > Calling authenticate() Nov 18, 2014 2:58:25 PM > > org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: > > Failed authenticate() test > > > > My server.xml is as follows: <… > defaultHost="localhost"> > className="org.apache.catalina.realm.LockOutRealm"> > className="org.apache.catalina.realm.UserDatabaseRealm" > > resourceName="UserDatabase" digest="md5"/> > > > > > autoDeploy="true" deployOnStartup="true"> > > > > > directory="logs" prefix="localhost_access_log." suffix=".txt" > > pattern="%h %l %u %t "%r" %s %b" /> > > > > <… > > > > I also tried to remove the LockOutRealm, but without success. As far > > as I understand with this setup class > > org.apache.catalina.realm.CombinedRealm.java is invoked to handle > > authentication. If I further understand correctly, then method > > authenticate(String username, String clientDigest,__String nonce, > > String nc, String cnonce, String qop,__String realmName, String > > md5a2) is also invoked. This method iterates over all configured > > Realms. It seems to me that, in case of the 401 error, the list of > > realms (Line 51) is empty and thus authentication fails. > > > > The error only occurs after many calls to the webservice. I was unable > > to identify any pattern, but it seems related to the nonce timeout, > > somehow. Could one verify this bug? > > What is the nonce timeout? > > Note that HTTP BASIC authentication does not use nonces, so the nonce > timeout wouldn't be the cause under those circumstances. > > How did you switch testing from HTTP DIGEST to HTTP BASIC authentication? > The stored credentials are of course incompatible. If you created a small test > case, can you share it with us? > > - -chris > -BEGIN PGP SIGNATURE- > Version: GnuPG v1 > Comment: GPGTools - http://gpgtools.org > > iQIcBAEBCAAGBQJUdf2pAAoJEBzwKT+lPKRYYa0P/1lxVAmXeDshnYP47zSnyk > hj > wv5z86sX57H480VdYQLIIrTwj9KOa6Wifgd/YkC6fUihLNIa+kOe0Jhoq6+K/IIA > hh9ZHu/qVKUHOsuef5sYD15CWX/VDEkJUyy4G/qvSB1u0dM5vGUkWggZVvn > 5kwRG > 4V0CIg4M4bNAdki3M8ZYKp8fmD5qzYFnfmjJOKwvGiFk4nJjUZG0crVbQC69cy > eC > 5/7tnzswV6dPwyJdBj0b/yiMx0h58mt0BSKz/VNsukxa2WbP0P9csP7mA9gleF > UB > OQdupQ6KE5t8lQBHogHJ7QvjlOJT0Tesqn+NUbNuK8cAmntEg8HQc3b/Erqdly > 7G > GM
Re: Is tomcat UserDatabaseRealm buggy?
Hello Chris, Currently I've attached tomcat sources to my sample application. The following I found out: 1) The problem occurs only if the nonce timed out. 1.1) After the nonce timed out, tomcat sends a new nonce, which the client correctly respond to. The new response contains the last send (new) nonce, an increased nonce count and the correct opaque. in DigestAuthenticator. authenticate(Request request, HttpServletResponse response, LoginConfig config) a new DigestInfo object is build. This object then contains nonceStale = true. From my point of view this is a bug, because after a timeout a valid new nonce should be sent to the client. - Andreas PS: Please do not use Jersey 1.18.2, because the client also contains a bug. If the nonce timed out, the old and new authorization header is sent to tomcat. Thus, two authorization headers are transmitted and tomcat could not handle this. If you want to use this client, I could provide you a fix for this. > -Ursprüngliche Nachricht- > Von: Kehlenbach, Andreas [mailto:andreas.kehlenb...@prostep.com] > Gesendet: Dienstag, 23. Dezember 2014 08:33 > An: Tomcat Users List > Betreff: [bulk]: AW: [bulk]: Re: Is tomcat UserDatabaseRealm buggy? > > Hello Chris, > > Long story short: I had no time in past, but now I created a small sample. > Attached you could find two archives. > projects.zip: contains two eclipse projects (client and server) tomcat- > config.zip contains three xmls which I copied into conf/ folder of tomcat. > > You could export the war file from within eclipse or just use the pre- > exported war file with the tomcat.zip. > The client project contains a ClientTest-class with a unit test. This test > just > fails if one is no longer "logged in". There should be a 401 at some point in > time in access.log of tomcat. > > As I'm unable to attach stuff larger than 1MB you must manually add all > needed jersey jars into projects of attached archive. > MyClient\lib\jersey-client-1.18.2.jar > MyClient\lib\jersey-core-1.18.2.jar > MyClient\lib\junit-4.10.jar > > and > > MyWebApplication\WebContent\WEB-INF\lib\jersey-core-1.18.2.jar > MyWebApplication\WebContent\WEB-INF\lib\jersey-server-1.18.2.jar > MyWebApplication\WebContent\WEB-INF\lib\jersey-servlet-1.18.2.jar > > Hope it helps and merry christmas, > Andreas > > > -Ursprüngliche Nachricht- > > Von: Christopher Schultz [mailto:ch...@christopherschultz.net] > > Gesendet: Mittwoch, 26. November 2014 17:20 > > An: Tomcat Users List > > Betreff: [bulk]: Re: Is tomcat UserDatabaseRealm buggy? > > > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA256 > > > > Andreas, > > > > On 11/26/14 5:42 AM, Kehlenbach, Andreas wrote: > > > I think I found the following bug in tomcat 7/8 with the following > > > setup: > > > > > > We use tomcat 7.0.42 (but I tried 7.0.55 and 8.0.15 without > > > success) and deployed a web service with jersey 1.18.2. > > > Additionally we set up HTTP authentication. In our case DIGEST > > > authentication, but I tried BASIC authentication the observed > > > behavior is the same. We have a web service with login and logout > > > methods, as well as some other methods which could only be invoked > > > if a login request was made previously. Authentication works fine, > > > till some point in time. At this point the client receives a HTTP > > > response 401 Unauthorized. I double checked that the client sends > > > correct credentials and nonce values. On server side I enabled > > > logging (see attached log file). The log shows two web service > > > calls, the first one returns successfully the last one reports the > > > 401 error. As one could see in line 12 and 13 FEIN: Calling > > > authenticate() Nov 18, 2014 2:58:25 PM > > > org.apache.catalina.realm.RealmBase authenticate Tomcat delegates > > > the authentication request to RealmBase class logs some stuff and > > > returns with FEIN: Successfully passed all security constraints > > > > > > But in case of my error just these three lines are logged: FEIN: > > > Calling authenticate() Nov 18, 2014 2:58:25 PM > > > org.apache.catalina.authenticator.AuthenticatorBase invoke FEIN: > > > Failed authenticate() test > > > > > > My server.xml is as follows: <… > > defaultHost="localhost"> > > className="org.apache.catalina.realm.LockOutRealm"> > > className="org.apache.catalina.realm.UserDatabaseRealm" > > > resourceName="UserDatabase" digest="md5"/> > > > > > > >