The NetBeans IDE issues unusual compiler errors on “Clean and Build” or external changes.The IDE becomes unaware of the JPA generated static metamodel

限于喜欢 提交于 2019-12-12 12:40:25

问题


I'm completely tired of using the NetBeans IDE 8.x (currently using 8.0.1) for months - it just looks like a hell (seriously). When some external changes are made to the project (especially a Java EE web application - containing hundredth of Java classes in different packages) or an attempt is made to Clean and Build to project (especially to the enterprise module), Background Scanning of Projects is initiated which unusually propagates compile-time errors in almost all classes in which classes from the JPA generated static metamodel are used in the EJB module as can be seen in the following snap shot.

Surprisingly, these erroneous classes, if opened in the IDE, no compile-time errors (indicated by a red curly line) are shown anymore by the IDE - I cannot say the reason because I myself do not know.

Sometimes, if the IDE is restarted, it initiates Background Scanning of Projects that may remove these errors (in most cases it does not), if the IDE it restarted again and again for at least 10 times!

When and why this happens is quite uncertain but there one certain thing - it happens because of the JPA generated static metamodel. The IDE apparently becomes unaware of the classes that end with an underscore (the classes of the metamodel). This is merely a wastage of time - it takes hours or days to build an application - I had to create all of these classes all over again from scratch one by one several times.


This did not happen prior to the version 8.x. Both 8.0 and 8.0.1 have the same issue (I'm not even quite sure about whether it is an issue or not. While using NetBeans 8.0, I incorrectly assumed that the later release would not impose this behaviour).


To reproduce this problem,

  • The application must have a JPA generated static metamodel.
  • The application should (not must) be using a Class Library that holds interfaces for remote EJBs.

In very small applications, this may or may not happen (I myself cannot confirm about the cause of this problem quite well and cannot say anything about this).


Does someone encounter this kind of problems while using NetBeans IDE especially 8.x - this makes almost impossible to develop an application using this IDE - it is merely a frustration? Does the IDE have some settings that I might be missing? Might I be deploying the application in a wrong way?

I can say only one thing - The Background Scanning of Project is performed incorrectly by the IDE or it is just a hell.

The way I deploy the application (Java EE containing some remote EJBs (including many local EJBs) which are held by a Class Library)

  • Clean and Build the Class Library
  • Clean and Build the Enterprise application (the EJB module denoted by a triangle by the IDE) (this step is the culprit)
  • Clean and build the Class Library again (after completion of the above two steps)
  • Deploy the application

These steps are performed at the very first time the application is built or some major changes are made to the application. Otherwise, only the last two steps are sufficient to deploy the application to the server (and I do it usually).

With this problem, it is almost impossible to proceed. Is there any (at least temporary) solution/workaround to this?

One additional thing. This not only happens in Java EE applications but I have another project that uses Spring in which this problem often happens.


EDIT :

Sometimes (again uncertain when this may happen), major options including Clean and Build of the submenu of a Class Library are disabled preventing us from doing Clean and Build as indicated by the following snap shot (right click on the Class Library to open the submenu).

Which is enabled, when the IDE is restarted for random number of times (1 time, 2 times, 5 times, 10 times or even more. It is completely uncertain how many times restarting the IDE can make those options of the submenu enable).


EDIT 2 :

The application uses the following major components.

  • JSF 2.2.8-02
  • PrimeFaces 5.1 (Community Release)
  • PrimeFaces Extension 2.1.0 (Community Release)
  • OmniFaces 1.8.1
  • EclipseLink 2.5.2 having JPA 2.1 (along with EclipseLink JPA ModelGen)
  • Java EE 7
  • GlassFish Server 4.1
  • NetBeans IDE 8.0.1
  • JDK 8u25

回答1:


When you see incorrect error indicators on classes in the Projects tab, try this: from the menu select Source -> Scan for External Changes.



来源:https://stackoverflow.com/questions/26535853/the-netbeans-ide-issues-unusual-compiler-errors-on-clean-and-build-or-external

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!