简体   繁体   中英

Eclipse takes long time to save web.xml

Well, I'm using Eclipse to build a dynamic web project(in Mac OS X). But there is something confused for me. When I start Eclipse and click the project explorer to expend the project folder, it takes long time to finish it. What's more, when I change the web.xml, it takes for at least 5 seconds to save it. I want to know why. Should I change something in the preference?


ps

I just found that.If I restart Eclipse and don't click the project explorer, it would be fine to modify and save the web.xml. But if I click to open the folders in the project explorer, it will take a long time to say the changes in web.xml now. So why?


ps again

Well, I just meet with this problem again. I'm using Ubuntu 11.04 with 4GB RAM. There are some other project similar but with lots of files. But it doesn't happen when I edit their web.xml. I'm confused again now.

I just find out that it maybe be related to the xml validation with remote DTD. If I close the net connection, everything will be ok.


Done!

I change xsi:schemaLocation's attr from " http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd " to " http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ".

Eclipse can run slow due to various reasons.

Large number of projects

If you have a large number of projects, Eclipse needs to process all of them when doing a clean build on all projects, when searching for references (types / resources), when validation needs to occur. You can use working sets to organize your projects, and hide the ones you're not using.

Validations on projects

Eclipse has the concept of validators that can be put on projects. This can lead to a lot of processing (ex: validation of xml, xsd, jsps /....). Sometimes it can be usefull to disable certain validators that you don't really need.

Memory

Memory can be tweaked by supplying standard java memory parameters in the eclipse.ini file. If insufficient memory is allocated to Eclipse, it can lead up to a lot of garbage collection, causing it to slow down.

Plugins

Some third party plugins introduce builders / validators that get applied on projects, that cuold slow down eclipse.

Make sure you use the lastest version of Eclipse, don't put too much projects in your workspace, and keep the third party plugins to a minimum.

For if someone misses it there seems to be a bug still in 2020 about this, the OP answered himself with the right solution

I change xsi:schemaLocation's attr from " http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd " to " http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ".

change the xsi:schemaLocation in the web.xml file as follow.

Open web.xml You will find it in

 2nd line of web.xml file: web-app xmlns:...

In that change the xsi:schemaLocation as

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 

Now save it. Do your work

It is a bug in eclipse for more than 2 years, please vote up the issue, mybe they give some attention: https://bugs.eclipse.org/bugs/show_bug.cgi?id=534776

Open eclipse.ini in your eclipse installation folder increase in -Xms and -Xmx

for my self: -Xms1024m -Xmx4096m

this worked for me

For me it seemed a bit silly but when applying the change as mentioned in another thread this solved the issue with Eclipse locking up for me. Just put a ';' between the two urls (2021.05.09).

https://stackoverflow.com/a/46161667

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM