14

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?


p.s

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?


p.s 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".

Lynn
  • 665
  • 8
  • 25
  • Do you have caching enabled using the Internet Cache preferences? – Dennis Jul 08 '11 at 07:26
  • Do you have Tomcat or another server running? Eclipse might be publishing to that server. – Adriaan Koster Jul 08 '11 at 08:06
  • yes, I'm using Tomcat, but I don't choose "Build Automatically" @AdriaanKoster – Lynn Jul 08 '11 at 08:11
  • I you modify web.xml within your WebContent directory, and Tomcat is looking at that file, then it will automatically republish it if it changes. 'web.xml' does not need to be built. – Adriaan Koster Jul 08 '11 at 08:40
  • @AdriaanKoster what should I do if I don't want it automatically republish? – Lynn Jul 08 '11 at 13:47
  • Go to the server overview page and under 'Publishing' select 'Never publish automatically'. – Adriaan Koster Jul 08 '11 at 15:30
  • I did it like what you said. But it still goes like before(takes long time to save the changes). So I think it's not the reason for the problem. When I close the "Project Explorer", things go well. I think there must be something wrong with it. I download a new 64-bit version Eclipse, but the problem is still there. Maybe macbook air with 2 GB RAM is not fit for the new Eclipse. Now, I choose not to use project explorer, and it seems everything go well. @AdriaanKoster – Lynn Jul 08 '11 at 15:49
  • I am using Eclipse Luna, have all validators suspended, 16GB of RAM and 8 processors, and it does exactly what Lynn says: when the schemaLocation is 2.4 it takes 10 seconds to save, when it is 2.5 it saves immediately. Strange but true! – MarcFasel Jun 17 '15 at 00:23

6 Answers6

9

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.

ddewaele
  • 22,363
  • 10
  • 69
  • 82
  • It is a bug in eclipse for more than 2 years, please vote up the issue, maybe they give some attention: https://bugs.eclipse.org/bugs/show_bug.cgi?id=534776 – erickdeoliveiraleal Jul 19 '20 at 11:38
0

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".

0

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

0

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

erickdeoliveiraleal
  • 708
  • 2
  • 9
  • 21
0

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

for my self : -Xms1024m -Xmx4096m

this worked for me

Houcine
  • 101
  • 8
0

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