Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

后台管理访问 index.htm 报错,日志如下 #342

Closed
Enan01 opened this issue Apr 1, 2017 · 8 comments
Closed

后台管理访问 index.htm 报错,日志如下 #342

Enan01 opened this issue Apr 1, 2017 · 8 comments

Comments

@Enan01
Copy link

Enan01 commented Apr 1, 2017

[ERROR] [16:58:20] org.apache.velocity - ResourceManager : unable to find resource '/templates/index.vm' in any resource loader.
2017-04-01 16:58:20.549:WARN::/index.htm
javax.servlet.ServletException: Could not resolve view with name 'index' in servlet with name 'spring'
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1226)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
at com.github.ltsopensource.admin.web.filter.LoginAuthFilter.doFilter(LoginAuthFilter.java:59)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

@qq254963746
Copy link
Member

检查一下, 启动是否有问题,看看其他url 也是否能访问

@Enan01
Copy link
Author

Enan01 commented Apr 7, 2017

@qq254963746 其他url可以访问,但是加载不了js和css

@zhaoyuguang
Copy link
Contributor

我也遇到了 线下没问题 线上出的问题 基本两周一次 重启admin就好了 什么也不用改

@lusong1986
Copy link
Contributor

我也偶尔碰到过,重启解决?具体什么原因还不清楚
能有人解答吗?

@lusong1986
Copy link
Contributor

初步怀疑是war解压出的文件被删除了,问了一下SA有没有cron任务在晚上运行,会不会影响/tmp目录的文件,结果他表示没有。于是继续查看Nginx日志,发现在3点36分钟时,前一个请求返回的是200,后一个就变成404了。这时另外一个同事提醒说,系统默认的tmpwatch任务会清除/tmp目录下的文件。如下:

cat /etc/cron.daily/tmpwatch
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch “$flags” -x /tmp/.X11-unix -x /tmp/.XIM-unix
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix
-X ‘/tmp/hsperfdata_*’ 10d /tmp
/usr/sbin/tmpwatch “$flags” 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch “$flags” -f 30d “$d”
fi
done

上面的脚本表示,tmpwatch分根据文件的修改(-m)/创建(-c)时间,清理/tmp下的10天前创建或修改的文件,问题就在这里了。如何解决呢?只要让Jetty解压war文件时,不放在/tmp下就能解决这个问题了。仔细查看Jetty的关于Temporary Directories的描述文档,原来只需要在${jetty.home}目录下创建一个work目录就行了。Jetty的这个Trick害死人,为什么不在Jetty发布包中就默认包含这个目录呢?

教训:使用开源的东西,一定要认真读一下它的文档,对于比较关键的问题,一定要非常熟悉,否则出了问题才来想办法解决,已经晚了。

@Enan01
Copy link
Author

Enan01 commented Mar 6, 2018

解决方案见issue#389

@Enan01 Enan01 closed this as completed Mar 6, 2018
@clivelzy
Copy link

clivelzy commented Sep 6, 2018

HTTP ERROR: 404
Problem accessing /index.htm. Reason:

NOT_FOUND

Powered by Jetty://

启动lts-admin后,未有异常错误,而且已经起来,但是访问index.htm页面提示404错误,

@xcw931924821
Copy link

Powered by Jetty://

启动lts-admin后,未有异常错误,而且已经起来,但是访问index.htm页面提示404错误, 我也这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants