mcms系统访问后台提示“系统配置错误!详细看论坛常见问题贴:点击查看”
来源:互联网 发布:经典小说推荐 知乎 编辑:程序博客网 时间:2024/06/03 18:46
今天博主遇见了这个问题,虽然没有彻底解决我的问题,但是楼主跟了一下源码,可以说下为什么会出现这个问题:
注:新手一个,可能写的不好,请各位大大见谅。如果不想查看源码请直接跳到文章结尾处,博主总结了出现此问题的原因。
1.首先,我们应该要找到这些错误的提示文字为什么会出现,在mcms的登录页面中,我们可以看到下面的代码:
<div class="page-container"><#if app?has_content> <h1><#if app?has_content>${app.appName}</#if></h1> <div class="row" style="margin:0px;"> <form class="form-horizontal" id="loginForm" action="${base}/ms/checkLogin.do"> <input type="text" name="managerName" class="managerName" placeholder="用户名" value="" autofocus/> <div style="color:#F00; margin-top:10px; display:none;" id="show">用户名不能为空</div> <input type="password" name="managerPassword" style=" margin-top: 10px;" class="managerPassword" placeholder="密 码" value=""/> <div style="color:#F00; margin-top:10px; display:none;" id="show1">密码不能为空</div> <input type="text" id="managerYzm" name="managerYzm" style=" margin-top: 10px;width:180px" class="managerName" placeholder="验 证 码" value=""/> <img id="imgcode1" src="" width="120px" height="40" style="position:relative;top:15px;left:-3px;border-radius:4px;"> <div style="color:#F00; margin-top:10px; display:none;" id="show2">验证码错误</div> <button id="loginBtn" type="button">登录</button> </form> </div> <#else> 系统配置错误!详细看论坛常见问题贴:<a href="http://ms.ming-soft.com/mbbs/13000/detail.do" target="_blank">点击查看</a> </#if> </div>
根据代码,我们可以看出,出现错误文字的原因是传递给页面的app为null,那么我们就要去找谁给这个页面传递的app这个对象。
2.在com.mingsoft.basic.action下的LoginAction.java页面中我们找到了这些代码:
public String login(HttpServletRequest request) {// 根据请求地址来显示标题AppEntity app = this.getApp(request);// 判断应用实体是否存在if (app != null) {// 检测应用是否有自定义界面bSystemSkinEntity sse = systemSkinBiz.getByManagerId(app.getAppManagerId());if (sse != null && !StringUtil.isBlank(sse.getSystemSkinLoginPage())) {return "redirect:/" + sse.getSystemSkinLoginPage();}} else {File file = new File(this.getRealPath(request, "WEB-INF/ms.install"));if (file.exists()) {String defaultId = FileUtil.readFile(this.getRealPath(request, "WEB-INF/ms.install")).trim();if (!StringUtil.isBlank(defaultId)) {app = (AppEntity) appBiz.getEntity(Integer.parseInt(defaultId));app.setAppUrl(this.getUrl(request));appBiz.updateEntity(app);// 获取tomcat下面默认的manager文件夹File managerFile = new File(request.getSession().getServletContext().getRealPath("/"));new File(managerFile.getParent() + File.separator + "/manager").delete();FileUtil.writeFile(defaultId, this.getRealPath(request, "WEB-INF/ms.install.bak"), Const.UTF8);file.delete();}}}request.setAttribute("app", app);return "/manager/login";}此方法中传递了我们登录的request,在方法开始地方我们可以看到,有一个app的实体类被创建了,而且它的值是getApp方法对request操作后的返回值,那么我们就需要去getApp方法中进行查看了。
3.LoginAction类继承了BaseAction类,getApp方法就是在BaseAction类中,即下面的代码:
protected AppEntity getApp(HttpServletRequest request) {AppEntity app = new AppEntity();// 获取用户所请求的域名地址IAppBiz appBiz = (IAppBiz) getBean(request.getServletContext(), "appBiz");AppEntity website = appBiz.getByUrl(this.getDomain(request));if (website == null) {return null;}BeanUtils.copyProperties(website, app);return app;}
我们可以看到此方法确实返回了一个app的实体类,而且方法中创建了另一个app的实体类叫做website,app是由website复制而来,所以我们需要去查看website是如何获取的。
4.在BaseAction类中,我们找到了getDomain方法,如下:
protected String getDomain(HttpServletRequest request) {String path = request.getContextPath();String domain = request.getServerName();if (request.getServerPort() == 80) {domain += path;} else {domain += ":" + request.getServerPort() + path;}return domain;}
在这个方法中,对我们请求的request进行了分解,得到了我们访问的域名,而后在第三步中,根据此url去数据库中获取了app的实体类。所以,如果你的网站出现了标题的错误,有可能是你的数据库中存放的url与你部署的url并不相同。
5.上面是我们去数据库中获取了app的实体类,而后台中,对于我们获取失败也做了处理,我们回到第二步的方法中,刚刚我们只看了第一步获取到了我们需要的app,如果获取不到的话就会进入到else语句当中:
File file = new File(this.getRealPath(request, "WEB-INF/ms.install"));if (file.exists()) {String defaultId = FileUtil.readFile(this.getRealPath(request, "WEB-INF/ms.install")).trim();if (!StringUtil.isBlank(defaultId)) {app = (AppEntity) appBiz.getEntity(Integer.parseInt(defaultId));app.setAppUrl(this.getUrl(request));appBiz.updateEntity(app);// 获取tomcat下面默认的manager文件夹File managerFile = new File(request.getSession().getServletContext().getRealPath("/"));new File(managerFile.getParent() + File.separator + "/manager").delete();FileUtil.writeFile(defaultId, this.getRealPath(request, "WEB-INF/ms.install.bak"), Const.UTF8);file.delete();}}
方法中去项目中读取了ms.install配置文件,文件中我只放入了一个1,这是数据库app表中我的网站的app_id,方法中获取了这个ID作为默认的ID去数据库中查询到了对应的实体类。所以,你的项目报错,也有可能是此文件丢失未找到。
总结:
mcms系统访问后台提示“系统配置错误!详细看论坛常见问题贴:点击查看”报错,原因大致有下面的两个:
1.数据库app表中存放的网站的url与你部署的网站url不一致
2.WEB-INF/ms.install配置文件丢失,或者文件中存放的数字不是你的网站在app表中的app_id
0 0
- mcms系统访问后台提示“系统配置错误!详细看论坛常见问题贴:点击查看”
- 去掉ECSHOP后台提示“no_license点击查看”
- Linux 系统如何查看系统配置信息
- Linux 系统如何查看系统配置信息
- Linux 系统如何查看系统配置信息
- Linux 系统如何查看系统配置信息
- 拿到一个系统,肯定要看看系统配置,linux下看配置,可没有windows那么直观。你只能一个一个查看。
- 查看系统配置
- 查看linux系统常用的命令,Linux查看系统配置常用命令
- 查看linux系统常用的命令,Linux查看系统配置常用命令
- 查看linux系统常用的命令,Linux查看系统配置常用命令
- 查看linux系统常用的命令,Linux查看系统配置常用命令
- 看雪论坛,上次访问时间
- win7系统下访问网上邻居提示用户名密码错误
- rabbitMQ重启提示发生系统错误 5。 拒绝访问。
- net start mongodb 提示:发生系统错误 5,拒绝访问。
- 可以在保利威视后台查看自己开发CMS系统帐号看了某个视频多长时间
- 一些linux系统配置常见问题
- android 长按监听
- 调通了SDRAM+UART的程序
- SQL将多个字段查询出来拼接成一行
- Theano入门说明(1)——前提
- Centos 6.5 rabbitmq 3.6.7 开机启动脚本
- mcms系统访问后台提示“系统配置错误!详细看论坛常见问题贴:点击查看”
- Java中不同的并发实现的性能比较
- cnpm安装vue的步骤
- Android学习之 WebView使用小结
- lua基础语法
- 状态模式
- Android之Glide获取图片Path、Bitmap用法
- 停止进程的方法(waitpid)
- win10隐藏\显示文件