NetBeans IDE在“清理和构建”上发出异常编译器错误。或外部更改.IDE无法识别JPA生成的静态元模型 [英] The NetBeans IDE issues unusual compiler errors on "Clean and Build" or external changes.The IDE becomes unaware of the JPA generated static metamodel

查看:288
本文介绍了NetBeans IDE在“清理和构建”上发出异常编译器错误。或外部更改.IDE无法识别JPA生成的静态元模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经厌倦了几个月使用NetBeans IDE 8.x(目前使用的是8.0.1) - 它看起来像是一个地狱(严重)。当对项目进行一些外部更改时(尤其是Java EE Web应用程序 - 包含不同包中的百分之一百的Java类)或者尝试清理并构建以进行项目(特别是对于企业模块) ),启动项目的后台扫描,它几乎在所有类中传播编译时错误,其中JPA生成的类(右键单击类库以打开子菜单)。





当IDE重新启动随机次数时启用哪个( 1次,2次,5次,10次甚至更多。完全不确定重启IDE的次数可以使子菜单的选项启用)。






编辑2:



该应用程序使用以下主要组件。




  • JSF 2.2.8-02

  • PrimeFaces 5.1(社区发布)

  • PrimeFaces Extension 2.1.0(社区发布)

  • OmniFaces 1.8.1

  • 具有JPA 2.1的EclipseLink 2.5.2(以及EclipseLink JPA ModelGen)

  • Java EE 7

  • GlassFish Server 4.1

  • NetBeans IDE 8.0.1

  • JDK 8u25


解决方案

当你在Projects选项卡中看到不正确的类错误指示时,试试这个:从菜单中选择Source - > Scan for External Changes。


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

解决方案

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

这篇关于NetBeans IDE在“清理和构建”上发出异常编译器错误。或外部更改.IDE无法识别JPA生成的静态元模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆