https://stackoverflow.com/questions/33576979/why-have-a-shutdown-port-in-tomcat
http://stackoverflow.com/questions/20670310/why-would-java-lang-illegalstateexception-the-resource-configuration-is-not-mo
contains multiple parameters with no annotation. Unable to resolve the injection source
How to determine your version of Tomcat and Java
https://confluence.atlassian.com/confkb/how-to-determine-your-version-of-tomcat-and-java-331914173.html
java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
http://crunchify.com/how-to-change-jvm-heap-setting-xms-xmx-of-tomcat/
The
https://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html
<Connector
port="8080"
protocol="HTTP/1.1"
proxyPort="443"
scheme="https"
secure="true"
proxyName="myapp.example.com"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" />
Set this attribute to true if you wish to have calls to
http://blog.dreamlu.net/blog/78
The shutdown port provides an OS neutral, scriptable way to shutdown a Tomcat instance. Once you remove the shutdown port you are almost certainly into the realms of OS specific code (or at least different code for Windows vs Unix plus derivatives). By default, Tomcat aims for common configuration and behaviour across all platforms.
One possible cause is that you have two or more applicable mappings for that URL call.
For example:
@Path("/{myParam}")
And somewhere else:
@Path("/{differentParam}")
Now Jersey have no way of telling what method is actually supposed to be called and gives this error.
- check tomcat logcontains multiple parameters with no annotation. Unable to resolve the injection source
How to determine your version of Tomcat and Java
https://confluence.atlassian.com/confkb/how-to-determine-your-version-of-tomcat-and-java-331914173.html
java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
http://crunchify.com/how-to-change-jvm-heap-setting-xms-xmx-of-tomcat/
- Go to
<Tomcat Directory>/bin
directory - Execute command:
./catalina.sh run
The connector section has the parameter
maxPostSize
The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
Another Limit is:
maxHttpHeaderSize The maximum size of the request and response HTTP header, specified in bytes. If not specified, this attribute is set to 4096 (4 KB).
You find them in
$TOMCAT_HOME/conf/server.xml
http://stackoverflow.com/questions/2943477/is-there-a-max-size-for-post-parameter-content
As per this the default is 2 MB for your
<Connector>
.maxPostSize = The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
Edit Tomcat's server.xml. In the
<Connector>
element, add an attribute maxPostSize
and set a larger value (in bytes) to increase the limit.
Having said that, if this is the issue, you should have got an exception on the lines of
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Proxy_SupportPost data too big
in tomcatThe
proxyName
and proxyPort
attributes can be used when Tomcat is run behind a proxy server. These attributes modify the values returned to web applications that call the request.getServerName()
and request.getServerPort()
methods, which are often used to construct absolute URLs for redirects. Without configuring these attributes, the values returned would reflect the server name and port on which the connection from the proxy server was received, rather than the server name and port to whom the client directed the original request.https://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html
- Include two directives in your
httpd.conf
file for each web application that you wish to forward to Tomcat. For example, to forward an application at context path/myapp
:ProxyPass /myapp http://localhost:8081/myapp ProxyPassReverse /myapp http://localhost:8081/myapp
http://localhost/myapp/*
to the Tomcat connector listening on port 8081. - Configure your copy of Tomcat to include a special
<Connector>
element, with appropriate proxy settings, for example:<Connector port="8081" ... proxyName="www.mycompany.com" proxyPort="80"/>
www.mycompany.com
on port 80.
<Connector
port="8080"
protocol="HTTP/1.1"
proxyPort="443"
scheme="https"
secure="true"
proxyName="myapp.example.com"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" />
Set this attribute to true if you wish to have calls to
request.isSecure()
to return true
for requests received by thisConnector
.http://blog.dreamlu.net/blog/78
session依赖于cookie,当cookie被禁用的时候将尝试使用url传递jsessionid
例如:/sign_in;jsessionid=7ba49c313a84295770fecbd01e86f116166sc5feg5yhzwis9zayzx492
二、tomcat中的实现
tomcat的核心jar:lib/catalina.jar,session的实现位于org.apache.catalina.session包中。
Session默认储存在内存中、file、db(以上三种tomcat、jetty均有实现,具体配置请百度)或者继承StoreBase扩展到cache中。
session核心代码列举(ManagerBase.java):
可以看出session实际是存储于一个map中,以sessionid作为key,value则为一个session对象。
protected Map sessions;
// ManagerBase 161行
this.sessions = new ConcurrentHashMap();
public void add(Session session) {
this.sessions.put(session.getIdInternal(), session);
int size = getActiveSessions();
if (size > this.maxActive) {
synchronized (this.maxActiveUpdateLock) {
if (size > this.maxActive) {
this.maxActive = size;
}
}
}
}
然而session又是一个key,value的对象,当然实际实现略显复杂。StandardSession为tomcat中的具体实现。我们可以简单的将他理解成一个Map<String, Map>的结构。
https://shantanusachdev.wordpress.com/2014/02/18/caused-by-java-lang-illegalstateexception-unable-to-complete-the-scan-for-annotations-for-web-application-webapp1-due-to-a-stackoverflowerror-possible-root-causes-include-a-too-low-setting-for/
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/megaphone-1.0.3_jbuild359] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1Boolean->org.bouncycastle.asn1.DERBoolean->org.bouncycastle.asn1.ASN1Boolean]
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2066)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2012)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1961)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1936)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1897)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1149)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5080)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
https://www.bouncycastle.org/
// ManagerBase 161行
this.sessions = new ConcurrentHashMap();
public void add(Session session) {
this.sessions.put(session.getIdInternal(), session);
int size = getActiveSessions();
if (size > this.maxActive) {
synchronized (this.maxActiveUpdateLock) {
if (size > this.maxActive) {
this.maxActive = size;
}
}
}
}
然而session又是一个key,value的对象,当然实际实现略显复杂。StandardSession为tomcat中的具体实现。我们可以简单的将他理解成一个Map<String, Map
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/webapp1] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.jaxen.util.AncestorAxisIterator->org.jaxen.util.AncestorOrSelfAxisIterator->org.jaxen.util.AncestorAxisIterator]
**First thing I tried of course was changing the memory settings. However this did not work. No matter how high I set it, it would always give this error.
Solution:
1. This happens in tomcat versions higher than 7.0.33, so downgrading could be one possible solution.
2. jaxen and dom4j don’t play very well together, upgrading to Jaxen-1.1.6 and dom4j-1.6.1 worked for me.
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/megaphone-1.0.3_jbuild359] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1Boolean->org.bouncycastle.asn1.DERBoolean->org.bouncycastle.asn1.ASN1Boolean]
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2066)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2012)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1961)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1936)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1897)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1149)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5080)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
Here at the Bouncy Castle, we believe in encryption. That's something that's near and dear to our hearts. We believe so strongly in encryption, that we've gone to the effort to provide some for everybody, and we've now been doing it for over 15 years!
- Increase the stack size
-Xss4m
- Tell Tomcat not to scan your application if you are not using any java based Servlet configuration add
metadata-complete="true"
to your web-app in web.xml
As it turns out Tomcat 7.0.47 has the same issue, but better reporting. When run locally the reporting showed me this:
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/api] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1Boolean->org.bouncycastle.asn1.DERBoolean->org.bouncycastle.asn1.ASN1Boolean]
Once I found the offending jar file, I added it to the catalina.properties file like this:
org.apache.catalina.startup.ContextConfig.jarsToSkip=bcprov*.jar
I think its because of two versions of JAR being referenced from classpath.
This is usually caused when different versions of bcprov-jdk*.jar being loaded.
For example, IN one of my scenario - I had
..../webapps/FOO/WEB-INF/lib/bcprov-jdk15on-147.jar
..../webapps/FOO/WEB-INF/lib/bcprov-jdk15on-1.51.jar
I got this resolved after removing any one of them from my classpath.