1 Tomcat异常
1.1 起步内存溢出问题Exception in thread http-bio-8080
1.1.1异常现象
现象如下: Tomcat7 启动后,后台抛出如下异常,前台一直无法登陆
Exception in thread ““http-bio-8080”-exec-6” java.lang.OutOfMemoryError: PermGen space Exception in thread ““http-bio-8080”-exec-9” java.lang.OutOfMemoryError: PermGen space Exception in thread “schedulerFactory_Worker-3” java.lang.OutOfMemoryError: PermGen space Exception in thread ““http-bio-8080”-exec-2” java.lang.OutOfMemoryError: PermGen space Exception in thread “Timer-0” java.lang.OutOfMemoryError: PermGen space
1.1.2解决方案
给tomcat 指定的jdk 加大启动的内存参数
-Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=128m
1.2 At least one JAR was scanned for TLDs yet contained no TLDs解决办法
在尝试以下操作前,请先关闭杀毒软件,确保不是受杀毒软件的影响; 部署的系统报如下错误,就是百度杀毒引起的。 报错内容:
Jun 03, 2013 1:09:49 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
这样的问题是你的页面中含有<!----> 的注释,去掉就好了,tomcat7.0.20.
tomcat 7 对EL 表达式的语法要求比较严格,例如"${owner.new}" 因包含关键字new 就会导致解析出错。 问题是出来了,怎么解决呢?有三种,如下:
- 严格遵守
java 规范,修改对象的属性名称,要求不包含java 关键字; - 修改
EL 表达式,例如"${owner.new}" 可以修改为"${owner['new']}" ; - 修改
tomcat 属性,忽略对EL 表达式的关键字检查。修改$CATALINA_BASE/conf/catalina.properties 文件,添加org.apache.el.parser.SKIP_IDENTIFIER_CHECK=true 选项。
1.3 tomcat HTTP Status 405
出现HTTP Status 405 - HTTP method GET is not supported by this URL 原因是:
- 继承自
Httpservlet 的Servlet 没有重写对于请求和响应的处理方法:doGet或doPost 等方法,默认调用父类的doGet或doPost 等方法。 - 父类
HttpServlet的doGet或doPost 等方法覆盖了你写的到doGet或doPost 等方法。
不管是1或2,父类HttpServlet的doGet或doPost 等方法默认实现是返回状态码是405 的Http错误表示 对于指定资源请求方法不被允许。 解决方法:
- 子类重写
doGet或doPost 等方法。 - 在扩张的
Servlet 中重写doGet或doPost 等方法来处理请求和响应时,不要调用父类的doGet或doPost 等方法即去掉supper.doGet(request,response)和super.doPost(request,response);
1.4 java.lang.IllegalStateException;Cannot forward after response has been committe
当发生在如下错误的时候,有一个方案可行, java.lang.IllegalStateException: Cannot forward after response has been committed 当你有多个跳转的页面的语句时候,好好检查一下,当 转发 或者 重定向 的时候,需要在后加一个retrun 即可。 服务器中不允许多次跳转,否则会下面这个错误。
因为服务器端使用sendRedirect 跳转到客户端的时候,不能在使用req.getRequestDispatcher("跳转的页面").forward(req, reqs); 跳转; 所以在跳转之后,return 就不会往下执行。
protected void login(HttpServletRequest req, HttpServletResponse reqs) throws ServletException, IOException {
if(req.getUserPrincipal()!=null){
String userID = req.getRemoteUser();
boolean bol = req.isUserInRole(USER_ROLE_ADMIN);
UserModel userModel =connectionDao.getUserModelByUserID(userID);
if(bol){
req.getSession().setAttribute("user",userModel);
reqs.sendRedirect(req.getContextPath()+"/admin/main.jsp");
return;
}else{
reqs.sendRedirect(req.getContextPath()+"/index.jsp");
return;
}
}
}
1.5 tomcat奇怪错误之A child container failed during start
错误详情:
严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SimpleLogin]] at java.util.concurrent.FutureTask
S
y
n
c
.
i
n
n
e
r
G
e
t
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
F
u
t
u
r
e
T
a
s
k
.
g
e
t
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
c
o
r
e
.
C
o
n
t
a
i
n
e
r
B
a
s
e
.
s
t
a
r
t
I
n
t
e
r
n
a
l
(
C
o
n
t
a
i
n
e
r
B
a
s
e
.
j
a
v
a
:
1123
)
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
c
o
r
e
.
S
t
a
n
d
a
r
d
H
o
s
t
.
s
t
a
r
t
I
n
t
e
r
n
a
l
(
S
t
a
n
d
a
r
d
H
o
s
t
.
j
a
v
a
:
785
)
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
u
t
i
l
.
L
i
f
e
c
y
c
l
e
B
a
s
e
.
s
t
a
r
t
(
L
i
f
e
c
y
c
l
e
B
a
s
e
.
j
a
v
a
:
150
)
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
c
o
r
e
.
C
o
n
t
a
i
n
e
r
B
a
s
e
Sync.innerGet(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase
Sync.innerGet(UnknownSource)atjava.util.concurrent.FutureTask.get(UnknownSource)atorg.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)atorg.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase
S
t
a
r
t
C
h
i
l
d
.
c
a
l
l
(
C
o
n
t
a
i
n
e
r
B
a
s
e
.
j
a
v
a
:
1549
)
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
F
u
t
u
r
e
T
a
s
k
StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask
StartChild.call(ContainerBase.java:1549)atjava.util.concurrent.FutureTaskSync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor
W
o
r
k
e
r
.
r
u
n
T
a
s
k
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
T
h
r
e
a
d
P
o
o
l
E
x
e
c
u
t
o
r
Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor
Worker.runTask(UnknownSource)atjava.util.concurrent.ThreadPoolExecutorWorker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SimpleLogin]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) … 7 more Caused by: java.lang.IllegalArgumentException: Invalid * in servlet mapping at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3217) at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3192) at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1302) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1323) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:346) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) … 7 more 2012-8-23 14:28:31 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask
S
y
n
c
.
i
n
n
e
r
G
e
t
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
j
a
v
a
.
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
o
n
:
F
a
i
l
e
d
t
o
s
t
a
r
t
c
o
m
p
o
n
e
n
t
[
S
t
a
n
d
a
r
d
E
n
g
i
n
e
[
C
a
t
a
l
i
n
a
]
.
S
t
a
n
d
a
r
d
H
o
s
t
[
l
o
c
a
l
h
o
s
t
]
]
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
u
t
i
l
.
L
i
f
e
c
y
c
l
e
B
a
s
e
.
s
t
a
r
t
(
L
i
f
e
c
y
c
l
e
B
a
s
e
.
j
a
v
a
:
154
)
a
t
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
c
o
r
e
.
C
o
n
t
a
i
n
e
r
B
a
s
e
Sync.innerGet(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Catalina.start(Catalina.java:675) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase
Sync.innerGet(UnknownSource)atjava.util.concurrent.FutureTask.get(UnknownSource)atorg.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)atorg.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.StandardService.startInternal(StandardService.java:443)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.startup.Catalina.start(Catalina.java:675)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451)Causedby:org.apache.catalina.LifecycleException:Failedtostartcomponent[StandardEngine[Catalina].StandardHost[localhost]]atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)atorg.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase
S
t
a
r
t
C
h
i
l
d
.
c
a
l
l
(
C
o
n
t
a
i
n
e
r
B
a
s
e
.
j
a
v
a
:
1549
)
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
F
u
t
u
r
e
T
a
s
k
StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask
StartChild.call(ContainerBase.java:1549)atjava.util.concurrent.FutureTaskSync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor
W
o
r
k
e
r
.
r
u
n
T
a
s
k
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
T
h
r
e
a
d
P
o
o
l
E
x
e
c
u
t
o
r
Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor
Worker.runTask(UnknownSource)atjava.util.concurrent.ThreadPoolExecutorWorker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) … 7 more 2012-8-23 14:28:31 org.apache.catalina.startup.Catalina start 严重: Catalina.start: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.startup.Catalina.start(Catalina.java:675) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) … 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) … 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) … 11 more 2012-8-23 14:28:31 org.apache.catalina.startup.Catalina start 信息: Server startup in 984 ms
错误原因: 已经发布到tomcat 上的某个项目的servlet 过滤器配置错误。 如在web.xml 下,将过滤规则定为* 就是一种错误,需要更正为/* 或者其他(但是必须要有/ 开头,表示当前项目)
|