R: how to read files in file system
Excuse me Dan: attached the screenshot. paolo -Messaggio originale- Da: Daniel Mikusa [mailto:dmik...@vmware.com] Inviato: martedì 11 settembre 2012 13.51 A: Tomcat Users List Oggetto: Re: how to read files in file system On Sep 11, 2012, at 3:11 AM, IBM partner Gestione Elaboratori wrote: With jsp i can read files in the file system only if there are located under the directory webapps/application/file. If I read a file ,for example, in c:/filename Tomcats signals an error (se atthachment) Again, there is no attachment. The list is probably removing it. Please try pasting the content into your email. Please also include the error that is given. Without that, we can only guess at what is happening. Dan How to read files located everywere in the file system? paoloc - 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: R: how to read files in file system
Try: URI uri = new URI(file//c:/..); // win Or file:///yourdir/.. on unix (note 3 /). From uri you can get the url and from here you can open an inputstream or you can use new File(url.toFile()) To access a resource from your classpath the following will do: URL url = Thread.currentThread().getContextClassloader().getResource(relativeNameOfFile); Basically this should work, but its untested as my phone does not provide a java compiler :-) Jens Sent from my iPhone On 18.09.2012, at 08:21, Ge Gestione Elaboratori\(IBM Business Partner\) case...@gmail.com wrote: Excuse me Dan: attached the screenshot. paolo -Messaggio originale- Da: Daniel Mikusa [mailto:dmik...@vmware.com] Inviato: martedì 11 settembre 2012 13.51 A: Tomcat Users List Oggetto: Re: how to read files in file system On Sep 11, 2012, at 3:11 AM, IBM partner Gestione Elaboratori wrote: With jsp i can read files in the file system only if there are located under the directory webapps/application/file. If I read a file ,for example, in c:/filename Tomcats signals an error (se atthachment) Again, there is no attachment. The list is probably removing it. Please try pasting the content into your email. Please also include the error that is given. Without that, we can only guess at what is happening. Dan How to read files located everywere in the file system? paoloc - 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: warDirectory property wrong evaluated in release version 2.0 ?
Thanks it's now fixed. 2012/9/17 Florian Maertl florian.maer...@macquarie.com: Jira is raised: https://issues.apache.org/jira/browse/MTOMCAT-175 Thanks Florian -Original Message- From: Olivier Lamy [mailto:ol...@apache.org] Sent: Montag, 17. September 2012 15:19 To: Tomcat Users List Subject: Re: warDirectory property wrong evaluated in release version 2.0 ? Hi, yup there is an issue here: http://svn.apache.org/repos/asf/tomcat/maven-plugin/trunk/tomcat6-maven- plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunW arMojo.java only for tomcat6 mojo. can you load a jira entry for that ? Thanks, -- Olivier 2012/9/17 Florian Maertl florian.maer...@macquarie.com: Hi all Today I updated the tomcat6-maven-plugin version in my project from 2.0-beta-1 to 2.0. Since then I got this exceptions when I'm starting the embedded tomcat instance: Sep 17, 2012 2:17:15 PM org.apache.catalina.startup.Embedded start INFO: Starting tomcat server Sep 17, 2012 2:17:15 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.32 Sep 17, 2012 2:17:15 PM org.apache.catalina.core.StandardContext resourcesStart SEVERE: Error starting static Resources java.lang.IllegalArgumentException: Document base /data/local/dvimgde/workspaces/classic.flo/daffiM2/trunk/daffi.core/targ et/${project.build.finalName does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.jav a:142) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext. java:4319) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.startup.Embedded.start(Embedded.java:825) at org.apache.tomcat.maven.plugin.tomcat6.AbstractRunMojo.startContainer(Ab stractRunMojo.java:850) at org.apache.tomcat.maven.plugin.tomcat6.AbstractRunMojo.execute(AbstractR unMojo.java:429) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBui ldPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja va:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja va:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.ja va:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject( LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject( LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild (LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleSt arter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launche r.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:2 30) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launc her.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352 ) Sep 17, 2012 2:17:15 PM org.apache.catalina.core.StandardContext start SEVERE: Error in resourceStart() Please note the missing closing } after project.build.finalName. But if I explicitely define the warDirectory property in my pom, it works: configuration warDirectory${project.build.directory}/${project.build.finalName}/war Directory /configuration With version 2.0-beta-1 it worked
Re: Problems loading external jar in my app !
I tried all the things that you expose, but without results :( Is it possible that the Debian installation disable tomcat auto WEB-INF checking? If it's possible, can you tell me where I can find this magic configuration file? I have another theory, Is it possible that the jar i'm using needs some extra configuration for tomcat recognition? I'm working with weka if this can help you ! Greetings, Joel 2012/9/13, Christopher Schultz ch...@christopherschultz.net: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Vishwanath, On 9/13/12 10:04 AM, Vishwanath Washimkar wrote: Joel, At first look it seemed to me odd, but I google search I got this link. It seems that you have not provided ' ; ' at the end of your import. That's not how it is supposed to work. Either there is a bug in Tomcat or there is something else wrong. I would be very surprised if adding a ; after the last import fixed this problem. Also test it out putting the jar in the webapps/lib or tomcat-root/lib. That first one is the right solution. I need to research on aptitude installation though. Aptitude is a package manager for Debian-based OSs. The following link might help. http://stackoverflow.com/questions/1858463/java-error-only-a-type-can-be-imported-xyz-resolves-to-a-package I think the ; is a red herring. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUCUACgkQ9CaO5/Lv0PAoygCfckVCwmJvMuhSEpgPWqOdQggP 20MAn0LeFCrswdcu6vI0zXzA8VbbHYZE =s0oX -END PGP SIGNATURE- - 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: Problems loading external jar in my app !
2012/9/18 joel badia escolà basto...@gmail.com: I tried all the things that you expose, but without results :( Is it possible that the Debian installation disable tomcat auto WEB-INF checking? If it's possible, can you tell me where I can find this magic configuration file? 1. It is not possible to disable loading libraries from WEB-INF/lib and classes from WEB-INF/classes, as that is required by the Servlet specification. Spelling matters. WEB-INF is in uppercase and lib is in lowercase, and the full path is ${CATALINA_BASE}/webapps/${web application name}/WEB-INF/lib The mapping between web application names and their URLs is explained in the Context chapter of the Configuration Reference. 2. How do you deploy your application into Tomcat? 3. Note that the examples application that is included with the official Apache Tomcat distributive has several libraries in it: jstl.jar, standard.jar. 4. http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems loading external jar in my app !
The placement it's correct i'm using Debian and my app it's deployed in /var/lib/tomcat6/webapps/ROOT/DiseaseDiscovery (where $CATALINA_BASE=/var/lib/tomcat6). This is the full tree of my webapp: . |-- disease_discover.jsp |-- disease_discover.jsp~ |-- disease_simpts.jsp |-- disease_simpts.jsp~ |-- get_diseases.jsp |-- get_diseases.jsp~ |-- get_simpts.jsp |-- get_simpts.jsp~ |-- images | |-- icona.png | |-- icona.xcf | |-- menu_background.png | `-- menu_background.xcf |-- index.html |-- index.html~ |-- make_completions.jsp |-- make_completions.jsp~ |-- make_diagnosis.jsp |-- make_diagnosis.jsp~ |-- make_disease_completions.jsp |-- make_disease_completions.jsp~ |-- prediction_data | |-- rt-test-nonoise-20.model | `-- tmp_test.arff |-- scripts | |-- diseasediscover.js | |-- diseasediscover.js~ | |-- disease_simpts.js | |-- disease_simpts.js~ | |-- jquery.js | |-- main.js | |-- main.js~ | |-- simpt_diseases.js | `-- simpt_diseases.js~ |-- simpt_diseases.jsp |-- simpt_diseases.jsp~ |-- styles | |-- basic_style.css | `-- basic_style.css~ `-- WEB-INF |-- classes `-- lib `-- weka.jar Spelling matters. WEB-INF is in uppercase and lib is in lowercase [...] I think that it's correct. As you can see i respect the lower and upper cases ! Thank's and best regards, Joel Badia Escolà 2012/9/18, Konstantin Kolinko knst.koli...@gmail.com: 2012/9/18 joel badia escolà basto...@gmail.com: I tried all the things that you expose, but without results :( Is it possible that the Debian installation disable tomcat auto WEB-INF checking? If it's possible, can you tell me where I can find this magic configuration file? 1. It is not possible to disable loading libraries from WEB-INF/lib and classes from WEB-INF/classes, as that is required by the Servlet specification. Spelling matters. WEB-INF is in uppercase and lib is in lowercase, and the full path is ${CATALINA_BASE}/webapps/${web application name}/WEB-INF/lib The mapping between web application names and their URLs is explained in the Context chapter of the Configuration Reference. 2. How do you deploy your application into Tomcat? 3. Note that the examples application that is included with the official Apache Tomcat distributive has several libraries in it: jstl.jar, standard.jar. 4. http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style Best regards, Konstantin Kolinko - 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: Problems loading external jar in my app !
Hi , why are you putting your webapplication under /var/lib/tomcat6/webapps/ROOT/DiseaseDiscovery . This make DiseaseDirecovery a part of the root web appliction. Put the webapplication in under the webapps directory : /var/lib/tomcat6/webapps/ROOT/DiseaseDiscovery I think u jars are not deploying as u r putting the webpplication directory under ROOT webapplication. I don't think debian OS will change anything how tomcat deploys web app. The deployment is minimum as specified in J2EE specs try this Vish On Tue, Sep 18, 2012 at 2:44 PM, joel badia escolà basto...@gmail.comwrote: I tried all the things that you expose, but without results :( Is it possible that the Debian installation disable tomcat auto WEB-INF checking? If it's possible, can you tell me where I can find this magic configuration file? I have another theory, Is it possible that the jar i'm using needs some extra configuration for tomcat recognition? I'm working with weka if this can help you ! Greetings, Joel 2012/9/13, Christopher Schultz ch...@christopherschultz.net: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Vishwanath, On 9/13/12 10:04 AM, Vishwanath Washimkar wrote: Joel, At first look it seemed to me odd, but I google search I got this link. It seems that you have not provided ' ; ' at the end of your import. That's not how it is supposed to work. Either there is a bug in Tomcat or there is something else wrong. I would be very surprised if adding a ; after the last import fixed this problem. Also test it out putting the jar in the webapps/lib or tomcat-root/lib. That first one is the right solution. I need to research on aptitude installation though. Aptitude is a package manager for Debian-based OSs. The following link might help. http://stackoverflow.com/questions/1858463/java-error-only-a-type-can-be-imported-xyz-resolves-to-a-package I think the ; is a red herring. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUCUACgkQ9CaO5/Lv0PAoygCfckVCwmJvMuhSEpgPWqOdQggP 20MAn0LeFCrswdcu6vI0zXzA8VbbHYZE =s0oX -END PGP SIGNATURE- - 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: Problems loading external jar in my app !
2012/9/18 joel badia escolà basto...@gmail.com: The placement it's correct i'm using Debian and my app it's deployed in /var/lib/tomcat6/webapps/ROOT/DiseaseDiscovery (where $CATALINA_BASE=/var/lib/tomcat6). This is the full tree of my webapp: . |-- disease_discover.jsp |-- disease_discover.jsp~ |-- disease_simpts.jsp |-- disease_simpts.jsp~ |-- get_diseases.jsp |-- get_diseases.jsp~ |-- get_simpts.jsp |-- get_simpts.jsp~ |-- images | |-- icona.png | |-- icona.xcf | |-- menu_background.png | `-- menu_background.xcf |-- index.html |-- index.html~ |-- make_completions.jsp |-- make_completions.jsp~ |-- make_diagnosis.jsp |-- make_diagnosis.jsp~ |-- make_disease_completions.jsp |-- make_disease_completions.jsp~ |-- prediction_data | |-- rt-test-nonoise-20.model | `-- tmp_test.arff |-- scripts | |-- diseasediscover.js | |-- diseasediscover.js~ | |-- disease_simpts.js | |-- disease_simpts.js~ | |-- jquery.js | |-- main.js | |-- main.js~ | |-- simpt_diseases.js | `-- simpt_diseases.js~ |-- simpt_diseases.jsp |-- simpt_diseases.jsp~ |-- styles | |-- basic_style.css | `-- basic_style.css~ `-- WEB-INF |-- classes `-- lib `-- weka.jar Spelling matters. WEB-INF is in uppercase and lib is in lowercase [...] I think that it's correct. As you can see i respect the lower and upper cases ! 1. The ROOT web application is the wrong place for your files. All web applications are independent. The ROOT application is just one of them. 2. You have not read the wikipedia article Thank's and best regards, Joel Badia Escolà 2012/9/18, Konstantin Kolinko knst.koli...@gmail.com: 2012/9/18 joel badia escolà basto...@gmail.com: I tried all the things that you expose, but without results :( Is it possible that the Debian installation disable tomcat auto WEB-INF checking? If it's possible, can you tell me where I can find this magic configuration file? 1. It is not possible to disable loading libraries from WEB-INF/lib and classes from WEB-INF/classes, as that is required by the Servlet specification. Spelling matters. WEB-INF is in uppercase and lib is in lowercase, and the full path is ${CATALINA_BASE}/webapps/${web application name}/WEB-INF/lib The mapping between web application names and their URLs is explained in the Context chapter of the Configuration Reference. 2. How do you deploy your application into Tomcat? 3. Note that the examples application that is included with the official Apache Tomcat distributive has several libraries in it: jstl.jar, standard.jar. 4. http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems loading external jar in my app !
remove the DiseaseDiscovery and put it in webapps directory and u should be good to go. Make it simple On Tue, Sep 18, 2012 at 6:11 PM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2012/9/18 joel badia escolà basto...@gmail.com: The placement it's correct i'm using Debian and my app it's deployed in /var/lib/tomcat6/webapps/ROOT/DiseaseDiscovery (where $CATALINA_BASE=/var/lib/tomcat6). This is the full tree of my webapp: . |-- disease_discover.jsp |-- disease_discover.jsp~ |-- disease_simpts.jsp |-- disease_simpts.jsp~ |-- get_diseases.jsp |-- get_diseases.jsp~ |-- get_simpts.jsp |-- get_simpts.jsp~ |-- images | |-- icona.png | |-- icona.xcf | |-- menu_background.png | `-- menu_background.xcf |-- index.html |-- index.html~ |-- make_completions.jsp |-- make_completions.jsp~ |-- make_diagnosis.jsp |-- make_diagnosis.jsp~ |-- make_disease_completions.jsp |-- make_disease_completions.jsp~ |-- prediction_data | |-- rt-test-nonoise-20.model | `-- tmp_test.arff |-- scripts | |-- diseasediscover.js | |-- diseasediscover.js~ | |-- disease_simpts.js | |-- disease_simpts.js~ | |-- jquery.js | |-- main.js | |-- main.js~ | |-- simpt_diseases.js | `-- simpt_diseases.js~ |-- simpt_diseases.jsp |-- simpt_diseases.jsp~ |-- styles | |-- basic_style.css | `-- basic_style.css~ `-- WEB-INF |-- classes `-- lib `-- weka.jar Spelling matters. WEB-INF is in uppercase and lib is in lowercase [...] I think that it's correct. As you can see i respect the lower and upper cases ! 1. The ROOT web application is the wrong place for your files. All web applications are independent. The ROOT application is just one of them. 2. You have not read the wikipedia article Thank's and best regards, Joel Badia Escolà 2012/9/18, Konstantin Kolinko knst.koli...@gmail.com: 2012/9/18 joel badia escolà basto...@gmail.com: I tried all the things that you expose, but without results :( Is it possible that the Debian installation disable tomcat auto WEB-INF checking? If it's possible, can you tell me where I can find this magic configuration file? 1. It is not possible to disable loading libraries from WEB-INF/lib and classes from WEB-INF/classes, as that is required by the Servlet specification. Spelling matters. WEB-INF is in uppercase and lib is in lowercase, and the full path is ${CATALINA_BASE}/webapps/${web application name}/WEB-INF/lib The mapping between web application names and their URLs is explained in the Context chapter of the Configuration Reference. 2. How do you deploy your application into Tomcat? 3. Note that the examples application that is included with the official Apache Tomcat distributive has several libraries in it: jstl.jar, standard.jar. 4. http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems loading external jar in my app !
Konstantin Kolinko wrote: 2012/9/18 joel badia escolà basto...@gmail.com: ... 2. You have not read the wikipedia article I think that we should implement a filter on the list, which automatically throws away any top-posted message. ;-) http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Accessing CoyoteRequest attributes in a Servlet
Hi all, I am trying to set up a Java Web Application using Servlets and JSPs in Tomcat 7. User authentication should be done on a central Shibboleth Identity Provider. I have already configured Apache including mod_ssl, mod_proxy_ajp and the shib2 module following these instructions: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall The redirect to the central login page works and, after entering my credentials, the session is correctly created by the identity provider and I am forwarded to my webapp. At this point I should have different attributes in my session, such as the user's email address, name and so on. But these are stored in the coyoteRequest attributes, which I can observe while debugging in Eclipse. As the coyoteRequest is a protected field of org.apache.catalina.connector.Request which again is a field of the RequestFacade I can not get any of these values. What I get is ONE of the attributes in the REMOTE_USER field (compare 2. in the instructions above). By setting ShibUseHeaders On in apache I get all of the attributes in the request headers, but this is not recommended for security reasons. Is there any way to access the coyoteRequest in a servlet or at least configure tomcat to transfer more attributes to the servletRequest? My current connector configuration in server.xml looks like this: Connector URIEncoding=UTF-8 connectionTimeout=2 port=8081 protocol=HTTP/1.1 redirectPort=8444/ Connector SSLEnabled=true URIEncoding=UTF-8 clientAuth=false maxThreads=150 port=8444 protocol=HTTP/1.1 scheme=https secure=true sslProtocol=TLS/ Connector URIEncoding=UTF-8 port=8010 protocol=AJP/1.3 redirectPort=8444 tomcatAuthentication=false packetSize=65536/ Many thanks and best regards, Philip - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems loading external jar in my app !
1. The ROOT web application is the wrong place for your files. All web applications are independent. The ROOT application is just one of them. Perfect with this i solve the problem ;) 2. You have not read the wikipedia article I'm not sure if I understand completely the full article, because as you notice my english skills are some limited (sorry i'm working too for fix it :P). But I think that one response like that, if I understood, it's correct? Best Regards and thanks everyone that helps me, Joel Badia Escolà - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing CoyoteRequest attributes in a Servlet
Philip Kahle wrote: Hi all, I am trying to set up a Java Web Application using Servlets and JSPs in Tomcat 7. User authentication should be done on a central Shibboleth Identity Provider. I have already configured Apache including mod_ssl, mod_proxy_ajp and the shib2 module following these instructions: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall The redirect to the central login page works and, after entering my credentials, the session is correctly created by the identity provider and I am forwarded to my webapp. At this point I should have different attributes in my session, such as the user's email address, name and so on. But these are stored in the coyoteRequest attributes, which I can observe while debugging in Eclipse. As the coyoteRequest is a protected field of org.apache.catalina.connector.Request which again is a field of the RequestFacade I can not get any of these values. What I get is ONE of the attributes in the REMOTE_USER field (compare 2. in the instructions above). By setting ShibUseHeaders On in apache I get all of the attributes in the request headers, but this is not recommended for security reasons. Why ? That is a generic recommendation, but it does not apply if : - all the requests to Tomcat go through httpd first - the link between httpd and Tomcat is secure (not accessible by anyone) If e.g. httpd and Tomcat live on the same host, and you configure the Tomcat AJP Connector to only accept requests from localhost, then it would be ok to pass private information through headers. Simplify your life if possible. Is there any way to access the coyoteRequest in a servlet or at least configure tomcat to transfer more attributes to the servletRequest? At least by using mod_jk instead of mod_proxy_ajp, you can transmit a bunch of things from Apache httpd to Tomcat (including Apache httpd's variables e.g.). I do not know mod_proxy_ajp well enough to confirm that this is possible with it also, but I would imagine so. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems loading external jar in my app !
joel badia escolà wrote: 1. The ROOT web application is the wrong place for your files. All web applications are independent. The ROOT application is just one of them. Perfect with this i solve the problem ;) 2. You have not read the wikipedia article I'm not sure if I understand completely the full article, because as you notice my english skills are some limited (sorry i'm working too for fix it :P). But I think that one response like that, if I understood, it's correct? Yes, perfect. It makes clear what you are responding to, it is easy to read in sequence, like a normal conversation, etc. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing CoyoteRequest attributes in a Servlet
André Warnier wrote: Philip Kahle wrote: Hi all, I am trying to set up a Java Web Application using Servlets and JSPs in Tomcat 7. User authentication should be done on a central Shibboleth Identity Provider. I have already configured Apache including mod_ssl, mod_proxy_ajp and the shib2 module following these instructions: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall The redirect to the central login page works and, after entering my credentials, the session is correctly created by the identity provider and I am forwarded to my webapp. At this point I should have different attributes in my session, such as the user's email address, name and so on. But these are stored in the coyoteRequest attributes, which I can observe while debugging in Eclipse. As the coyoteRequest is a protected field of org.apache.catalina.connector.Request which again is a field of the RequestFacade I can not get any of these values. What I get is ONE of the attributes in the REMOTE_USER field (compare 2. in the instructions above). By setting ShibUseHeaders On in apache I get all of the attributes in the request headers, but this is not recommended for security reasons. Why ? That is a generic recommendation, but it does not apply if : - all the requests to Tomcat go through httpd first - the link between httpd and Tomcat is secure (not accessible by anyone) If e.g. httpd and Tomcat live on the same host, and you configure the Tomcat AJP Connector to only accept requests from localhost, then it would be ok to pass private information through headers. Simplify your life if possible. Is there any way to access the coyoteRequest in a servlet or at least configure tomcat to transfer more attributes to the servletRequest? At least by using mod_jk instead of mod_proxy_ajp, you can transmit a bunch of things from Apache httpd to Tomcat (including Apache httpd's variables e.g.). I do not know mod_proxy_ajp well enough to confirm that this is possible with it also, but I would imagine so. Addendum : sorry, that was not a direct answer to your question. The direct answer is that HttpServletRequest (and ServletRequest) already provide a bunch of methods to access request attributes. See http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html. These are part of the specification, so you do not need to configure anything at the Tomcat level for that. As long as the request already contains attributes of course. Still talking about mod_jk, basically anything you set in Apache httpd using SetEnv for example, gets passed to Tomcat as a request attribute, through the AJP protocol. Someone else would need to confirm if this is also the case using mod_proxy_ajp. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Fwd: Setting initial memory for a Tomcat Windows Service
Hello, Is this a bug or am I doing this wrong ? Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the -Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
mod_jk vs. mod_proxy
All, I wanted your opinion on this topic. I was heavily into using mod_jk a few years back. But I have since started using mod_proxy for the following reasons: (1) mod_proxy is easier to configure (2) I remember reading that mod_jk is deprecated (3) Logging for mod_proxy appears inline with Apache traffic log entries and is easier to debug. I am able to get detailed logging from mod_proxy by adjusting Apache's LogLevel to debug. (4) Could there be any other reasons that I might be missing? I do also like the separate logging that mod_jk gives though. I notice that mod_jk is still being used. I just wanted to know your opinion. Thanks. -Shanti
Re: Verifying mod_jk is installed
John Rellis wrote: Hey, I would very much appreciate some help, flying blind at the moment. I want to use mod_jk as a load balancer to two remote tomcat instances and I am failing so I need to verify the steps. I have installed mod_jk, I will paste the mod_jk log to the end of the email. Is there anything I can do to verify that mod_jk is installed properly The log you supply below shows definitely that mod_jk is installed and working. Whether it is configured properly for what you want to achieve is another issue. Also, if it was not installed or loaded in Apache httpd, then any of your Jk* instruction lines in httpd.conf would trigger an error when you start Apache. Is jkstatus a URL I can hit??? I put *JkMount /jkmanager* jkstatus* in apache2.conf so I was assuming I could hit host/jkmanager and there would be something there. instead i get missing uri map for ip-xx-xx-xx-xx.us-west-2.compute.internal:/jkmanager Many thanks for any tips! :) */etc/apache2/conf/workers.properties* # Define worker names worker.list=jkstatus, LoadBalancer # Create virtual workers worker.jkstatus.type=status worker.LoadBalancer.type=lb # Declare Tomcat server workers 1 through n worker.worker1.type=ajp13 worker.worker1.host=tomcatone worker.worker1.port=8009 worker.worker2.type=ajp13 worker.worker2.host=tomcattwo worker.worker2.port=8009 # Associate real workers with virtual LoadBalancer worker worker.LoadBalancer.balance_workers=worker1,worker2 */etc/apache2/mods-enabled/jk.conf* IfModule jk_module JkWorkersFile /etc/apache2/conf/workers.properties JkLogFile /var/log/apache2/mod_jk.log JkLogLevel debug JkShmFile /var/log/apache2/jk-runtime-status # Since: 1.2.27 JkWatchdogInterval 60 /IfModule */etc/apache2/apache2.conf* * * # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # LockFile ${APACHE_LOCK_DIR}/accept.lock # # PidFile: The file in which the server should record its process # identification number when it starts. # This needs to be set in /etc/apache2/envvars # PidFile ${APACHE_PID_FILE} # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to Off to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 5 ## Server-Pool Size Regulation (MPM specific) ## # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves IfModule mpm_prefork_module StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 /IfModule # worker MPM # StartServers: initial number of server processes to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a # graceful restart. ThreadLimit can only be changed by stopping # and starting Apache. # ThreadsPerChild: constant number of worker threads in each server process # MaxClients: maximum number of simultaneous client connections # MaxRequestsPerChild: maximum number of requests a server process serves IfModule mpm_worker_module StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 MaxRequestsPerChild 0 /IfModule # event MPM # StartServers: initial number of server processes to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxClients: maximum number of simultaneous client connections # MaxRequestsPerChild: maximum number of requests a server process serves IfModule mpm_event_module StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 MaxRequestsPerChild 0 /IfModule # These need to be set in /etc/apache2/envvars User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} # # AccessFileName: The name of the file to look for in each directory #
Re: mod_jk vs. mod_proxy
On Sep 18, 2012, at 10:04 AM, Shanti Suresh wrote: All, I wanted your opinion on this topic. I was heavily into using mod_jk a few years back. But I have since started using mod_proxy for the following reasons: (1) mod_proxy is easier to configure (2) I remember reading that mod_jk is deprecated I've not heard this. Where did you read this? (3) Logging for mod_proxy appears inline with Apache traffic log entries and is easier to debug. I am able to get detailed logging from mod_proxy by adjusting Apache's LogLevel to debug. (4) Could there be any other reasons that I might be missing? I found this article helpful. http://www.tomcatexpert.com/blog/2010/06/16/deciding-between-modjk-modproxyhttp-and-modproxyajp Dan I do also like the separate logging that mod_jk gives though. I notice that mod_jk is still being used. I just wanted to know your opinion. Thanks. -Shanti - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fwd: Setting initial memory for a Tomcat Windows Service
On 9/18/2012 10:03 AM, Patrick Flaherty wrote: Hello, Is this a bug or am I doing this wrong ? I'm not totally sure what you're asking about, but I have found that tomcat7w does not always reflect the current settings if you have made changes. IIRC, I usually need to restart it to get it to pick up changes. The other option is to look in the registry for the values; the changes will appear there by hitting Refresh. Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the -Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - 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: Verifying mod_jk is installed
André, Thanks! OK, so I put JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus Into apache2.conf and no success. I did however put it in sites-available/default VirtualHost *:80 ServerAdmin webmaster@localhost JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus . And I can now hit host/jkmanager/ and I get a UI. Is this the expected behaviour??? Many thanks again! John On Tue, Sep 18, 2012 at 3:05 PM, André Warnier a...@ice-sa.com wrote: John Rellis wrote: Hey, I would very much appreciate some help, flying blind at the moment. I want to use mod_jk as a load balancer to two remote tomcat instances and I am failing so I need to verify the steps. I have installed mod_jk, I will paste the mod_jk log to the end of the email. Is there anything I can do to verify that mod_jk is installed properly The log you supply below shows definitely that mod_jk is installed and working. Whether it is configured properly for what you want to achieve is another issue. Also, if it was not installed or loaded in Apache httpd, then any of your Jk* instruction lines in httpd.conf would trigger an error when you start Apache. Is jkstatus a URL I can hit??? I put *JkMount /jkmanager* jkstatus* in apache2.conf so I was assuming I could hit host/jkmanager and there would be something there. instead i get missing uri map for ip-xx-xx-xx-xx.us-west-2.** compute.internal:/jkmanager Many thanks for any tips! :) */etc/apache2/conf/workers.**properties* # Define worker names worker.list=jkstatus, LoadBalancer # Create virtual workers worker.jkstatus.type=status worker.LoadBalancer.type=lb # Declare Tomcat server workers 1 through n worker.worker1.type=ajp13 worker.worker1.host=tomcatone worker.worker1.port=8009 worker.worker2.type=ajp13 worker.worker2.host=tomcattwo worker.worker2.port=8009 # Associate real workers with virtual LoadBalancer worker worker.LoadBalancer.balance_**workers=worker1,worker2 */etc/apache2/mods-enabled/jk.**conf* IfModule jk_module JkWorkersFile /etc/apache2/conf/workers.**properties JkLogFile /var/log/apache2/mod_jk.log JkLogLevel debug JkShmFile /var/log/apache2/jk-runtime-**status # Since: 1.2.27 JkWatchdogInterval 60 /IfModule */etc/apache2/apache2.conf* * * # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # LockFile ${APACHE_LOCK_DIR}/accept.lock # # PidFile: The file in which the server should record its process # identification number when it starts. # This needs to be set in /etc/apache2/envvars # PidFile ${APACHE_PID_FILE} # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to Off to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 5 ## Server-Pool Size Regulation (MPM specific) ## # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves IfModule mpm_prefork_module StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 /IfModule # worker MPM # StartServers: initial number of server processes to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a # graceful restart. ThreadLimit can only be changed by stopping # and starting Apache. # ThreadsPerChild: constant number of worker threads in each server process # MaxClients: maximum number of simultaneous client connections # MaxRequestsPerChild: maximum number of requests a server process serves IfModule mpm_worker_module StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 MaxRequestsPerChild 0 /IfModule # event MPM # StartServers: initial number of server processes to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker
Re: Verifying mod_jk is installed
John Rellis wrote: André, Thanks! OK, so I put JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus Into apache2.conf and no success. I did however put it in sites-available/default VirtualHost *:80 ServerAdmin webmaster@localhost JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus . And I can now hit host/jkmanager/ and I get a UI. Is this the expected behaviour??? Yes, but do not top-post. Read http://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style In reality there are several factors at work here. We are getting into Apache VirtualHost logic, and the logic of inheritance of JkMount from the main Apache configuration to the virtual hosts. To get a fuller explanation, see the online documentation and the JkMountCopy directive. Briefly : - for Apache httpd : - generally, whatever lives outside a VirtualHost section belongs to the main configuration, and basically acts as a default value for any VirtualHost, /unless/ it is superseded by a similar directive inside a VirtualHost section. - for JkMount however : by default, a JkMount in the main httpd configuration is /not/ inherited by the VirtualHost sections, /unless/ you use the JkMountCopy instruction appropriately. In addition, there is the logic determining which VirtualHost configuration is really handling your request. The first defined VirtualHost in the Apache httpd configuration (from top to bottom) acts as the default VirtualHost. That means that for any request where httpd cannot determine to which VirtualHost it is addressed (because the hostname of the request does not match any ServerName of a VirtualHost), Apache httpd will use this default virtual host configuration to process the request. In your case, if you send a request to http://(ip address)/x, and none of your VirtualHost sections contains a serverName (ip address) matching exactly, then the request will be processed with the configuration of the default VirtualHost. Which is what is happening here. And the combination of all the above is why, when you put the JkMounts in the default VirtualHost configuration section, it works. But it is not really supposed to work that way. Your http request should be properly addressed to a specific VirtualHost - by name - and this VirtualHost configuration should be so that it contains the appropriate JkMount directives (or a JkMountCopy directive, to inherit the JkMounts from the main configuration). And I hope that you are not totally lost ater that. ;-) - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Setting initial memory for a Tomcat Windows Service
On Sep 18, 2012, at 10:11 AM, David kerber wrote: On 9/18/2012 10:03 AM, Patrick Flaherty wrote: Hello, Is this a bug or am I doing this wrong ? I'm not totally sure what you're asking about, but I have found that tomcat7w does not always reflect the current settings if you have made changes. IIRC, I usually need to restart it to get it to pick up changes. The other option is to look in the registry for the values; the changes will appear there by hitting Refresh. I'm am looking at the registry keys and they are not changing. If I use tomcatw.exe and make the change to max mem then I see the registry change to reflect the change I make in the interface. But I need to configure this via command-line ! Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the -Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - 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: Setting initial memory for a Tomcat Windows Service
On 9/18/2012 11:29 AM, Patrick Flaherty wrote: On Sep 18, 2012, at 10:11 AM, David kerber wrote: On 9/18/2012 10:03 AM, Patrick Flaherty wrote: Hello, Is this a bug or am I doing this wrong ? I'm not totally sure what you're asking about, but I have found that tomcat7w does not always reflect the current settings if you have made changes. IIRC, I usually need to restart it to get it to pick up changes. The other option is to look in the registry for the values; the changes will appear there by hitting Refresh. I'm am looking at the registry keys and they are not changing. If I use tomcatw.exe and make the change to max mem then I see the registry change to reflect the change I make in the interface. But I need to configure this via command-line ! I don't think you can start a service from the command line with different options from what are already stored in the registry. ISTM this would be a big security problem. However, with some utility programs, you can change service settings from the cmd line before starting it with a net start... command. Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the -Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - 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: Verifying mod_jk is installed
On Tue, Sep 18, 2012 at 3:56 PM, André Warnier a...@ice-sa.com wrote: John Rellis wrote: André, Thanks! OK, so I put JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus Into apache2.conf and no success. I did however put it in sites-available/default VirtualHost *:80 ServerAdmin webmaster@localhost JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus . And I can now hit host/jkmanager/ and I get a UI. Is this the expected behaviour??? Yes, but do not top-post. Read http://en.wikipedia.org/wiki/** Posting_style#Choosing_the_**proper_posting_stylehttp://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style In reality there are several factors at work here. We are getting into Apache VirtualHost logic, and the logic of inheritance of JkMount from the main Apache configuration to the virtual hosts. To get a fuller explanation, see the online documentation and the JkMountCopy directive. Briefly : - for Apache httpd : - generally, whatever lives outside a VirtualHost section belongs to the main configuration, and basically acts as a default value for any VirtualHost, /unless/ it is superseded by a similar directive inside a VirtualHost section. - for JkMount however : by default, a JkMount in the main httpd configuration is /not/ inherited by the VirtualHost sections, /unless/ you use the JkMountCopy instruction appropriately. In addition, there is the logic determining which VirtualHost configuration is really handling your request. The first defined VirtualHost in the Apache httpd configuration (from top to bottom) acts as the default VirtualHost. That means that for any request where httpd cannot determine to which VirtualHost it is addressed (because the hostname of the request does not match any ServerName of a VirtualHost), Apache httpd will use this default virtual host configuration to process the request. In your case, if you send a request to http://(ip address)/x, and none of your VirtualHost sections contains a serverName (ip address) matching exactly, then the request will be processed with the configuration of the default VirtualHost. Which is what is happening here. And the combination of all the above is why, when you put the JkMounts in the default VirtualHost configuration section, it works. But it is not really supposed to work that way. Your http request should be properly addressed to a specific VirtualHost - by name - and this VirtualHost configuration should be so that it contains the appropriate JkMount directives (or a JkMountCopy directive, to inherit the JkMounts from the main configuration). And I hope that you are not totally lost ater that. ;-) --**--**- To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.orgusers-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org André, Thanks very much for your help. I put : VirtualHost *:80 ServerAdmin webmaster@localhost JkMount /ClusterApp/ LoadBalancer JkMount /ClusterApp/* LoadBalancer JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus And it is now hitting my cluster after two days of agony s YEEES Phew! Your explanation is great, and with it, i put JkMountCopy in the virtual host and the url mappings in apache2.conf and it works! :) Beer! Thanks again. Regarding top posting, apologies, I am using gmail and I never noticed it was an issue on other lists but I of course respect the decision of each individual list! :) I'm not sure how to bottom post in gmail so I just put my reply after yours, hope its ok!
Re: Setting initial memory for a Tomcat Windows Service
On Sep 18, 2012, at 11:39 AM, David kerber wrote: On 9/18/2012 11:29 AM, Patrick Flaherty wrote: On Sep 18, 2012, at 10:11 AM, David kerber wrote: On 9/18/2012 10:03 AM, Patrick Flaherty wrote: Hello, Is this a bug or am I doing this wrong ? I'm not totally sure what you're asking about, but I have found that tomcat7w does not always reflect the current settings if you have made changes. IIRC, I usually need to restart it to get it to pick up changes. The other option is to look in the registry for the values; the changes will appear there by hitting Refresh. I'm am looking at the registry keys and they are not changing. If I use tomcatw.exe and make the change to max mem then I see the registry change to reflect the change I make in the interface. But I need to configure this via command-line ! I don't think you can start a service from the command line with different options from what are already stored in the registry. ISTM this would be a big security problem. However, with some utility programs, you can change service settings from the cmd line before starting it with a net start... command. If you read down this thread, I'm just trying to change the memory from the command line using the Tomcat tools and it does not work. Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the - Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/ max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - 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 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Setting initial memory for a Tomcat Windows Service
On 9/18/2012 11:52 AM, Patrick Flaherty wrote: On Sep 18, 2012, at 11:39 AM, David kerber wrote: On 9/18/2012 11:29 AM, Patrick Flaherty wrote: On Sep 18, 2012, at 10:11 AM, David kerber wrote: On 9/18/2012 10:03 AM, Patrick Flaherty wrote: Hello, Is this a bug or am I doing this wrong ? I'm not totally sure what you're asking about, but I have found that tomcat7w does not always reflect the current settings if you have made changes. IIRC, I usually need to restart it to get it to pick up changes. The other option is to look in the registry for the values; the changes will appear there by hitting Refresh. I'm am looking at the registry keys and they are not changing. If I use tomcatw.exe and make the change to max mem then I see the registry change to reflect the change I make in the interface. But I need to configure this via command-line ! I don't think you can start a service from the command line with different options from what are already stored in the registry. ISTM this would be a big security problem. However, with some utility programs, you can change service settings from the cmd line before starting it with a net start... command. If you read down this thread, I'm just trying to change the memory from the command line using the Tomcat tools and it does not work. I see that, but you're doing it for a service, and apparently trying to do it from a command line. I just don't think that's possible with the current tools. Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the -Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Verifying mod_jk is installed
On 9/18/2012 11:46 AM, John Rellis wrote: On Tue, Sep 18, 2012 at 3:56 PM, André Warniera...@ice-sa.com wrote: John Rellis wrote: André, Thanks! OK, so I put JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus Into apache2.conf and no success. I did however put it in sites-available/default VirtualHost *:80 ServerAdmin webmaster@localhost JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus . And I can now hit host/jkmanager/ and I get a UI. Is this the expected behaviour??? Yes, but do not top-post. Read http://en.wikipedia.org/wiki/** Posting_style#Choosing_the_**proper_posting_stylehttp://en.wikipedia.org/wiki/Posting_style#Choosing_the_proper_posting_style In reality there are several factors at work here. We are getting into Apache VirtualHost logic, and the logic of inheritance of JkMount from the main Apache configuration to the virtual hosts. To get a fuller explanation, see the online documentation and the JkMountCopy directive. Briefly : - for Apache httpd : - generally, whatever lives outside aVirtualHost section belongs to the main configuration, and basically acts as a default value for any VirtualHost, /unless/ it is superseded by a similar directive inside a VirtualHost section. - for JkMount however : by default, a JkMount in the main httpd configuration is /not/ inherited by the VirtualHost sections, /unless/ you use the JkMountCopy instruction appropriately. In addition, there is the logic determining which VirtualHost configuration is really handling your request. The first defined VirtualHost in the Apache httpd configuration (from top to bottom) acts as the default VirtualHost. That means that for any request where httpd cannot determine to which VirtualHost it is addressed (because the hostname of the request does not match any ServerName of a VirtualHost), Apache httpd will use this default virtual host configuration to process the request. In your case, if you send a request to http://(ip address)/x, and none of your VirtualHost sections contains a serverName (ip address) matching exactly, then the request will be processed with the configuration of the default VirtualHost. Which is what is happening here. And the combination of all the above is why, when you put the JkMounts in the default VirtualHost configuration section, it works. But it is not really supposed to work that way. Your http request should be properly addressed to a specific VirtualHost - by name - and this VirtualHost configuration should be so that it contains the appropriate JkMount directives (or a JkMountCopy directive, to inherit the JkMounts from the main configuration). And I hope that you are not totally lost ater that. ;-) --**--**- To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.orgusers-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org André, Thanks very much for your help. I put : VirtualHost *:80 ServerAdmin webmaster@localhost JkMount /ClusterApp/ LoadBalancer JkMount /ClusterApp/* LoadBalancer JkMount /jkmanager/ jkstatus JkMount /jkmanager/* jkstatus And it is now hitting my cluster after two days of agony s YEEES Phew! Your explanation is great, and with it, i put JkMountCopy in the virtual host and the url mappings in apache2.conf and it works! :) Beer! Thanks again. Regarding top posting, apologies, I am using gmail and I never noticed it was an issue on other lists but I of course respect the decision of each individual list! :) I'm not sure how to bottom post in gmail so I just put my reply after yours, hope its ok! That's exactly what bottom-posting is, so you did it just right. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing CoyoteRequest attributes in a Servlet
Am 18.09.2012 15:47, schrieb André Warnier: André Warnier wrote: Philip Kahle wrote: Hi all, I am trying to set up a Java Web Application using Servlets and JSPs in Tomcat 7. User authentication should be done on a central Shibboleth Identity Provider. I have already configured Apache including mod_ssl, mod_proxy_ajp and the shib2 module following these instructions: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall The redirect to the central login page works and, after entering my credentials, the session is correctly created by the identity provider and I am forwarded to my webapp. At this point I should have different attributes in my session, such as the user's email address, name and so on. But these are stored in the coyoteRequest attributes, which I can observe while debugging in Eclipse. As the coyoteRequest is a protected field of org.apache.catalina.connector.Request which again is a field of the RequestFacade I can not get any of these values. What I get is ONE of the attributes in the REMOTE_USER field (compare 2. in the instructions above). By setting ShibUseHeaders On in apache I get all of the attributes in the request headers, but this is not recommended for security reasons. Why ? That is a generic recommendation, but it does not apply if : - all the requests to Tomcat go through httpd first - the link between httpd and Tomcat is secure (not accessible by anyone) If e.g. httpd and Tomcat live on the same host, and you configure the Tomcat AJP Connector to only accept requests from localhost, then it would be ok to pass private information through headers. Simplify your life if possible. Is there any way to access the coyoteRequest in a servlet or at least configure tomcat to transfer more attributes to the servletRequest? At least by using mod_jk instead of mod_proxy_ajp, you can transmit a bunch of things from Apache httpd to Tomcat (including Apache httpd's variables e.g.). I do not know mod_proxy_ajp well enough to confirm that this is possible with it also, but I would imagine so. Addendum : sorry, that was not a direct answer to your question. The direct answer is that HttpServletRequest (and ServletRequest) already provide a bunch of methods to access request attributes. See http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html. These are part of the specification, so you do not need to configure anything at the Tomcat level for that. As long as the request already contains attributes of course. Still talking about mod_jk, basically anything you set in Apache httpd using SetEnv for example, gets passed to Tomcat as a request attribute, through the AJP protocol. Someone else would need to confirm if this is also the case using mod_proxy_ajp. Thanks for your answer! I already studied the methods exposed by HttpServletRequest (and ServletRequest from within a filter) but neither these objects nor the attached session objects directly include these attributes. Only the (invisible) coyoteRequest object inside does so. I will further investigate the mod_env approach though. As Tomcat and httpd indeed remain on the same host and both the exceptions you named apply, I will just stick to the header approach for now. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Setting initial memory for a Tomcat Windows Service
On Sep 18, 2012, at 12:08 PM, David kerber wrote: On 9/18/2012 11:52 AM, Patrick Flaherty wrote: On Sep 18, 2012, at 11:39 AM, David kerber wrote: On 9/18/2012 11:29 AM, Patrick Flaherty wrote: On Sep 18, 2012, at 10:11 AM, David kerber wrote: On 9/18/2012 10:03 AM, Patrick Flaherty wrote: Hello, Is this a bug or am I doing this wrong ? I'm not totally sure what you're asking about, but I have found that tomcat7w does not always reflect the current settings if you have made changes. IIRC, I usually need to restart it to get it to pick up changes. The other option is to look in the registry for the values; the changes will appear there by hitting Refresh. I'm am looking at the registry keys and they are not changing. If I use tomcatw.exe and make the change to max mem then I see the registry change to reflect the change I make in the interface. But I need to configure this via command-line ! I don't think you can start a service from the command line with different options from what are already stored in the registry. ISTM this would be a big security problem. However, with some utility programs, you can change service settings from the cmd line before starting it with a net start... command. If you read down this thread, I'm just trying to change the memory from the command line using the Tomcat tools and it does not work. I see that, but you're doing it for a service, and apparently trying to do it from a command line. I just don't think that's possible with the current tools. I thought it was according to : http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html If it doesn't work, can anyone confirm that you cannot do this ? Thanks again, Pat Begin forwarded message: From: Patrick Flaherty pflah...@rampageinc.com Date: September 13, 2012 6:19:34 PM EDT To: Tomcat Users List users@tomcat.apache.org Subject: Re: Setting initial memory for a Tomcat Windows Service On Sep 13, 2012, at 5:37 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Patrick, On 9/13/12 11:41 AM, Patrick Flaherty wrote: I'm trying to change the max memory (java heap -Xmx) using Tomcat's //US// switch. I type it according to the Windows service how-to. We would like to script this into our Tomcat deployment script which right now simply installs the service using service install. With the service already installed I tried the following command line options: tomcat7.exe //US//tomcat7 --JvmMs=512 --JvmMx=1024 Hmm. tomcat7.exe //US//tomcat7 --JvmOptions -Xms512m -Xmx1024m Although I get no error, I know its not taking because after starting tomcat.exe I look in the Windows process manager and it shows its only using 50MB of ram instead of 512MB of ram (the -Xms value) Silly question: how do you start Tomcat? (tomcat.exe does not exist). It's a Windows service. While testing this I'm just using the Services Control Manager to stop and start the service. Any help would be greatly appreciated. You didn't follow the instructions for --JvmOptions: http://tomcat.eu.apache.org/tomcat-7.0-doc/windows-service-howto.html I did follow the instructions. There are options for *just* min/max heap size (JvmMS JvmMx) You want: - --JvmOptions -Xms=512#-Xmx=1024 No, this did not work. After you do either of your commands, what do you see if you do: C:\ tomcat7w.exe //ES//tomcat7 I'm just launching tomcat7w.exe in Windows and checking the Java tab to see if it took. That should show you the current configuration (and let you edit everything if you want). Remember that you are only editing the service definition: you will have to launch Tomcat via the service if you want that configuration to take effect. Also, if Tomcat is running when you change the configuration, you'll have to restart the service to notice any change. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBSUhAACgkQ9CaO5/ Lv0PBzPgCePlVSr8zUutRBQleANxuTXNBw WFQAoK+cTorm2zEbfAdgnfgMzNz6ouWi =XEix -END PGP SIGNATURE- - 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: Accessing CoyoteRequest attributes in a Servlet
On 18/09/2012 17:13, Philip Kahle wrote: Am 18.09.2012 15:47, schrieb André Warnier: André Warnier wrote: Philip Kahle wrote: Hi all, I am trying to set up a Java Web Application using Servlets and JSPs in Tomcat 7. User authentication should be done on a central Shibboleth Identity Provider. I have already configured Apache including mod_ssl, mod_proxy_ajp and the shib2 module following these instructions: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall The redirect to the central login page works and, after entering my credentials, the session is correctly created by the identity provider and I am forwarded to my webapp. At this point I should have different attributes in my session, such as the user's email address, name and so on. But these are stored in the coyoteRequest attributes, which I can observe while debugging in Eclipse. As the coyoteRequest is a protected field of org.apache.catalina.connector.Request which again is a field of the RequestFacade I can not get any of these values. What I get is ONE of the attributes in the REMOTE_USER field (compare 2. in the instructions above). By setting ShibUseHeaders On in apache I get all of the attributes in the request headers, but this is not recommended for security reasons. Why ? That is a generic recommendation, but it does not apply if : - all the requests to Tomcat go through httpd first - the link between httpd and Tomcat is secure (not accessible by anyone) If e.g. httpd and Tomcat live on the same host, and you configure the Tomcat AJP Connector to only accept requests from localhost, then it would be ok to pass private information through headers. Simplify your life if possible. Is there any way to access the coyoteRequest in a servlet or at least configure tomcat to transfer more attributes to the servletRequest? At least by using mod_jk instead of mod_proxy_ajp, you can transmit a bunch of things from Apache httpd to Tomcat (including Apache httpd's variables e.g.). I do not know mod_proxy_ajp well enough to confirm that this is possible with it also, but I would imagine so. Addendum : sorry, that was not a direct answer to your question. The direct answer is that HttpServletRequest (and ServletRequest) already provide a bunch of methods to access request attributes. See http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html. These are part of the specification, so you do not need to configure anything at the Tomcat level for that. As long as the request already contains attributes of course. Still talking about mod_jk, basically anything you set in Apache httpd using SetEnv for example, gets passed to Tomcat as a request attribute, through the AJP protocol. Someone else would need to confirm if this is also the case using mod_proxy_ajp. Thanks for your answer! I already studied the methods exposed by HttpServletRequest (and ServletRequest from within a filter) but neither these objects nor the attached session objects directly include these attributes. Only the (invisible) coyoteRequest object inside does so. I will further investigate the mod_env approach though. As Tomcat and httpd indeed remain on the same host and both the exceptions you named apply, I will just stick to the header approach for now. A Valve will probably get you what you need but it is Tomcat specific. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Latest Tomcat release question...
Hi All, Has anyone tried the newest Tomcat release and noticed any performance differences? My startup is 20 seconds but it is not often I restart my Tomcat server due to it being so stable but I am interested in any performance gain when it is executing and a request is going through the tomcat code before it reaches my code or after and the response is going back through the Tomcat layers. Regards, -Tony
Re: mod_jk vs. mod_proxy
Hi Dan, On Tue, Sep 18, 2012 at 10:10 AM, Daniel Mikusa dmik...@vmware.com wrote: I've not heard this. Where did you read this? My apologies! I read wrong. It must have been about mod_jk2. I found this article helpful. http://www.tomcatexpert.com/blog/2010/06/16/deciding-between-modjk-modproxyhttp-and-modproxyajp Thank you for pointing out that reference. This is a really nice article indeed. Sorry about the misunderstanding. -Shanti
Re: Clustering Question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John, On 9/17/12 5:20 PM, John Rellis wrote: Thanks Chris. My replies will be a little sporadic as I am cooking a 10 pm dinner :) From what I was reading I thought I could hit some sort of manager there but it was never able to, when I hit http://balancer/jkmanager I get nothing just a 404. This is in my apache2.conf: (i removed them from jk.conf as i thought my security was messed up) JkMount /jkmanager/* jkstatus /jkmanager/* != /jkmanager so it's no surprise that you got a 404. Try: JkMount /jkmanager jkstatus uri_worker_map_add::jk_uri_worker_map.c (720): wildchar rule '/jkmanager/*=jkstatus' source 'JkMount' was added NEXT (1) map #0: uri=/jkmanager/* worker=jkstatus context=/jkmanager/* source=JkMount type=Wildchar len=12 Do you have all your JkMount directives inside VirtualHosts? If you have them outside, they won't take effect (sounds odd, but makes a little sense if you think about it). *I should also mention, there's an error while starting :* ubuntu@balancer:/etc/apache2/mods-enabled$ sudo service apache2 restart * Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName That's not your problem, here, but you might want to fix that. /etc/hostname just contains balancer /etc/hosts (ip's changed for tomcatone and tomcatone): 127.0.0.1 localhost 123.123.123.123 tomcattwo 123.123.123.123 tomcatone 127.0.1.1 balancer 127.0.1.1 is unlikely to be what you meant, here. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBYvLEACgkQ9CaO5/Lv0PB6wQCfQEuPyKUo5VZQ8BZY96nngY0J m4MAoKIBFwL89Eiv/vOkEcf8gerCaF7+ =t3JI -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat7 + WebSocket + mod_jk
My WebSocket connection is closing briefly after opening because I have Apache httpd on port 80 with mod_jk running in front of my Tomcat instance on port 8080. When I connect directly on 8080 to Tomcat the WebSocket app works. What is the recommended configuration to allow a WebSocket app to run through Apache to Tomcat and/or how do you adjust mod_jk to allow the WebSocket connection? I basically want to do what most do... send Java traffic to the web app container and serve static content via Apache - but now there is a 3rd element, a WebSocket connection - so how do you configure this through Apache? Thanks! -- View this message in context: http://tomcat.10.n6.nabble.com/Tomcat7-WebSocket-mod-jk-tp4986848.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: Tomcat7 + WebSocket + mod_jk
On 18/09/2012 20:07, sfwicket wrote: My WebSocket connection is closing briefly after opening because I have Apache httpd on port 80 with mod_jk running in front of my Tomcat instance on port 8080. When I connect directly on 8080 to Tomcat the WebSocket app works. What is the recommended configuration to allow a WebSocket app to run through Apache to Tomcat and/or how do you adjust mod_jk to allow the WebSocket connection? I basically want to do what most do... send Java traffic to the web app container and serve static content via Apache - but now there is a 3rd element, a WebSocket connection - so how do you configure this through Apache? Sorry, you can't. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Latest Tomcat release question...
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tony, On 9/18/12 1:58 PM, Tony Anecito wrote: Has anyone tried the newest Tomcat release and noticed any performance differences? My startup is 20 seconds but it is not often I restart my Tomcat server due to it being so stable but I am interested in any performance gain when it is executing and a request is going through the tomcat code before it reaches my code or after and the response is going back through the Tomcat layers. As for startup, I just restarted my local dev instance (running 1 webapp with a reasonable amount of db-loading in a ServletContextListener): Sep 18, 2012 3:04:29 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/apache-tomcat-7.0.30/lib Sep 18, 2012 3:04:34 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler [http-nio-127.0.0.1-8217] Sep 18, 2012 3:04:34 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 4115 ms So it's 4 seconds for me. My system config: Mac OS X 10.8.1 Oracle JDK 1.7.0_07 Tomcat 7.0.30 Intel Core i7 2.5GHz 2x4 (8 logical cores) 8GiB RAM There are 3 things I can think of that could make your Tomcat start slowly: 1. Insufficient entropy in /dev/random 2. DNS timeouts 3. Your webapp does a lot of stuff on startup - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBYyyUACgkQ9CaO5/Lv0PAb8ACffNZc584OIXwKQZkaUXOT6MAj bewAnRBCcBqgm/L0n86PouPUC4WeFc41 =HGEj -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Latest Tomcat release question...
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 18/09/2012 20:27, Christopher Schultz wrote: There are 3 things I can think of that could make your Tomcat start slowly: 1. Insufficient entropy in /dev/random 2. DNS timeouts 3. Your webapp does a lot of stuff on startup One of which is likely to be JAR scanning thanks to the default mandatory scanning required by Servlet 3.0. There are ways stop this completely if this is the issue. Mark -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQIcBAEBAgAGBQJQWMu6AAoJEBDAHFovYFnnApgP/RsLfy6mZ9EzPbINTmqs4AQ+ 5eVMhooWG6IBztV0ePECRHuYXc4ERGGIW2f6PeZIp9Hv7FpredVHYoCJe3isGEap 5dbjTdwW8dL9f2vxPJu/NU0V0osnLsm5glyOa8gf4/yl6zvreYoSe6lrGiRJCfAX qHAorWB0+Nd8amcDlf+Nr7Ky/XwR75Tn24vf9AqJyWnFX0W83JchdyQPaOlsKpy+ viVCghlbF0hG9qD/IxyoGrfCGJonpVQ+whHwcLiA3u0FxNgSsm0eTKjDaG/eidXc f88/btU9fANtPH6X31DCISSy9sqpNXS1GbSyU3Cl/GE98us2JfWJn3piHjbW6FDI IkXETQSSh2iQNtq4QkJ5JbWhT3uL/ycANr8aU5zePJZxymHQhYk0e7QZgBFXS3vi zLywFj/JHeLmVisRVG24f3wWHRwtJvVHHZWIWgziMcMK46AI+uPGPRFChtXXpumS 5hRUAfERmeMxovDTnBCRvmMbDMrZYIz4n6nUw3CMNegk0ExxjlQYOB/iUww7kvtU OSd2TaEwcY9oUKsYpWScC5tvyONR66f2PwTwejjjvu9qjvLw82L7n6ealruvxb5r 4H1HdueKUTqkH+hNHqPMuJIFKltL0Yg931/jAjv/LcqNi377zPpnlDQAsagIL4yV Az0UdhjBM8/hobQWAh7d =v7rB -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: mod_jk vs. mod_proxy
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shanti, On 9/18/12 10:04 AM, Shanti Suresh wrote: All, I wanted your opinion on this topic. I was heavily into using mod_jk a few years back. But I have since started using mod_proxy for the following reasons: (1) mod_proxy is easier to configure (2) I remember reading that mod_jk is deprecated (3) Logging for mod_proxy appears inline with Apache traffic log entries and is easier to debug. I am able to get detailed logging from mod_proxy by adjusting Apache's LogLevel to debug. (4) Could there be any other reasons that I might be missing? I do also like the separate logging that mod_jk gives though. I notice that mod_jk is still being used. I just wanted to know your opinion. I use mod_jk because it gives me greater freedom of configuration and tends to get updated more often. It is definitely harder to configure, though, since a separate configuration file is usually used. As I don't use SSL between httpd and Tomcat this isn't much of an issue for me, but connecting httpd-Tomcat via SSL is trivial with mod_proxy_http (and not with mod_jk) while forwarding SSL info from httpd - Tomcat (while still using an unencrypted channel) is trivial in mod_jk but more difficult with mod_proxy_http. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBYzKUACgkQ9CaO5/Lv0PBx0QCglrPz2MZLBeqeKp8LivAvLMqj CosAnirMA2WNiN03BGvO6FthJ07LfWNK =jDfk -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat7 + WebSocket + mod_jk
Assuming you mean you can't use mod_jk with a WebSocket app... More generally speaking, what is the Best Practice for configuring a production environment stack utilizing a Tomcat Web App which uses WebSockets? Load Balancer, Apache, Tomcat - and specifically - the proxying of traffic on port 80. Should Tomcat just be run on port 80? If not, how is the proxying achieved to allow WebSocket traffic alongside of static Apache traffic and normal Java traffic on the same port? Thanks! -- View this message in context: http://tomcat.10.n6.nabble.com/Tomcat7-WebSocket-mod-jk-tp4986848p4986853.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: Tomcat7 + WebSocket + mod_jk
Unless you are going to need more than one web container i really don't see the reason to use Apache HTTPD as a reverse proxy, provided that you have installed and are using the APR connector. As for the anwser to the question how do you achieve proxying of websocket communication i think there is no standard way yet. Keep in mind users are probably going to run into problems with Websockets if they are behind a firewall, web proxy etc. Unfortuantely websockets are great but are not mature yet. On Tue, Sep 18, 2012 at 10:47 PM, sfwicket li...@bgb.net wrote: Assuming you mean you can't use mod_jk with a WebSocket app... More generally speaking, what is the Best Practice for configuring a production environment stack utilizing a Tomcat Web App which uses WebSockets? Load Balancer, Apache, Tomcat - and specifically - the proxying of traffic on port 80. Should Tomcat just be run on port 80? If not, how is the proxying achieved to allow WebSocket traffic alongside of static Apache traffic and normal Java traffic on the same port? Thanks! -- View this message in context: http://tomcat.10.n6.nabble.com/Tomcat7-WebSocket-mod-jk-tp4986848p4986853.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: Tomcat7 + WebSocket + mod_jk
So run a single instance of Tomcat on port 80 with no HAProxy or Apache and hit it directly in production env sounds like the only answer? And subsequently all static content deployed with that web app will be served by Tomcat? With no load distribution between instances using an LB? Looking for a better answer than deploying something to prod as if it was on my desktop. -- View this message in context: http://tomcat.10.n6.nabble.com/Tomcat7-WebSocket-mod-jk-tp4986848p4986859.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: Tomcat7 + WebSocket + mod_jk
On 18/09/2012 21:07, sfwicket wrote: So run a single instance of Tomcat on port 80 with no HAProxy or Apache and hit it directly in production env sounds like the only answer? And subsequently all static content deployed with that web app will be served by Tomcat? With no load distribution between instances using an LB? Looking for a better answer than deploying something to prod as if it was on my desktop. Put WebSocket on a separate port? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat7 + WebSocket + mod_jk
Tomcat (with the APR connector) serves static content just fine. Unless you need load balancing tomcat will do just fine. On Tue, Sep 18, 2012 at 11:07 PM, sfwicket li...@bgb.net wrote: So run a single instance of Tomcat on port 80 with no HAProxy or Apache and hit it directly in production env sounds like the only answer? And subsequently all static content deployed with that web app will be served by Tomcat? With no load distribution between instances using an LB? Looking for a better answer than deploying something to prod as if it was on my desktop. -- View this message in context: http://tomcat.10.n6.nabble.com/Tomcat7-WebSocket-mod-jk-tp4986848p4986859.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: Tomcat7 + WebSocket + mod_jk
That is of course a solution, but then prepare to have problems with firewalls, proxies etc. On Tue, Sep 18, 2012 at 11:09 PM, Mark Thomas ma...@apache.org wrote: On 18/09/2012 21:07, sfwicket wrote: So run a single instance of Tomcat on port 80 with no HAProxy or Apache and hit it directly in production env sounds like the only answer? And subsequently all static content deployed with that web app will be served by Tomcat? With no load distribution between instances using an LB? Looking for a better answer than deploying something to prod as if it was on my desktop. Put WebSocket on a separate port? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat7 + WebSocket + mod_jk
On 18/09/2012 21:13, Nikos Viorres wrote: That is of course a solution, but then prepare to have problems with firewalls, proxies etc. Separate hostname then, still on port 80. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat7 + WebSocket + mod_jk
If i am not mistaken, this is considered XSS and is not allowed, although a different port is. I was looking at websockets a couple of months ago for an enterprise app and decided against using them for these problems, i went with Long polling and async requests instead which are compabtible with almost all browsers and dont have problems with proxies. N On Tue, Sep 18, 2012 at 11:14 PM, Mark Thomas ma...@apache.org wrote: On 18/09/2012 21:13, Nikos Viorres wrote: That is of course a solution, but then prepare to have problems with firewalls, proxies etc. Separate hostname then, still on port 80. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat7 + WebSocket + mod_jk
On 18/09/2012 21:27, Nikos Viorres wrote: If i am not mistaken, this is considered XSS and is not allowed, Yes, you are mistaken. The WebSocket spec specifically considers this scenario and there are security controls in place if you wish to use them. Mark although a different port is. I was looking at websockets a couple of months ago for an enterprise app and decided against using them for these problems, i went with Long polling and async requests instead which are compabtible with almost all browsers and dont have problems with proxies. N On Tue, Sep 18, 2012 at 11:14 PM, Mark Thomas ma...@apache.org wrote: On 18/09/2012 21:13, Nikos Viorres wrote: That is of course a solution, but then prepare to have problems with firewalls, proxies etc. Separate hostname then, still on port 80. 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: Tomcat7 + WebSocket + mod_jk
Thanks, i ll look into that On Tue, Sep 18, 2012 at 11:30 PM, Mark Thomas ma...@apache.org wrote: On 18/09/2012 21:27, Nikos Viorres wrote: If i am not mistaken, this is considered XSS and is not allowed, Yes, you are mistaken. The WebSocket spec specifically considers this scenario and there are security controls in place if you wish to use them. Mark although a different port is. I was looking at websockets a couple of months ago for an enterprise app and decided against using them for these problems, i went with Long polling and async requests instead which are compabtible with almost all browsers and dont have problems with proxies. N On Tue, Sep 18, 2012 at 11:14 PM, Mark Thomas ma...@apache.org wrote: On 18/09/2012 21:13, Nikos Viorres wrote: That is of course a solution, but then prepare to have problems with firewalls, proxies etc. Separate hostname then, still on port 80. 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: Latest Tomcat release question...
Thanks Christopher, I have not started using 7.0.30 yet and I do have connection pools setup on startup I believe 5 or 6 of them which may account for the 20 seconds. What I was interested in is after startup using 7.0.30 has anyone noticed a performance improvement for their apps? Thanks, -Tony --- On Tue, 9/18/12, Christopher Schultz ch...@christopherschultz.net wrote: From: Christopher Schultz ch...@christopherschultz.net Subject: Re: Latest Tomcat release question... To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, September 18, 2012, 1:27 PM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tony, On 9/18/12 1:58 PM, Tony Anecito wrote: Has anyone tried the newest Tomcat release and noticed any performance differences? My startup is 20 seconds but it is not often I restart my Tomcat server due to it being so stable but I am interested in any performance gain when it is executing and a request is going through the tomcat code before it reaches my code or after and the response is going back through the Tomcat layers. As for startup, I just restarted my local dev instance (running 1 webapp with a reasonable amount of db-loading in a ServletContextListener): Sep 18, 2012 3:04:29 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/apache-tomcat-7.0.30/lib Sep 18, 2012 3:04:34 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler [http-nio-127.0.0.1-8217] Sep 18, 2012 3:04:34 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 4115 ms So it's 4 seconds for me. My system config: Mac OS X 10.8.1 Oracle JDK 1.7.0_07 Tomcat 7.0.30 Intel Core i7 2.5GHz 2x4 (8 logical cores) 8GiB RAM There are 3 things I can think of that could make your Tomcat start slowly: 1. Insufficient entropy in /dev/random 2. DNS timeouts 3. Your webapp does a lot of stuff on startup - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBYyyUACgkQ9CaO5/Lv0PAb8ACffNZc584OIXwKQZkaUXOT6MAj bewAnRBCcBqgm/L0n86PouPUC4WeFc41 =HGEj -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat7 + WebSocket + mod_jk
-Original Message- From: sfwicket [mailto:li...@bgb.net] Sent: Tuesday, September 18, 2012 3:08 PM To: users@tomcat.apache.org Subject: Re: Tomcat7 + WebSocket + mod_jk So run a single instance of Tomcat on port 80 with no HAProxy or Apache and hit it directly in production env sounds like the only answer? And subsequently all static content deployed with that web app will be served by Tomcat? With no load distribution between instances using an LB? Looking for a better answer than deploying something to prod as if it was on my desktop. Google seems to think that HaProxy _may_ work: http://jfarcand.wordpress.com/2011/10/06/configuring-haproxy-for-websocket/ http://stackoverflow.com/questions/10896175/load-balance-websocket-connections-to-tornado-app-using-haproxy Also, it looks like something like BigIp (if that is an option for you ) will support websockets: https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/38/aft/1180466/showtab/groupforums/Default.aspx They have trial Virtual Edition. I realized this isn't an Apache/OpenSource solution. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Latest Tomcat release question...
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tony, On 9/18/12 4:55 PM, Tony Anecito wrote: Thanks Christopher, I have not started using 7.0.30 yet and I do have connection pools setup on startup I believe 5 or 6 of them which may account for the 20 seconds. What I was interested in is after startup using 7.0.30 has anyone noticed a performance improvement for their apps? No, I haven't, but there was a fairly gaping performance/memory problem fixed in 7.0.30 and I would highly recommend the upgrade. I didn't notice because I have very little in the way of support libraries, etc. in my webapps. Basically, I don't use Spring, so I don't have to wait 20 minutes to deploy my webapp ;) - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBY564ACgkQ9CaO5/Lv0PDDWQCdEclcddNFo+zRP3fu3oekUhPe eQ4An0g5OX5M49Uo4lwMZjJoz5v88PKF =psrC -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Clustering Question
On Sep 18, 2012 7:26 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John, On 9/17/12 5:20 PM, John Rellis wrote: Thanks Chris. My replies will be a little sporadic as I am cooking a 10 pm dinner :) From what I was reading I thought I could hit some sort of manager there but it was never able to, when I hit http://balancer/jkmanager I get nothing just a 404. This is in my apache2.conf: (i removed them from jk.conf as i thought my security was messed up) JkMount /jkmanager/* jkstatus /jkmanager/* != /jkmanager so it's no surprise that you got a 404. Try: JkMount /jkmanager jkstatus uri_worker_map_add::jk_uri_worker_map.c (720): wildchar rule '/jkmanager/*=jkstatus' source 'JkMount' was added NEXT (1) map #0: uri=/jkmanager/* worker=jkstatus context=/jkmanager/* source=JkMount type=Wildchar len=12 Do you have all your JkMount directives inside VirtualHosts? If you have them outside, they won't take effect (sounds odd, but makes a little sense if you think about it). *I should also mention, there's an error while starting :* ubuntu@balancer:/etc/apache2/mods-enabled$ sudo service apache2 restart * Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName That's not your problem, here, but you might want to fix that. /etc/hostname just contains balancer /etc/hosts (ip's changed for tomcatone and tomcatone): 127.0.0.1 localhost 123.123.123.123 tomcattwo 123.123.123.123 tomcatone 127.0.1.1 balancer 127.0.1.1 is unlikely to be what you meant, here. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBYvLEACgkQ9CaO5/Lv0PB6wQCfQEuPyKUo5VZQ8BZY96nngY0J m4MAoKIBFwL89Eiv/vOkEcf8gerCaF7+ =t3JI -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Thanks Chris! Yeah it was the fact they weren't in virtual hosts that did it. Thanks for your help! Learning lots!
WebSocketServlet BASIC auth
Hello everybody, I'm testing a web application to use WebSocket with Tomcat 7.0.30. I would like my WebSocket connection to be protected and accessible only from authenticated user. In particular I would like to use the BASIC authentication. From what I understand I thought that by adding the security-constraint to the web.xml would be enough. So basically I have added this to the web.xml file: security-constraint web-resource-collection web-resource-nameGalaxy/web-resource-name url-pattern/*/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint role-nameadmin/role-name role-nameuser/role-name /auth-constraint /security-constraint login-config auth-methodBASIC/auth-method realm-nametestDS/realm-name /login-config security-role role-nameadmin/role-name /security-role security-role role-nameuser/role-name /security-role unfortunately that doesn't work, and without any problem I can connect to the websocket channel without any authentication. What do I need to do in order to restrict the access to the application? Thanks in advance
Re: WebSocketServlet BASIC auth
On 18/09/2012 23:04, Gismor3 wrote: What do I need to do in order to restrict the access to the application? Thanks in advance The WebSocket protocol does not include any concept of an authentication challenge. I tested this recently and the browsers drop the connection if they get a 401 response. To get this working with Tomcat, the following *should* work but is untested. 1. Create an HTTP session. 2. Authenticate the user 3. Start the web socket connection. Provided the user/session is already authenticated, you should be able to protect the WebSocket endpoints using normal Servlet security in web.xml. HTH, Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing CoyoteRequest attributes in a Servlet
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 9/18/12 9:47 AM, André Warnier wrote: Still talking about mod_jk, basically anything you set in Apache httpd using SetEnv for example, gets passed to Tomcat as a request attribute, through the AJP protocol. You need to use JkEnvVar if it's something non-standard (which I suspect Phillip's variables are). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBY/VcACgkQ9CaO5/Lv0PBvAQCfZY525WGXNiuIwhn3YarwkMPL TpoAoMFv1UkSOoOUkSiQwHH8PSoJ+mCN =4RDL -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Latest Tomcat release question...
Hi Christopher, Thanks for the heads up about the memory issue. I looked over the release notes before I posted here and did not remember reading that. I do not use spring either and glad for that but I do use JAX-WS and am working on swithing to JAX-RS and there are quite a few libraries for JAX-RS. This weekend I will look at using 7.0.30. Best Regards, -Tony --- On Tue, 9/18/12, Christopher Schultz ch...@christopherschultz.net wrote: From: Christopher Schultz ch...@christopherschultz.net Subject: Re: Latest Tomcat release question... To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, September 18, 2012, 3:29 PM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tony, On 9/18/12 4:55 PM, Tony Anecito wrote: Thanks Christopher, I have not started using 7.0.30 yet and I do have connection pools setup on startup I believe 5 or 6 of them which may account for the 20 seconds. What I was interested in is after startup using 7.0.30 has anyone noticed a performance improvement for their apps? No, I haven't, but there was a fairly gaping performance/memory problem fixed in 7.0.30 and I would highly recommend the upgrade. I didn't notice because I have very little in the way of support libraries, etc. in my webapps. Basically, I don't use Spring, so I don't have to wait 20 minutes to deploy my webapp ;) - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBY564ACgkQ9CaO5/Lv0PDDWQCdEclcddNFo+zRP3fu3oekUhPe eQ4An0g5OX5M49Uo4lwMZjJoz5v88PKF =psrC -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org