catalina.out rolling with Tomcat 6.0

Fixed it, turns out the standard logging configuration defines a file logger and also a console logger. The file logger goes to the daily catalina log, and the console logger writes to catalina.out. Fix was to change in conf/logging.properties: .handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler to .handlers = 1catalina.org.apache.juli.FileHandler That stops anything getting written to catalina.out

Access Tomcat Manager App from different host

For Tomcat v8.5.4 and above, the file <tomcat>/webapps/manager/META-INF/context.xml has been adjusted: <Context antiResourceLocking=”false” privileged=”true” > <Valve className=”org.apache.catalina.valves.RemoteAddrValve” allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> </Context> Change this file to comment the Valve: <Context antiResourceLocking=”false” privileged=”true” > <!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve” allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –> </Context> After that, refresh your browser (not need to restart Tomcat), you can see the manager page.

How to use HttpServletRequest#getParts() in a servlet filter running on Tomcat?

In order to get HttpServletRequest#getParts() to work in a Filter in Tomcat, you need to set allowCasualMultipartParsing=”true” in the webapp’s <Context> element in Webapp/META-INF/context.xml or Tomcat/conf/server.xml. <Context … allowCasualMultipartParsing=”true”> Because as per the servlet 3.0 specification the HttpServletRequest#getParts() should only be available inside a HttpServlet with the @MultipartConfig annotation. See also the documentation of the … Read more

How to pass tomcat port number on command line?

Change your server.xml so that it will use port numbers expanded from properties instead of hardcoded ones: <Server port=”${port.shutdown}” shutdown=”SHUTDOWN”> … <Connector port=”${port.http}” protocol=”HTTP/1.1″/> … </Server> Here’s how you can start in Linux (assuming your current directory is CATALINA_HOME): JAVA_OPTS=”-Dport.shutdown=8005 -Dport.http=8080″ bin/startup.sh In windows it should be smth like following: set “JAVA_OPTS=-Dport.shutdown=8005 -Dport.http=8080” bin\startup.bat

Is security-constraint configuration for Tomcat mandatory?

No, it’s not necessary. It means that your web application only available through HTTPS (and not available through HTTP). If you omit the <transport-guarantee>CONFIDENTIAL</transport-guarantee> tag (or the whole <security-constraint>) your application will be available through both HTTP and HTTPS. If your web.xml contains <transport-guarantee>CONFIDENTIAL</transport-guarantee> Tomcat automatically redirects the requests to the SSL port if you … Read more

How to avoid storing passwords in the clear for tomcat’s server.xml Resource definition of a DataSource?

As said before encrypting passwords is just moving the problem somewhere else. Anyway, it’s quite simple. Just write a class with static fields for your secret key and so on, and static methods to encrypt, decrypt your passwords. Encrypt your password in Tomcat’s configuration file (server.xml or yourapp.xml…) using this class. And to decrypt the … Read more

How does Tomcat locate the webapps directory?

It can be changed in the $CATALINA_BASE/conf/server.xml in the <Host />. See the Tomcat documentation, specifically the section in regards to the Host container: Tomcat 6 Configuration Tomcat 7 Configuration The default is webapps relative to the $CATALINA_BASE. An absolute pathname can be used.

Tomcat manager remote deploy script

Providing an update to this question. Tomcat 7 has changed it’s manager API. Please refer to: Manager commands Following new URL pattern : http://{host}:{port}/manager/text/{command}?{parameters} Example curl -T “myapp.war” “http://manager:manager@localhost:8080/manager/text/deploy?path=/myapp&update=true” Security Keep in mind the server must be able to accept your remote IP. This is a sample configuration: <Context privileged=”true” antiResourceLocking=”false” docBase=”${catalina.home}/webapps/manager”> <Valve className=”org.apache.catalina.valves.RemoteAddrValve” allow=”127\.0\.0\.1″ … Read more

Error starting Tomcat from NetBeans – ‘127.0.0.1*’ is not recognized as an internal or external command

Assuming you are on Windows (this bug is caused by the crappy bat files escaping), It is a bug introduced in the latest versions (7.0.56 and 8.0.14) to workaround another bug. Try to remove the ” around the JAVA_OPTS declaration in catalina.bat. It fixed it for me with Tomcat 7.0.56 yesterday. In 7.0.56 in bin/catalina.bat:179 … Read more

tech