0

Given the following environment to run an enterprise application in Java EE 7.

  • GlassFish Server 4.0
  • NetBeans IDE 8.0
  • JDK 1.7
  • EclipseLink 2.5.1 having JPA 2.1
  • EclipseLink Metamodel Generator provided by EclipseLink itself - 2.5.1.v20130918-f2b9fc5
  • JSF 2.2.6 running PrimeFaces 5.0, PrimeFaces Extension 2.0, OmniFaces 1.7

In some persistent entity classes, I committed some changes manually as they were required (it was done so many times in the past but it did not create any problem). After that, there is a wrench icon on some classes in the the generated metamodel that says, "Needs to be compiled", when mouse button is hovered over them as can be seen in snap shot below.

enter image description here

I undeployed the application from the server, stopped and then started the server, did clean and build and finally deployed all over from scratch but all in vain.

There are no compile time errors. The project is successfully deployed. An exception occurs at run time, when a page that uses one or more of such classes is attempted by the client indicating, "There is no such class - java.lang.NoClassDefFoundError".

I also deleted the entire metamodel along with the entire build folder and made the IDE generate the model all over again from scratch but no attempts were successful.

In addition to this, also deleted the generated folder and cleaned osgi-cache in ${GlassFishHome}/domains/domain1.

What might be the cause? When could it happen?

atamanroman
  • 11,607
  • 7
  • 57
  • 81
Tiny
  • 27,221
  • 105
  • 339
  • 599

1 Answers1

0

It causes from many things and difficult to say solution. This error message is too general. I think it always happen from bad architecture in JavaEE. Suggestion: Add compiler option such as -Xlint and see what it say.

Enkhbayar
  • 1
  • 2
  • It happens almost all uncertainly. Many a times, the JPA generated matamodel vanishes into thin air, all of a sudden and compiler errors are propagated to the entire project. The IDE is nevertheless unable to report these errors (unless it is restarted). The project can still be deployed that causes huge run time errors. A few times, the windows system itself was crashed with the known/dangerous blue screen error, when a web page is requested by the browser from such an erroneous project. It appears that the background scanning of projects (publishing) is not precisely managed by the IDE – Tiny Jun 27 '14 at 20:13
  • When some changes are made to existing JPA entities and/or some other EJBs, the IDE starts publishing that causes the relevant/corresponding metamodel classes to be removed from the classpath. This did not happen prior to NetBeans 8.0. I cannot explore it more precisely because the reason of this happening is uncertain to me. – Tiny Jun 27 '14 at 20:17