IDEA 打war包部署时子模块jar包没依赖上
使用IDEA在tomcat中部署maven多模块时出现的一个莫名的bug
首先在server中打印下: 可以看见 context [] startup failed due to previous error, see server log for details.
[2018-10-19 10:55:28,273] Artifact springmvc-test:war exploded: Artifact is being deployed, please wait... Oct 19, 2018 10:55:29 AM org.apache.catalina.startup.TldConfig execute 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. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Oct 19, 2018 10:55:30 AM org.apache.catalina.core.StandardContext startInternal SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file Oct 19, 2018 10:55:30 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [] startup failed due to previous errors [2018-10-19 10:55:30,410] Artifact springmvc-test:war exploded: Error during artifact deployment. See server log for details. Oct 19, 2018 10:55:38 AM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /opt/apache-tomcat-7.0.90/webapps/manager Oct 19, 2018 10:55:38 AM org.apache.catalina.startup.TldConfig execute 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. Oct 19, 2018 10:55:38 AM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory /opt/apache-tomcat-7.0.90/webapps/manager has finished in 222 ms
于是我们打开tomcat日志位置并查看: 显示framework-base中的ConfigItem NotFound.
zwj@ubuntu:~/.IntelliJIdea2018.1/system/tomcat/Unnamed_learn/logs$ ls catalina.2018-10-18.log localhost_access_log.2018-10-17.txt catalina.2018-10-19.log localhost_access_log.2018-10-18.txt host-manager.2018-10-18.log localhost_access_log.2018-10-19.txt host-manager.2018-10-19.log manager.2018-10-18.log localhost.2018-10-18.log manager.2018-10-19.log localhost.2018-10-19.log cat localhost。2018-10-19.log org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.zwj.framework.base.config.ConfigItem] for bean with name 'com.zwj.framework.base.config.ConfigItem#0' defined in class path resource [spring/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.zwj.framework.base.config.ConfigItem
果然在war包下的lib中并没有framework-base,springwork-mybatis等子模块的jar包:
显然使用idea点击运行tomcat时,在编译打包过程中我们的子模块给遗漏了?带着问题继续查看IDEA的日志。。。
zwj@ubuntu:~$ cd .IntelliJIdea2018.1/system/log/ zwj@ubuntu:~/.IntelliJIdea2018.1/system/log$ ls build-log idea.log.2 idea.log.5 idea.log idea.log.3 threadDumps-freeze-20181016-152806-IU-181.5540.7-20sec idea.log.1 idea.log.4 zwj@ubuntu:~/.IntelliJIdea2018.1/system/log$ tail -f idea.log com.intellij.execution.ExecutionException: Cannot load /home/zwj/learn/learn/springmvc-test/target/artifacts/springmvc_test_war_exploded /META-INF/context.xml: /home/zwj/learn/learn/springmvc-test/target/artifacts/springmvc_test_war_exploded/META-INF/context.xml (No such file or directory) at org.jetbrains.idea.tomcat.TomcatUtil.loadXMLFile(TomcatUtil.java:208) at org.jetbrains.idea.tomcat.TomcatUtil.findContextInContextXml(TomcatUtil.java:107) at org.jetbrains.idea.tomcat.TomcatUtil.findContextElement(TomcatUtil.java:381) at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.addApplicationContext(TomcatAdminLocalServerImpl.java:191)
百度了半天发现,这个context文件没有加载并不是错误的根本,而是没有导入子模块的jar包时产生的子错误。
庆幸的是最终还是找到了错误,我们看到下图中artifacts的lib中没有子模块的jar包,需要先点击lib,然后在available elements中点开相应模块,然后再
pack into进去。
最后点击运行就行了。。。。。。。
坑。。。。。
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
windows下使用Linux子系统
在 Windows 上进行 web 开发,比较普遍的方案是使用 phpstudy 或者别的一些集成环境软件进行环境搭建,写好代码后将代码上传至版本管理工具 git/svn,再将代码同步到 Linux 服务器,这个过程当中开发者的开发环境(Windows)与代码最终执行的环境(Linux)不一致经常会导致一些奇奇怪怪的问题,想在 Windows 上进行 linux 下的 web 开发,不想用 mac(毕竟没钱买 mac),又不想使用虚拟机(虚拟机开机速度慢,添加站点需要重启,分配内存会导致机器变得卡顿),这时候,wsl 的出现就完美解决了这些问题。无需通过虚拟机以及双系统的形式体验 Linux ,并且可以实现系统级别的文件交互操作,实在是太具有吸引力了。 什么是 wsl在 Windows 10 系统下内置了 Linux,子系统 Linux 运行在 Windows 10 上,微软将这个 Linux 系统命名为:Windows Subsystem for Linux。简称 WSL。启动 Linux 子系统 系统要求:Windows 10 且必须是 64 位。在 『控制面板』 --> 『...
- 下一篇
CNN-RNN中文文本分类,基于TensorFlow 实现
使用卷积神经网络以及循环神经网络进行中文文本分类 CNN做句子分类的论文可以参看: https://arxiv.org/abs/1408.5882 还可以去读dennybritz大牛的博客: http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/ 以及字符级CNN的论文: https://arxiv.org/abs/1509.01626 本文是基于TensorFlow在中文数据集上的简化实现,使用了字符级CNN和RNN对中文文本进行分类,达到了较好的效果。 使用THUCNews的一个子集进行训练与测试,数据集请自行到THUCTC:一个高效的中文文本分类工具包 下载,请遵循数据提供方的开源协议。 本次训练使用了其中的10个分类,每个分类6500条数据。 类别如下: 体育, 财经, 房产, 家居, 教育, 科技, 时尚, 时政, 游戏, 娱乐 数据集划分如下: ●训练集: 5000*10 ●验证集: 500*10 ●测试集: 1000*10 从原数据集生成子集的过程请参看...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
-
Docker使用Oracle官方镜像安装(12C,18C,19C)
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS8编译安装MySQL8.0.19
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- MySQL8.0.19开启GTID主从同步CentOS8
- CentOS7,8上快速安装Gitea,搭建Git服务器
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
推荐阅读
最新文章
- SpringBoot2整合Thymeleaf,官方推荐html解决方案
- CentOS关闭SELinux安全模块
- CentOS8编译安装MySQL8.0.19
- CentOS7设置SWAP分区,小内存服务器的救世主
- 设置Eclipse缩进为4个空格,增强代码规范
- CentOS8安装MyCat,轻松搞定数据库的读写分离、垂直分库、水平分库
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题