tomcat

 

<pre class="lang:default decode:true">tomcat



allow access from

https://knowledgebase.progress.com/articles/Article/How-to-configure-Tomcat-to-accept-only-localhost-access-for-the-Manager-Application

&lt;filter&gt;
&lt;filter-name&gt;Remote Address Filter&lt;/filter-name&gt;
&lt;filter-class&gt;org.apache.catalina.filters.RemoteAddrFilter&lt;/filter-class&gt;
&lt;init-param&gt;
&lt;param-name&gt;allow&lt;/param-name&gt;
&lt;param-value&gt;127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1&lt;/param-value&gt;
&lt;/init-param&gt;
&lt;/filter&gt;
&lt;filter-mapping&gt;
&lt;filter-name&gt;Remote Address Filter&lt;/filter-name&gt;
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;

check if running
in win
netstat -an | find "8080"



error spring3



https://stackoverflow.com/questions/36715102/spring-boot-deploy-war-on-tomcat-7

As M. Deinum mentioned, Tomcat 7 is using 3.0.x servet APIs. Spring Boot by default uses 3.1. To change it, Spring Boot understands these Maven properties if you are using older servlet and tomcat APIs:
&lt;properties&gt;
&lt;tomcat.version&gt;7.0.69&lt;/tomcat.version&gt;
&lt;servlet-api.version&gt;3.0.1&lt;/servlet-api.version&gt;
&lt;/properties&gt;



multiwars

endpoints.jmx.unique-names to true.
https://stackoverflow.com/questions/26901991/spring-boot-actuator-with-multiple-web-applications-in-a-tomcat-container-throws
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

https://github.com/spring-cloud/spring-cloud-config/issues/118
I was able to solve this by defining both:
spring:
application:
name: my-app-name
jmx:
default-domain: my-app-name



outof memory GermSize

edit tomcatPath/bin/setenv.sh
CATALINA_OPTS="-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"

https://stackoverflow.com/questions/3334911/what-does-jvm-flag-cmsclassunloadingenabled-actually-do
Update This answer is relevant for Java 5-7, Java 8 has this fixed: https://blogs.oracle.com/poonam/about-g1-garbage-collector,-permanent-generation-and-metaspace Kudos go to mt.uulu

For Java 5-7:

The standard Oracle/Sun VM look on the world is: Classes are forever. So once loaded, they stay in memory even if no one cares anymore. This usually is no problem since you don't have that many purely "setup" classes (= used once for setup and then never again). So even if they take up 1MB, who cares.

But lately, we have languages like Groovy, that define classes at runtime. Every time you run a script, one (or more) new classes are created and they stay in PermGen forever. If you're running a server, that means you have a memory leak.

If you enable CMSClassUnloadingEnabled the GC will sweep PermGen, too, and remove classes which are no longer used.

[EDIT] You will also have to enable UseConcMarkSweepGC (thanks to Sam Hasler). See this answer: https://stackoverflow.com/a/3720052/2541

https://stackoverflow.com/questions/12688778/increase-tomcat-memory-settings
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.

Configure tomcat memory usage
tomcatPath/bin/setenv.sh export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:PermSize=265m -XX:MaxPermSize=1024m" -Xms: This the initial java heap size. -Xmx: This is the maximum java heap size. The heap is the memory space which holds all the objects created by your application, it is the memory space allocated for your application, normally an application wouldn’t require more than maximum 2 GB of memory. In case of low heap space, “OutOfMemoryError: java heap space” exception is thrown. -XX:PermSize: This is the initial perm gen size. -XX: MaxPermSize: This is the maximum perm gen size. The perm gen size is the space where your code base is stored inside the memory , the bigger your code base is, the more perm gen space is required, normally application wouldn’t require more than maximum 1 GB of Perm gen space. In case of low perm gen space, “OutOfMemoryError: PermGen” exception is thrown. https://stackoverflow.com/questions/11222365/catalina-opts-vs-java-opts-what-is-the-difference CATALINA_OPTS vs JAVA_OPTS - What is the difference? There are two environment variables - CATALINA_OPTS and JAVA_OPTS - which are both used in the catalina.sh startup and shutdown script for Tomcat. They are described in comments within that file as: [JAVA_OPTS]: (optional) Java runtime options used when the "start", "stop" or "run" command is executed and [CATALINA_OPTS]: (optional) Java runtime options used when the "start" or "run" command is executed So why are there two different variables? And what's the difference? Firstly, anything specified in EITHER variable is passed, identically, to the command that starts up Tomcat - the "start" or "run" command - but only values set in JAVA_OPTS are passed to the "stop" command. That probably doesn't make any difference to how Tomcat runs in practise as it only effects the end of a run, not the start. The second difference is more subtle. Other applications may also use JAVA_OPTS, but only Tomcat will use CATALINA_OPTS. So if you're setting environment variables for use only by Tomcat, you'll be best advised to use CATALINA_OPTS, whereas if you're setting environment variables to be used by other java applications as well, such as by JBoss, you should put your settings in JAVA_OPTS. Source: CATALINA_OPTS v JAVA_OPTS - What is the difference? Remote Debug https://stackoverflow.com/questions/30011505/how-to-run-the-apache-tomcat-8-in-debug-mode export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n" sh ./catalina.sh start timeout web.xml &lt;!-- ==================== Default Session Configuration ================= --&gt; &lt;!-- You can set the default session timeout (in minutes) for all newly --&gt; &lt;!-- created sessions by modifying the value below. --&gt; &lt;session-config&gt; &lt;!--&lt;session-timeout&gt;1&lt;/session-timeout&gt;--&gt; &lt;session-timeout&gt;60&lt;/session-timeout&gt; &lt;/session-config&gt; server version https://stackoverflow.com/questions/14925073/how-to-find-out-running-tomcat-version cd tomcat/lib java -cp catalina.jar org.apache.catalina.util.ServerInfo if you can upload a JSP file you may print out some info like in this example: bestdesigns.co.in/blog/check-jsp-tomcat-version Save this code into a file called tomcat_version.jsp: Tomcat Version : &lt;%= application.getServerInfo() %&gt;&lt;br&gt; Servlet Specification Version : &lt;%= application.getMajorVersion() %&gt;.&lt;%= application.getMinorVersion() %&gt; &lt;br&gt; JSP version : &lt;%=JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %&gt;&lt;br&gt; When you access, http://example.com/tomcat_version.jsp, the output should look similar to: Tomcat Version : Apache Tomcat/5.5.25 Servlet Specification Version : 2.4 JSP version: 2.0 param java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize' ' [/kbd] </pre>

 

发表评论

邮箱地址不会被公开。 必填项已用*标注