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

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 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. Hope that helps.

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

403 Access Denied on Tomcat 8 Manager App without prompting for user/password

This may be work. Find the CATALINA_HOME/webapps/manager/META-INF/context.xml file and add the comment markers around 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> You can find more details at this page.

Is Tomcat running?

On my linux system, I start Tomcat with the startup.sh script. To know whether it is running or not, i use ps -ef | grep tomcat If the output result contains the whole path to my tomcat folder, then it is running

Custom java.util.logging Handler in tomcat

For the Tomcat-wide custom logging you need to inject your class into the Tomcat bootstrap ClassLoader. Thus jar with custom Handler and required dependencies have to be put into the startup script CLASSPATH. I’d advice to a add custom script at $CATALINA_BASE/bin/setenv.sh, i.e. #!/bin/sh CLASSPATH=”$CATALINA_BASE/bin/myhandler.jar” or you can collect required jars dynamically as script variables … Read more

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

Increase Tomcat memory settings [duplicate]

try setting this CATALINA_OPTS=”-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m -Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC” in {$tomcat-folder}\bin\setenv.sh (create it if necessary). See http://www.mkyong.com/tomcat/tomcat-javalangoutofmemoryerror-permgen-space/ for more details.