Eclipse Tomcat jsp类文件偶尔找不到
我最近开始收到以下信息 严重:servlet jsp 的 Servlet.service() 抛出异常 java.lang.ClassNotFoundException: org.apache.jsp.login_jsp
它偶尔会发生。 假期前一切都很好。但现在我开始经历异常。
我认为该问题与服务器重新启动和发布参数有关。 [同步启动、重新启动]...等等... 根据我保存的是 jsp 还是 java 文件,Eclipse 有时会破坏此文件夹中的内容: .metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost
有时,当我在浏览器上点击刷新时,我会看到特定的 _jsp.class 文件出现。但其他时候我会得到异常并注意到 jsp_class 丢失,通常是 WEB-INF/view 文件。
我不认为这与无法编译 jsp 有任何关系,因为没有错误 - 我的 jsps 不包含任何 <% %>仅 JSTL/EL
编辑: 我按照 BalusC 的建议删除项目(顺便取消选中永久删除文件的复选框)并导入。我对原始项目和“复制”项目都执行了此操作,但目前我只导入了原始项目。它似乎表现正常,但现在说还为时过早,因为这是一个间歇性错误。
在编辑和保存 .java 文件后,我确实得到了以下几次信息,但现在经过十几次尝试后无法复制它:
Jan 6, 2011 6:54:53 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Jan 6, 2011 6:54:53 PM org.apache.catalina.session.StandardManager doUnload
SEVERE: IOException while saving persisted sessions: java.io.FileNotFoundException:
C:\jrozycki\MyDocuments\Development\Eclipse\STK\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
\work\Catalina\localhost\_\SESSIONS.ser (The system cannot find the path specified)
java.io.FileNotFoundException:
C:\jrozycki\MyDocuments\Development\Eclipse\STK\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
\work\Catalina\localhost\_\SESSIONS.ser (The system cannot find the path specified)
I recently started getting the following
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: org.apache.jsp.login_jsp
It happens sporatically.
All was good prior to the holidays. But now I have started experiencing the exception.
The issue I believe pertains to server restarting and publishing paramters. [Start, Restart Synchonized] ... etc...
Based on whether I save a jsp or a java file Eclipse sometimes blows things away in this folder: .metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost
Sometime when I hit refresh on the browser, I'll see that particular _jsp.class file appear. But other times I'll get the exception and notice a jsp_class missing, usually the WEB-INF/view files.
I don't think it has anything to do with not being able to comile the jsp, because there are no errors - my jsps do not contain any <% %> only JSTL/EL
EDIT:
I followed BalusC's suggestion of deleting project (uncheck the check box on permantly deleting files btw) and importing. I did this for both the original and "copied" project but I only imported the original project for now. It seems be behaving, but it is too early to say since it was an intermitent error.
I did get the follwoing a couple of times after editing and saving a .java file, but can't duplicate it after a dozen tries now:
Jan 6, 2011 6:54:53 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Jan 6, 2011 6:54:53 PM org.apache.catalina.session.StandardManager doUnload
SEVERE: IOException while saving persisted sessions: java.io.FileNotFoundException:
C:\jrozycki\MyDocuments\Development\Eclipse\STK\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
\work\Catalina\localhost\_\SESSIONS.ser (The system cannot find the path specified)
java.io.FileNotFoundException:
C:\jrozycki\MyDocuments\Development\Eclipse\STK\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
\work\Catalina\localhost\_\SESSIONS.ser (The system cannot find the path specified)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,这是矩阵中的一个故障。 Eclipse 相当复杂。我、我的所有同事和其他人有时也会想到这一点。
您可以尝试的最佳方法是在 Eclipse 中右键单击正在运行的服务器实例,然后选择清理。如果这没有帮助,那么之后只需重新启动服务器即可。如果这仍然没有帮助,请关闭/打开项目,清理服务器并重新启动它。
根据评论更新:
包括
.metadata
文件夹等等?我想这确实是罪魁祸首。如果它是由不同的 Eclipse 版本/环境生成的,则可能会严重冲突。删除项目,然后选择“文件”>“导入>一般>将现有项目放入工作区,然后指向项目的根目录。Well, that's a glitch in the matrix. Eclipse is pretty complicated. It also occurs to me and all of my colleagues and anyone else sometimes.
Best what you can try is to rightclick the running server instance in Eclipse and choose Clean. If that doesn't help, then just restart the server thereafter. If that even doesn't help, then close/open the project, clean the server and restart it.
Update as per the comment:
Including the
.metadata
folder and so on? I think this is indeed the culprit. It could heavily conflict if it's generated by a different Eclipse version/environment. Delete the project and then choose File > Import > General > Existing Projects into Workspace and then point to project's root.以防万一有人仍然读到这篇文章,这个问题第一次袭击了我。
在 Eclipse 4.5 中,似乎对我有用的唯一方法是右键单击“服务器”选项卡中的服务器,然后“添加和删除...”,删除受影响的项目(以清理工作区中生成的 *_jsp.class 文件) )并再次添加回来。
Just in case anyone still reads this, the problem just hit me for the first time.
The only thing that seems to work for me in Eclipse 4.5 is to right-click on the server in the Servers tab, then "Add and Remove...", remove the affected project (to clean generated *_jsp.class files in workspace) and add it back again.