关于tomcat源码的examples项目无法访问,访问404

java lang ClassNotFoundException listeners ContextListener

在运行tomcat源码中遇到的问题

在启动tomcat源码后,tomcat自带的几个项目都生效了,如docs,manage等等,但是examples模块始终无法访问,查看控制台日志后发现加载examples时,发生了错误。

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.
One or more listeners failed to start. Full details will be found in the appropriate container log file
Context [/examples] startup failed due to previous errors

根据提示的内容找到日志文件logs/localhost.yyyy-MM-dd.log,看到错误日志:

java.lang.ClassNotFoundException: listeners.ContextListener
...
java.lang.ClassNotFoundException: listeners.SessionListener
...
java.lang.ClassNotFoundException: async.AsyncStockContextListener

之后去源码中去找这几个类,发现确实存在,但是是在examples项目的WEB-INF的classes文件夹下,而且图标不对

因为报的异常是找不到类,但是类确实存在,只有一种可能,那就是没有加载进内存,在idea的maven项目中要将java文件编译,加载进内存需要将文件夹设置为Sources Root
在这里插入图片描述
设置完成后项目中的类就会编译,加载进内存。
重新启动tomcat源码,就发现可以访问examples类

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值