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/, 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:[email protected]: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\ (create it if necessary). See for more details.

Tomcat 8 Maven Plugin for Java 8

Yes you can, In your pom.xml, add the tomcat plugin. (You can use this for both Tomcat 7 and 8): pom.xml <!– Tomcat plugin –> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http:// localhost:8080/manager/text</url> <server>TomcatServer</server> *(From maven > settings.xml)* <username>*yourtomcatusername*</username> <password>*yourtomcatpassword*</password> </configuration> </plugin> tomcat-users.xml <tomcat-users> <role rolename=”manager-gui”/> <role rolename=”manager-script”/> <user username=”admin” password=”password” roles=”manager-gui,manager-script” /> </tomcat-users> settings.xml (maven … Read more

Tomcat Server/Client Self-Signed SSL Certificate

Finally got the solution to my problem, so I’ll post the results here if anyone else gets stuck. Thanks to Michael Martin of Michael’s Software Thoughts & Ramblings I discovered that: keytool by default uses the DSA algorithm when generating the self-signed cert. Earlier versions of Firefox accepted these keys without problem. With Firefox 3 … Read more

Add JVM options in Tomcat

As Bhavik Shah says, you can do it in JAVA_OPTS, but the recommended way (as per is to use CATALINA_OPTS: # CATALINA_OPTS (Optional) Java runtime options used when the “start”, # “run” or “debug” command is executed. # Include here and not in JAVA_OPTS all options, that should # only be used by Tomcat … Read more

Get ServletContext in JAX-RS resource

Furthermore, @Resource annotation might not work. Try this ServletContext context; The injection doesn’t happen until you hit the service method public class MyService { @Context ServletContext context; public MyService() { print(“Constructor ” + context); // null here } @GET @Path(“/thing”) { print(“in wizard service ” + context); // available here