在VSCODE中编辑 .java 文件会导致Eclipse中的Tomcat出错。

huangapple go评论74阅读模式
英文:

Editing .java files in VSCODE causes error on Tomcat in Eclipse

问题

我正在处理一些用JAVA编写的遗留代码。
这就像是“纯粹的java”与JSP和servlets,没有maven,也没有spring boot。
通常我使用VSCODE,但是“一直以来的方式”是使用带有一些特殊配置和密钥库的ECLIPSE和TOMCAT。

我的问题是:在VSCODE上修改一个.java文件后,TOMCAT开始出现错误:

2020年8月28日 上午11:42:13 org.apache.catalina.core.ContainerBase startInternal
严重: 子容器启动时出错
原因: org.apache.catalina.LifecycleException: 子容器启动时出错
警告: Web应用程序[header]似乎已启动了一个名为[Abandoned connection cleanup thread]的线程,但未能将其停止。这很可能会导致内存泄漏。线程的堆栈跟踪:
java.lang.Object.wait(本机方法)
java.lang.ref.ReferenceQueue.remove(Unknown Source)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
2020年8月28日 上午11:42:13 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads

我不知道为什么会出现这种情况,也不知道如何修复。最后我只能撤销更改,将更改内容复制粘贴到Eclipse中。然后它就能正常工作,即使GIT表示没有更改...

英文:

I'm working on some legacy code in JAVA.
It's like "pure java" with JSP and servlets, no maven and no spring boot.
I usually use VSCODE but the "way it's always been done" is with ECLIPSE and TOMCAT with some special configurations and a keystore.

My problem is: after I modify a .java file on VSCODE the TOMCAT starts giving up the errors:

ago 28, 2020 11:42:13 AM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
ADVERTÊNCIA: The web application [header] appears to have started a thread named [Abandoned connecti
on cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(Unknown Source)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
ago 28, 2020 11:42:13 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads

And I have no idea why or how to fix. I end up having to revert the changes, copy and paste the changes inside Eclipse. And then it works, even GIT says there's no changes...

答案1

得分: 0

不知道为什么,但是从构建路径中排除然后读取任何文件似乎是诀窍。

也许只需触摸".classpath"文件就足够了。

默认情况下,Eclipse中没有显示该文件,但在VSCODE中有。它位于项目的根文件夹中。

似乎你不需要每次都这样做。
我正在使用git flow,只有当我切换到新的功能分支时,我才需要再次执行这个操作。

英文:

No idea why, but excluding and then reading any file from buildpath seems to be the trick.

Maybe just touching the ".classpath" file should be enough.

That file doesn't appear in Eclipse by default, but does in VSCODE. Its located in the root folder of the project.

It appears you don't need to keep doing this every time.
I'm using git flow and only as I've changed to a new feature branch I had to do this again.

huangapple
  • 本文由 发表于 2020年8月28日 22:52:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/63636179.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定