IDEA无法运行SpringMVC项目,提示No TLD files were found in

发布于 2022-09-06 09:15:37 字数 10105 浏览 17 评论 0

2017年12月27日 01:08更新

我刚刚误解了一个IDEA的设置项:
图片描述

我以为这是“浏览器默认打开这个网址”的意思,结果是给项目加前缀,导致一直404,但是我还是很好奇我问的问题的答案,希望有朋友愿意帮我解答,谢谢。


原问题如下:

小弟刚从Eclipse转战到IDEA平台,可以说是诸事不顺。

尝试用IDEA编写一个简单的SpringMVC例子,但是一直无法正常运行,在几经奋战之下,已经跳过几个坑,比如JDK版本冲突问题,比如libraries未勾选上等问题。

但是还是无法顺利的完成,在Google与baidu的搜索之下,也没有找到合适的资料,所以希望能够借助各位的帮助。

说了这么多,错误信息贴出来:

[2017-12-27 12:22:01,098] Artifact myProjectName:war exploded: Artifact is being deployed, please wait...
27-Dec-2017 00:22:02.541 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/assets/css/].
27-Dec-2017 00:22:02.541 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/assets/js/].
27-Dec-2017 00:22:02.542 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/assets/images/].
27-Dec-2017 00:22:02.543 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/assets/].
27-Dec-2017 00:22:02.543 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/views/].
27-Dec-2017 00:22:02.543 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
27-Dec-2017 00:22:02.546 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/logkit-1.0.1.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.547 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/c3p0-0.9.5.2.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.548 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-tx-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.549 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-dao-2.0.8.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.549 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/avalon-framework-4.1.3.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.550 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-beans-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.552 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-web-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.555 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/mybatis-3.4.5.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.556 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-jdbc-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.558 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-core-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.558 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-jcl-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.560 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/mchange-commons-java-0.2.11.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.561 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-expression-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.586 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan TLD files were found in JAR [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-webmvc-5.0.1.RELEASE.jar].
27-Dec-2017 00:22:02.587 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/aopalliance-1.0.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.587 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/gson-2.8.2.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.588 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/mysql-connector-java-6.0.6.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.590 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-context-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.591 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-aop-5.0.1.RELEASE.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.591 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/fastjson-1.2.43.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.592 详细 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/mybatis-spring-1.3.1.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
27-Dec-2017 00:22:02.593 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 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.

备注一点:同样的配置,在Eclipse中可以完美运行(包含几个主要的配置文件,以及共用的Maven,Tomcat等)

如果可以,小弟还想问一下,如何让IDEA像Eclipse一样在运行时显示更多关于Spring容器的日志呢?比如是否加载某个配置文件,还有IDEA的运行目录能不能不要那么非主流?直接放在Tomcat的webapps下面呢?

感谢!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半步萧音过轻尘 2022-09-13 09:15:37

先回答你误解的那个设置:

clipboard.png
这里其实没有什么好解释,字面意思就很显然是配置上下文地址的,至于你以为的“浏览器默认打开这个网址”是这个:

clipboard.png

关于TLD文件问题

你可以参考这里,也许能解决你的问题。
https://my.oschina.net/fdblog...

关于让IDEA像Eclipse一样在运行时显示更多关于Spring容器的日志

你觉得少,首先可能是你项目自身日志配置的问题,详细的日志,例如log4j、slf4j等等请自行网上了解。
这里给出spring官方文档说明:https://docs.spring.io/spring...

clipboard.png

还有一种可能是在这里:

clipboard.png

以前我也用eclipse,用了IDEA就再也回不去了,不是IDEA非主流,是你没习惯。

如果坑实在太多,最简单的办法就是你在IDEA新建一个空的maven工程,再把以前的代码一个个copy过来,这样出问题的可能性会小很多。

香草可樂 2022-09-13 09:15:37

首先需要明确一点,项目构建是否使用了Maven?

从项目使用了lib目录感觉不是
/E:/IDEA/myProjectName/target/myProjectName/WEB-INF/lib/spring-webmvc-5.0.1.RELEASE.jar

  1. 从传统的web项目由eclipse到idea,导入的时候选择从Eclipse导入
    图片描述
  2. 导入后手动配置依赖,选择项目依赖的jdk版本和 项目编译版本
    图片描述
    图片描述
  3. 添加项目中的lib到编译路径,右键lib
    图片描述
  4. 如果项目是web项目,如果没有web模块,要添加web模块。打开Project Structure ,选择Modules,查看要运行的Module是否有web模块,没有则添加
    图片描述
  5. 配置web模块
    在idea中web资源的目录是web文件夹,如果是eclipse项目web资源的目录则是WebRoot,点击Module中项目下的web进行更改,改为WebRoot即可。这两个地方都需要更改。
    图片描述
  6. 配置Artifacts
    在idea中部署的都是Artifacts。在第4步添加web模块的时候,添加完成后,对话框右下角是有提示创建Artifact的,选择创建即可;这里我们手动创建
    图片描述
  7. 给idea添加tomcat
    图片描述

    如果需要热加载需要更改On Update actionOn frame deactivatioinUpdate classes and resources
    Tomcat依赖的JDK版本和启动也有较大关系。
    图片描述
    部署项目,添加后给项目配置Application context 路径,只能有一个/路径

  8. 添加tomcat依赖
    如果项目中使用了Servlet等 API,如果lib中没有相关依赖,我们要添加Tomcat依赖到项目中
    图片描述
    图片描述
  9. 启动项目,即可。

关于Tomcat运行目录的问题:

这里有三个目录

  1. Project compiler output
    图片描述
  2. Module compile out paht
    图片描述
  3. Artifacts Out directory
    图片描述

因为Tomcat部署的都是Artifact,所以就是Artifacts Out directory这个路径。你看一个这个路径,就知道了。会把项目中编译好的资源拷贝到这个路径下。在第一次运行的时候,idea也会拷贝的,至于热加载配置,在前文也提到了。


第一次回答问题,希望可以帮到你。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文