Tomcat 6.0.26 缓存 Java 类
我突然面临一个奇怪的问题,我不知道为什么会发生这种情况。
我的基本设置是使用maven(eclipse插件0.20),Tomcat 6.0.26。
直到几天前,我才能在调试模式下启动 tomcat,在调试时更改代码并测试它们。然后运行maven的prepare-package,停止并启动tomcat以反映更改。
但几天后,调试选项停止工作,并且 eclips 无法正确加载类中的更改。我最初认为这是一个调试问题,但即使我停止 tomcat,运行准备包并启动 tomcat,我的类更改也不会显示。
我通常在 Eclipse 中保持自动构建为 true,它将类文件写入 target/classes,然后 maven 将其复制到 Tomcat 读取它的 WEB-INF/classes 中。切换此选项仅有助于准备包有时起作用。
我不确定这是否是我的 maven-plugin 或 tomcat 执行一些奇怪的类缓存的问题。这些不是 servlet 或 JSP,而是普通的 java 类。
想知道是否有人看到此类问题,还是只是我的机器给我带来了麻烦
I am facing a wierd issue suddenly and I am out of wits why this would happen.
My basic setup is to use maven (eclipse plugin 0.20), Tomcat 6.0.26.
Until few days back i was able to start tomcat in debug mode, make changes in code while debugging and test them. Then later run prepare-package for maven, stop and start tomcat to reflect the changes.
But since couple of days, debug option stopped working and eclips was not loading the changes from the class correctly. I initially thought it to be a debug issue, but then even if I stopped tomcat, ran a prepare package and started tomcat, my class changes do not show up.
I normally keep build automatically true in eclipse which writes the class file to target/classes and maven copies it to WEB-INF/classes from where tomcat reads it. Toggling this option helped prepare-package to work only sometimes.
I am not sure if this may be an issue with my maven-plugin or tomcat doing some wierd caching of classes. These are not servlet or JSPs but normal java classes.
Wanted to know if someone saw this kind of issue or is it just my machine giving me trouble
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以编写一个小型Web应用程序,从eclipse将其部署到tomcat,调试它,修改代码并查看它是否自动部署。它有效,您可以尝试删除您的eclipse项目并重新导入和重建它
You could write a small web application, deploy it to tomcat from eclipse, debug it, modify the code and see if its auto deployed..It that works, you could try deleting your eclipse project and reimporting and rebuilding it
此问题已解决。我的应用程序有两个 jar(一些内容但仅名称不同)具有相同的类(相同的包层次结构)和不同的版本。所以当我尝试调试时,它选择了旧的。我删除了旧的罐子,问题解决了。
谢谢
This issue is resoved. my application had two jar(some content but different names only) having same class (same package hierarchy) with different versions. so when i was trying to debug, it was picking older one. i removed the older jar and problem is solved.
Thanks