Log 4j error on tomcat shutdown
Hi All, During tomcat (version 6.0.18 with jdk 1.5) shutdown , I get the following error in the console : log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. Whats wrong here ? What does this mean and how do I resolve this ? PS: I am using lo4j1.2.15.jar in my webapp's WEB-INF/lib directory. Regards, Subhrajyoti Mobile: +919830079545 Mail: choudh...@labware.com Web: www.labware.com LabWare LIMS Solutions - Results Count
RE: Tomcat running out of threads.
Hello, According to tomcat documentation, JkOptions +DisableReuse has some performance penalty, because opens new connection for each request. In my case, issue was solved by setting the param: connectionTimeout on the ajp13 connector / entry on tomcat's server.xml Also look at docs for firstReadTimeout parameter. Now mod_jk is using a pool of connectors, but tomcat expires old threads on the pool so issue was solved. Regards, Bernardo. Mark Thomas-18 wrote: From: Hari Prasad [mailto:ursha...@yahoo.co.in] hi.. i too have the same issue.. did anyone find solution? 1. JkOptions +DisableReuse 2. Use correct timeouts and CPing/CPong I'd go with option 1. YMMV. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- View this message in context: http://www.nabble.com/Tomcat-running-out-of-threads.-tp16812001p21413171.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Log 4j error on tomcat shutdown
From: choudh...@labware.com [mailto:choudh...@labware.com] Hi All, During tomcat (version 6.0.18 with jdk 1.5) shutdown , I get the following error in the console : log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. Whats wrong here ? What does this mean and how do I resolve this ? It is a side effect of the default clean-up Tomcat does to attempt to avoid memory leaks caused by bugs in user applications and/or third party libraries. If you are sure you application doesn't have any memory leaks then use org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false See http://localhost:8080/docs/config/systemprops.html for more info. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat running out of threads.
From: Bernardo Cabezas [mailto:ber...@bergantells.net] Hello, According to tomcat documentation, JkOptions +DisableReuse has some performance penalty, because opens new connection for each request. There is actually quite a lot of disagreement between the Tomcat committers about the correctness of that statement in the docs. I am aware of fairly large deployments that actaully saw a significant performance increase by enabling that option. That said, it may well be that a similar performance increase could have been obtained by correctly tuning the timeout parameters. It is certainly the case the YMMV and you need to test in your environment. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Logging configuration in Tomcat
Chuck There are many web apps. Log4j logger is used in all web apps there are no system.out or system.err If I configure log4j at each web app level using log4j.properties, am abile to achive log file rotation but, this requires one log file per web application. What I am interested is one log file for all web apps - say catalina,out this file should be rotated based on size, which should be configurable. Am not Ok with catalina.out being rotated once in a day or once in a month. Could you let me know, how to achieve my requirement, please ? Thanks --- On Sun, 1/11/09, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Caldarale, Charles R chuck.caldar...@unisys.com Subject: RE: Logging configuration in Tomcat To: Tomcat Users List users@tomcat.apache.org Date: Sunday, January 11, 2009, 10:34 PM From: Jay [mailto:difficult...@yahoo.com] Subject: RE: Logging configuration in Tomcat My actual problem is that, as it is, catalina.out is growing Sounds like your webapps are using System.out or System.err for their logging, which is poor practice. They should be using a proper logging mechanism, not just splattering print statements wherever they feel like it. You should be able to address that with the swallowOutput attribute of the Context element: http://wiki.apache.org/tomcat/FAQ/Logging#Q6 http://tomcat.apache.org/tomcat-5.5-doc/config/context.html Set the attribute in conf/context.xml if you want it to apply to all webapps. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Comitting Valve-code to Tomcat
Dear all, I've got a piece of code here which I think might be useful not only for me but others. Since I believe in sharing knowledge, I'd like to pass it to the ASF so that it might become a part of Tomcat. Problems whch are solved by this Valve: -- As you may know, j_security_check works as follows: - If a request to some protected content comes in, Tomcat stores this request internally - a html/jsp/servlet is called asking for the login-credentials - the credentials are then passed to j_security_check which then checks Authentication / Authorization (AA) - if AA is ok, the old url, which was stored before, then is requested. However, there are some scenarios where this flow does not work and we would want to always redirect to a *pre-defined starting-page*. There are some options like - http://securityfilter.sourceforge.net - implement your own JAA - JSSO - etc. However, those solutions sometimes are missing something (like i.e. SingleSignOn), or you have to dive into how to implement JAA, a new framework etc. Well, to circumvent all this and make live easier for some of us, I've developed a Valve, which handles those problems: After having declared said Valve in ${catalina.home}/conf/server.xml, the only things that have to be done are: - the protected area needs to be specified in server.xml - the default starting-page needs to be specified in server.xml - the default starting-page *must* be in the protected area Now if a request to the protected content comes in without authorization, the following things happen: - the request will be redirected to the pre-defined starting-page - since the pre-definied starting-page is within the protected area, the login-html/jsp/servlet will be called to ask for the credentials - j_security_check will check the credentials given and redirect to the pre-definied starting-page (i.e. /protected/index.html) Since I believe that this Valve might be useful to some of us, I would like to share the code / docs with the ASF so that it might become part of Tomcat. Could somebody please let me know the steps required? I've read http://tomcat.apache.org/getinvolved.html already, and I've also read http://www.apache.org/foundation/how-it-works.html, however, I'm not really sure of what to do next. Shall I just put the code into the dev-mailinglist? I'm aware that ASF might also decline this Valve becoming part of Tomcat, however, I believe in sharing knowledge, therefore I'm trying it anyway ;) Looking forward to your suggestions! Gregor -- just because your paranoid, doesn't mean they're not after you... gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2 gpgp-key available @ http://pgpkeys.pca.dfn.de:11371 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Comitting Valve-code to Tomcat
From: Gregor Schneider [mailto:rc4...@googlemail.com] Could somebody please let me know the steps required? Create a Bugzilla entry. Add it as an attachment. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Comitting Valve-code to Tomcat
Hi Mark, actually, it's not really a bug within Tomcat since Tomcat follows the servlet-specs regarding j_security_check. Therefore, it's more an enhancement - you still suggest a bugzilla-entry? Cheers Gregor -- just because your paranoid, doesn't mean they're not after you... gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2 gpgp-key available @ http://pgpkeys.pca.dfn.de:11371 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Can't re-deploy webapp with Manager -- started after upgrade to Tomcat 6
Having issues re-deploying my webapp using Tomcat Manager. Previously used tomcat 5.0.28 with no issues, now using tomcat 6.0.14 and can't re-deploy. I'm getting an exception: java.util.zip.ZipException: error reading zip file. Sequence of actions and my configuration are below. 1) Start Tomcat (my webapp is not already installed) 2) ant deploy à webapp works fine 3) ant deploy à webapp is undeployed, but not re-deployed (even though there is a log msg in tomcat.log saying Deploying) a.In tomcat.log: 10:32:28,216 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost' 10:32:28,217 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: init: Global resources are available 10:32:28,228 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: undeploy: Undeploying web application at '/jglass' 10:32:29,006 INFO [http-8080-1] org.apache.catalina.startup.HostConfig: Undeploying context [/jglass] 10:32:41,611 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: deploy: Deploying web application at '/jglass' 10:32:41,611 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: Uploading WAR file to /usr/local/jakarta-tomcat/webapps/jglass.war 10:32:45,317 INFO [http-8080-1] org.apache.catalina.startup.HostConfig: Deploying web application archive jglass.war b. In webapp.log: 10:32:28,242 INFO [] SessionListener: == sessionDestroyed: 6F32614EDB7F15D1752D00A3DDAD9437.W01 == 10:32:28,243 INFO [] SessionListener: == contextDestroyed: IGLASS == 4) ant deploy à tries to deploy, but receives exception a. In tomcat.log: 10:40:02,982 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: undeploy: Undeploying web application at '/jglass' 10:40:03,004 INFO [http-8080-1] org.apache.catalina.startup.HostConfig: Undeploying context [/jglass] 10:40:04,967 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: deploy: Deploying web application at '/jglass' 10:40:04,969 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]: Manager: Uploading WAR file to /usr/local/jakarta-tomcat/webapps/jglass.war 10:40:07,190 INFO [http-8080-1] org.apache.catalina.startup.HostConfig: Deploying web application archive jglass.war 10:40:39,488 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/jglass]: Log4J config file: prefix [/usr/local/jakarta-tomcat/webapps/jglass/], filename[WEB-INF/classes/log4j.xml], WITH watchdog Log4J, using DOMConfigurator. 10:40:39,739 INFO [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/jglass]: Marking servlet action as unavailable 10:40:39,743 ERROR [http-8080-1] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/jglass]: Servlet /jglass threw load() exception javax.servlet.UnavailableException: java.util.zip.ZipException: error reading zip file at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402) at net.iglass.jglass.servlets.FrontController.init(FrontController.java:49) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1220) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297) at
RE: Comitting Valve-code to Tomcat
From: Gregor Schneider [mailto:rc4...@googlemail.com] Subject: Re: Comitting Valve-code to Tomcat Therefore, it's more an enhancement - you still suggest a bugzilla-entry? Yes; there's a bugzilla category for enhancement - look at the drop-down list. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Comitting Valve-code to Tomcat
From: Gregor Schneider [mailto:rc4...@googlemail.com] Hi Mark, actually, it's not really a bug within Tomcat since Tomcat follows the servlet-specs regarding j_security_check. Therefore, it's more an enhancement - you still suggest a bugzilla- entry? Yes. Bugzilla is for tracking ehancements and bugs. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 6 does not start in a cluster. It simply hangs... Any Idea..
HI Filip: I did three dumps. It is hanging on the same class. Please let me know any ideas... We are in production. I have same setup on development and it works. However, cluster setup on development is on the same box with apache web server in front. In production there are three servers with hardware load balancer in the the front. Thanks Jaspal jsandhu2204 wrote: Please see the three stack dumps I did. http://www.nabble.com/file/p21367357/Thread-dump-three-times.txt Thread-dump-three-times.txt Filip Hanik - Dev Lists wrote: Could you take more than one thread dump, take 3, wait 5 seconds between each. As you can see, the startup thread is still executing your application code com.valleyoak.util.IVosTableInfo, this is the thread that starts up tomcat Filip main thread - the one starting tomcat main prio=6 tid=0x01dc1c00 nid=0x15cc in Object.wait() [0x01f4d000..0x01f4fc70] java.lang.Thread.State: RUNNABLE at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161) at com.valleyoak.db.IVosStorable.findColumnTables(IVosStorable.java:1245) at com.valleyoak.model.Payment.clinit(Payment.java:136) at com.valleyoak.model.ContextListener.contextInitialized(ContextListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) - locked 0x41f4f390 (a org.apache.catalina.core.StandardContext) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) - locked 0x41eef8b8 (a java.util.HashMap) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) One of the cluster threads have received the session state data from the other node and is deserializing it pool-2-thread-1 prio=6 tid=0x01dc5c00 nid=0xf00 in Object.wait() [0x777c000..0x0777fae0] java.lang.Thread.State: RUNNABLE at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.valleyoak.util.IVosTableInfo.class$(IVosTableInfo.java:504) at com.valleyoak.util.IVosTableInfo.loadTables(IVosTableInfo.java:522) at com.valleyoak.util.IVosTableInfo.clinit(IVosTableInfo.java:53) at com.valleyoak.db.IVosStorable.findColumnTables(IVosStorable.java:1245) at com.valleyoak.model.User.clinit(User.java:71) at java.io.ObjectStreamClass.hasStaticInitializer(Native Method) at java.io.ObjectStreamClass.computeDefaultSUID(ObjectStreamClass.java:1696) at java.io.ObjectStreamClass.access$100(ObjectStreamClass.java:52) at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:205) at java.security.AccessController.doPrivileged(Native Method) at java.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:202) at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:558) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) jsandhu2204 wrote: I have created stack trace when servers hangs. Please see attached. I would appreciate if you can help me with this. If I put distributable/ flag in the web.xml of the application. Tomcat6 does not start sometimes. It simply hangs. http://www.nabble.com/file/p21347289/CheatSheet-ltr1vs02-Tomcat6-hangs-if-put-distributeable-tag.rtf CheatSheet-ltr1vs02-Tomcat6-hangs-if-put-distributeable-tag.rtf http://www.nabble.com/file/p21347289/CheatSheet-Tomcat6-hangs-if-put-distributeable-tag.rtf CheatSheet-Tomcat6-hangs-if-put-distributeable-tag.rtf Filip Hanik - Dev Lists wrote: When this happens, simply take a thread dump, and we can see why it is hanging Unix: kill -3 pid jstack -l pid Windows Ctrl+Break in the console jstack -l pid Filip jsandhu2204 wrote: Problem1 : While starting tomcat6, sometimes it starts other times it simply hangs on the following message: INFO: Manager [localhost#/ivos]; session state send at 12/12/08 12:34 AM received in 110 ms. Tomcat Log: INFO: Register manager /ivos to cluster element Engine with name Catalina Dec 12, 2008 12:34:53 AM org.apache.catalina.ha.session.DeltaManager start INFO: Starting clustering manager at /ivos Dec 12, 2008 12:34:53 AM org.apache.catalina.ha.session.DeltaManager getAllClusterSessions WARNING: Manager [localhost#/ivos], requesting session state from org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 88, 8, 28}:4002,{10, 88, 8, 28},4002,
Re: Tomcat 6 does not start in a cluster. It simply hangs... Any Idea..
hi Jaspal, the problem seems to be in the com.valleyoak package. The main thread is stuck at at com.valleyoak.model.Payment.clinit(Payment.java:136) (at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161)) - last line the cluster thread is stuck at at java.lang.Class.forName0(Native Method) because the main thread is stuck during a clinit (this is class init, happens directly after class loading, to do static initializers), the cluster thread can't continue. what you need to investigate is why at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161)) - last line is stuck, but it does look like its a problem with your code. Filip jsandhu2204 wrote: HI Filip: I did three dumps. It is hanging on the same class. Please let me know any ideas... We are in production. I have same setup on development and it works. However, cluster setup on development is on the same box with apache web server in front. In production there are three servers with hardware load balancer in the the front. Thanks Jaspal jsandhu2204 wrote: Please see the three stack dumps I did. http://www.nabble.com/file/p21367357/Thread-dump-three-times.txt Thread-dump-three-times.txt Filip Hanik - Dev Lists wrote: Could you take more than one thread dump, take 3, wait 5 seconds between each. As you can see, the startup thread is still executing your application code com.valleyoak.util.IVosTableInfo, this is the thread that starts up tomcat Filip main thread - the one starting tomcat main prio=6 tid=0x01dc1c00 nid=0x15cc in Object.wait() [0x01f4d000..0x01f4fc70] java.lang.Thread.State: RUNNABLE at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161) at com.valleyoak.db.IVosStorable.findColumnTables(IVosStorable.java:1245) at com.valleyoak.model.Payment.clinit(Payment.java:136) at com.valleyoak.model.ContextListener.contextInitialized(ContextListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) - locked 0x41f4f390 (a org.apache.catalina.core.StandardContext) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) - locked 0x41eef8b8 (a java.util.HashMap) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) One of the cluster threads have received the session state data from the other node and is deserializing it pool-2-thread-1 prio=6 tid=0x01dc5c00 nid=0xf00 in Object.wait() [0x777c000..0x0777fae0] java.lang.Thread.State: RUNNABLE at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.valleyoak.util.IVosTableInfo.class$(IVosTableInfo.java:504) at com.valleyoak.util.IVosTableInfo.loadTables(IVosTableInfo.java:522) at com.valleyoak.util.IVosTableInfo.clinit(IVosTableInfo.java:53) at com.valleyoak.db.IVosStorable.findColumnTables(IVosStorable.java:1245) at com.valleyoak.model.User.clinit(User.java:71) at java.io.ObjectStreamClass.hasStaticInitializer(Native Method) at java.io.ObjectStreamClass.computeDefaultSUID(ObjectStreamClass.java:1696) at java.io.ObjectStreamClass.access$100(ObjectStreamClass.java:52) at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:205) at java.security.AccessController.doPrivileged(Native Method) at java.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:202) at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:558) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) jsandhu2204 wrote: I have created stack trace when servers hangs. Please see attached. I would appreciate if you can help me with this. If I put distributable/ flag in the web.xml of the application. Tomcat6 does not start sometimes. It simply hangs. http://www.nabble.com/file/p21347289/CheatSheet-ltr1vs02-Tomcat6-hangs-if-put-distributeable-tag.rtf CheatSheet-ltr1vs02-Tomcat6-hangs-if-put-distributeable-tag.rtf http://www.nabble.com/file/p21347289/CheatSheet-Tomcat6-hangs-if-put-distributeable-tag.rtf CheatSheet-Tomcat6-hangs-if-put-distributeable-tag.rtf Filip Hanik - Dev Lists wrote: When this happens, simply take a thread dump, and we can see why it is hanging Unix: kill -3 pid jstack -l pid Windows Ctrl+Break in the console jstack -l pid Filip jsandhu2204 wrote: Problem1 : While starting
Re: single instance of background job?
What I did was a little bit of extra work on top of quartz. I have a table that stores the configuration for all of my quartz jobs. When a quartz job kicks off, it will first try to update its last execute time in the table. If the last execute time is too new the update will fail and the process will exit. I use spring-javaconfig to build my quartz configuration from this table procedurally on application startup and I provide a web and Ice API for administrators to make changes. -Matt Rusty Wright wrote: This isn't really a Tomcat question I'm guessing but I don't know where else to ask. In our setup we have multiple Tomcats behind a load balancer. I have a background task that will run once a day, via Quartz. All Tomcats will be using the same war so they will all run the job, but I need it so only one of them runs the job. I'm looking for ideas for how to implement this. At the moment all I can think of is to use a table in a database with a unique constraint on a column, and each background process tries to insert today's date (-mm-dd) and the one that succeeds runs the job, and the ones that don't, do nothing. Thanks - 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
Tomcat shutdown script initiates Heap dump collection
Hello It is observed that when ever we initiate tomcat shutdown script, Heap Dumps are collected in catalina.out log file. 1. Is this a normal behavior ? Will it have any impacts on performance ? 2. Could you please let us know the configuration which triggers the heap dump collection ? Thanks Prakash -- View this message in context: http://www.nabble.com/Tomcat-shutdown-script-initiates-Heap-dump-collection-tp21421003p21421003.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 6 does not start in a cluster. It simply hangs... Any Idea..
Thanks Filip. I am going to ask the vendor. Filip Hanik - Dev Lists wrote: hi Jaspal, the problem seems to be in the com.valleyoak package. The main thread is stuck at at com.valleyoak.model.Payment.clinit(Payment.java:136) (at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161)) - last line the cluster thread is stuck at at java.lang.Class.forName0(Native Method) because the main thread is stuck during a clinit (this is class init, happens directly after class loading, to do static initializers), the cluster thread can't continue. what you need to investigate is why at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161)) - last line is stuck, but it does look like its a problem with your code. Filip jsandhu2204 wrote: HI Filip: I did three dumps. It is hanging on the same class. Please let me know any ideas... We are in production. I have same setup on development and it works. However, cluster setup on development is on the same box with apache web server in front. In production there are three servers with hardware load balancer in the the front. Thanks Jaspal jsandhu2204 wrote: Please see the three stack dumps I did. http://www.nabble.com/file/p21367357/Thread-dump-three-times.txt Thread-dump-three-times.txt Filip Hanik - Dev Lists wrote: Could you take more than one thread dump, take 3, wait 5 seconds between each. As you can see, the startup thread is still executing your application code com.valleyoak.util.IVosTableInfo, this is the thread that starts up tomcat Filip main thread - the one starting tomcat main prio=6 tid=0x01dc1c00 nid=0x15cc in Object.wait() [0x01f4d000..0x01f4fc70] java.lang.Thread.State: RUNNABLE at com.valleyoak.util.IVosTableInfo.findColumnTables(IVosTableInfo.java:161) at com.valleyoak.db.IVosStorable.findColumnTables(IVosStorable.java:1245) at com.valleyoak.model.Payment.clinit(Payment.java:136) at com.valleyoak.model.ContextListener.contextInitialized(ContextListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) - locked 0x41f4f390 (a org.apache.catalina.core.StandardContext) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) - locked 0x41eef8b8 (a java.util.HashMap) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) One of the cluster threads have received the session state data from the other node and is deserializing it pool-2-thread-1 prio=6 tid=0x01dc5c00 nid=0xf00 in Object.wait() [0x777c000..0x0777fae0] java.lang.Thread.State: RUNNABLE at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.valleyoak.util.IVosTableInfo.class$(IVosTableInfo.java:504) at com.valleyoak.util.IVosTableInfo.loadTables(IVosTableInfo.java:522) at com.valleyoak.util.IVosTableInfo.clinit(IVosTableInfo.java:53) at com.valleyoak.db.IVosStorable.findColumnTables(IVosStorable.java:1245) at com.valleyoak.model.User.clinit(User.java:71) at java.io.ObjectStreamClass.hasStaticInitializer(Native Method) at java.io.ObjectStreamClass.computeDefaultSUID(ObjectStreamClass.java:1696) at java.io.ObjectStreamClass.access$100(ObjectStreamClass.java:52) at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:205) at java.security.AccessController.doPrivileged(Native Method) at java.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:202) at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:558) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) jsandhu2204 wrote: I have created stack trace when servers hangs. Please see attached. I would appreciate if you can help me with this. If I put distributable/ flag in the web.xml of the application. Tomcat6 does not start sometimes. It simply hangs. http://www.nabble.com/file/p21347289/CheatSheet-ltr1vs02-Tomcat6-hangs-if-put-distributeable-tag.rtf CheatSheet-ltr1vs02-Tomcat6-hangs-if-put-distributeable-tag.rtf http://www.nabble.com/file/p21347289/CheatSheet-Tomcat6-hangs-if-put-distributeable-tag.rtf CheatSheet-Tomcat6-hangs-if-put-distributeable-tag.rtf Filip Hanik - Dev Lists wrote: When this happens, simply take a thread
Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
Greetings, In tomcat 6.x (6.0.14 in my case) I am seeing the following behavior: If I designate default error pages in my web.xml file: error-page error-code404/error-code location/docs/error404.html/location /error-page Then when I call HttpServletResponse.sendError(): public class DispatchServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { response.sendError(404); } } Tomcat returns the designated page, but with an HTTP status of 200. If I drop the default page then I get the canned response with an HTTP status of 404. Is that correct? Seems like it shouldn't work that way to me, but then that's why I'm here, looking for some insight. Nathan = = = Nathan Potterndp at opendap.org OPeNDAP, Inc.541.752.1852 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
some config issue with Apple supplied Tomcat
Hi, I am trying to setup a cluster using Apple supplied Apache2 and Tomcat. On OSX, tomcat is in /Library/Tomcat. Apache is configured in a mixed way, because Apple installs 1.3 and 2.2, so there is /etc/httpd for config of 1.3 and /etc/apache2 for config of 2.2. However even the config file in /etc/apache2 refers to the workers.properties in /etc/httpd :) Looks like as siamese twins in the process of separation. Tomcat version 6.0.18 Java: java version 1.5.0_16 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16- b06-284) Java HotSpot(TM) Server VM (build 1.5.0_16-133, mixed mode) apache2: version 2.2 Tomcat is running after checking the checkbox and restarting Apache2 pathsrv1:httpd administrator$ ps -avx |grep tomcat 59195 Ss 0:01.10 0 0 0 600172628 -0 0.0 0.0 /bin/sh /Library/Tomcat/bin/tomcat-launchd.sh 62573 R+ 0:00.00 0 0 0 590472 92 -0 0.0 0.0 grep tomcat and I can get to the SessionExample via port 80. However I get this into the mod_jk.log: [Mon Jan 12 14:57:31 2009] [59281:] [error] init_jk::mod_jk.c (2701): Initializing shm:/usr/logs/jk-runtime-status.59281 errno=2. Load balancing workers will not function properly. Looking on the Internet someone recommended to create a run directory, that used to be in /usr/local/apache2/. I do not know if that is the solution for this Apple supplied config on OSx 10.5.6. I also have a second issue, but that might relate to this message above. I created a reverse proxy setup and this is what Apple put into the site configuration file: IfModule mod_proxy_balancer.c ProxyPass /apps/ balancer://balancer-group/ stickysession=JSESSIONID ProxyPassReverse /apps/ balancer://balancer-group/ Proxy balancer://balancer-group BalancerMember http://pathsrv1.yalepath.org loadfactor=1 /Proxy /IfModule Right now I have just one machine and I am trying it as a Balance member and also as a reverse proxy. So based upon the config, I thought that if I want to go to; http://pathsrv1.yalepath.org/apps/examples/servlets/servlet/SessionExample than the reverse proxy that is pathsrv1 will pass it to the balance member, that is again pathsrv1 and from there It will give me the SessionExample as if I would have gone just to http://pathsrv1.yalepath.org/examples/servlets/servlet/SessionExample Either my config is not right, or my thinking :) Any good hint is appreciated. János - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat: client disconnects?
Hi, We have a RHEL5.2 Linux server running Apache/2.2.3, Tomcat-5.5.26 MySQL 5.0.45. We are experiencing users having issues connecting to our RH server and getting disconnected with errors in their browsers that state there is a DNS error or page cannot be displayed. Users connect to Apache then Tomcat serves up our JSP's that sometimes accesses specific MySQL server DB's. We also have Mediawiki running - using PHP and Apache - that has disconnected users as well. Most of the pages seems to be index.jsp or index.php lately for both websites(These are websites internal - our company web servers). I have tried to view the Apache, Tomcat and Mysql logs extensively. In Apache: I only see a few 401 404's sometimes but with no further details. In Tomcat: it is a mess of exceptions that our developers try and keep cleaned up. ( We do not use Log4j) In Mysql: there are lots of slow queries I've been logging - 1 sec. The errors that occur are random browser disconnects - urls that end or start with *.jsp/ or *.php/ pages. We have also tried using WinXP host files and using an IP address to bypass DNS altogether - no luck. Examples below: # At 2:58PM - Jan 09, 2009: Page cannot be displayed IE6 using IP address. http://10.97.24.23/Qoe/custord1.jsp?id=6271pageMode=view While just reviewing an order (not editing) Hit refresh and it cleared up... Problem around 4:15PM - Jan 9, 2009: http://10.97.24.23/Sales/IndentedATPServlet?partNum=086EXUCCCXMAqty=1warehouse=M Problem around 5:05PM - Jan 9, 2009: http://wsi/Qoe/index.jsp (same thingPage Cannot Be Displayed) ### Our MysqL server has a tendancy to ramp up or the load avg increases using massive CPU cycles - I restart Tomcat and the system usually calms down - Mysql included. We are currently using tcpdump on the server Wireshark on the affected clients to look at the packet level of my connections to the webserver. I know more details are probably needed - this is a complex problem. And only seems to happen in the am right when users login to their machines and start up their browsers and then happens at the end of the day as well. I've tried looking at the timeframes in the message and other logs but can't find any relevant info that makes sense yet. We've debugged our MS Active Dir DNS here and used host files on the clients to stripping the Linux box of many un-needed services including IPv6. We haven't had other issues with DNS that I've noticed with other applications and/or servers in our entire organization. Any responses or suggestions are appreciated! Thanks. -SP -- View this message in context: http://www.nabble.com/Tomcat%3A-client-disconnects--tp21424139p21424139.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
tomcat 6 apache 2.2 jk connector: auto config?
I am trying to figure out the best way to configure tomcat 6 to work under apache2.2 running on XP. I have seen a way to 'auto configure' the jk connector, and another way to manually configure it in the httpd.conf file. It seems the auto configure is easier, but are there important advantages to doing it the manual way? I have tried both ways and still not gotten either to work...but I would like to know the best way and limit my efforts to understanding that way. Thanks John -- View this message in context: http://www.nabble.com/tomcat-6-apache-2.2-jk-connector%3A-auto-config--tp21424572p21424572.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
From: Nathan Potter [mailto:n...@opendap.org] Subject: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called. Tomcat returns the designated page, but with an HTTP status of 200. If I drop the default page then I get the canned response with an HTTP status of 404. Is that correct? Don't think so. Does your code happen to call response.setStatus(200) somewhere along the way? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Logging configuration in Tomcat
From: Jay [mailto:difficult...@yahoo.com] Subject: RE: Logging configuration in Tomcat There are many web apps. Log4j logger is used in all web apps there are no system.out or system.err Then where is your catalina.out usage coming from? Tomcat does not itself put anything in catalina.out; data in there appears only because the Tomcat startup script redirects System.out and System.err to that file. If I configure log4j at each web app level using log4j.properties, am abile to achive log file rotation but, this requires one log file per web application. Which really, really is what you need. Lumping them all together will create serious grief, as other posters have already pointed out. What I am interested is one log file for all web apps A bad idea. You could just merge the log files after they've been generated. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat shutdown script initiates Heap dump collection
From: Prakash Nathan1 [mailto:mrap...@yahoo.com] Subject: Tomcat shutdown script initiates Heap dump collection Things you didn't bother to tell us: 1) Tomcat version you're using. 2) JRE/JDK version you're using. 3) Platform you're running on. Would you like us to guess? Heap Dumps are collected in catalina.out log file. 1. Is this a normal behavior ? No. Will it have any impacts on performance ? The heap dump at termination won't, but since this is going on, other more noticeable things might be configured to happen as well. 2. Could you please let us know the configuration which triggers the heap dump collection ? Nothing in Tomcat. What JVM command line parameters do you have set for running Tomcat? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat 6 apache 2.2 jk connector: auto config?
Hello Johnrock, I don't have a solution. Just to let you know that I have been trying auto and mod_proxy on my Linux box but neither one has worked 100% (partial success here is still a loss). If you solve the problem let us know. :-O David. johnrock wrote .. I am trying to figure out the best way to configure tomcat 6 to work under apache2.2 running on XP. I have seen a way to 'auto configure' the jk connector, and another way to manually configure it in the httpd.conf file. It seems the auto configure is easier, but are there important advantages to doing it the manual way? I have tried both ways and still not gotten either to work...but I would like to know the best way and limit my efforts to understanding that way. Thanks John -- View this message in context: http://www.nabble.com/tomcat-6-apache-2.2-jk-connector%3A-auto-config--tp21424572p21424572.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: HTTP Status 404
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Satya, satya mahapatra wrote: The web.xml file is inside \WebRoot\WEB-INF\web.xml. According to this I have modified the context.xml inside Tomcat 6.0\conf as below. WatchedResource/WebRoot/WEB-INF/web.xml/WatchedResource AFAICT, WatchedResource expects resources to be relative to the application's root, so you really want this: WatchedResourceWEB-INF/web.xml/WatchedResource ...if your application's name is WebRoot. Note that web.xml is watched by default, and you don't need this extra setting. Also note that you shouldn't be changing conf/context.xml. If you want to customize your own application's deployment, then use a context.xml file in the META-INF directory of your web application instead of modifying the server-wide config file. But still its not able to pick the web.xml and thats why showing 404 error. Any idea where else I need to change? But when I removed the WebRoot folder and only kept the WEB-INF folder directly inside the context path then its working fine. I suspect that you have your application deployed within the ROOT app and thus not properly deployed. Does your directory structure look like this: ROOT - WebRoot - WEB-INF - web.xml ?? If that's the case, your application is improperly deployed. Either deploy WebRoot at the same level as the ROOT directory (to deploy your application as WebRoot), or move everything from WebRoot up to ROOT (to deploy your application as the root application). Is there any way to customize the directory structure of the web application and please let me know where i am going wrong. There is only one acceptable directory structure for a web application and that is to have WEB-INF at the top-level of the application's deployment directory (or WAR file). If you are still having problems, please give more detail about where your files are, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklr3ogACgkQ9CaO5/Lv0PAIQwCff/AnAlsTKJq/mBwpg6pyalaR AUoAn235r5fDHnrt02WB/RkV9BhN2/bc =xBKM -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [us...@httpd] Problem with mod_headers ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, André Warnier wrote: I am using a Tomcat java application which unfortunately sets the Content-Type response header wrongly : it says text/html; charset=iso-8859-1 instead of text/html; charset=iso-8859-2, and there is no way I can change that application itself. So I am trying to rectify that header after-the-fact, using mod_headers. Unfortunately, it does not seem to work. This obviously isn't answering your question, but isn't the application advertising ISO-8859-2 as the content type because that's what it's using? If the application can't be changed (that is, the Content-Type is set in stone somewhere) wouldn't the /actual/ encoding being used also be set in stone? What's the danger in allowing the application to simply continue to use ISO-8859-1 (other than the obvious limitations of the character set itself)? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklr5I0ACgkQ9CaO5/Lv0PCt9QCfQivKj8se2vGgYt8ayOGGroMs i6sAn1UHLVPMGZXmPd+qiE3XD6ECRTgk =JhD5 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat POST Section Execution Size limit
Hello, I am in the process of developing a small site using JSTL and Tomcat 6.0. I already have a large portion of the site developed. The construct of my standard JSTL .jsp page uses the standard Post-Redirect-Get format and looks similar to:...c:if test=${pageContext.request.method=='GET'} ... Generate HTML for GET Request .../c:ifc:if test=${pageContext.request.method=='POST'} ... Execute POST actions .../c:if... I have noticed that I am running into some type of limit with the POST section upon execution. When the POST logic being executed(includes SQL actions, CHOOSE logic, etc...) reaches a certain size, I get the following error java.lang.IllegalStateExceptionIf I trim any part of the POST Section actions, it works without issuing error. I went through many of the config options (such as maxPostSize) outlined at http://tomcat.apache.org/tomcat-6.0-doc/config/http.htmland none of the changes seem to make a difference. None of the individual JSP files so far exceed about 55KB Does anyone have any insight into what would fix this issue ? Thanks,BT _ Windows Live™ Hotmail®: Chat. Store. Share. Do more with mail. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_explore_012009
Re: [us...@httpd] Problem with mod_headers ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, André Warnier wrote: - the only viable solution in my case is thus to make sure that the Tomcat servlet issues the correct Content-Type header in the first place. If the servlet itself cannot be modified, then a servlet filter wrapping the response in a javax.servlet.ServletResponseWrapper wrapper would be the way to go. The wrapper should override the methods by which the servlet sets and/or obtains the response encoding. Note that this is a very common use case for filters: wrap the request (or, in this case, the response) with a custom object that extends ServletRequestWrapper (or ServletResponseWrapper) and overrides the appropriate methods, then delegate processing to the next processor in the filter chain. You probably want to use HttpServletResponseWrapper in stead of the more generic wrapper class. (In my case, the servlet has to keep believing that its response output stream is iso-8859-1, otherwise it does the wrong charset translations from its internal Unicode strings to the 8-bit response stream.) That's a pretty significant bug! - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklr5g4ACgkQ9CaO5/Lv0PA8sACgpmv/U0O/DsFHvow33QllQeIF VxkAoILFKW+1R1ljGegbVQAWNutNlyDE =WrCw -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
On Jan 12, 2009, at 3:34 PM, Caldarale, Charles R wrote: Don't think so. Does your code happen to call response.setStatus(200) somewhere along the way? - Chuck Well at first I didn't think so, but now I am wondering After adding some more instrumentation I have determined that I am inadvertently setting the status to 200. I was replicating the problem with this servlet: package opendap.experiments; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; public class SendErrorTest extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { try { System.out.println(Calling HttpServletResponse.sendError(404)); response.sendError(HttpServletResponse.SC_NOT_FOUND); System.out.println(HttpServletResponse.sendError(404) returned.); } catch (Exception e) { System.out.println(e.getMessage()); } } } And a simple document service servlet: servlet-mapping servlet-namedocs/servlet-name url-pattern/docs/*/url-pattern /servlet-mapping With this error-page: error-page error-code404/error-code location/docs/error404.html/location /error-page I added some instrumentation and looked at the logs and saw that when the sendError() method is called in the SendErrorTest servlet the call returns immediately. And is followed by a the docs servlet receiving a request for the error document, which since it is successfully returning a document sets the HTTP status to 200. Is sendError() using a redirect? Is there a way to set the value of the location element in the error- page declaration so that tomcat just grabs the file from the context directory? The java servlet spec (2.4) says: If the sendError method is called on the response, the container consults the list of error page declarations for the Web application that use the status-code syntax and attempts a match. If there is a match, the container returns the resource as indicated by the location entry. So what does the container returns the resource as indicated by the location entry mean for tomcat? Is there an example of a design pattern you can point me to? Thanks, Nathan = = = Nathan Potterndp at opendap.org OPeNDAP, Inc.541.752.1852 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Permission problems for Downloaded files
Hi, I installed Apache 2.2 + Tomcat 5 + SSL on Linux and they run perfect. The Java web application gives users(after they login) ability to upload files(pdf,ppt..) then creates a record for them, right way users can see their records and can open the documents that they uploaded. The problem is when they click on the link to open the files that they uploaded before they get a forbidden screen. The Java program save upload files on the APache/htdocs directory. To solve that I have to run following command for the htdocs directory. chmod 755 the_name_document. After that the users can access their files. The uploaded files could be accessible right away. How can I solve this problem? Thanks, MK
Re: [OT] Basic int/char conversion question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, André Warnier wrote: an existing webapp reads from a socket connected to an external program. The input stream is created as follows : fromApp = socket.getInputStream(); The read is as follows : StringBuffer buf = new StringBuffer(2000); int ic; while((ic = fromApp.read()) != 26 ic != -1) // hex 1A (SUB) buf.append((char)ic); This is wrong, because it assumes that the input stream is always in an 8-bit default platform encoding, which it isn't. Does it? The only assumption I see here is that the byte code 0x1a has a special meaning. Since ASCII is usually the lowest common denominator for character encodings, is this a bad assumption? How do I do this correctly, assuming that I do know that the incoming stream is an 8-bit stream (like iso-8859-x), and I do know which 8-bit encoding is being used (such as iso-8859-1 or iso-8859-2) ? I cannot change the InputStream into something else, because there are a zillion other places where this webapp tests on the read byte's value, numerically. I like Chuck's suggestion to use an InputStreamReader because the interfaces are (at least accidentally) the same, at least for the method in question. I'm not sure how you would modify an entire application to fix this code everywhere, though. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklr6QEACgkQ9CaO5/Lv0PBYDQCgk0iWAsuvSlujYJRCiWerrHXg lFIAnio6Qts6FMg1lWZZvNSkqvNLY70p =z+yg -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
On Mon, Jan 12, 2009 at 19:58, Nathan Potter n...@opendap.org wrote: On Jan 12, 2009, at 3:34 PM, Caldarale, Charles R wrote: Don't think so. Does your code happen to call response.setStatus(200) somewhere along the way? - Chuck Well at first I didn't think so, but now I am wondering After adding some more instrumentation I have determined that I am inadvertently setting the status to 200. I was replicating the problem with this servlet: package opendap.experiments; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; public class SendErrorTest extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { try { System.out.println(Calling HttpServletResponse.sendError(404)); response.sendError(HttpServletResponse.SC_NOT_FOUND); System.out.println(HttpServletResponse.sendError(404) returned.); } catch (Exception e) { System.out.println(e.getMessage()); } } } And a simple document service servlet: servlet-mapping servlet-namedocs/servlet-name url-pattern/docs/*/url-pattern /servlet-mapping With this error-page: error-page error-code404/error-code location/docs/error404.html/location /error-page I added some instrumentation and looked at the logs and saw that when the sendError() method is called in the SendErrorTest servlet the call returns immediately. And is followed by a the docs servlet receiving a request for the error document, which since it is successfully returning a document sets the HTTP status to 200. Is sendError() using a redirect? Is there a way to set the value of the location element in the error-page declaration so that tomcat just grabs the file from the context directory? The java servlet spec (2.4) says: If the sendError method is called on the response, the container consults the list of error page declarations for the Web application that use the status-code syntax and attempts a match. If there is a match, the container returns the resource as indicated by the location entry. So what does the container returns the resource as indicated by the location entry mean for tomcat? Is there an example of a design pattern you can point me to? Thanks, Nathan It sounds like error404.html isn't a plain HTML file, but a page that's generated by a servlet. Is that right? If so, the servlet should not set the status to 200 for an error page - it should leave the error status alone. Maybe you need a different version of the servlet to handle error pages, or maybe your error pages should just be static HTML files. -- Len - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: single instance of background job?
Quartz has a clustering facility that makes this easy, the OpenSymphony website has more docs on this, investigate the forums/community there. org.quartz.jobStore.isClustered = true Using a JDBC JobStore with the cluster config should ensure that the job only runs once within the cluster. p Rusty Wright wrote: Hmm, I see your point. I'll discuss it with others here and see what they think. Leon Rosenberg wrote: Hello Rusty, On Sun, Jan 11, 2009 at 6:10 PM, Rusty Wright rusty.wri...@gmail.com wrote: The reason making it a web app appeals to me is that then I can have it log to a database, and I can tweak its configuration via a web page. And I can have a checkbox, disable/enable so I can turn it off if needed. Well it seems like you are trying to bypass your companies security guidelines. Which means, either you are doing the wrong thing, or the guidelines are wrong. However, if you would follow the guidelines you will have to protect your configuration page from the outworld, and also from the developers, allowing only admins to change it (otherwise you are creating a backdoor into your own application) and you win nothing. So I'm trying make something that gives me (and the end user) more direct and timely access to it. I understand that there are companies, where you have to actually act against the policies to achieve a positive result (for the company), but maybe you should try to talk people first and try to change things a bit. If you use the word agile often, your chances to actually get limited access to the production system will increase dramatically :-) regards Leon - 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: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
On Jan 12, 2009, at 5:38 PM, Len Popp wrote: It sounds like error404.html isn't a plain HTML file, but a page that's generated by a servlet. Is that right? Yes. If so, the servlet should not set the status to 200 for an error page - it should leave the error status alone. I can see that. Maybe you need a different version of the servlet to handle error pages, That's waht I have been slowly getting to: Make an error handling servlet. or maybe your error pages should just be static HTML files. Well, they certainly could be. But how do I serve them without a servlet to do it? That was ultimately my question: How do I set the value of the location element in the error page declaration: error-page error-code404/error-code location/docs/error404.html/location /error-page So that tomcat will grab a static HTML page from disk? Let's say that the error document is here: $CATALINA_HOME/webapps/myContext/docs/error404.html Because it doesn't do it if I disable the servlet (and it's mappings) that hands our the docs, it just returns an empty document. Nathan -- Len - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org = = = Nathan Potterndp at opendap.org OPeNDAP, Inc.541.752.1852 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
From: Nathan Potter [mailto:n...@opendap.org] Subject: Re: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called. Is sendError() using a redirect? No, more like an internal forward. Is there a way to set the value of the location element in the error-page declaration so that tomcat just grabs the file from the context directory? Yes - don't give it a URL pattern that matches the mapping for any of your servlets. So what does the container returns the resource as indicated by the location entry mean for tomcat? Haven't checked the code yet, but I believe it treats it like a GET for the resource, so it's subject to whatever servlet mapping you have in place. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
From: Nathan Potter [mailto:n...@opendap.org] Subject: Re: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called. But how do I serve them without a servlet to do it? You don't have to serve them - Tomcat's DefaultServlet does it for you, just as it does for all static resources. How do I set the value of the location element in the error page declaration: So that tomcat will grab a static HTML page from disk? You normally would put static error pages in a separate directory, so that they will not be processed by any of your servlets. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to have multiple loggers with shared code also using the logger?
How to have multiple loggers with shared code also using the logger? In ${catalina.home}/lib there is a jar file that contains class MyLog. There is a function in it public class MyLog { public static Logger getLogger() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL log4j_properties = classLoader.getResource(log4j.properties); String loggerName = log4j_properties != null ? log4j_properties.toString() : default; synchronized (MyLog.class) { Logger logger = Logger.getRootLogger().getLoggerRepository().exists(loggerName); if (logger == null) { logger = Logger.getLogger(loggerName); System.out.println(Created logger: loggerName= + loggerName); } return logger; } } } The jar file in ${catalina.home}/lib contains common code used by all web applications, and it calls MyLog.getLogger() to write some logs. My ROOT application in ${catalina.home}/webapps/ROOT and web service application in ${catalina.home}/webapps/mywebservice also call MyLog. The intent of getLogger() above is to return the logger for the application currently being run. I have verified that Thread.currentThread().getContextClassLoader().hashCode() has value1 for the ROOT application and value2 for the mywebservice application. We have the following two log4j.properties: ${catalina.home}/webapps/ROOT/WEB-INF/lib/root.jar!/log4j.properties ${catalina.home}/webapps/mywebservice/WEB-INF/lib/root.jar!/log4j.properties The value of loggerName is the first one when we're running the ROOT application, and the second one when running the mywebservice application. So far, so good. After starting Tomcat, if we run the ROOT application first, then it will call MyLog.getLogger(), and the log4j.properties found by the call to Logger.getLogger() will be the first one above. If we run mywebservice first, then Logger.getLogger() will find the second log4j.properties file. Any subsequent call to Logger.getLogger() will use the same log4j.properties. So suppose we run the ROOT application first, then the new logger will be initialized with the first log4j.properties above. And then if mywebservice calls MyLog.getLogger(), a new logger will get created, but it will be based on the same log4j.properties file. You can see this because all applications log to the same file (each of my log4j.properties specifies a different file). - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Configuring Tomcat -- moving to another directory
Hello, I want to move Tomcat to another directory. Red5 server requires that I move Tomcat to a directory that has a path with no spaces in it.So, I moved the java sdk and I moved the tomcat server to the same directory. The directories are: C:\jbin\jdk1.6.0_07 C:\jbin\Tomcat6.0 Where is the configuration information for tomcat? I looked and could not find a file. I did notice that the Apache Tomcat Properties application (tomcat6w.exe) has paths in it, but I couldn't see where it was getting the information, and I couldn't change the path to the executable. Does anyone know how to do this? Thanks for your help, ...John -- View this message in context: http://www.nabble.com/Configuring-Tomcatmoving-to-another-directory-tp21429735p21429735.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat returns HTTP status of 200 when HttpServletResponse.sendError() called.
On Jan 12, 2009, at 6:08 PM, Caldarale, Charles R wrote: But how do I serve them without a servlet to do it? You don't have to serve them - Tomcat's DefaultServlet does it for you, just as it does for all static resources. How do I set the value of the location element in the error page declaration: So that tomcat will grab a static HTML page from disk? You normally would put static error pages in a separate directory, so that they will not be processed by any of your servlets. I see the conflict in my design now: I mapped one of my servlets to be the default servlet: servlet-mapping servlet-namehyrax/servlet-name url-pattern*/url-pattern /servlet-mapping And since it doesn't serve static content like the Tomcat DefaultServlet, I'm not seeing the expected behavior for the error- page mappings. Which is kind of a bummer: People pretty much rely on the fact that the service defaults to the hyrax servlet. Is sendError() using a redirect? No, more like an internal forward. I just did some more testing and discovered that if I don't actually call response.setStatus() in my docs servlet (which serves the static content) then it seems to inherit(?) a status from the internal forward . Is that right? Would I be better off just not calling response.setStatus() unless something actually goes awry with the request? = = = Nathan Potterndp at opendap.org OPeNDAP, Inc.541.752.1852 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Reusing form configured in form based authentication
Hi, I have an application using form based authentication. Is it possible to use the same form as a stand-alone login screen? Default, if you enter the url of the form manually (or get it from your browser's history) and you submit it, you get an error message. You always have a smart-ass who will do this, so I want to have my application properly handle it and never want error screen to show. I would venture a guess that you just have to configure a proper servlet mapping for the j_security_check action to enable you to use the form directly also, but would that then cause problems for the server authentication? Or would Tomcat be able to handle this? And the j_security_check action would then probably have to be configured so that no authentication is needed for it to execute, right? Otherwise I'll land in a loop. Thanks! Charl - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
logging
Hi, I have an app that only shows minimal logging info like [INFO], [ERROR] but lately I moved the app to a new server and I have seen a lot of logs in the catalina.out, something like: [Loaded com.mysql.jdbc.JDBC4DatabaseMetaData from file:/usr/local/jakarta/apache-tomcat-5.5.25/webapps/istudio/WEB-INF/lib/mysql-connector-java-5.1.6.jar] any way to remove thos [Loaded...] logs? Thanks, Angelo -- View this message in context: http://www.nabble.com/logging-tp21430889p21430889.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org