Re: Query related to detection of the Source IP Address in Load-balancing mode
On 23/11/2011 06:37, Faseela K wrote: Hi, I have applications running on two tomcat servers which are in load balancing mode. OK so far. If I try to access the application from the first server,and if the request is forwarded to the second server, the request.getRemoteAddr() on the second server still returns 127.0.0.1(instead of first server IP). So server #1 connects to the load balancer? On which server is the load balancer? If the client is outside the two loadbancing servers, I am getting the proper client IP address. Sounds like the application is working properly then. I am using tomcat 5.5.31 and mod_jk module for load balancing,and my platform is solaris 10. Is there a way to get the actual client IP,rather than localhost,if the client is on the same box as the tomcat server,and if the request is forwarded to the second load balancing server? If the client is on the same physical server as the Tomcat, then the correct IP address *is* 127.0.0.1. Your networking stack may well identify that it's a local operation bypass the time-consuming roundtrip through the network device, just doing a shorter in-memory operation via the loopback address. p Thanks, Faseela -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Single war file - multiple hosts - can't get log4j to log to different files
On 23/11/2011 13:06, chris derham wrote: I just wanted to see everything in a single place - from what I have read this can't be done Correct. It could be done, but the apps would need to look outside of their local host. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Single war file - multiple hosts - can't get log4j to log to different files
On 22/11/2011 22:35, Christopher Schultz wrote: Chris, On 11/22/11 2:28 PM, chris derham wrote: Java running on windows 2008 r2 against tomcat 7.0.19 java version 1.6.0_24 Thanks! I have a single war file, and would like to host multiple demo sites of our app. So ideally users access demo1.company.com and demo2.company.com. Completely isolated, but all running the same war. Please correct me where ever my logic is wrong, but I figured that I would 1) have a tomcat instance, containing config directory. This would have catalina/demo1.company.com/ROOT.xml containing pertinent jndi config. Sounds good. 2) in server.xml add this Host name=demo1.company.com appBase=webapps\demos unpackWARs=false autoDeploy=false Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=demo_access_log. suffix=.log pattern=%h %l %u %t quot;%rquot; %s %b resolveHosts=false/ /Host Well, that will give you an access log for the whole host. If that's what you want, that's what you got. If you want the webapps to have separate access logs, you'll have to configure the Valve in ROOT.xml (and whatever other webapps you deploy). Maybe something like ROOT-access as the prefix value. When I start the app, it works and the app works. However all context's apps log to the same log file. What I want to know how to make the different contexts under different hosts log to different file. Our log4j file contains appender name=FILE class=org.apache.log4j.rolling.RollingFileAppender param name=Threshold value=INFO / param name=File value=${catalina.base}/logs/demo.log / So, this is a different issue. Above, you had an access log, which logs the hosts and URLs that they request, etc. It appears that log4j is an application log, like for INFO and DEBUG and stuff like that, right? Well, the obvious solution is to change the value of the File parameter in your log4j configuration. Try using something like ROOT-demo.log and a different value in the config file for the other copies that you deploy. Of course, that means that you can't actually use the same WAR file, or you need to figure out some way to load the log4j configuration file from another location. If you write your own ServletContextListener to load the log4j configuration (that's what we do over here... it also shuts-down log4j when the webapp undeploys), then you ought to be able to use the JNDI context to find the location of a configuration file on a per-context basis. For instance, you could put your config files somewhere like /etc/mywebapp/ROOT.xml and /etc/mywebapp/non-root.xml and just change the name of the log file name. (which does stuff like log the I have searched around, and found some references to JNDI context selectors for log4j, but I believe that this is to allow log4j separation - not directly related to what I am trying to do. I'm afraid I don't know a thing about JNDI context selectors and log4j. Sorry. I have tried to add a suitable web.xml environment entry, and then add it to the log file name, e.g. ${catalina.base}/logs/${tomcatInstancePrefix}demo.log. Then in ROOT.xml for each host I add Environment name=tomcatInstancePrefix value=demo2- type=java.lang.String override=false/ and in web.xml I add resource-env-ref resource-env-ref-nametomcatInstancePrefix/resource-env-ref-name resource-env-ref-typejava.lang.String/resource-env-ref-type /resource-env-ref but that didn't work Yeah, that doesn't work because it doesn't set a system property, which is what log4j requires for that kind of replacement. You could just run separate instances of Tomcat. It would be less hassle easier to manage. Separate CATALINA_HOME CATALINA_BASE, so you can use the same core code just create some separate instances. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: tomcat http connector
On 22 Nov 2011, at 07:53, Jan Vávra va...@602.cz wrote: Hello, I use ajp, because on tomcat I make authentication based on client certificate. That you cannot do via http connector. Oh dear. Of course it can. CLIENT_CERT auth is part of the Servlet spec. p Jan. Hi, Is there any document which I can refer to which states if tomcat's built in http connector (Coyote) can be used for production ? And also a comparison between http connector and AJP one. Thanks, Asha - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat http connector
On 22/11/2011 16:21, Caldarale, Charles R wrote: From: Shanti Suresh [mailto:sha...@umich.edu] Subject: Re: tomcat http connector Tomcat's built-in HTTP connector can be used for production if your production traffic is light. It is advisable to front-end Tomcat with Apache. Sorry, that's just BS. Back in the Tomcat 3 or 4 days, it was true to some extent, but performance of Tomcat without httpd has been demonstrated to be equal or better. I agree with Chuck. Apache's I/O is superior to Tomcat. Another incorrect statement; with Tomcat's APR connector, the I/O is identical - since it's all the same code. Regardless, as Pid pointed out, overall performance is rarely limited by the connector; the application architecture is the critical factor. +1 front-ending Tomcat with Apache also gives you access to the powerful traffic filtering, security and other modules that are available for Apache. Tsk, tsk. p And introduces configuration complexity and a greater opportunity to create attack vectors due to seemingly innocuous configuration errors. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Single war file - multiple hosts - can't get log4j to log to different files
On 22/11/2011 19:28, chris derham wrote: Host name=demo1.company.com appBase=webapps\demos unpackWARs=false autoDeploy=false The appBase I find a little concerning... You don't have any apps directly place in webapps do you? p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: tomcat http connector
On 22/11/2011 20:08, André Warnier wrote: Pid wrote: On 22/11/2011 16:21, Caldarale, Charles R wrote: From: Shanti Suresh [mailto:sha...@umich.edu] Subject: Re: tomcat http connector Tomcat's built-in HTTP connector can be used for production if your production traffic is light. It is advisable to front-end Tomcat with Apache. Sorry, that's just BS. Back in the Tomcat 3 or 4 days, it was true to some extent, but performance of Tomcat without httpd has been demonstrated to be equal or better. I agree with Chuck. Apache's I/O is superior to Tomcat. Another incorrect statement; with Tomcat's APR connector, the I/O is identical - since it's all the same code. Regardless, as Pid pointed out, overall performance is rarely limited by the connector; the application architecture is the critical factor. +1 front-ending Tomcat with Apache also gives you access to the powerful traffic filtering, security and other modules that are available for Apache. Tsk, tsk. -1. (to the tsk, tsk I mean). Because that part is true. There are a whole bunch of add-on modules for Apache httpd which have no equivalent (yet) in the Tomcat world. (Or they are much more difficult to find). I'm increasingly less keen on employing a jack-of-all trades approach in the use of HTTPD e.g. traffic filtering. That is a network problem. p p And introduces configuration complexity and a greater opportunity to create attack vectors due to seemingly innocuous configuration errors. - Chuck But that's also true. So the real answer is, as usual, it depends.. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: where to put static files?
On 21 Nov 2011, at 03:15, S Ahmed sahmed1...@gmail.com wrote: I have a spring project (web app), in my project where should I be putting my static files like images/css/javascript? In my WEB-INF like: /WEB-INF/Assets {images/css/js} You can't serve files directly from WEB-INF. I know when I go in production I will have nginx map to this folder to serve the static files, but I just want to know where I can put them for development/testing. How about somewhere sensible? /images /scripts /styles p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Connection pooling issue with MySQLNonTransientConnectionException and Java webapp
On 21 Nov 2011, at 09:28, app...@dsl.pipex.com app...@dsl.pipex.com wrote: Hello I don't think this is a Tomcat issue but I thought I would post here just in case. I have a Java, JSP and MySQL application running under Apache Tomcat 6.0.26 which I've been testing with JMeter. What I find is that for a simple test having 10 users logging in and displaying a JSP which is populated from several database reads, everything is fine. But when I increase the number of users in JMeter to 20+, logging in starts to fail with HTTP request 500. Checking the logs I find that I am getting large numbers of MySQLNonTransientConnectionExceptions as follows: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. So this indicates that there's an issue either with the connection pooling through Apache Tomcat 6.0.26 or MySQL Community Server 5.X. The relevant part of the application's context.xml file in the project reads as follows: Resource auth=Container driverClassName=com.mysql.jdbc.Driver logAbandoned=true maxActive=-1 maxIdle=30 maxWait=1 minEvictableIdleTimeMillis=3 name=jdbc/myApp numTestsPerEvictionRun=5 password=XX removeAbandoned=true removeAbandonedTimeout=120 testOnBorrow=true testOnReturn=false testWhileIdle=true timeBetweenEvictionRunsMillis=-1 type=javax.sql.DataSource url=jdbc:mysql://localhost:3306/myApp?autoReconnect=true username=XX validationQuery=select 1/ I've set maxActive above to -1 on the understanding that this is unlimited. I think that the MySQL error is because MySQL is refusing the connections. Am I correct here? Can anyone suggest a workaround or advise? Typically, my database operations are as follows: // Gets an ArrayList of Datasets. public static ArrayListDataset getDatasets() { ConnectionPool_DB pool = ConnectionPool_DB.getInstance(); Connection connection = pool.getConnection(); Usually the connection is initialised as null and then assigned inside the try block. What happens if the method above throws an error after a connection is removed from the pool? p PreparedStatement ps = null; ResultSet rs = null; String query = (SELECT * + FROM Dataset + WHERE Active = ' + Valid.TRUE + ';); try { ps = connection.prepareStatement(query); rs = ps.executeQuery(); ArrayListDataset datasets = new ArrayListDataset(); while (rs.next()) { datasets.add(mapDataset(rs)); } return datasets; } catch(Exception ex) { logger.error(Error getting list of Datasets\n, ex); return null; } finally { Database_Utils.closeResultSet(rs); Database_Utils.closeStatement(ps); pool.freeConnection(connection); } } And there can be quite a few of these per page. Thanks Martin O'Shea - 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: APR SSL error: Socket bind failed: [98] Address already in use
On 21 Nov 2011, at 02:44, Eric Kemp cruisingat90...@gmail.com wrote: Below is my entire server.xml (minus commented lines) ?xml version='1.0' encoding='utf-8'? Server port=8005 shutdown=SecretCommand Listener className=org.apache.catalina.core.AprLifecycleListener SSLEngine=on / Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.core.JreMemoryLeakPreventionListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener / Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener / GlobalNamingResources Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / /GlobalNamingResources Service name=Catalina Connector port=8080 protocol=HTTP/1.1 connectionTimeout=2 URIEncoding=UTF-8 redirectPort=8443 / !-- Adding the connector below causes the Socket bind failed: [98] Address already in use error to appear in catalina.out... and https does not work. -- What happens if you use 8444 instead? p Connector port=8443 protocol=org.apache.coyote.http11.Http11AprProtocol maxThreads=150 scheme=https secure=true clientAuth=false sslProtocol=TLS SSLEnabled=true SSLCertificateKeyFile=/etc/apache2/ssl/myDomain.com.key SSLCACertificateFile=/etc/apache2/ssl/myDomain.com.ca.crt / Engine name=Catalina defaultHost=localhost Realm className=org.apache.catalina.realm.UserDatabaseRealm resourceName=UserDatabase/ Host name=localhost appBase=webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service /Server Thanks On Sun, Nov 20, 2011 at 4:18 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Eric Kemp [mailto:cruisingat90...@gmail.com] Subject: Re: APR SSL error: Socket bind failed: [98] Address already in use Any other ideas would still be appreciated. As others have noted, the conflict is likely on some port other than 8443. Post your entire server.xml, preferably with comments removed, so we can see all of the ports declared there. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat recycling
On 21 Nov 2011, at 13:24, Jan Vávra va...@602.cz wrote: Hello, is there any way how to tell tomcat: Recycle after X minutes OR Y requests like it is eg. on the IIS server? IIS can reboot itself after N requests? That's awesome. What could possibly go wrong? Yes, IIS can do recycling See eg. at http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1652e79e-21f9-4e89-bc4b-c13f894a0cfe.mspx?mfr=true It is a quite easy to setup it in the configuration. I might file an enhancement request for Tomcat... If you have already done it, can I vote it for? If I add my own script containing /etc/init.d/tomcat restart to the crontab I loose the user sessions and users have to relogin. Yes... because you restarted the server! As Chris Schultz wrote it is possible to persist sessions over tomcat restarts. I chagned my session objects to be serializable and It works. I experience some problems with OutOfMemory error. Wouldn't it be better to understand and fix the OOM, rather than just rebooting the server frequently? Yes, it is allways better to solve the cause than the consequence of a problem. But not allways man can have enough time or means to solve it. When an error occurs at production it is better to setup some kind of recovery (eg. recycling) and than solve it at pre-production / devel environment. You can use a third party lib with an error. Particulary in my case, my app consists of a one single cycle where I download a CRL, parse it using BouncyCastle lib and retrieve serial numbers of revoked certificates. So the problem can rather in third party lib than in my small piece of code. I've tried to profile memory consuption but have not found out nothing. Maybe I had had not enough memory for java virtual machine. I've set it from 128 MB to 512 MB and the problem have not occured yet. On tomcat I run a periodic thread that downloads CRLs and I suspect this of memory leaks. Why? Can't you fix that? If we forget the OOM exception, I was forced to make a ShutDownHook. I use spring quartz scheduler and my job can run quite a long time. So I had to add some notification to stop job correctly. Tomcat was complainting about possible memory leaks when ending quartz job-worker threads when I was stopping app for redeploy my app. Yes, Tomcat is helping you by warning you about a potential problem. The last time I looked at Quartz the shutdown process didn't actually wait for threads to finish before returning. I had a little success with Thread.yield() but I suspect that it would not be effective for multiple jobs or a longer process. In a single process model (crontab) I could afford to kill -9 the process and I could rely on transactionality in the database which I'm using. I'm not sure how that relates to this discussion. At the end I'd like to make a little comparision. Recently I've used .NET + native calls of dlls, php + custom made php modules (native dlls), jsp+java. .NET and php have possibilities for some kind of recoveries. I'm not sure what that means. It's almost imposible to crash Apache like a whole (control + x worker processes). So .NET and php seems me they're more stable than tomcat because they have some possibilites. I completely disagree. You're comparing two languages with an application server, for a start. I haven't studied recovery options in other java app. servers, but I'd really appriciate something in Tomcat. I think the harm this function would do would outweigh any perceived benefits. If you want to reboot Tomcat periodically employ cron and the service wrapper. p Jan - 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: where to put static files?
On 21 Nov 2011, at 18:52, André Warnier a...@ice-sa.com wrote: Hi. What we are trying to say is this : The WEB-INF and META-INF sub-directories of a Tomcat webapp, are supposed to contain files that should NOT be accessed by the users. For example, in the WEB-INF and META-INF subdirectories, there are files (like WEB-INF/web.xml) which may contain private information (such as, e.g., passwords to access a database system). For that reason, Tomcat itself forbids access to the content of these directories. If you try to access Tomcat directly via a URL like http://myhost.company.com/mywebapp/WEB-INF/somefile;, you will get a Forbidden response. Always. But if on the same host, you run another webserver (Apache, nginx,..), and you allow this webserver to access the content of the Tomcat ../webapps/mywebapp/WEB-INF directory, then you bypass the Tomcat security and make it useless. That means that a user, with a well-crafted URL, will be able to access and display the content of those files. This is a big security hole. You can configure the front-end webserver to also forbid this, but it requires additional configuration, and you will forget to do it, or do it wrong. So don't do that. Tomcat will server static resources just fine, usually as fast as Apache or nginx would. If you insist that you must serve this static content directly from the front-end webserver, and not ask Tomcat to do it, then place them somewhere under the DocumentRoot of the front-end webserver (which should /NOT/ be the same as the Tomcat webapps directory), and use the proxy instructions so that these requests are /not/ forwarded to Tomcat, but served locally. +1. I would use stronger terms: never allow DocumentRoot and tomcat/webapps to overlap. p For example : ProxyPass /mywebapp/images ! ProxyPass /mywebapp/css ! ProxyPass /mywebapp ajp://tomcat:8009/mywebapp will proxy all requests for /mywebapp to Tomcat, *except* for the /images and /css subdirectories. Jan Vávra wrote: Hello, when I started my project others told me to use apache for static content and tomcat for java/jsp. It works quite good. Tomcat is hidden under reverse proxy (mod_ajp). So static content gives apache, dynamic tomcat. Jan. I have a spring project (web app), in my project where should I be putting my static files like images/css/javascript? In my WEB-INF like: /WEB-INF/Assets {images/css/js} I know when I go in production I will have nginx map to this folder to serve the static files, but I just want to know where I can put them for development/testing. - 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: Connection pooling issue with MySQLNonTransientConnectionException and Java webapp
On 21 Nov 2011, at 16:11, Terence M. Bandoian tere...@tmbsw.com wrote: On 1:59 PM, Martin O'Shea wrote: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: Too many connections I'd check into this. I agree. I am interested in whether connections are being created but not returned to the pool, hence my question... p -Terence Bandoian - 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: Connection pooling issue with MySQLNonTransientConnectionException and Java webapp
On 21 Nov 2011, at 16:25, Martin O'Shea app...@dsl.pipex.com wrote: Thanks Terence. Yes, I have been. Increasing the number of connections in MySQL, the max_connections parameter, seems to have helped somewhat. If you are leaking connections it will just delay the problem, even make it worse. Connect VisualVM to Tomcat and monitor the connection pool, (assuming you have configured the pool as a Resource). If it keeps increasing in size, outgrowing the Connector threads, you have a leak. p Is there an optimum number of connections that the 'equivalent' Tomcat maxActive should have? -Original Message- From: Terence M. Bandoian [mailto:tere...@tmbsw.com] Sent: 21 Nov 2011 16 11 To: Tomcat Users List Subject: Re: Connection pooling issue with MySQLNonTransientConnectionException and Java webapp On 1:59 PM, Martin O'Shea wrote: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: Too many connections I'd check into this. -Terence Bandoian - 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: Connection pooling issue with MySQLNonTransientConnectionException and Java webapp
On 21 Nov 2011, at 20:09, Martin O'Shea app...@dsl.pipex.com wrote: Are you able to provide any more information about what I am actually looking for in VisualVM? Depends how you defined the Db. Did you define a global Resource in server.xml? Or perhaps in conf/context.xml? p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Connection pooling issue with MySQLNonTransientConnectionException and Java webapp
On 21 Nov 2011, at 21:25, Martin O'Shea app...@dsl.pipex.com wrote: Well, I hope I’m reading VisualVM correctly, because when I run the JMeter test first time around, I see 40 ‘connector’ threads created in VisualVM, all of which run for so long and then return to a wait state. I always forget to tell people to get the plugins, apologies. There is a JConsole Mbean plugin for it that you can use to inspect various of Tomcats internals. And if I run the test again several times in succession, the number of connector threads remains the same: they run, and then wait. JMeter also indicates a clean run with no errors reported. The list strips attachments and embedded. If you created a DataSource and a connection pool, then you will find values indicating the pool size etc. You are aiming to monitor the pool size during the test. p
Re: Tomcat dependency setup
On 21 Nov 2011, at 22:09, John Hinnegan john.hinne...@gmail.com wrote: Hi, I'm looking for a resource for how to set dependencies on tomcat. I'm using SBT and looking to replace Jetty with Tomcat in the test/build phase. (SBT is a build tool written in Scala - I had to look it up) http://catb.org/~esr/faqs/*smart*-*questions*.html I already deploy to tomcat in prod. Here's the jetty dependency. Ugly. That's presumably a Maven reference? 15 org.eclipse.jetty % jetty-webapp % 7.4.5.v20110725 % container, 16 javax.servlet % servlet-api % 2.5 % provided Where would I look to get the equivalent dependency for tomcat? Tomcat's Maven components are under group org.apache.tomcat - the rest varies by the bits you need and the version. Have a browse of the repo. p Thanks in advance
Re: tomcat http connector
On 22 Nov 2011, at 07:15, Asha K S a...@adobe.com wrote: Is there any performance comparison document available already between http and AJP Please don't top-post. Post your questions below the answers so it's possible to read the conversation without jumping up and down the page. The AJP and HTTP connectors serve different purposes - you choose based on whether you are integrating with Apache HTTPD or not, rather than on performance. On performance: 95+% of the performance will come from getting your app design and code right. The rest is made up from choosing the right amount of memory and garbage collector settings, a modern JVM, testing more testing, not having resource pools that are too small, etc. (I'm deliberately ignoring hardware.) If you're new to this you are extremely unlikely to notice the difference between the different Tomcat Connectors performance. p The answer is: use the NIO implementations if you really need speed from Tomcat. Thanks, Asha -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: Tuesday, November 22, 2011 12:40 PM To: Tomcat Users List Subject: RE: tomcat http connector From: Asha K S [mailto:a...@adobe.com] Subject: RE: tomcat http connector My question was mainly regarding which one is recommended for production . Both, depending on what you need to do. If you are using httpd for something useful (and just serving static content isn't one of those things), then most people connect Tomcat to it via mod_jk or mod_proxy_ajp. If you have no specific need for httpd, then use Tomcat directly and avoid the complexity and performance impact. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - 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: APR SSL error: Socket bind failed: [98] Address already in use
On 19 Nov 2011, at 18:44, Eric Kemp cruisingat90...@gmail.com wrote: Summary: I'm looking for ideas on how to resolve this Address already in use error when configuring SSL in Tomcat APR. Environment: Running Apache Tomcat/6.0.24 on OS is Ubuntu 10.04.2 LTS with JVM 1.7.0_01-b08 // // Prior to configuring SSL, and after starting Tomcat I run netstat -tulpn and see that port 8443 is not used: // Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 29002/mysqld tcp0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2136/sshd tcp6 0 0 127.0.0.1:8005 :::* LISTEN 12796/java tcp6 0 0 :::8080 :::* LISTEN 12796/java tcp6 0 0 :::22 :::* LISTEN 2136/sshd udp0 0 0.0.0.0:68 0.0.0.0:* 2087/dhclient3 // // I stop Tomcat, and add the following to my server.xml file: // Listener className=org.apache.catalina.core.AprLifecycleListener SSLEngine=on / Connector port=8443 protocol=org.apache.coyote.http11.Http11AprProtocol maxThreads=150 scheme=https secure=true clientAuth=false sslProtocol=TLS SSLEnabled=true SSLCertificateKeyFile=/etc/apache2/ssl/myUniqueDomain.com.key SSLCACertificateFile=/etc/apache2/ssl/myUniqueDomain.com.ca.crt / // // I restart Tomcat, and see the following in the catalina.out file: How are you start/stop/restarting Tomcat - bin/script or service? After calling stop, are you sure Tomcat has actually stopped? p // SEVERE: Error starting endpoint java.lang.Exception: Socket bind failed: [98] Address already in use at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:646) at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:753) at org.apache.coyote.http11.Http11AprProtocol.start(Http11AprProtocol.java:137) at org.apache.catalina.connector.Connector.start(Connector.java:1080) at org.apache.catalina.core.StandardService.start(StandardService.java:531) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Nov 19, 2011 11:35:19 AM org.apache.catalina.startup.Catalina start SEVERE: Catalina.start: LifecycleException: service.getName(): Catalina; Protocol handler start failed: java.lang.Exception: Socket bind failed: [98] Address already in use at org.apache.catalina.connector.Connector.start(Connector.java:1087) at org.apache.catalina.core.StandardService.start(StandardService.java:531) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) // // Running netstat -tulpn I see that port 8443 is now being used: // Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 29002/mysqld tcp0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2136/sshd tcp6 0 0 127.0.0.1:8005 :::* LISTEN 10696/java tcp6 0 0 :::8080 :::* LISTEN 10696/java tcp6 0 0 :::22 :::* LISTEN 2136/sshd tcp6 0 0 :::8443 :::* LISTEN 10696/java udp0 0 0.0.0.0:68 0.0.0.0:* 2087/dhclient3 If I change Connector port=8443 to Connector port=8445, I get the same error message, and netstat -tulpn shows: tcp6 0 0 :::8445 :::* LISTEN 10696/java I have also tried adding the following to my server.xml as an attribute to Connector and still get the same error
Re: APR SSL error: Socket bind failed: [98] Address already in use
On 20 Nov 2011, at 12:49, Igor Cicimov icici...@gmail.com wrote: Isnt 8005 shutdown port for tomcat? I can see sshd bound to that port already. I think that's the line above... There is a java process holding 8005 On Nov 20, 2011 6:33 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/11/19 Eric Kemp cruisingat90...@gmail.com: Summary: I'm looking for ideas on how to resolve this Address already in use error when configuring SSL in Tomcat APR. Environment: Running Apache Tomcat/6.0.24 That one is old. Maybe you can upgrade to 6.0.33? on OS is Ubuntu 10.04.2 LTS with JVM 1.7.0_01-b08 There were severe issues with 1.7.0, such as Loop unroll optimization causes incorrect result. I do not know whether all of them are fixed in 7u1. http://tomcat.markmail.org/thread/oghpdg2whkrpnk7w Anyway, maybe you can try running with Java 6? // // I restart Tomcat, and see the following in the catalina.out file: // SEVERE: Error starting endpoint java.lang.Exception: Socket bind failed: [98] Address already in use at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:646) at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:753) at org.apache.coyote.http11.Http11AprProtocol.start(Http11AprProtocol.java:137) at org.apache.catalina.connector.Connector.start(Connector.java:1080) at org.apache.catalina.core.StandardService.start(StandardService.java:531) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) What INFO messages are before this one? Maybe you can post your entire server.xml (without comments and passwords)? 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: mod_jk connection pool configuration
On 17 Nov 2011, at 20:39, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pid, On 11/16/11 7:20 PM, Pid wrote: What I'm not clear on is whether the mod_jk worker connection_pool_size is 60 per Server child, or 60 * 10 Server children. mod_jk's connection_pool_size, when left to the default (which I think everyone should do) will auto-size for the situation. Auto-size or select-at-startup? I thought the latter, and that in worker mpm it derived from ThreadsPerChild. At least that's how I read the docs Mladen / Rainer's previous statements on the topic. Obviously, in the prefork MPM, it defaults to 1 because you simple can't make more than one connection. For the worker MPM, I think the default is one connection per thread (per worker, of course), so if you have 600 total threads, you'll have 600 threads * 20 connections each = 12000. Right... but if MaxClients is 600 that's a lot of unused open connections, no? You can, of course, limit the number of connections by setting connection_pool_size to something smaller than the total number of threads * Tomcats you have. You'd only really want to do that if you were expecting a lot of requests to be handled directly by httpd with no communication with Tomcat. If you have 10% of your traffic going to Tomcat, then you might want to have your connection_pool_size set to 60 instead of (defaulting to) 600. I thought it defaults to 60 but becomes 600 in total because there are 10 pools, one for each worker. If MaxClients is still 600 and there is one Tomcat, one might assume that allowing all 600 to go to that Tomcat is sensible - but if there are two Tomcats, what is the behaviour? NB 600 to each Tomcat would be more than MaxClients. mod_jk isn't affected by MaxClients, of course (aside from possibly the auto-default of connection_pool_size). Correct, but if MaxClients is 600, what's the point of having more connections open to the backend Tomcat(s)? If you have 600 worker threads and 1 Tomcat, I would expect 600 persistent connections from httpd to that one Tomcat instance. Doubling the number of Tomcat instances (by adjusting the worker, for example, to be an lb) will result in doubling the number of backend connections to 1200. If you have more than one worker, then the number of Tomcat instances is essentially multiplied. So, if you have 20 TC backends each with 2 workers assigned to them, then you'll 24000 connections instead. Will this change If Tomcat instances start failing? Probably not -- mod_jk will just retire the connection and create a new one. If you are having load problems, you might make things worse with all this connection churn. Agreed. So, what was the problem you were trying to solve in the first place? I saw behaviour I didn't expect at a customer. Made more complicated by other factors, so I wanted to clarify the expected behaviour. Or, was this a capacity-planning Gedankenexperiment? - -chris PS Missed you (again) at ApacheCon. Get on a plane you lazy bum. Yeah. :(. Unavoidable customer work. -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7FcNcACgkQ9CaO5/Lv0PCIGACfbMFvTIacHTCO2sFavOSL2dzS pd4AoLbsnhHNclExBJ2TsyZN5ZA61JO6 =xePs -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: CLOSE_WAIT Connection Issue
On 18 Nov 2011, at 08:49, Chandrakant Solanki solanki.chandrak...@gmail.com wrote: Hi, 1] having one project in webapps, which will hold connection for 45 seconds. 2] I executed 5000 CURL request, on above project. 3] And then from Clinet Side, from where, I execute curl, kill all curl process. So, on server all ESTABLISHED becomes, CLOSE_WAIT in netstat Another clear description of what you're seeing, thanks - but what is the problem? What do you expect or want to happen? p tcp0 0 10.168.43.69:8080 115.113.7.178:1197 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:1965 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:1709 CLOSE_WAIT 10761/java tcp0 0 10.168.43.69:8080 115.113.7.178:64429 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:64941 CLOSE_WAIT 10761/java tcp0 0 10.168.43.69:8080 115.113.7.178:64685 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:4268 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:4780 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:5036 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:2220 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:2476 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:2732 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:2988 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:3244 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:3500 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:3756 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:4012 CLOSE_WAIT 10761/java tcp0 0 10.168.43.69:8080 115.113.7.178:1196 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:1452 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:1708 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:1964 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:64428 CLOSE_WAIT 10761/java tcp0 0 10.168.43.69:8080 115.113.7.178:64684 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:64940 CLOSE_WAIT 10761/java tcp 126 0 10.168.43.69:8080 10.168.86.11:55709 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:5039 CLOSE_WAIT 10761/java tcp1 0 10.168.43.69:8080 115.113.7.178:4783 CLOSE_WAIT 10761/java tcp 294 0 10.168.43.69:8080 115.113.7.178:4271 CLOSE_WAIT 10761/java On Fri, Nov 18, 2011 at 1:22 PM, Pid * p...@pidster.com wrote: On 18 Nov 2011, at 07:34, Chandrakant Solanki solanki.chandrak...@gmail.com wrote: Hi All, I am using apache-tomcat 6.0.26 and below is my server.xml Connector port=8080 protocol=org.apache.coyote. http11.Http11NioProtocol redirectPort=8443 maxKeepAliveRequests=1 maxThreads=5000 minSpareThreads=100 maxSpareThreads=300 processCache=500 acceptorThreadCount=1 enableLookups=false disableUploadTimeout=false connectionUploadTimeout=24 compression=on compressionMinSize=2048 noCompressionUserAgents=gozilla, traviata compressableMimeType=text/html,text/xml acceptCount=50 connectionTimeout=6 / Connector port=8443 protocol=org.apache.coyote.http11.Http11Protocol maxThreads=1 minSpareThreads=100 maxSpareThreads=300 processCache=500 acceptorThreadCount=1 enableLookups=false disableUploadTimeout=false connectionUploadTimeout=24 compression=on connectionTimeout=6 compressionMinSize=2048 noCompressionUserAgents=gozilla, traviata compressableMimeType=text/html,text/xml acceptCount=50 scheme=https secure=true address=X.X.X.X allowTrace=false SSLEnabled=true SSLCertificateFile= SSLCertificateKeyFile=... clientAuth=false sslProtocol=TLSv1 maxKeepAliveRequests=1/ I have executed CURL request, around 5000 and after that I kill all my curl process. So, all ESTABLISHED connection becomes in CLOSE_WAIT state. You have described some TCP states. Can you state what the problem is please? p Is any
Re: Tomcat Causes Server to go Panic/Crash
On 18 Nov 2011, at 08:34, Adrian Zara adrian.z...@aonhewitt.com wrote: Hi Miki, Noted with thanks! I'll replace my JVM with a better one. As for the JAVA_OPTS variable, I am planning to revert it back to its original value of 512 and retain it there as I am not confident of removing it from the catalina.sh. Are you not reading what people are telling you? Do NOT use JAVA_OPTS. Use CATALINA_OPTS instead. p As for the server's memory, I'm not sure how to test it. Best regards, Adrian Mikolaj Rydzewski m...@ceti.pl 11/18/2011 04:26 PM Please respond to Tomcat Users List users@tomcat.apache.org To Tomcat Users List users@tomcat.apache.org cc Subject RE: Tomcat Causes Server to go Panic/Crash On Fri, 18 Nov 2011 16:19:53 +0800, Adrian Zara wrote: I will consider replacing the JVM with the ones you suggested. But for the meantime, while I do not have these better JVM's yet, I'll check of removing the AgressiveHeap option in the JAVA_OPTS as advised by Jürgen. Please do the following: 1. Replace GNU Java with a real one. 2. Use CATALINA_OPTS instead of JAVA_OPTS (so shutdown script won't pick it up). 3. Have you tested server's memory for errors? -- Mikolaj Rydzewski m...@ceti.pl - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org The information contained in this e-mail and any accompanying documents may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message, including any attachments. Any dissemination, distribution or other use of the contents of this message by anyone other than the intended recipient is strictly prohibited. All messages sent to and from this e-mail address may be monitored as permitted by applicable law and regulations to ensure compliance with our internal policies and to protect our business. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or contain viruses. You are deemed to have accepted these risks if you communicate with us by e-mail. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat recycling
On 18 Nov 2011, at 15:36, Jan Vávra va...@602.cz wrote: Hello, is there any way how to tell tomcat: Recycle after X minutes OR Y requests like it is eg. on the IIS server? IIS can reboot itself after N requests? That's awesome. What could possibly go wrong? I might file an enhancement request for Tomcat... If I add my own script containing /etc/init.d/tomcat restart to the crontab I loose the user sessions and users have to relogin. Yes... because you restarted the server! I experience some problems with OutOfMemory error. Wouldn't it be better to understand and fix the OOM, rather than just rebooting the server frequently? On tomcat I run a periodic thread that downloads CRLs and I suspect this of memory leaks. Why? Can't you fix that? I consider to cut out this to a standalone process called via crontab. JV. - 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: CLOSE_WAIT Connection Issue
On 18 Nov 2011, at 07:34, Chandrakant Solanki solanki.chandrak...@gmail.com wrote: Hi All, I am using apache-tomcat 6.0.26 and below is my server.xml Connector port=8080 protocol=org.apache.coyote. http11.Http11NioProtocol redirectPort=8443 maxKeepAliveRequests=1 maxThreads=5000 minSpareThreads=100 maxSpareThreads=300 processCache=500 acceptorThreadCount=1 enableLookups=false disableUploadTimeout=false connectionUploadTimeout=24 compression=on compressionMinSize=2048 noCompressionUserAgents=gozilla, traviata compressableMimeType=text/html,text/xml acceptCount=50 connectionTimeout=6 / Connector port=8443 protocol=org.apache.coyote.http11.Http11Protocol maxThreads=1 minSpareThreads=100 maxSpareThreads=300 processCache=500 acceptorThreadCount=1 enableLookups=false disableUploadTimeout=false connectionUploadTimeout=24 compression=on connectionTimeout=6 compressionMinSize=2048 noCompressionUserAgents=gozilla, traviata compressableMimeType=text/html,text/xml acceptCount=50 scheme=https secure=true address=X.X.X.X allowTrace=false SSLEnabled=true SSLCertificateFile= SSLCertificateKeyFile=... clientAuth=false sslProtocol=TLSv1 maxKeepAliveRequests=1/ I have executed CURL request, around 5000 and after that I kill all my curl process. So, all ESTABLISHED connection becomes in CLOSE_WAIT state. You have described some TCP states. Can you state what the problem is please? p Is any configuration is missing or doing something wrong.. Please help me out. -- Regards, Chandrakant Solanki - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
mod_jk connection pool configuration
Hi, Tomcat 6.0.32, HTTPD (worker mpm) 2.2.19, mod_jk 1.2.31. If ThreadsPerChild is 60 and ServerLimit is 10, MaxClients is 600, how many connections, at peak, will be made to 20 Tomcat instances? Will this change If Tomcat instances start failing? p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: mod_jk connection pool configuration
On 16 Nov 2011, at 13:47, Pid * p...@pidster.com wrote: Hi, Tomcat 6.0.32, HTTPD (worker mpm) 2.2.19, mod_jk 1.2.31. If ThreadsPerChild is 60 and ServerLimit is 10, MaxClients is 600, how many connections, at peak, will be made to 20 Tomcat instances? I should add that 'connection_pool_size' is not set in workers.properties. Will this change If Tomcat instances start failing? p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: mod_jk connection pool configuration
On 16/11/2011 16:52, Christopher Schultz wrote: Pid, On 11/16/11 8:47 AM, Pid * wrote: Tomcat 6.0.32, HTTPD (worker mpm) 2.2.19, mod_jk 1.2.31. If ThreadsPerChild is 60 and ServerLimit is 10, MaxClients is 600, how many connections, at peak, will be made to 20 Tomcat instances? - From httpd docs: MaxClients: For threaded and hybrid servers (e.g. beos or worker) MaxClients restricts the total number of threads that will be available to serve clients. The default value for beos is 50. For hybrid MPMs the default value is 16 (ServerLimit) multiplied by the value of 25 (ThreadsPerChild). Therefore, to increase MaxClients to a value that requires more than 16 processes, you must also raise ServerLimit. ServerLimit: With worker use this directive only if your MaxClients and ThreadsPerChild settings require more than 16 server processes (default). Do not set the value of this directive any higher than the number of server processes required by what you may want for MaxClients and ThreadsPerChild. So if MaxClients is 600 and ThreadsPerChild is 60 then you can't have more than 10 processes each with 60 threads. If you want more than 16 server processes (which it looks like you don't need), then you'll need to set ServerLimit to something higher than it's default for worker which appears to be 16. I'm not sure you need ServerLimit at all. If you have 20 TCs on the back end, then mod_jk will have to open 20 * 600 = 12000 connections at peak, if my math is correct. That's only 600 connections per TC, or course, but you may have trouble with creating that many connections from the proxy. What I'm not clear on is whether the mod_jk worker connection_pool_size is 60 per Server child, or 60 * 10 Server children. If MaxClients is still 600 and there is one Tomcat, one might assume that allowing all 600 to go to that Tomcat is sensible - but if there are two Tomcats, what is the behaviour? NB 600 to each Tomcat would be more than MaxClients. If you have more than one worker, then the number of Tomcat instances is essentially multiplied. So, if you have 20 TC backends each with 2 workers assigned to them, then you'll 24000 connections instead. Will this change If Tomcat instances start failing? Probably not -- mod_jk will just retire the connection and create a new one. If you are having load problems, you might make things worse with all this connection churn. Agreed. p -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Having different apps (contexts) on different ports
On 15/11/2011 08:01, Mario Splivalo wrote: Can I have several Tomcat contexts on different ports? I need to have manager app listening only on 8080, and all the other apps on 80. Is something like that possible, within one Tomcat Service? You can have more than one Connector. You can't assign individual apps to specific Connectors. Or, if I fire up two services (under same server), each with its own set of connectors, is manager app from one service able to manage apps in another? The Manager application can only manage applications in the same Host. Unfortunately, separate Services will have separate Hosts. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: mod_jk Avoid loadbalancing
On 14/11/2011 10:42, Alexander Diedler wrote: Hello It is possible in a three node TC 6.0 / TC7.0 Cluster to avoid the loadbalancing between these three nodes? We only need the session replication. The Loadbalancing with failover will be done by a Big-IP F5, so we don´t need a “double” balanced request, first time by the HW-balancer and second time by the Apache mod_jk himself. So don't put httpd+mod_jk in front - just point the F5 at the Tomcats. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: mod_jk Avoid loadbalancing
On 15/11/2011 15:00, Jeffrey Janner wrote: Alexander - From reading your emails, it sounds like you have the following setup F5 HW-balancer | / \ / \ Level 1 balancing / \ HTTPD1 HTTPD2 | | Level 2 balancing | | | TC1 TC2TC3 Is that correct? You state that you want to eliminate Level 2. However, from a performance standpoint, why would you? Without the Level 2 balancing, it is conceivable that one of the 3 Tomcats could end up processing the bulk the JSP requests. Why? p However, Pid is correct. If you are worried about performance, you could drop the HTTPD servers and balance directly to the Tomcat servers. Tomcat is just as fast at delivering static content as HTTPD, and it simplifies deployment. Jeff -Original Message- From: Alexander Diedler [mailto:adied...@tecracer.de] Sent: Tuesday, November 15, 2011 5:56 AM To: Tomcat Users List; p...@pidster.com Subject: AW: mod_jk Avoid loadbalancing Hello, Yes, it was an option to solve my problem. But what about the performance? My opinion was to forward only necessary requests to the Tomcat (jsp, java etc) and let the Apache HTTPD deliver the static content (CSS,JS,Images etc). Best regards Alexander -Ursprüngliche Nachricht- Von: Pid [mailto:p...@pidster.com] Gesendet: Dienstag, 15. November 2011 12:41 An: Tomcat Users List Betreff: Re: mod_jk Avoid loadbalancing On 14/11/2011 10:42, Alexander Diedler wrote: Hello It is possible in a three node TC 6.0 / TC7.0 Cluster to avoid the loadbalancing between these three nodes? We only need the session replication. The Loadbalancing with failover will be done by a Big-IP F5, so we don´t need a double balanced request, first time by the HW-balancer and second time by the Apache mod_jk himself. So don't put httpd+mod_jk in front - just point the F5 at the Tomcats. p -- [key:62590808] __ Confidentiality Notice: This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: 403 error starting tomcat 7.0.22 application on windows 7
On 13 Nov 2011, at 07:07, bas...@obninsk.com bas...@obninsk.com wrote: Hi. I updated winXp to win7 and cannot start my tomcat 7.0.22 web-application. The tomcat returns 403 error. When i run manager application everything is ok. The manager app is ok, or running the manager app fixes your other app? What seems to be my problem? Problem: you haven't told us anything useful. Thanks. 403 is HTTP Forbidden, it means that Auth has failed. What Auth do you have configured? p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: 403 error starting tomcat 7.0.22 application on windows 7
On 13 Nov 2011, at 08:46, bas...@obninsk.com bas...@obninsk.com wrote: Hi. I updated winXp to win7 and cannot start my tomcat 7.0.22 web-application. The tomcat returns 403 error. When i run manager application everything is ok. The manager app is ok, or running the manager app fixes your other app? The manager itself runs ok but starting my app from the manager list still results in 403 error. What seems to be my problem? Problem: you haven't told us anything useful. Thanks. 403 is HTTP Forbidden, it means that Auth has failed. What Auth do you have configured? No Auth have been configured, because i just copy my app to the webapps directory from the old operating system, where my app was running without any Auth configuration. What else has changed? Do you still have the old server.xml file? Can you paste the application web.xml file (inline) into your reply? Remove usernames/passwords if present. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: 403 error starting tomcat 7.0.22 application on windows 7
On 13/11/2011 09:31, bas...@obninsk.com wrote: Hi. I updated winXp to win7 and cannot start my tomcat 7.0.22 web-application. The tomcat returns 403 error. When i run manager application everything is ok. The manager app is ok, or running the manager app fixes your other app? The manager itself runs ok but starting my app from the manager list still results in 403 error. What seems to be my problem? Problem: you haven't told us anything useful. Thanks. 403 is HTTP Forbidden, it means that Auth has failed. What Auth do you have configured? No Auth have been configured, because i just copy my app to the webapps directory from the old operating system, where my app was running without any Auth configuration. What else has changed? Operating system have been changed from WinXp pro to Win7 pro. That's all. Do you still have the old server.xml file? No. I've installed Tomcat 7.0.22. Can you paste the application web.xml file (inline) into your reply? ?xml version=1.0 encoding=UTF-8? web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/javaee; xmlns:web=http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 display-nameWEB query/display-name description/description error-page error-code404/error-code location/includes/error404.jsp/location /error-page error-page error-code500/error-code location/includes/error500.jsp/location /error-page servlet description/description display-namereportcmnt/display-name servlet-namereportcmnt/servlet-name jsp-file/jsp/reportcmnt.jsp/jsp-file /servlet servlet-mapping servlet-namereportcmnt/servlet-name url-pattern/reportcmnt/url-pattern /servlet-mapping /web-app Remove usernames/passwords if present. What is in the WEB-INF/lib and WEB-INF/classes directory? Does the application deploy correctly? Is there anything in the logs? Do you have an access log configured, if so, what does it show? What user account is Tomcat running under? p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: SSL Tomcat 6 7
On 13/11/2011 10:03, Lau Eng Huat wrote: Hi everybody, I have followed this example on setting up the SSL on Tomcat Expert http://www.tomcatexpert.com/knowledge-base/using-openssl-configure-ssl-certificates-tomcat . The question that I have is how do you use Apache Common HttpClient to sent and received information from the servlet. I have no idea on how to write the code for the httpClient and Servlet. Please help me on this , I'm stuck at this for couple of weeks already. One of those is a question for the Apache Commons community. Note: Commons HttpClient has been superceded by Http Components. http://hc.apache.org/httpcomponents-client-ga/index.html If you don't know how to write a Servlet, then you should have a look at the documentation site and examples shipped with your Tomcat version: http://tomcat.apache.org/ p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: JVM config for tomcat7.0.19
On 11/11/2011 16:40, celtic man wrote: Is this JAVA setting below OK ? cat /proc/meminfo MemTotal: 4149124 kB MemFree:457884 kB 4Gb total memory on the linux box and have 0.4GB free memory and tomcat(6.0.18) running with below : JAVA_OPTS=-Xmx2000M so that i.e 1.9GB ?? or please suggest me the best settings that i add and not have any memory leak issues on the application.. Please don't top-post. No-one can really answer the question you have asked, we don't know enough about your application or how much memory it needs to use. We can only advise you to avoid bad configuration. Trying to assign 2Gb to a Java process if the OS only has 0.5Gb free beforehand is bad configuration. And maths, it's also Bad Maths. If you use JAVA_OPTS to set memory config, (as below), you will create a JVM instance with 2Gb of RAM, if you are using the shutdown.sh script which will run as well as the existing Tomcat instance. Both processes will end up using the swap, be horribly slow probably OOM. If you use CATALINA_OPTS, these values are not applied during shutdown but are used during startup. You have 4Gb of physical RAM. The amount of memory you can use for Tomcat is the amount of free RAM when Tomcat is not running. If your server (without Tomcat) has 2Gb free, then Tomcat can use up to 2Gb. The -Xmx and -Xms settings apply to the Object Heap. The Object Heap is only one part of the memory that a Java process consumes. (The Non-Heap area includes the PermGen space, for example.) So, with 2Gb free RAM, you may be able to set -Xmx to 1.2Gb (this is a guess, not a hard rule). You will have to test it yourself to determine what is safe. Use VisualVM or JConsole (both are included with the JDK) to measure heap/non-heap usage and compare it to the amount that the OS says the process is using. p Pid * wrote: On 10/11/2011 22:45, Igor Cicimov wrote: JAVA_OPTS=-Xms2048M -Xmx2048M -XX:Permsize=512m -XX:MaxPermsize=512m You are allocating here 2.5GB of memory to tomcat ... how do you expect it to start on a box with 2GB in total of which only 500MB are available? +1 It's the perfect way to achieve shockingly bad performance. p On Fri, Nov 11, 2011 at 8:25 AM, Christopher Schultz ch...@christopherschultz.net wrote: Celtic, On 11/10/11 12:02 PM, celtic man wrote: So i have updated the setenv.sh with -Xms2048M -Xmx2048M -XX:Permsize=512m -XX:MaxPermsize=512m and restarted tomcat.. Where is setenv.sh located? Can you give us the full contents of that file? but when i grep for tomcat process i don't see it .. ps -ef | grep tomcat root 10959 1 19 14:57 pts/4 00:00:29 /appl/java/bin/java -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/appl/tomcat/endorsed -classpath /appl/tomcat/bin/bootstrap.jar:/appl/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/appl/tomcat -Dcatalina.home=/appl/tomcat -Djava.io.tmpdir=/appl/tomcat/temp org.apache.catalina.startup.Bootstrap start How are you starting Tomcat? Give us the exact command you are running. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: graceful restart tomcat
On 10/11/2011 08:28, Kaushal Shriyan wrote: Hi, Is there a way to forcefully graceful restart tomcat server using bash script via cron.Any sample bash script ? Which is it: forceful or graceful? The two are not usually compatible. 'graceful' is found in Apache HTTPD: [the] signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately. There is no equivalent for Tomcat. The Commons Daemon found in tomcat/bin/commons-daemon-native.tar.gz provides a service wrapper and /etc/init.d/ type sample script which may be useful. Why do you need to schedule Tomcat restarts? It is often a mitigation applied instead of resolving the cause of a memory leak. Better to find fix the leak than leave it place. p Regards, Kaushal - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: sessionCookieDomain and sessionCookiePath
On 10/11/2011 08:39, Ionut Stoian wrote: Hello, I have an application serving several subdomains (a1.domain.com, a2.domain.com etc.) and i want to be able to have a single session cookie shared between subdomains (registered on domain .domain.com). However, when using Tomcat's sessionCookieDomain (tried on versions 6.0.33, 7.0.22) i don't get the expected behaviour: 1. If i set the sessionCookiePath to \test for example i get only one JSESSIONID cookie with domain .domain.com, but the path obviously is set to /test. 2. If i set the sessionCookiePath to \, or if i don't set it at all, i get a JSESSIONID cookie with domain .domain.com and a JSESSIONID cookie with domain a1.domain.com, which is not what i expect. Why would you set it to '\' or anything that starts with '\'? sessionCookieDomain, sessionCookiePath are Servlet 3.0 (ie Tomcat 7.0) configuration directives. They won't work in Tomcat 6.0. Where did you set them? In tomcat/conf/context.xml or somewhere else? p As a side note, on Tomcat 6.0.33 i also tried using the emptySessionPath attribute for the connector, but that did not help either. Can you please spot the error in my logic and guide me through the right steps to achieve this single JSESSIONID cookie? Thanks, Ionut -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Unable to receive message through TCP channel
On 10/11/2011 10:20, uwe.hellm...@t-systems.com wrote: Hello together, I am using to Tomcat 5.5.26 Servers. I took over the responsibility for this system some time ago. Since then we already got the following error message. SEVERE: Manager [/mywebapp]: Unable to receive message through TCP channel java.lang.ClassNotFoundException: After questioning what this error is about I got no response but the comment that everything is running fine. So I haven't searhc after it. But now after having a rollout of new servlet version we have some serious performance issues. And now I have to check for every severe error message I can find. But unfornatly I haven't found a solution or cause for this. The only thing which I have found is a posting that this might be a problem of the tomcats version and that this might be a bug which was solved in 5.5.28. Is this correct? How can we judge whether the posting is accurate if you don't post a link to it? Do you have exactly the same versions of the application deployed on each node of the cluster? Is there a reason why you aren't upgrading to the latest version of 5.5 (5.5.34)? p The cluster configuration part in server.xml looks like a standard configuration: Host name=localhost appBase=webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false Cluster className=org.apache.catalina.cluster.tcp.SimpleTcpCluster managerClassName=org.apache.catalina.cluster.session.DeltaManager expireSessionsOnShutdown=false useDirtyFlag=true notifyListenersOnReplication=true Membership className=org.apache.catalina.cluster.mcast.McastService mcastAddr=228.0.0.4 mcastPort=45564 mcastFrequency=500 mcastDropTime=3000/ Receiver className=org.apache.catalina.cluster.tcp.ReplicationListener tcpListenAddress=auto tcpListenPort=4002 tcpSelectorTimeout=100 tcpThreadCount=6/ Sender className=org.apache.catalina.cluster.tcp.ReplicationTransmitter replicationMode=pooled ackTimeout=15000/ Valve className=org.apache.catalina.cluster.tcp.ReplicationValve filter=.*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.css;.*\.txt;/ Deployer className=org.apache.catalina.cluster.deploy.FarmWarDeployer tempDir=/tmp/war-temp/ deployDir=/tmp/war-deploy/ watchDir=/tmp/war-listen/ watchEnabled=false/ ClusterListener className=org.apache.catalina.cluster.session.ClusterSessionListener/ /Cluster I found out thatwe are not using the Deployer context. It is just configured, but both Tomcats servers use a deployment path on its local storage. Has somebody an idea? Mit freundlichen Grüßen / Yours sincerely Uwe Hellmann T-Systems International GmbH Production CSS GCU Large Accounts AC Express Logistics LT1 Gradestr. 20, 30163 Hannover +49 511 333 - 1233 (Tel.) +49 511 333 - 1287 (Fax) Email: uwe.hellm...@t-systems.commailto:uwe.hellm...@t-systems.com Internet: http://www.t-systems.comhttp://www.t-systems.com/ T-Systems International GmbH Aufsichtsrat: René Obermann (Vorsitzender) Geschäftsführung: Reinhard Clemens (Vorsitzender), Dr. Ferri Abolhassan, Ulrich Meister, Georg Pepping, Hagen Rickmann, Dietmar Wendt, Klaus Werner Handelsregister: Amtsgericht Frankfurt am Main HRB 55933 Sitz der Gesellschaft: Frankfurt am Main Notice: This transmittal and/or attachments may be privileged or confidential. If you are not the intended recipient, you are hereby notified that you have received this transmittal in error; any review, dissemination, or copying is strictly prohibited. If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you. -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: sessionCookieDomain and sessionCookiePath
On 10 Nov 2011, at 13:06, Ionut Stoian isto...@tremend.ro wrote: It was a typo, i meant /. They are available also on tomcat 6.0.27: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html -- Forwarded message -- From: Pid p...@pidster.com To: Tomcat Users List users@tomcat.apache.org Date: Thu, 10 Nov 2011 09:28:15 + Subject: Re: sessionCookieDomain and sessionCookiePath On 10/11/2011 08:39, Ionut Stoian wrote: Hello, I have an application serving several subdomains (a1.domain.com, a2.domain.com etc.) and i want to be able to have a single session cookie shared between subdomains (registered on domain .domain.com). However, when using Tomcat's sessionCookieDomain (tried on versions 6.0.33, 7.0.22) i don't get the expected behaviour: 1. If i set the sessionCookiePath to \test for example i get only one JSESSIONID cookie with domain .domain.com, but the path obviously is set to /test. 2. If i set the sessionCookiePath to \, or if i don't set it at all, i get a JSESSIONID cookie with domain .domain.com and a JSESSIONID cookie with domain a1.domain.com, which is not what i expect. Why would you set it to '\' or anything that starts with '\'? sessionCookieDomain, sessionCookiePath are Servlet 3.0 (ie Tomcat 7.0) configuration directives. They won't work in Tomcat 6.0. Where did you set them? In tomcat/conf/context.xml or somewhere else? p Please don't top post. I missed that addition to 6.0. (must read release notes to see what else I missed). Can you confirm which file you set the config in? p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: JVM config for tomcat7.0.19
On 10/11/2011 22:45, Igor Cicimov wrote: JAVA_OPTS=-Xms2048M -Xmx2048M -XX:Permsize=512m -XX:MaxPermsize=512m You are allocating here 2.5GB of memory to tomcat ... how do you expect it to start on a box with 2GB in total of which only 500MB are available? +1 It's the perfect way to achieve shockingly bad performance. p On Fri, Nov 11, 2011 at 8:25 AM, Christopher Schultz ch...@christopherschultz.net wrote: Celtic, On 11/10/11 12:02 PM, celtic man wrote: So i have updated the setenv.sh with -Xms2048M -Xmx2048M -XX:Permsize=512m -XX:MaxPermsize=512m and restarted tomcat.. Where is setenv.sh located? Can you give us the full contents of that file? but when i grep for tomcat process i don't see it .. ps -ef | grep tomcat root 10959 1 19 14:57 pts/4 00:00:29 /appl/java/bin/java -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/appl/tomcat/endorsed -classpath /appl/tomcat/bin/bootstrap.jar:/appl/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/appl/tomcat -Dcatalina.home=/appl/tomcat -Djava.io.tmpdir=/appl/tomcat/temp org.apache.catalina.startup.Bootstrap start How are you starting Tomcat? Give us the exact command you are running. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: how to connect to datasource
On 09/11/2011 08:34, spike@12 wrote: Please don't top-post. Read: http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html Pay attention to the paragraph which refers to the 'validationQuery' attribute. No. I am using tomcat 6.0, java 6.0, linux system. Crikey. That changes everything. http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: SSL for modjk and tomcat
On 09/11/2011 11:20, Harsimranjit singh Kler wrote: Please don't top-post. hi Thanks for reply. There are some parameters whate they are for i saw like: : JkExtractSSL On JkHTTPSIndicator HTTPS JkSESSIONIndicator SSL_SESSION_ID JkCIPHERIndicator SSL_CIPHER JkCERTSIndicator SSL_CLIENT_CERT and JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkExtractSSL etc etc these are not helpful? They are helpful and do serve a purpose. Whether that has any bearing on your problem is a different matter altogether. You might consider explaining more clearly what you are trying to achieve. and some one post like this: http://ask.metafilter.com/53101/How-do-I-force-HTTPS-in-Tomcat-through-Apache-and-modjk is also wrong? Have you read any of the Tomcat documentation, or are you just googling? p On Wed, Nov 9, 2011 at 3:47 PM, André Warnier a...@ice-sa.com wrote: Harsimranjit singh Kler wrote: Hi I am using httpd 2.2.17 modjk 1.2.30 tomcat 6.0.I want to enable SSL in my setup. i Am able to successfully on httpd.but there is lot of confusion how to enable between httpd to AJP AJP to tomcat. There is no confusion. You can't do that. There is no SSL variant of the AJP protocol. There is not specific documentation also. For the same reason. 1) what are step for modjk configurations? 2)Is AJP support SSL? No. That should have been the first question. 3)Changes in server.xml for AJP port to support SSL requests via modjk? None, see above. Note : what you /can/ do, is to use mod_jk to pass all relevant SSL information about the original client-Apache connection, to Tomcat, via HTTP headers. Additional note : of course, if you would really must do this, you could still run the mod_jk-to-Tomcat connection over an SSL tunnel. But that would be something set up totally outside of Apache, Tomcat and their configuration. E.g. browser -- HTTPS -- apache + mod_jk - localhost:localport1 localport1 -- SSL tunnel -- remoteport1 -- remote AJP port 8009 -- Tomcat --**--**- To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.orgusers-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Clustering and session persistence across restarts?
On 7 Nov 2011, at 22:23, Al DiVenuti aloviciou...@gmail.com wrote: Hello, I am currently configuring a sandbox development environment with two clustered Tomcat 6.0.32 instances running on the same Windows XP SP3 (32-bit) hosts. I have a question regarding whether or not the Manager implementations available for a Tomcat 6 Cluster (i.e. the Delta Manager or the Backup Manager) supports Restart Persistence for sessions that enables the web application's session data to be serialized prior to shutdown or application reload and then restored when the web application is restarted as a result of the Tomcat restart or reloading of the web application. The availability of this behavior for the Standard Manager is documented quite clearly at http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html . This is a very useful feature. My review of the Tomcat documentation at http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-manager.html makes no mention of that behavior being available for the Delta Manager or the Backup Manager - but I want to be certain whether or not it is available. Serialisation to file is not available in the cluster session managers. p I am happy to provide additional information if my question is not clear. Many thanks! -Al - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problem with loading Bouncy Castle
On 08/11/2011 08:47, Jan Vávra wrote: Hello, I have a problem with loading bouncy castle. My code snippet is: int position = Security.addProvider(new BouncyCastleProvider()); KeyStore store = KeyStore.getInstance(PKCS12, BC); In the application log I have message that BouncyCastleProvider is already loaded (position== -1). But call of getInstance(.) failed with exception: java.security.KeyStoreException: PKCS12 not found Caused by: java.security.KeyStoreException: PKCS12 not found Caused by: java.security.NoSuchAlgorithmException: class configured for KeyStore(provider: BC)cannot be found Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore class JDKPKCS12KeyStore$BCPKCS12KeyStore is contained in webapps/appX/WEB-INF/lib/bcprov-ext-jdk16-146.jar In the catalina log there is a message: Nov 8, 2011 8:34:22 AM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException On the tomcat I have 2 more applications that use the same version of bcprov-ext. Each has it in own WEB-INF/lib directory. Could anybody give me an advice? Why tomcat does complaint about Illegal access? Is there any way how to debug work of org.apache.catalina.loader.WebappClassLoader? My tomcat version is: Apache Tomcat/6.0.29 1.6.0_22-b04 Sun Microsystems Inc. Linux 2.6.32.36-0.5-default amd64 Try putting the jar in tomcat/lib instead of in each webapp. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: AW: mod_jk - Browser displays HTML Sourcecode
On 08/11/2011 15:12, Alexander Diedler wrote: Hello That most probably means that the URL mappings for mod_jk are not correct, and that Apache httpd is serving that content directly. Look at (or show here) the JkMount lines that should be somewhere in your Apache configuration. Was attached in the post: JkMount /* loadbalancer So everything would be served by tomcat. At a second level, it also means that you are doing something that is really not recommended : allow Apache httpd access to the Tomcat application directories. +1 I'd go further: *never* publish a Tomcat application docBase as an HTTPD DocumentRoot. That bypasses any security that you may have in Tomcat. Your current problem is a perfect example : Apache now shows the source code of your JSP pages. Hopefully there is no secret password in there. Test : (http://www.test.de/xyz)/WEB-INF/web.xml Yes you are right, I can read the web.xml from the browser. How we can avoid it? Don't publish a Tomcat application docBase as an HTTPD DocumentRoot. Simples. p Greetings Alexander In the Apache access log: xxx.xxx.214.145 - - [08/Nov/2011:14:44:08 +0100] GET / HTTP/1.1 200 23281 ##OK xxx.xxx.214.145 - - [08/Nov/2011:14:44:11 +0100] GET /go/VV4QB69WO9F01A9KGBSYVGNVGHY6T95J HTTP/1.1 200 88572##Not ok, sorcecode displayed. In the virtual-host.conf: ## Tomcatanbindung JkMount /* loadbalancer JkOptions +ForwardURICompatUnparsed AllowEncodedSlashes On Greetings Alexander - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: o Tomcat alter the page encoding for JSP file created via Netbeans 7.01
On 05/11/2011 17:57, Kiran Badi wrote: Hi All, I am aware this might be offtopic but being a silent member to this list, I think this list can give me better suggestion than doing a google.So posting here. Unfortunately it was on someone else's topic. In future please don't just edit a reply's subject line body (which is called thread-hijacking). Start an entirely new email. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: AW: mod_jk - Browser displays HTML Sourcecode
On 08/11/2011 15:54, André Warnier wrote: But obviously it isn't, so there's something wrong with this JkMount. Jumping ahead, that bit comes next when the OP's sorted their layout out... ;) p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: how to connect to datasource
On 09/11/2011 07:00, spike@12 wrote: Hi, I have setup my application using with tomcat and it is working fine. But when I have restarted my DB machine, my application is not working. If I have restart my tomcat server then it is working fine. may I know, how to connect to datasource automatically if my DB machine is restarted?? Is it having any specific parameter to connect datasource automatically?? Please let me know. Thanks in advance. It's better to tell us precise details about your Tomcat, Java and OS version when asking a question. I'll assume 7.0. A validation query may help. Note: restarting a DB while the application server is up is often prone to problems. Read: http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html Pay attention to the paragraph which refers to the 'validationQuery' attribute. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Custom Standard Classloader
On 4 Nov 2011, at 11:24, Paul Wilson paulalexwil...@gmail.com wrote: Hi there, I'd like to specify a custom implementation of 'StandardClassLoader' for Tomcat 6. Why? I've written such an implementation of 'org.apache.catalina.loader.StandardClassLoader' and dropped it onto the classpath What does the above mean, exactly? Sounds like that's what broke it. p (using the Eclipse launch configuration). However, I get an error: java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina It seems that only the lib/* jars are available at this point in time, and not bootstrap.jar. What's the correct way to override the StandardClassLoader? Regards, Paul - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Session expiration - browser -Web application
On 4 Nov 2011, at 19:24, Tim Watts t...@cliftonfarm.org wrote: Léa, Life needn't be this difficult. :-) You're reinventing wheels here instead of understanding how the wheels you already have work. Again, read the spec. Pretty please. So many questions will be answered. +1 JSP != PHP The Servlet Container (Tomcat) provides a great deal of functionality for you. http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html p On Fri, 2011-11-04 at 11:55 -0700, Léa Massiot wrote: @Christopher : Thank you for your answer. Christopher wrote: The new session created is completely empty. It has nothing to do with the user going back in the history, etc. No, you are right. What I meant is that I was/am managing session expiration inside the Webapp (for instance if the user clicks a button which is inside the Webapp and if the session has expired, I redirect him to the log in page). Christopher wrote: I always try to have enough information in the page (form) so that resuming a workflow after a session timeout is a possibility. I'm sorry but I do not understand what you are explaining me here... A SOLUTION... I THINK. I have found a solution, here it is: for all the JSPs which require a user to be identified (*), I add the following code: Better solution is to check whether the user principle is set. The spec will explain this. % ASessionAttribute aSessionAttribute = null; HttpSession httpSession = null; httpSession = request.getSession(); aSessionAttribute = (ASessionAttribute) httpSession.getAttribute(aSessionAttribute); if(aSessionAttribute == null) { response.sendRedirect(the-log-in-page.jsp); } % Then if a user presses the F5 key and if the session has expired, he is properly redirected to the log in page. Best regards, -- Léa (*) That is to say, in my example, the aSessionAttribute object musn't be null. - 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: IPv6 question
On 31 Oct 2011, at 14:47, Jeffrey Janner jeffrey.jan...@polydyne.com wrote: -Original Message- From: Issac Goldstand [mailto:mar...@beamartyr.net] Sent: Monday, October 31, 2011 6:40 AM To: users@tomcat.apache.org Subject: IPv6 question Hi Tomcat community I'm planning to give a short blurb on IPv6 support in Tomcat at ApacheCon next week, but as I'm not a heavy Tomcat user, can someone go over the following information and correct me if I've mis-stated something? * IP binding is handled by the underlying JRE or via APR if tcnative is used * If Connector only specifies a port, then addresses 0.0.0.0 AND :: are assumed [Jeff Janner] I'm not sure the above applies for APR, I've never gotten it to work (at least not on Windows). It appears that APR defaults to IPV6 if no address is given. If you look back in this list for about a year to year a half, you'll see much discussion on this. I am not positive that this has not been addressed yet, as I've resorted to specifying address='0.0.0.0' in all my connectors since I ran into the problem. Give it a test and see. I think you are correct however for the JRE-based connectors. -Djava.net.preferIPv4Stack p * Otherwise, specify address parameter: - IPv4 as x.x.x.x - IPv6 as [x:x::x] Sample config: File: server.xml Connector port=8080 address=85.195.98.140 address=[2a01:7a0:3:200::2:2] protocol=HTTP/1.1 ... / Also, if there are any other points that bear mentioning, I'd be happy to add them. Thanks, Issac - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org __ Confidentiality Notice: This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system. - 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: cannot read complete HTTP request body. It reads only 8192 characters
On 1 Nov 2011, at 01:43, Anantaneni Harish anantaneni.ha...@vertexsoft.com wrote: Any thoughts about this? Only one. Why doesn't request.getParameterXxxx work for you? p Thanks and Regards, Harish -Original Message- From: Anantaneni Harish Sent: Monday, October 31, 2011 11:23 AM To: Tomcat Users List Subject: RE: cannot read complete HTTP request body. It reads only 8192 characters String keyValuePair = null; String[] arrKeyValue = null; BufferedReader in = request.getReader(); while ((keyValuePair = in.readLine()) != null) { arrKeyValue = keyValuePair.split(=); Above code reads incomplete data(read only 8192 bytes) at my customer's environment, but reads complete data in my environment. String keyValuePair = null; String[] arrKeyValue = null; BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream())); while ((keyValuePair = in.readLine()) != null) { arrKeyValue = keyValuePair.split(=); Above code reads complete data in both the environments. *no changes done to customer's environment. I hope you can help me now by finding the reason for data lost at my customer's environment when using request.getReader(). Thanks and Regards, Harish -Original Message- From: André Warnier [mailto:a...@ice-sa.com] Sent: Friday, October 28, 2011 9:08 PM To: Tomcat Users List Subject: Re: cannot read complete HTTP request body. It reads only 8192 characters Konstantin Kolinko wrote: 2011/10/27 Christopher Schultz ch...@christopherschultz.net: On 10/27/2011 4:58 AM, Anantaneni Harish wrote: Thanks for the directions the Rainer. Actually the issue is just solved. We have changed from BufferedReader in = request.getReader(); to BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream())); Now whole body has been read at my client's environment as well. But would like to know, what causes the issue. Do you have any idea, why same method can read whole data in my environment and does not read whole data at my customer's environment? You'll have to provide more information, such as the code you are using. I'm fairly sure Tomcat is not the source of the problem. +1. I think you need to pay more attention on the documentation of the java.io.Reader#read() method, or maybe look for a tutorial. See also documentation for java.io.InputStream#available(). In short: the read() method returns a portion of data that is currently available. If you need more data you must call read() repeatedly in a loop until it returns -1. .. and the difference between two systems, may be that on one system, the network is faster (or the system slower, or the buffer bigger) and so by the time you do the read, there are more bytes available in the buffer. If you had provided some of your source code that performs reading, we would be able to point at the exact error in your code. - 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: Compile, build and prepare Webapp for Tomcat in command line
On 1 Nov 2011, at 11:34, Léa Massiot lmhe...@orange.fr wrote: @Christopher : Thank you for your answer. I wouldn't mind using Maven instead of Ant... yet it doesn't look like I can a find a nice and simple (hello world) example to get started with it (like the one I found for Ant, cf. the link in my previous post)... Actually, I managed to build my Webapp for Tomcat using Ant yesterday... @Terence : Thank you for pointing me to this build.xml example file. www.gradle.org - best of Ant and Maven, less of the trauma. p Best regards, -- Léa -- View this message in context: http://old.nabble.com/Compile%2C-build-and-prepare-Webapp-for-Tomcat-in-command-line-tp32752945p32758026.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 5.5.26 running 'select_user' for every transaction
On 02/11/2011 16:23, David Kirtland wrote: It isn't something obvious built into our webapp, but it would seem to be a method we are calling in the jdbc driver. There is no record of a 'select_user' anywhere when doing a grep, but our Java developers have found the issue now. The code wasn't changed between versions which is odd seeing as the issue only arose on the newer version - and I have replicated this. Anyway, they are now going to work around the issue, not calling that method any more. If I find the exact method it is off them I will re-post. Not calling which method? On which driver? How much other old code/libraries are you using, if you're using a 3 year old Tomcat? p Thanks Dave Kirtland Systems Administrator dkirtl...@epitiro.com www.epitiro.com T. +44 (0)2920 433 693 F. +44 (0)2920 433 699 -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: 02 November 2011 16:01 To: Tomcat Users List Subject: Re: Tomcat 5.5.26 running 'select_user' for every transaction David, On 11/2/11 11:30 AM, David Kirtland wrote: Since upgrading from Tomcat 5.5.20 to 5.5.26 (Debian Etch to Lenny - apt versions) we are seeing a 'select_user' query to the database for every single transaction. This is in addition to a 'select 1' (the configured validationQuery). Obviously this is a big overhead which I don't see that we need. If anyone can shed some light on what this is doing and why it's there (and ideally if we can turn it off) that would be very helpful! I've searched through the docs and can't really find any reference to it. Have you tried: $ grep -i select_user `find src -type f` ?? Tomcat itself is definitely not doing this to you. -chris - 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 -- -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: Rollback in Tomcat7 under parallel deployment
On 29/10/2011 12:41, chris derham wrote: Also, what happens if ROOT##001 and ##002 have the same log4j configs and are writing to the same log file?? How have people handled this situation? You'll certainly end up with both apps writing to the same file. Whether or not that is a problem will depend on exactly how you have configured logging. Is it possible to pick up the name of the war file (or version number) so that you can log to different files? So instead of ${catalina.base}\logs\myapp.txt I could use ${catalina.base}\logs\myapp-${applicationName}.txt say ${applicationName} which would be replaced with ROOT##001, making the log file catalina_base\logs\myapp-ROOT##001.log? Basically I am trying to ask does such a variable exist, and if so what is its name? The catalina.base variable works because it's a system property. There's no applicationName variable. p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: context.xml not being read
On 28 Oct 2011, at 02:07, jilen jilen.zh...@gmail.com wrote: On 10/28/2011 06:45 AM, Rajkumar Singh wrote: Hi Chuck, Once again appreciate your response. What I did was I created a WAR file and dropped it under the tomcat webapps folder and started it. This helped in overcoming my problem. This process created conf/Catalina/[host]/[appName].xml and copied all the property from my local META-INF/context.xml into the new [appName].xml. This helped the tomcat in reading all the environment variables. Thank you everyone who replied to my mail. Please keep up the good work. Thanks Raj From: Caldarale, Charles Rchuck.caldar...@unisys.com To: Tomcat Users Listusers@tomcat.apache.org Date: 10/27/2011 05:55 PM Subject: RE: context.xml not being read From: Rajkumar Singh [mailto:rajkumar.si...@digitas.com] Subject: Re: context.xml not being read If the context.xml file is being ignored then why the variable that I have defined in the server.xml is not being read? Should I delete the META-INF/context.xml file completely? Having aContext element in server.xml is strongly discouraged these days. Better to keep it in META-INF/context.xml of the webapp, or in conf/Catalina/[host]/[appName].xml. Regardless, you must have it in only one place; having it in multiple places means the behavior is undefined. Note that if you want to define the default webapp, it should be named ROOT (case sensitive). You must not use path attribute when theContext element is in META-INF/context.xml or in conf/Catalina/[host]/[appName].xml. Read the docs on theContext element for more details. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Disclaimer The information in this email and any attachments may contain proprietary and confidential information that is intended for the addressee(s) only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, retention or use of the contents of this information is prohibited. When addressed to our clients or vendors, any information contained in this e-mail or any attachments is subject to the terms and conditions in any governing contract. If you have received this e-mail in error, please immediately contact the sender and delete the e-mail. This is the question i've asked before in org.apache.catalina.startup.HostConfig.deployWAR(ContextName, File, String) i found some code like these context.setName(cn.getName()); context.setPath(cn.getPath()); context.setWebappVersion(cn.getVersion()); context.setDocBase(file); ... name and path attribute are override with the war name *So these attribute are not work. * Seems like they work like tgey're supposed to, to me. p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: HOW TO detect what app server you're running in
On 26 Oct 2011, at 12:47, Konstantin Kolinko knst.koli...@gmail.com wrote: Note, that this method is unreliable. 1) The actual value can be configured by server administrator. 2) There are 3-rd party repackaged distributions of Tomcat, which may/should change the value. It would be better to rely on presence of certain features that you are going to use, or let the user configure your webapp. It Best regards, Konstantin Kolinko 2011/10/25 Bob DeRemer bob.dere...@thingworx.com: Yeah, that should do it - should have remembered that - I'm already using this - purely for diagnostic info. Thanks, guys! -Original Message- From: Ronald Klop (Mailing List) [mailto:ronald-mailingl...@base.nl] Sent: Tuesday, October 25, 2011 7:39 AM To: Tomcat Users List Subject: Re: HOW TO detect what app server you're running in Does this help? public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println(serverinfo: + getServletContext().getServerInfo()); } Ronald. Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer bob.dere...@thingworx.com: I may need to use some Tomcat-specific code in my web app. As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic. If anyone knows how best to do this, ideally with some sample java code, that'd be great. Thanks, Bob - 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: cannot read complete HTTP request body. It reads only 8192 characters
On 26 Oct 2011, at 06:31, Anantaneni Harish anantaneni.har...@vertexsoft.com wrote: We have an environment using HTTP connector, customer environment using AJP connector. In HTTP environment this issue is not occured. but in the AJP environment cannot read complete HTTP request body. It reads only 8192 characters Can some help me, if there are any settings to be changed? Yes, there are. (Hint: give us some real info* and we'll return the favour) p * e.g. Exact OS, Java, Tomcat versions. Thanks and Regards, Harish - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat clustering session attribute is changed without request
On 24/10/2011 11:55, Hodchenkov, Paul wrote: Hi all, I have configured tomcat 7 cluster by using [1] with DeltaManager and it works fine. However I have the following 2 questions: 1) My application stores session map in memory(admin can force logout of any user and change some session attribute). Will this session attribute be replicated if it is changed without tomcat http request (changed by backend task for example)? What does 'stores session map in memory' actually mean? Instead of copying session objects around the place, why not just use the JMX API and the operations on the Manager MBean? Catalina:type=Manager,context=/myapp,host=localhost p 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can solve the problem with http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html Best Regards, Paul Hodchenkov Senior Java developer, Oxagile Skype: paul.hodchenkov Email: mailto:paul.hodchen...@oxagile.com signature.asc Description: OpenPGP digital signature
Re: deploy tomcat quietly and automatically
On 24/10/2011 10:46, Josh Ho wrote: Dears I wanna deploy tomcat on many windows servers. A binary source has been chosen (apache-tomcat-6.0.29.exe). Is there a way to deploy it quietly and automatically like JDK(such as : jdk-6u24-windows-x64.exe /quiet) Why not pick the zip version just unzip it (quietly)? p signature.asc Description: OpenPGP digital signature
Re: Tomcat clustering session attribute is changed without request
On 24/10/2011 14:05, Hodchenkov, Paul wrote: Hi, Thanks for the reply! - What does 'stores session map in memory' actually mean? It's ConcurrentMapString, HttpSession map which is filled by HttpListener. I can access session attributes of any user using this approach. Does changes to attributes in HttpSession cause a replication in this case? Don't know, probably. What is the benefit of using JMX connection to access the session instead of HttpListener in this case? It means you don't have to jump through hoops to access something that is already accessible elsewhere. p -Original Message- From: Pid [mailto:p...@pidster.com] Sent: Monday, October 24, 2011 3:59 PM To: Tomcat Users List Subject: Re: Tomcat clustering session attribute is changed without request On 24/10/2011 11:55, Hodchenkov, Paul wrote: Hi all, I have configured tomcat 7 cluster by using [1] with DeltaManager and it works fine. However I have the following 2 questions: 1) My application stores session map in memory(admin can force logout of any user and change some session attribute). Will this session attribute be replicated if it is changed without tomcat http request (changed by backend task for example)? What does 'stores session map in memory' actually mean? Instead of copying session objects around the place, why not just use the JMX API and the operations on the Manager MBean? Catalina:type=Manager,context=/myapp,host=localhost p 2) It's seems that expireSessionsOnShutdown=false in DeltaManager can solve the problem with http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html? [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html Best Regards, Paul Hodchenkov Senior Java developer, Oxagile Skype: paul.hodchenkov Email: mailto:paul.hodchen...@oxagile.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org signature.asc Description: OpenPGP digital signature
Re: URI mapping
On 22/10/2011 23:37, Eldon Olmstead wrote: On 2011-10-22 5:57 PM, Pid wrote: On 22/10/2011 17:42, Eldon Olmstead wrote: Thanks for the response Mark, Ok so if I want to keep mod_jk as part of this, ( it is what we use at work ), then if I understand right, I have no choice but to make tomcat support /tomcat7/ in the path. Do I do this just by moving all the webapps under webapps/tomcat7/? No. The appBase (the 'webapps' dir in your case) is not a document root like HTTPD, it is the location for your apps - their published paths are based on their names (usually). You would have rename the applications, from: tomcat/webapps/app1.war - http://host/app1 tomcat/webapps/app2.war - http://host/app2 to: tomcat/webapps/tomcat7#app1.war - http://host/tomcat7/app1 tomcat/webapps/tomcat7#app2.war - http://host/tomcat7/app2 The '#' in the name is translated to a '/' in the path. OK, so what about the folders that come with Tomcat then? Like ROOT, manager, and host-manager? Do I jar those up and name them as tomcat7#ROOT.war, tomcat7#manager.war, and tomcat7#host-manager.war? ROOT is the special name for the default application. Changing it's name to tomcat7#ROOT would remove the default app create a new one on path: /tomcat7/ROOT Not what you want. If the apps are exploded .WAR files (ie, directories) just renaming the directories as above would be enough. Having said that: you either need to use mod_proxy so you can map URLs to non-matching app paths, or put a JkMount line in for each web app. You're making your life unnecessarily difficult. I just tried creating wars for the above but that doesn't work. What doesn't? Be precise, please. Tomcat's access log is showing apache is passing on the request: 127.0.0.1 - - [22/Oct/2011:18:27:06 -0300] GET /tomcat7 HTTP/1.1 404 - The above probably doesn't work because you don't have an app called 'tomcat7'. 127.0.0.1 - - [22/Oct/2011:18:27:14 -0300] GET /tomcat7/ROOT HTTP/1.1 404 - ( tried this just in case ) It's not clear what you've actually done. 127.0.0.1 - - [22/Oct/2011:18:27:21 -0300] GET /tomcat7/manager HTTP/1.1 404 - That is the expected result: try '/tomcat7/manager/html' p The apps aren't being found. p Will I have to make other configuration changes? What is the right way to do this? The way we have it at work is that each tomcat worker is pointing to one developer's tomcat installation for the developer to do with as they need. On 2011-10-22 1:17 PM, Mark Thomas wrote: On 22/10/2011 17:11, Eldon Olmstead wrote: Hello, I'm using the following Apache2.2 mod_jk 1.2.32 Tomcat 7.0.21 I am trying to understand how to configure Apache to allow access to Tomcat via mod_jk. I have already made some progress, but have got stuck on one point. Currently, I can access Apache at http://localhost ( works ) I can also access tomcats default wepapp and the manager and host-manager via http://localhost:8080/ http://localhost:8080/manager http://localhost:8080/host-manager What I want to do next it to connect Apache to Tomcat via mod_jk such that the following URLs work http://localhost/tomcat7/ ( default tomcat webapp) http://localhost/tomcat7/manager http://localhost/tomcat7/host-manager I have updated the workers.properties with: worker.list=tomcat7 worker.tomcat7.type=ajp13 worker.tomcat7.host=localhost worker.tomcat7.port=8809 I have added the the following in my http-jk.conf that I include in http.conf: JkMount /tomcat7/* tomcat7 When I try to access http://localhost/tomcat7, tomcat is given the URI /tomcat7/ 127.0.0.1 - - [22/Oct/2011:11:34:20 -0300] GET /tomcat7/ HTTP/1.1 404 979 So from the above log, I know that apache is forwarding the requests to tomcat via mod_jk ok, but tomcat now thinks that /tomcat7/ is now part of the request and since there is no tomcat7 web app, it doesn't match the request. I would like http://localhost/tomcat7/ to map to the root of my Tomcat, and to be able to access http://localhost/tomcat7/manager, http://localhost/tomcat7/host-manager. What do I do next? If you want to modify the URL, you'll need to use mod_proxy. Then you can do: ProxyPass /tomcat7 http://localhost:8080 or ProxyPass /tomcat7 ajp://localhost:8080 Note that as soon as you start modifying the URL as part of the ProxyPass you open up a world of opportunity for things to go wrong (redirects, cookie paths, links). All of these are fixable but it is a lot easier just to use the same URL structure in both httpd and Tomcat. 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
Re: tomcat error 404
On 23 Oct 2011, at 17:21, Dave Filchak sub...@zuka.net wrote: Ok, perhaps this will be more helpful. To follow is the way the db connection is set up now, and I am not sure it is correct because, as I understand it, you are supposed to add a context to the server.xml ... not recommended in the last 2 major versions of Tomcat. file defining the db connection through jdbc/mysql ( which I am not sure of the format yet ), either in the main system one or the application specific one, OR to the META-INF/content.xml file, You mean 'context.xml' of course. which I do not have. What I do have is this, in my application directory at /home/XX/public_html/WEB-INF/conf/environment.xml: That is not a Tomcat file. Could it be an application specific file? jdbc-config drivercom.mysql.jdbc.Driver/driver urljdbc:mysql://###.###.###.###:3306/###_exodus/url user#_exodus/user password#/password max10/max init10/init queueQueryselect now()/queueQuery logFile/home/#/public_html/WEB-INF/logs/pool.txt/logFile /jdbc-config Logging inside the api action is generally considered to be A Bad Idea. When I modify theurl, it does show up in the error that is generated so the app snip Error initializing sub-systems: Please check the following: 1. That your machine has a valid connection to jdbc:mysql://localhost/_exodus Using: Username: _exodus Password: ## Driver: com.mysql.jdbc.Driver The stacktrace below indicates that the JavaMail libs are missing. They would either be in your apps WEB-INF/lib or tomcat/lib. In an old Tomcat it might have been in tomcat/common/lib or tomcat/shared/lib. p *DETAILS FOLLOW:* java.lang.Exception: Unable to Initialize Environment: java.lang.NoClassDefFoundError: javax/mail/Address at com.snapmedia.degrassi.base.BroadcastSystem.(Unknown Source) at com.snapmedia.degrassi.base.BroadcastSystem.(Unknown Source) at com.snapmedia.SystemController.init(SystemController.java:86) at com.snapmedia.WebSystemController.init(WebSystemController.java:39) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:219) Caused by: java.lang.ClassNotFoundException: javax.mail.Address at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284) ... 25 more I have verified that thew username and password are correct by logging into the MySQL server from the command line. Something with the driver? Dave On 22/07/64 2:59 PM, André Warnier wrote: Hi. One thing at a time.. 1) When you send XML configuration files, please remove everything that is a comment. XML files are already being wrapped by the email program, and are difficult to read as it is. Having plenty of comments in them in addition makes is really a hassle to figure out what is being used or not. (Note: an XML comment is anything between a pair of !-- and -- ) 2) one error message below talks about an invalid XML file. Inside one of the comments (between a leading !-- and a trailing --), there is another pair of -- . That is incorrect and causes the entire file to be rejected/ignored. Inspect that file carefully, remove the offending --, and try again. (Note: the extra -- may also be due to a previous bad edit of the file. It may have been a !-- or
Re: : tomcat error 404
On 23/10/2011 19:57, Dave Filchak wrote: My environment.xml file @ /home/##/public_html/WEB-INF/conf/ Once again: this is not a Tomcat configuration file, it's application specific. p signature.asc Description: OpenPGP digital signature
Re: : tomcat error 404
Don't put a Context in server.xml. That is a massive can of worms all on its own. On 23/10/2011 19:57, Dave Filchak wrote: Context path='' docBase='/home/#/public_html/' debug='0' Resource name=jdbc/exodus auth=Container type=javax.sql.DataSource username=#_# password=# driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/#_#?useUnicode=trueamp;characterEncoding=utf8 maxActive=15 maxIdle=7 defaultTransactionIsolation=READ_COMMITTED validationQuery=Select 1 / / The above won't work, it should really stop Tomcat from starting. Wrong: Context Resource ... / / Right: Context Resource ... / /Context p signature.asc Description: OpenPGP digital signature
Re: : tomcat error 404
On 23/10/2011 19:57, Dave Filchak wrote: description Please contact Nick should any questions or issues arise about this application. /description Have you tried contacting 'Nick'? p signature.asc Description: OpenPGP digital signature
Re: : tomcat error 404
On 23/10/2011 19:57, Dave Filchak wrote: I know this is probably screwed up now so I appreciate the help I have had so far and would seriously appreciate any input as to how to straighten this out and get the connection to the database functional. I really need to get the site up and running today. Thanks for your consideration and your time. What do the logs say? We don't know what's wrong this time. p signature.asc Description: OpenPGP digital signature
Re: URI mapping
On 23/10/2011 20:51, Mark Eggers wrote: - Original Message - From: André Warnier a...@ice-sa.com To: Tomcat Users List users@tomcat.apache.org Cc: Sent: Sunday, October 23, 2011 5:08 AM Subject: Re: URI mapping Let's restart from the beginning. You have, say, 3 Tomcat servers running, and for the sake of the example let's say that these are - a Tomcat 5.x server - a Tomcat 6.x server - a Tomcat 7.x server You want to run the same applications on all of them (with identical names on each server), because for instance these are test servers serving to verify that a given application runs fine under each of these Tomcat versions. You want to be able to choose which Tomcat server you are accessing, by means of some URI prefix. Example : a request with URI http://myhost/tomcat7/webapp1; should be forwarded to webapp1 on Tomcat7, while a request with URI http://myhost/tomcat5/webapp1; should be forwarded to Tomcat5. Of course, once inside the respective Tomcat, you want this prefix to have been removed, so that the applications inside this Tomcat look similar to the same ones in other Tomcats, name-wise. Example : a request with URI http://myhost/tomcat7/webapp1; should be forwarded to webapp1 on Tomcat7, whith a request URI of /webapp1 (and not /tomcat7/webapp1). For this, you set up a front-end proxy Apache httpd, which should forward the requests to individual Tomcats in function of the URI prefix, and strip this prefix while doing so. Preferably, you would like to do the proxying via mod_jk. That is a problem, because the standard proxying instructions of mod_jk (JkMount e.g.), do not provide a syntax for forwarding URI's, and modifying these URIs at the same time. That is why Mark originally oriented you to mod_proxy and mod_proxy_ajp, which can do that, for example as : ProxyPass /tomcat7 ajp://tomcat7-host:8017 ProxyPass /tomcat6 ajp://tomcat6-host:8016 ProxyPass /tomcat5 ajp://tomcat7-host:8015 (and have each Tomcat listen on the apropriate port with its AJP Connector) Using the above, a request with URI http://myhost/tomcat7/webapp1; will be forwarded to the tomcat7 server with a URI of /webapp1, while a request with URI http://myhost/tomcat5/webapp1; will be forwarded to the tomcat5 server with a URI (also) of /webapp1. As far as I understand, this is what you want to achieve (although it is not via mod_jk, but via mod_proxy_ajp instead). Mark however pointed out the drawbacks of modifying the URI : when one of these applications generates a self-referencing URI, it will not by default re-insert the stripped host prefix. For example, if application /webapp1 on tomcat7 creates a page with a link to itself like href=/webapp1/something, it will not magically know to make this into href=/tomcat7/webapp1/something. And when this link is clicked in the browser, it will generate a request to http://myhost/webapp1/something;, and the above Proxy instructions in the front-end won't know what to do with it and will ignore it. And the same happens with redirects etc.. You can overcome this, but it is likely in the end to create more hassle than you really want. On the other hand, if you do /not/ modify the URI while proxying the call, then you end up with a much less easy configuration on the side of the Tomcats, as you have seen before. So maybe let's look at another kind of solution, involving DNS and VirtualHosts. Would a solution whereby you access the different Tomcats as follows be acceptable ? - http://myhost-tomcat7.company.com/webapp1 is forwarded to tomcat7's webapp1 - http://myhost-tomcat6.company.com/webapp1 is forwarded to tomcat6's webapp1 - http://myhost-tomcat5.company.com/webapp1 is forwarded to tomcat5's webapp1 If yes, then do as outlined below. For a start, I suppose that you want to have an Apache httpd front-end, and that the Apache httpd and all tomcats, all run on the same physical host. Step 1 : Suppose that the front-end Apache httpd host is currently known via DNS as myhost.company.com. Define 3 additional DNS aliases for it : - myhost-tomcat7.company.com - myhost-tomcat6.company.com - myhost-tomcat5.company.com Step 2 : define 3 new VirtualHost's in the Apache httpd front-end, one each with - ServerName myhost-tomcat7.company.com - ServerName myhost-tomcat6.company.com - ServerName myhost-tomcat5.company.com (I assume that you know how to do that) Step 3 : In each of these VirtualHost configurations, add the following lines : - in the myhost-tomcat7.company.com host, add ProxyPass / ajp://myhost-tomcat7.company.com:8017 ProxyPassReverse / ajp://myhost-tomcat7.company.com:8017 (and similarly for the other VirtualHost's) Step 4 : make each of your Tomcats listen on the corresponding AJP port : - tomcat7 listens on port 8017 - tomcat6 listens on port 8016 - tomcat5 listens on port
Re: : tomcat error 404
On 24/10/2011 00:07, Caldarale, Charles R wrote: From: Dave Filchak [mailto:sub...@zuka.net] Subject: Re: Re: : tomcat error 404 So where should the Context be? Apparently, you haven't read the 5.5 docs. To quote: Apparently I'm rusty too... :s p For Tomcat 5, unlike Tomcat 4.x, it is NOT recommended to place Context elements directly in the server.xml file. Context elements may be explicitly defined: In the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps. In the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host. In individual files (with a .xml extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. Only if a context file does not exist for the application in the $CATALINA_HOME/conf/[enginename]/[hostname]/; in an individual file at /META-INF/context.xml inside the application files. The META-INF/context.xml location is the usual, when you're packaging a webapp up for distribution. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. signature.asc Description: OpenPGP digital signature
Re: : tomcat error 404
On 24/10/2011 00:18, Dave Filchak wrote: I upload the JavaMail and JAF libs to /home/##/public_html/WEB-INF/lib/ and added them to my $CLASSPATH I now get the following: How did you add them to the classpath? Tomcat automatically loads Jars resources found in its various lib classes directories, so don't do that... p Error initializing sub-systems: Please check the following: 1. That your machine has a valid connection to jdbc:mysql://localhost:3306/#_exodus Using: Username: #_exodus Password: # Driver: com.mysql.jdbc.Driver *DETAILS FOLLOW:* java.lang.Exception: Unable to Initialize Environment: java.lang.NoClassDefFoundError: javax/mail/Address at com.snapmedia.degrassi.base.BroadcastSystem.(Unknown Source) at com.snapmedia.degrassi.base.BroadcastSystem.(Unknown Source) at com.snapmedia.SystemController.init(SystemController.java:86) at com.snapmedia.WebSystemController.init(WebSystemController.java:39) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:219) Caused by: java.lang.ClassNotFoundException: javax.mail.Address at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284) ... 25 more which is a different error but seemingly still to do with mail? Dave On 23/10/11 6:34 PM, Pid wrote: On 23/10/2011 23:32, Dave Filchak wrote: The logs, at least the catalina.err and catalina.out files do not say anything much, at least as far as an error goes. I cannot find any other log files specific only to this app so they appear not to be working. I only see this in catalina.err in the last while: Oct 23, 2011 2:59:10 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: /include/../../include/system-checkup.jsp(2,0) The value for the useBean class attribute com.snapmedia.WebSystemController is invalid. If that class/servlet didn't start because the JavaMail libs are missing that would explain why you can't use it. p at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148) at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1204) at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1117) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:) at org.apache.jasper.compiler.Node$Root.accept(Node.java:457) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2240) at org.apache.jasper.compiler.Node$IncludeDirective.accept(Node.java:598) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216
Re: Undeploy fails with Tomcat 7 manager application
On 22/10/2011 12:38, Mike wrote: Mark Thomas markt at apache.org writes: Where is the log file created? Why are you trying to delete it? Mark The logfile is created within the application deployed to the webapps directory of tomcat (and there within [applicationName]\resources\log). I am not trying to delete it. However, when issuing the redeploy command with maven the problem appears (The continued presence of this file may cause problems.) and the application cannot be redeployed. Even when trying to undeploy the application via the tomcat manager (via the manager gui button undeploy) it cannot be undeployed completely. Only the war file and all application files except the log file are removed. Only when stopping tomcat can the application be completely removed. After starting tomcat again I can deploy again successfully. Writing the log file (or any file) inside the app isn't such a good idea. Try putting it in the tomcat/logs directory. p signature.asc Description: OpenPGP digital signature
Re: URI mapping
On 22/10/2011 17:42, Eldon Olmstead wrote: Thanks for the response Mark, Ok so if I want to keep mod_jk as part of this, ( it is what we use at work ), then if I understand right, I have no choice but to make tomcat support /tomcat7/ in the path. Do I do this just by moving all the webapps under webapps/tomcat7/? No. The appBase (the 'webapps' dir in your case) is not a document root like HTTPD, it is the location for your apps - their published paths are based on their names (usually). You would have rename the applications, from: tomcat/webapps/app1.war - http://host/app1 tomcat/webapps/app2.war - http://host/app2 to: tomcat/webapps/tomcat7#app1.war - http://host/tomcat7/app1 tomcat/webapps/tomcat7#app2.war - http://host/tomcat7/app2 The '#' in the name is translated to a '/' in the path. p Will I have to make other configuration changes? What is the right way to do this? The way we have it at work is that each tomcat worker is pointing to one developer's tomcat installation for the developer to do with as they need. On 2011-10-22 1:17 PM, Mark Thomas wrote: On 22/10/2011 17:11, Eldon Olmstead wrote: Hello, I'm using the following Apache2.2 mod_jk 1.2.32 Tomcat 7.0.21 I am trying to understand how to configure Apache to allow access to Tomcat via mod_jk. I have already made some progress, but have got stuck on one point. Currently, I can access Apache at http://localhost ( works ) I can also access tomcats default wepapp and the manager and host-manager via http://localhost:8080/ http://localhost:8080/manager http://localhost:8080/host-manager What I want to do next it to connect Apache to Tomcat via mod_jk such that the following URLs work http://localhost/tomcat7/ ( default tomcat webapp) http://localhost/tomcat7/manager http://localhost/tomcat7/host-manager I have updated the workers.properties with: worker.list=tomcat7 worker.tomcat7.type=ajp13 worker.tomcat7.host=localhost worker.tomcat7.port=8809 I have added the the following in my http-jk.conf that I include in http.conf: JkMount /tomcat7/* tomcat7 When I try to access http://localhost/tomcat7, tomcat is given the URI /tomcat7/ 127.0.0.1 - - [22/Oct/2011:11:34:20 -0300] GET /tomcat7/ HTTP/1.1 404 979 So from the above log, I know that apache is forwarding the requests to tomcat via mod_jk ok, but tomcat now thinks that /tomcat7/ is now part of the request and since there is no tomcat7 web app, it doesn't match the request. I would like http://localhost/tomcat7/ to map to the root of my Tomcat, and to be able to access http://localhost/tomcat7/manager, http://localhost/tomcat7/host-manager. What do I do next? If you want to modify the URL, you'll need to use mod_proxy. Then you can do: ProxyPass /tomcat7 http://localhost:8080 or ProxyPass /tomcat7 ajp://localhost:8080 Note that as soon as you start modifying the URL as part of the ProxyPass you open up a world of opportunity for things to go wrong (redirects, cookie paths, links). All of these are fixable but it is a lot easier just to use the same URL structure in both httpd and Tomcat. 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 signature.asc Description: OpenPGP digital signature
Re: Tomcat application startup - Lifecycleexception
On 21/10/2011 00:26, ramsri wrote: I now know that there is no longer a need to mess around with setclasspath.sh. I'm not sure there ever was. p signature.asc Description: OpenPGP digital signature
Re: JAR locked in Tomcat after using addUrl to dynamically add JAR to running webapp
On 20/10/2011 18:18, Bob DeRemer wrote: Hi Tomcat Community: BACKGROUND: I have a Servlet-based WEBAPP that is running in Tomcat7, JDK 1.6.0_27 on Windows Server 2008 R2 64-bit - all 64-bit. We make use of class.newInstance quite a bit as we have a fairly modular, interface-based system, and create class instances on the fly. As part of our extensibility, I'm also using a pretty well documented hack [The code is listed below] for dynamically adding JAR(s) so they are accessible immediately without stopping our WEBAPP or the actual Tomcat server process. This process has worked great for both JAR(s) in the WEB-INF/lib and for ones we dynamically added - until you try and stop the WEBAPP via the Tomcat manager app. PROBLEM: This solution for dynamically loading JARs worked great as long as we start/stop the actual Tomcat server process, but I found out the JAR(s) that I have been dynamically loading this way are not released when you stop the WEBAPP. I am using SysInternals Process Explorer to monitor the open file handles of the Tomcat7 process. I can see that when I stop the WEBAPP, the dynamically loaded JAR is still referenced. QUESTION: I made an assumption that calling Thread.currentThread().getContextClassLoader() would provide me the classloader of my WEBAPP - which should be the same classloader that all the JARs in the WEB-INF/lib are in. We control the WEBAPP, so I assumed this was a safe assumption. The usage of the dynamically loaded JAR(s) is no different than the default JAR(s) in WEB-INF/lib. None of the WEB-INF/lib JARs are left open when we stop the WEBAPP - only the JAR(s) that are loaded via the addUrl approach below. I have been through a number of online articles when I first created this logic - including a PDF by Ted Neward [while at Developmentor] that described these approaches, but am not sure how to troubleshoot this further now. If anyone has an answer or any suggestions, I would greatly appreciate it. Do you have 'antiJarLocking' enabled on the Context? p Thanks in advance, Bob Code to dynamically load JAR(s): public static void loadJarOnTheFly(File jarFile) throws IOException { Class?[] parameters = new Class[]{URL.class}; // IMPORTANT: MUST use the webapp classloader - so derived extension classes can resolve their base classes ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); // cast to a URL class loader so we can additional JAR(s) to the search path URLClassLoader webappClassLoader = (URLClassLoader)contextClassLoader; Class? sysclass = URLClassLoader.class; try { URL jarUrl = jarFile.toURI().toURL(); Method method = sysclass.getDeclaredMethod(addURL, parameters); method.setAccessible(true); method.invoke(webappClassLoader, new Object[]{ jarUrl }); } catch (Throwable t) { throw new IOException(Error, could not add URL to system classloader); } } Bob DeRemer Senior Director, Architecture and Development http://www.thingworx.comhttp://www.thingworx.com/ Skype: bob.deremer O: 717.505.7923 M: 717.881.3986 signature.asc Description: OpenPGP digital signature
Re: Error starting Tomcat
On 20/10/2011 20:16, ramsri wrote: Konstantin: I am very glad that I found this thread. For a week I have been struggling with this problem. If this is a new problem, please start a new thread. I have Tomcat7 running. My application which was running just fine under Tomcat5 does not run under Tomcat7. I have created setupclasspath.sh with all the necessary JARs. That's not likely to help matters, don't do that. My Tomcat starts fine and I see the opening page. Even my Axis comes up ok but not my application. I start Tomcat with ./startup.sh and I do not use Eclipse. The message that I get is *** Oct 20, 2011 3:04:03 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mywebapp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1055) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:978) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1329) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) *** I tried reading this thread but I cannot understand what exactly I should do in my setup. I see only one /opt/tomcat7/lib/servlet-api.jar and this file is inside my CLASSPATH. Your help is greatly appreciated. Thank you. Please start a new thread. p signature.asc Description: OpenPGP digital signature
Re: Tomcat application startup - Lifecycleexception
On 20/10/2011 23:27, ramsri wrote: I have been struggling for a week now getting my application deployed on Tomcat 7. I am unable to make much progress with it and request your help. I am not very good with Tomcat. So please bear with me and request details in your solution. I can see this site being very informative. I have Tomcat7 running. My application which was running just fine under Tomcat5 does not start under Tomcat7. I have modified setclasspath.sh with all the necessary JARs. That is what I used to do on Tomcat5. Am I not supposed to mess with this file? No, despite the name, you're not meant to alter this file. You're meant to put all of the application's JAR files in mywebapp/WEB-INF/lib There is a servlet-api.jar that I find under $CATALINA_HOME/lib ... and a few other JAR files, all of which Tomcat will load automatically, because it has its own classloader. Tomcat itself starts fine and I see the opening page. Even my Axis comes up ok but not my application. Start over with a fresh download and a clean installation. Do not modify setclasspath.sh. Read all of the following: http://tomcat.apache.org/tomcat-7.0-doc/appdev/index.html p I start Tomcat with ./startup.sh and I do not use Eclipse. The message that I get is as follows. Thanks very much for your help. Glad to provide more info if needed. *** Oct 20, 2011 3:04:03 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mywebapp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1055) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:978) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1329) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) *** signature.asc Description: OpenPGP digital signature
Re: Using the Apache Tomcat 6.0 SSL Configuration HOW-TO guide, but it is not working
On 19 Oct 2011, at 16:15, ML Harmon mlhlanma...@gmail.com wrote: I don't see any log file? what would be the log files name? Please don't top post (see below). On Fri, Oct 14, 2011 at 9:55 AM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2011/10/14 ML Harmon mlhlanma...@gmail.com: I don't even know enough about Tomcat to know how to troubleshoot this, am very new to this. 1) If you know where your server.xml is, you should know where your log files are as well. There is logs folder that is sibling to conf. Did you find the logs folder as indicated above? What is in it? p 2) There are two different implementations of SSL connector (Java-based and OpenSSL-based), that are configured rather differently. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat configuration under webApp
On 18 Oct 2011, at 16:12, ettoregia ettore...@gmail.com wrote: My system: Tomcat 6.0.18 --- Linux Red Hat 4 -- Java 6 Hi folk, does anyone of you knows where I can get some materials in order to understand how Tomcat works with sub-directories within an exploded-war file? http://tomcat.apache.org/ ? I clarify the question: I have the below structure and what I don't understand is why those xml files that are also under /Tomcat/conf/ are put under such a webApp folder. My understanding is that having them under one own folder they can be customized for any specific war, am I right? /tomcat/apps/webAppName{ Catalina catalina.properties log4j.properties tomcat-users.xml catalina.policy context.xml server.xmlweb.xml } The above is not a standard file layout and I don't understand what the braces mean. What is in the server.xml file? p I'm asking this because the IT department of the Company where I work as consultant, is not giving me any write privileges to modify some files, neither they're allowing me to copy, by myself, a .war file under webApp. In the end, with those files I can customize the catalina.properties, tomcat-users to deploy my webApp from the browser, the context and the like.. Do you think is this the point? Probably the qeustion is trivial but I'm on my own and have no one else to ask. Thanks in advance, Ettore. -- View this message in context: http://old.nabble.com/Tomcat-configuration-under-webApp-tp32675490p32675490.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Reuse mod ajp proxy connections
On 18/10/2011 20:40, Christopher Schultz wrote: Dimitar, On 10/18/2011 2:15 PM, Dimitar Georgievski wrote: We have a Tomcat 5.5.25 server connected to Apache 2.2.9 over mod_ajp_proxy. Monitoring of the servers shows that AJP proxy connections are not reused but closed and reopened. Frequent closing of TCP connections leaves many connections in TIME_WAIT state and this is something we would prefer to avoid if possible. You could update both Tomcat and HTTPD to more recent versions. p AJP is intended to maintain persistent connections. Something must be going wrong or your configuration must be forcing such behavior. My understanding of the *reuse* flag in AJP13_END_RESPONSE structure is that this flag is hard coded and cannot be controlled by configuration settings. I couldn't find any in Tomcat AJP connector configuration that could do that. Since Tomcat is sending the response, is there any way to control the reuse of AJP TCP connection through Tomcat configuration? I hope I don't have to resort to editing and recompilation of the mod_ajp_proxy module :-) Can you post your AJP Connector settings from conf/server.xml as well as your mod_proxy_ajp configuration as well? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org signature.asc Description: OpenPGP digital signature
Re: Tomcat configuration under webApp
On 18/10/2011 23:29, Tim Watts wrote: On Tue, 2011-10-18 at 09:15 -0700, ettoregia wrote: Pid * wrote: On 18 Oct 2011, at 16:12, ettoregia ettore...@gmail.com wrote: My system: Tomcat 6.0.18 --- Linux Red Hat 4 -- Java 6 Hi folk, does anyone of you knows where I can get some materials in order to understand how Tomcat works with sub-directories within an exploded-war file? http://tomcat.apache.org/ ? I clarify the question: I have the below structure and what I don't understand is why those xml files that are also under /Tomcat/conf/ are put under such a webApp folder. My understanding is that having them under one own folder they can be customized for any specific war, am I right? /tomcat/apps/webAppName{ Catalina catalina.properties log4j.properties tomcat-users.xml catalina.policy context.xml server.xmlweb.xml } The above is not a standard file layout and I don't understand what the braces mean. Sorry I meant /tomcat/apps/myAppName/conf/ and under conf all the files mentioned above That is a strange layout. Is it possible that the IT people are running each webapp in a separate JVM and pointing CATALINA_BASE to /tomcat/apps/appName ? If they are, then it might make a bit more sense. I wonder if the OP was given more precise deployment instructions that are being misunderstood... p What is in the server.xml file? p I'm asking this because the IT department of the Company where I work as consultant, is not giving me any write privileges to modify some files, neither they're allowing me to copy, by myself, a .war file under webApp. In the end, with those files I can customize the catalina.properties, tomcat-users to deploy my webApp from the browser, the context and the like.. Do you think is this the point? Probably the qeustion is trivial but I'm on my own and have no one else to ask. Thanks in advance, Ettore. -- View this message in context: http://old.nabble.com/Tomcat-configuration-under-webApp-tp32675490p32675490.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org signature.asc Description: OpenPGP digital signature
Re: Tomcat configuration under webApp
On 18/10/2011 23:29, Tim Watts wrote: Sorry I meant /tomcat/apps/myAppName/conf/ and under conf all the files mentioned above That is a strange layout. Is it possible that the IT people are running each webapp in a separate JVM and pointing CATALINA_BASE to /tomcat/apps/appName ? What is in the server.xml file? Question still stands... p signature.asc Description: OpenPGP digital signature
Re: Tomcat 7 won't run as Windows service
On 15/10/2011 22:46, David Rush wrote: No, I did not uninstall the old service. I'd like to be able to keep multiple Tomcat instances going at once. Normally I do keep multiple instances, each installed as a service (on different ports with different service names), but they've always been of the exact same version. It was not clear to me whether you were adding a service or replacing it. Would there be an issue with different Tomcat versions installed at once? There shouldn't be. On my development box I did get the Tomcat Windows service to run after moving back to Java 6. But my last attempt to install and run a Windows service on our staging machine is now failing to run as a service as well, although I'm not getting the commons-daemon error like before. Again I can run it fine from startup.bat, and can install the service, but starting the service fails. Nothing notable in stdout or stderr logs, either. Event viewer says The david2 Tomcat 7 service terminated with service-specific error 0 (0x0). Bah. What exactly is needed for the Tomcat bootstrapping to find the Java install that it's to use? The service wrappers, e.g tomcat7w.exe, have a control panel with various tabs properties therein. You must either run that program with a parameter so it knows which service to refer to, or make a copy with the same name as the service, e.g. david7w.exe and then run it. I thought that setting JAVA_HOME in setenv.bat was a way, but apparently that's not used when it runs as a service. See above, and: http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html Use the popup to select the Java version you wish to run. p Is it a matter of having JAVA_HOME set at the time that the service is created, and it keeps that value in the service configuration somehow? Or does the JAVA_HOME env var have to be set in the environment of the service that's trying to run, every time it starts? David On 10/15/2011 10:31 AM, Pid wrote: On 14/10/2011 13:16, Konstantin Kolinko wrote: 2011/10/14 David Rushda...@rushtone.com: I've been running Tomcat 6.0.18 for a long time, and am now trying to upgrade to 7.0.22 (64 bit .zip download). I can start Tomcat 7 with startup.bat and it's working fine. The script to install it as a service worked without complaint, and the service is there. Did you uninstall the old service first? p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org signature.asc Description: OpenPGP digital signature
Re: Session across Realm and Servlet
On 16/10/2011 05:57, sailendra karthik wrote: On 10/16/11, sailendra karthik karthiksailen...@gmail.com wrote: On 10/15/11, Pid p...@pidster.com wrote: On 14/10/2011 22:36, sailendra karthik wrote: I need to maintain a session object between Realm and Servlet. I have written a CustomRealm and every thing working fine and now it is required to send an object to servlets (possibly by HttpRequestServlet ) But i know/think Servlet is not yet Initiated. So how it is possible to access HttpRequestServlet and set some session attribute in my Custom Realm which extends RealmBase. Or else it should be a different Procedure. Waiting for some clue. This is clear, but so are we. Which version of Tomcat for example? p Tomcat 6.0.22 As you asked about version of Tomcat, Is it possible in some tomcat version, if yes, can you tell me that version and which portion in that tomcat version(like few classes) makes it possible. You are trying, for some reason, to force a Realm and a Servlet to interact directly. Don't do this. What is the real problem, why do you need a custom realm implementation? For what purpose are you setting an object in the session? p signature.asc Description: OpenPGP digital signature
Re: Session across Realm and Servlet
On 16/10/2011 12:01, sailendra karthik wrote: On Sun, Oct 16, 2011 at 2:25 PM, Pid p...@pidster.com wrote: On 16/10/2011 05:57, sailendra karthik wrote: On 10/16/11, sailendra karthik karthiksailen...@gmail.com wrote: On 10/15/11, Pid p...@pidster.com wrote: On 14/10/2011 22:36, sailendra karthik wrote: I need to maintain a session object between Realm and Servlet. I have written a CustomRealm and every thing working fine and now it is required to send an object to servlets (possibly by HttpRequestServlet ) But i know/think Servlet is not yet Initiated. So how it is possible to access HttpRequestServlet and set some session attribute in my Custom Realm which extends RealmBase. Or else it should be a different Procedure. Waiting for some clue. This is clear, but so are we. Which version of Tomcat for example? p Tomcat 6.0.22 As you asked about version of Tomcat, Is it possible in some tomcat version, if yes, can you tell me that version and which portion in that tomcat version(like few classes) makes it possible. You are trying, for some reason, to force a Realm and a Servlet to interact directly. Don't do this. What is the real problem, why do you need a custom realm implementation? For what purpose are you setting an object in the session? p Real Problem :- In my Custom Realm Implementation iam autheticating some user and allowing him to access my webapps(servlets or filters) (my application) What's wrong with the existing realms? This authentication session i need it to be reused in my webapp(to avoid another authentication) if it is an authorized session. What's wrong with the existing container functionality? So for this purpose i want to set an object in the session and reuse that object(connection Object) at my servlets level. What kind of object? p How can i over come this signature.asc Description: OpenPGP digital signature
Re: Configure tomcat using init.d
On 14/10/2011 16:31, Mark Thomas wrote: On 14/10/2011 16:15, Mark H. Wood wrote: This I can agree with. They don't allow application managers access to Tomcat's config., but anyone can drop stuff into /etc/init.d, whence it will run as root? Really? Something is not right here. +1 These support guys need firing... Is it just me, or is the simple privilege escalation attack that this makes possible the quickest way to solve this? :) Granted, it isn't the best way to solve it but boy would I be tempted in your shoes. Yes, quite. p signature.asc Description: OpenPGP digital signature
Re: appbase directory deleted partically
On 14/10/2011 04:07, Osamu Ochiai wrote: Hello The problem: Tomcat started successfully but the deployed webapp did not work because the appbase directory was deleted partially. Maybe the directory was deletedby mistake without user's intention. Can Tomcat delete appbase directory except in the case of webapp WAR. updated (deploy)? The environment: Tomcat6.0.29, Java SE6, Windows7 The appBase directory was partially deleted? What does that mean, the contents of it were deleted or the directory itself? p signature.asc Description: OpenPGP digital signature
Re: filters on j_security_check
On 13/10/2011 20:53, Caldarale, Charles R wrote: If you want to do programmatic security in addition to declarative security, Or use the Servlet 3.0 APIs, supported by Tomcat. p signature.asc Description: OpenPGP digital signature
Re: Session across Realm and Servlet
On 14/10/2011 22:36, sailendra karthik wrote: I need to maintain a session object between Realm and Servlet. I have written a CustomRealm and every thing working fine and now it is required to send an object to servlets (possibly by HttpRequestServlet ) But i know/think Servlet is not yet Initiated. So how it is possible to access HttpRequestServlet and set some session attribute in my Custom Realm which extends RealmBase. Or else it should be a different Procedure. Waiting for some clue. This is clear, but so are we. Which version of Tomcat for example? p signature.asc Description: OpenPGP digital signature
Re: Help with mixed SSL and non-SSL pages in Tomcat 7.0
On 14/10/2011 21:09, Janet Preston wrote: I have a web site with a login page that has to be accessed using SSL so that the password is not sent as clear text. That's good. The rest of the site is non-SSL. Oh. Why not? p signature.asc Description: OpenPGP digital signature
Re: Classloaders in catalina.properties
On 14/10/2011 17:52, spr...@gmx.eu wrote: Hi, in catalina.properties I can define paths for common, server and shared loaders. Where do I find them here in the docs?: http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html Here we have only system and common... Because, while the functionality remains, it's no longer the default. See: http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html p signature.asc Description: OpenPGP digital signature
Re: Tomcat 7 won't run as Windows service
On 14/10/2011 13:16, Konstantin Kolinko wrote: 2011/10/14 David Rush da...@rushtone.com: I've been running Tomcat 6.0.18 for a long time, and am now trying to upgrade to 7.0.22 (64 bit .zip download). I can start Tomcat 7 with startup.bat and it's working fine. The script to install it as a service worked without complaint, and the service is there. Did you uninstall the old service first? p signature.asc Description: OpenPGP digital signature
Re: Problem in spring-tomcat project
On 14/10/2011 17:41, Anisha Karki wrote: I am following the tutorial: http://static.springsource.org/docs/Spring-MVC-step-by-step/part2.html on developing and configuring the views and the controller. But i am getting following error: org.apache.jasper.JasperException: /index.jsp (line: 1, column: 1) The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed I have already copied jstl.jar and jsltl-standard.jar to WEB-INF folder but the problem is not solved. How to solve this problem ?any help would be appreciated. Is this a Spring tutorial question or a Tomcat question? You don't mention anything about Tomcat. p signature.asc Description: OpenPGP digital signature
Re: WebApp access to a LAN share
On 15/10/2011 19:38, Léa Massiot wrote: Hello, Thank you for reading my post. Here is my problem: - I have two machines S and M on the same LAN. - S is a Debian machine running a Tomcat server. - And I have a WebApp W deployed on this Tomcat server. - M is a Windows machine which hosts some files for W. - S and M belong to the same Samba domain. - On M, the WebApp files are stored in a directory: C:\p1\p2\. - p2 is a share. - Somewhere in the WebApp Java code, I have declared a final to store the files path. Here is what I wrote: public static final String s_path = //M/p2/; - Now, when I manipulate the WebApp in such a way a file f.xml located in C:\p1\p2\p3\ has to be opened and read, I get the following error: java.io.FileNotFoundException: /M/p2/p3/f.xml (No such file or directory) My question is: how do I have to declare s_path to properly access, from S (W), those files which are stored on M? (I basically want to have the data on one machine and Tomcat on another machine). Can you help me? Yes. If there's a way to avoid this strategy, you should do. Why do you need to access this file across the network and is there more than one file? Are you sure that the Tomcat user actually has permission to access the file? p signature.asc Description: OpenPGP digital signature
Re: filters on j_security_check
On 13/10/2011 15:09, Alejandro Soto wrote: Hi, my name is Alejandro, I am working with Tomcat 7.0.20 and I need to know how can I apply filters to j_security_check to verify the status of login before continue with my authentication process. You can't use Filters because the Authentication Valves act before the Filter chain. Why do you need to filter on j_security_check? p I was thinking to use valves, but I read on internet that valves will be replaced with Filters - GSOC since Tomcat 7.0.x, so, I'm not sure what to do . Please, this is very important to me and any help will be appreciated. Best Regards. signature.asc Description: OpenPGP digital signature
Re: Pound Signs in Context/Paths
On 12/10/2011 15:55, Richard W. Adams wrote: My Tomcat Version: 6.0.18.0 (running under Jboss) That's old. I'm trying to understand the script we use to deploy to our Tomcat server. = The scripts uses pound signs (#) instead of slashes in the path to the WAR = file being deployed. Let me first be clear: The script works. What I=20 DON'T understand is why, or the purpose of the pound signs. I tried=20 searching the Web for documentation on the use of the pound signs, but=20 came up dry. I'm concerned that we might be using an undocumented feature = that could break in future versions of Tomcat. Can anyone point me to official documentation about pound signs (#) in=20 Tomcat paths/contexts? tomcat/webapps/myapp#is#here.war is published as http://hostname/myapp/is/here ^^ where the highlighted part is the context path. This is called mult-level paths: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html p signature.asc Description: OpenPGP digital signature
Re: redirection error due to context path after JAAS authentication with mod_proxy
On 12/10/2011 17:51, Woonsan Ko wrote: - Original Message - From: André Warnier a...@ice-sa.com To: Tomcat Users List users@tomcat.apache.org Cc: Sent: Wednesday, October 12, 2011 11:52 AM Subject: Re: redirection error due to context path after JAAS authentication with mod_proxy Woonsan Ko wrote: Hi, I have a reverse proxy configuration like this: VirtualHost *:80 ServerName localhost ProxyPreserveHost On ProxyPass / http://localhost:8080/app1/ ProxyPassReverse / http://localhost:8080/app1/ ProxyPassReverseCookiePath /app1 / /VirtualHost If it is really like above, then why are you using an Apache httpd front-end at all? Would it not be easier (+ simpler, + more efficient) to just get Tomcat to listen on port 80 and whatever IP address Apache httpd is listening to right now ? One simple strong reason is that I don't want to run tomcat by root. JSVC, iptables, Tanuki - bunch of different way to handle that. p (To get exactly the same behaviour as above, you would also have to make app1 be the Tomcat ROOT application.) Note: I also use a lot of setups with Apache httpd as front-end, and Tomcat as a back-end, and sometimes this is very practical. At least, when the Apache httpd front-end is actually doing something other than forwarding the requests to Tomcat. But here, it does not seem to be doing anything at all. - 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 signature.asc Description: OpenPGP digital signature
Re: How to externalize a webapp's logging.properties?
On 11/10/2011 07:28, Dan Checkoway wrote: Hello, I run several webapps under one instance of tomcat (7.0.21 currently, fwiw), and each webapp uses JDK logging and needs to log to its own separate log file. I accomplish this by placing logging.properties in WEB-INF/classes, and an example of how it's set up is: handlers = org.apache.juli.FileHandler org.apache.juli.FileHandler.level = FINE org.apache.juli.FileHandler.directory = ${catalina.base}/logs org.apache.juli.FileHandler.prefix = my-webapp. org.apache.juli.FileHandler.formatter = com.mycompany.logging.MyCustomFormatter ...all of my logging levels... You can configure the main logging.properties to output separate files per application, as per: http://tomcat.apache.org/tomcat-6.0-doc/logging.html The Manager application is configured like this. p (and fwiw, my custom logging formatter lives in a jar that I place in $TOMCAT_HOME/endorsed) It works great. The challenge I face, however, is that I deploy my webapps as .war files, and I'd like to be able to deploy the same exact .war file to different environments...dev, test, staging, production. And I'd like to be able to use different logging level config in each of those environments. As it stands right now, I'm sorta confined to that single instance of logging.properties that gets built into my webapp. I want to externalize this moving part if possible. I played around with omitting logging.properties from my webapp, and instead using just $TOMCAT_HOME/conf/logging.properties, but (a) I wasn't able to get it to work the same as it's working right now, and (b) that funnels me into sharing logging level config across my webapps (in other words, webapp 1 can't have a different logging level for package x.y.z than webapp 2). Forget (b) for the time being, since I can live with shared logging levels across webapps. The main issue I'm having with this approach is that I can't seem to get *all* of my logging to go to my webapp-specific log file. Some stuff still gets logged to catalina.out. So... 1. Is it currently possible to do what I'm trying to do? Per-webapp logging control without using WEB-INF/classes/logging.properties? I could really use a working example if this is doable. 2. Is there any other hook I can take advantage of (i.e. a context listener or something), by which my code can get invoked prior to JULI initializing for my webapp, where I might be able to override the java.util.logging.config.file system property, or something like that? 3. If neither of those options is possible, how feasible would it be to add a feature to tomcat, where you can configure a path to logging.properties (in theory classpath: or file: style) on a per-webapp basis? i.e. in conf/server.xml in the Context. Or if there's an easier way, shove me toward it... Thanks, Dan signature.asc Description: OpenPGP digital signature
Re: parallel webapp initialization
On 11/10/2011 08:20, Alexander Knöller wrote: Hi Felix. Then you are already working on a patch? I haven't done any tomcat development, yet. And I am not familiar with the ettiquette for developing patches. http://tomcat.apache.org/getinvolved.html So if you are already working on it, I won't start doing the same, right? Except cuncurrent development is favored? If there's a patch it'll be posted on Bugzilla. You can contribute collaborate there. p Regards Alex Am 10.10.2011 um 19:30 schrieb Felix Schumacher: Hi, Am Montag, den 10.10.2011, 10:17 +0200 schrieb Alexander Knöller: Hi Mark. I'd like to give it a try. If I can't find time to do it I'll send an email. I also took interest in it and have parallel starting of contexts implemented. But for stopping I couldn't find a central point to implement parallel undeploys. Also if I would want to parameterize deployment parallelization on per host-basis I would have to add methods StandardHost and to make life easier add methods to Host. Would that be acceptable? Regards Felix Regards Alex Am 09.10.2011 um 18:32 schrieb Mark Thomas: On 09/10/2011 13:55, Alexander Knöller wrote: Hello mailing list. We use a single tomcat instance (soon switching from 5.5.23 to 7.x) with 24 webapps. Each webapp is based on spring and hibernate doing a lot of I/O during initialization. Tomcat is often restarted which causes long downtimes. As far as i can see the tomcat initializes its wepapps sequentially. So despite the fact, that our tomcat-intance runs on a 8 core linux system, tomcat seems to use a single thread to initalize the webapps. Is there a way on tomcat 7 to make it initialize webapps in parallel? Nope. Or is there a basic obstacle? Not that I can think of off the top of my head. Just that no-one has felt the need to scratch that particular itch. Both start and stop needs to be taken care of. If you want to propose a patch, this might provide a starting point: https://issues.apache.org/bugzilla/show_bug.cgi?id=46264 I've added some review comments to that patch that you may want to consider when writing a patch. If you need any help with the patch, just ask here. Thinking about this has got me interested. If you decide not to take a look at writing a patch for this, I'll probably take a look - maybe later this week. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- neulandFon (0421) 380107-30 Buero fuer Informatik Fax (0421) 380107-99 Konsul-Smidt-Str. 8g Mobil (0176) 20674323 28217 Bremen alexander.knoel...@neuland-bfi.de http://www.neuland-bfi.de Geschäftsführer: Thomas Koch Registergericht: Amtsgericht Bremen, HRB 23395 HB Steuer-Nr. 71-582/03051 USt-ID. DE 246585501 _ Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail und der darin enthaltenen Informationen sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - 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 -- neulandFon (0421) 380107-30 Buero fuer Informatik Fax (0421) 380107-99 Konsul-Smidt-Str. 8g Mobil (0176) 20674323 28217 Bremen alexander.knoel...@neuland-bfi.de http://www.neuland-bfi.de Geschäftsführer: Thomas Koch Registergericht: Amtsgericht Bremen, HRB 23395 HB Steuer-Nr. 71-582/03051 USt-ID. DE 246585501 _ Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail und der darin enthaltenen
Re: Loading Super Classes with ClassLoader in Tomcat
On 11/10/2011 12:59, Peter Lavin wrote: Hi Christopher, Pid, Filippo, thanks for your help. I have got this working as required on my Tomcat server. Here is the code that works. public class MyCustomClassLoader extends ClassLoader { public MyCustomClassLoader(ClassLoader contextClassLoader) { super(contextClassLoader); } public synchronized Class? arrayToClass(String name, byte[] ct, boolean resolve) { Class? c = defineClass(name, ct, 0, ct.length); try { this.loadClass(c.getName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (resolve) System.out.println(Resolving Class in + this.getClass()); resolveClass(c); return c; } } // end class // This is called by... MyCustomClassLoader cl = new MyCustomClassLoader(Thread.currentThread().getContextClassLoader()); Class? sp = cl.arrayToClass(null, byArray, True); // use the now loaded class sp for something here So passing the parent ClassLoader to the constructor was the key. I'm curious to know what the class org.apache.catalina.loader.WebappClassLoader is intended for? I was trying to do... MyCustomClassLoader extends org.apache.catalina.loader.WebappClassLoader{ It's the classloader the webapp uses. Extending it doesn't mean you inherit the relationships it holds, you still have to pass in a parent classloader in the constructor. p and had to add tomcat-catalina-7.0.0.jar to my dependencies in Eclipse. This works in the IDE but I get the following error when attempting to deploy the subsequent war in Tomcat (as the jar ended up in the WAR file too)... Oct 11, 2011 10:42:30 AM org.apache.tomcat.util.digester.Digester endElement SEVERE: End event threw exception java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet What is the class WebappClassLoader intended for? It looks like what Christopher's question is valid :-) I have a question, though, since the default parent ClassLoader of any ClassLoader /should/ be the current thread's context ClassLoader, so none of the above code should be necessary. but the default ClassLoader used does not appear to be the one of the Webapp in question. thanks again, regards, Peter Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pid, On 10/10/2011 2:23 PM, Pid wrote: On 10/10/2011 18:51, Peter Lavin wrote: Hi Filippo, tks for your reply. I'm not actually specifying any ClassLoader, perhaps I should? How should I specify a ClassLoader to use when dynamically loading a class? You can pass one into the Constructor of your own classloader: public CustomClassloader(ClassLoader parent) { super(parent); } And to be perfectly explicit, OP should be doing this when constructing their CustomClassLoader (presumably in a ServletContextListener): CustomClassLoader cl = new CustomClassLoader(Thread.currentThread().getContextClassLoader()); This should allow Peter's ClassLoader to find superclass definitions from the webapp's ClassLoader. I have a question, though, since the default parent ClassLoader of any ClassLoader /should/ be the current thread's context ClassLoader, so none of the above code should be necessary. Perhaps the CustomClassLoader is being initialized in a weird way that does not make the above connection. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6TWHwACgkQ9CaO5/Lv0PD//gCgthcJU6rJ5pVjkJt3AOgEHqGq EeYAnjq+VkKl/Ojx0QbP2lXPh5062bR6 =3mOs -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org signature.asc Description: OpenPGP digital signature