使用eclipse及sts遇到的问题

都是自己遇到过的问题,解决办法一半以上是从网上找到的,自己整理了一下。

导入项目后报error:java compiler level does not match the version of the installed java project
右键项目“Properties”,在弹出的“Properties”窗口左侧,单击“Project Facets”,打开“Project Facets”页面。在页面中的“Java”下拉列表中,选择相应版本

Eclipse 修改项目名称
1:修改项目目录下:.project文件 
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GZELearning</name>
2:项目右键属性 --> Web Project Settings --> Context root
(整理者,我的改这个就行)
3:修改项目目录下:.settings\org.eclipse.wst.common.component


eclipse中is missing required source folder问题的解决
在本机的开发环境中,eclipse.project文件可能存在对缺失文件夹的引用,但是project中已经没有了该文件夹,导致编译的时候找不到该文件夹。
解决方法:
选中project-->右键-->properties--->java build path-->Source,把缺少的文件夹remove掉,重新编译就ok了

解决Eclipse中Java工程间循环引用而报错的问题 
循环引用通常发生再如下两种情况下:
(1)如果我们的项目包含多个工程(project),而它们之间又是循环引用的关系;
(2)使用maven进行项目构建时,两个module之间存在相互依赖;
那么Eclipse在编译时会抛出如下一个错误信息:
A cycle was detected in the build path of project: XXX
解决方法:
Eclipse Menu -> Window -> Preferences… -> Java -> Compiler -> Building -> Building path problems -> Circular dependencies -> 将Error改成Warning
不过这种方法治标不治本,更好的解决方法是去掉项目间的重复引用。

tomcat7在eclipse中,调试时断点频繁停在threadpoolexecutor
Typically, the debugger in Eclipse is configured to suspend execution at the location where the exception was thrown, on all uncaught exceptions. Note that the exception might be handled later, lower down in the stack frame and might not lead to the thread being terminated. This would be cause of the behavior observed.
eclipse在默认情况下勾选了“Suspend execution on uncaught exceptions”,暂停执行未捕获的异常。因此eclipse会把所有未捕获的异常先在ThreadPoolExecutor这个类中暂停。
解决方法:Preferences->Java->Debug,去掉"Suspend
execution on uncaught exceptions"

当启动tomcat时候出现 Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor. 的错误,那表示你的tomcat启动超时了,有时候你重新启动下就好了,但有时需要重新启动很多次,如果你不想这样的话,你只需修改下tomcat的启动 时间就行了,步骤如下:
修改 workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml文件。
<servers>
<server hostname="localhost" id="JBoss v5.0 at localhost" name="JBoss v5.0 at localhost" runtime-id="JBoss v5.0" server-type="org.eclipse.jst.server.generic.jboss5" server-type-id="org.eclipse.jst.server.generic.jboss5" start-timeout="1000" stop- timeout="15" timestamp="0">
<map jndiPort="1099" key="generic_server_instance_properties" port="8090" serverAddress="127.0.0.1" serverConfig="default"/>
</server>
</servers>
把 start-timeout="45" 改为 start-timeout="1000" 或者更长 重启eclipse就可以了。

启动tomcat插件报WEB-INF\class does not exist or is not a readable directory
实际是之前别的插件在Tomcat的Server.xml里留了痕迹
这次是多了一行:
<Context path="" reloadable="true" docBase="D:\eclipse\kepler_workspace\mpa\webapp\WEB-INF\class" workDir="D:\eclipse\kepler_workspace\mpa\work" />

项目报Cannot change version of project facet Dynamic web module to 2.5
(可能管用)
右键项目,Project Facets里面修改Dynamic web module为2.5,这样可能不行,就要修改配置文件
1.把Servlet改成2.5,修改项目的web.xml
<?xml version="1.0" encoding="UTF-8"?>  
<web-app version="2.5"  
    xmlns="http://java.sun.com/xml/ns/javaee"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">  
  <display-name>Archetype Created Web Application</display-name>  
</web-app>  

2.修改项目的设置,在Navigator下打开项目.settings目录下的
org.eclipse.jdt.core.prefs   把1.5改成1.6
org.eclipse.wst.common.component   把project-version="1.5.0"改成project-version="1.6.0"
打开org.eclipse.wst.common.project.facet.core.xml  把<installed facet="java" version="1.5"/>改成<installed facet="java" version="1.6"/>,把  <installed facet="jst.web" version="2.3"/>改成  <installed facet="jst.web" version="2.5"/>

运行Applet后窗口中文是乱码
在对应文件的 run configurations - Arguments - VM arguments 中增加
-Dfile.encoding=GB18030

包冲突,调用NodeList.item(0).getTextContent()时报没有找到对应方法
实际是 jdk中有 org.w3c.dom.NodeList, xml-apis包中也有org.w3c.dom.NodeList,
系统默认加载xml-apis,但是低版本的xml-apis没有 getTextContent() 方法
解决:可以在eclipse中 项目右键 -> Properties -> Java Build Path -> Order and Export 中
选择把jdk移动到最上,表示先加载jdk

Eclipse启动时报错 An internal error has occurred. java.lang.NullPointerException
解决方案:删除工作空间下的.metadata\.plugins\org.eclipse.core.runtime\.settings\com.genuitec.eclipse.ast.deploy.core.prefs。
重新打开Eclipse
ps:web项目需要重新部署

导出项目为一个jar包时报 No resources selected JAR creation failed. See details for additional information. No resources selected
原因,项目重命名过,导致 Launch configuration 选项使用的main方法对应的class不存在了
解决:指定对应项目的运行类

Eclipse无法启动报
An internal error occurred during: "reload maven project". java.lang.NullPointerException

报错原因:在工作引入了maven项目,启动时加载太慢(下载jar包),然后将其关闭,eclipse也关闭。由于没有正常关闭导致eclipse无法将数据正常写入配置文件导致无法启动。
错误形式:An internal error occurred during: "reload maven project". java.lang.NullPointerExceptio
解决办法:
  第一种方法:在Eclipse工作区间内找.metadata并直接删除,此时便可以正常打开。(此方法不推荐,因失去一些配置信息并且还要手动导入项目,损失较大)
  第一种方法:在Eclipse工作区间内找.metadata——>.plugins——>org.eclipse.e4.workbench——>workbench.xmi直接删除(不用手动导入原来项目,但失去配置信息,损失相对第一种方法来说,相对较小)
  第三种方法:在Eclipse工作区间内找.metadata——>.plugins——>org.eclipse.e4.workbench——>workbench.xmi并用编译工具打开,删除sharedElements配置项(eclipse加载界面配置文件workbench.xmi中的sharedElements配置项找不到相应的文件导致的异常。比前两种方法,损失最小,不过有时也可能是persistedState标签项造成的,此时要求使用者要对Eclipse软件及各种配置相当熟悉)
--整理者:我修改workbench.xmi时没有备份,就删掉了,重启后暂时没发现什么问题


关于 the'org.eclipse.recommenders.completion.rcp'plug-inor disable the'Java Proposa......问题
表现是使用提示快捷键补全类名时会卡住,然后报错.提示信息说要disable Java -> Editor -> Content Assist -> Advanced 的选项Java Proposals(Code Recommenders) 
解决办法是禁用 Java Proposals(Code Recommenders),选中 Java Proposals 和 Java Proposals(Task-Focused)

--但是还是哪里有问题

 

使用sts创建springcloud项目后pom.xml报Unknow
解决:
在<properties>标签中增加<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
然后再 update project 一下
据说是 springboot2.1.5.RELEASE 升级maven的版本到3.1.2,而当前ide不支持那么高,
其实就是要降低maven-jar-plugin的版本


启动时报An internal error occurred during: "Initializing Java Tooling".
1.可以选择重置窗口布局
windows -> perspective -> reset perspective 
2.可以选择删除工作空间的/.metadata/.plugins/org.eclipse.core.resources/.project
但是会使项目配置(如svn版本)丢失


导入项目后报Access restriction: The type 'BASE64Decoder' is not API(restriction on required library 'jdk路径\jre\lib\rt.jar)
一种做法是删除项目的JRE System Library再重新添加就好了

 

尝试向tomcat服务中添加项目报there are no resources that can be added or removed from the server
Setting property 'source' to 'org.eclipse.jst.jee.server:xx' did not find a matching property

1.查看项目属性,properties -> Project Facets -> Dynamic Web Module
可能没有被勾选
2.还有可能是eclipse不知道webapp目录在哪里,使用myeclipse添加项目,程序会主动提示设置这个目录,或者直接在项目的 properties -> Deployment Assembly 里面设置
3.如果没有指定Deployment Assembly,则eclipse可能会自动生成一个WebContent文件夹

启动项目报ClassFormatException: Invalid byte tag in constant pool: 60
大体是jar包版本问题,我这个是提示
Unable to process Jar entry [com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class] from Jar [jar:file:/D:/Tools/Apache/apache-tomcat-7.0.65win64/webapps/zkweb_scan/WEB-INF/lib/icu4j.jar!/] for annotations

debug时不走断点
和快捷键 Ctrl+Alt+B 有关
有一个选项,菜单 run -> Skip All Breakpoints

异常关机导致workspace内项目丢失
大体是,电脑断电了,再次打开sts,左侧的Package Explorer里没有东西了
解决:选择 文件 -> Open Projects from File System, 在 Directory里选择指定workspace,会出现导入所有项目的列表.
但是这样的话,之前设置的 working sets 虽然还在,里面是没有项目的,需要手动导入

使用sts 4.4.2版本使用Alt+/报错
新装的4.4.2版本,创建项目时使用提示快捷键,可以出现提示,但是第一行显示 Error while computing completion
查看sts的在工作空间下的日志 /.metadata/.log
会发现每一次提示都会报错
!MESSAGE org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
重启之后正常了

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值