Bug 218658 - Generated Sources for JPA metamodel are not recognized in source packages
Generated Sources for JPA metamodel are not recognized in source packages
Status: RESOLVED INCOMPLETE
Product: java
Classification: Unclassified
Component: Compiler
8.0.2
All All
: P2 with 15 votes (vote)
: 8.1
Assigned To: Dusan Balek
issues@java
:
: 251130 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-20 07:27 UTC by marcincinik
Modified: 2016-04-15 21:12 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
compilation issues (100.96 KB, image/png)
2012-09-20 07:27 UTC, marcincinik
Details
files *.rapt and *.sig (26.01 KB, application/octet-stream)
2015-10-20 18:59 UTC, FiruzzZ
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marcincinik 2012-09-20 07:27:41 UTC
Created attachment 124617 [details]
compilation issues

Please consult the screenshot first.

I am using JPA generated metamodel which in turn uses metamodel processor from eclipse link (this is standard mechanism used in java based on META-INF/"services").

Metamodel is generated properly during compilation phase and the generated classes show up in "Generated Sources (annotations)" (also properly).

The problem:
----------------
Classed belonging to "Source packages" (normal classes) in general can't see any classes which show up in "Generated sources (annotations)".

The project build is based on maven. Maven build succeeds, however Netbeans shows some imports which cannot be resolved which leads to compilation failures reported by Netbeans. Those imports are coming from the "Generated sources (annotations)".

The problem persists also in dev 201209200001
Comment 1 cheesus 2013-10-13 19:56:56 UTC
experiencing the same problem on 7.4RC1s (same project, several people on different OSses).

strange enough, adding build/generated-sources/ap-source-output to src path and removing it again after one good compile did indeed helped...!?
Comment 2 cheesus 2013-10-14 09:26:16 UTC
The safer way seems to be:

stop netbeans
rm -rf  ${HOME}/.cache/netbeans/7.4rc1/
(or Library/Caches/NetBeans/7.4rc1)
start netbeans
clean build
Comment 3 pierrecaron 2013-10-24 17:23:43 UTC
I also have the same problem.

I cannot find the ${HOME}/.cache/netbeans/7.4rc1/ (or library/Caches/NetBeans/7.4rc1) folder (I'm running on Windows XP).
Comment 4 luca.adamo 2014-01-30 17:56:31 UTC
It is still happening to me, both on version 7.2.1 and version 7.4. The same exact project compiles fine on another workstations with 7.4. I tried to delete the cache and restart with no luck. The only workaround is to manually add the build/generated-sources folder to the src PATH
Comment 5 chriswesdorp 2014-06-06 11:22:45 UTC
Running into the same issue working with Product Version: NetBeans IDE 8.0 (Build 201403101706)

Clearing the cache seems to remove the problem for the first start, but the problem returns after changes to the entities.
Comment 6 ender01 2014-08-25 20:04:59 UTC
I am seeing the same behavior with generated classes from the cxf-codegen-plugin. 
Maven still builds/compiles everything fine but the editor complains about the classes not being found.
Comment 7 fistons 2014-12-30 12:39:18 UTC
Same problem here, with Netbeans 8.0.2. Cleaning the cache seems to work with Linux but not with Windows 7
Comment 8 FiruzzZ 2015-02-23 12:23:21 UTC
Bug remains on
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
I tried changing the lib, switching between eclipselink 241 > 252, didn't work, now the IDE doesn't find more generated meta model than before
Comment 9 FiruzzZ 2015-02-23 12:36:46 UTC
(In reply to FiruzzZ from comment #8)
> Bug remains on
> Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
> I tried changing the lib, switching between eclipselink 241 > 252, didn't
> work, now the IDE doesn't find more generated meta model than before

PD: removing the cache folder /local/netbeans/cache solved the issue, but the IDE threw a few problems notifications on its start up
Comment 10 naskaom 2015-03-03 14:33:03 UTC
Clearing the .cache/netbeans/8.0.2 didn't work for me. I had to add generated metamodel classes to the src path and not remove them. Confused.
Comment 11 RayDeCampo 2015-03-03 14:41:06 UTC
I was experiencing this issue on a Maven project where the JPA implementation was Hibernate.  I solved it by adding hibernate-entitymanager and hibernate-jpa-2.1-api to the pom.xml as provided dependencies.  HTH
Comment 12 naskaom 2015-03-03 18:58:02 UTC
Mine is not a maven project. And I use eclipselink.
Comment 13 Petr Hejl 2015-04-16 07:46:42 UTC
*** Bug 251130 has been marked as a duplicate of this bug. ***
Comment 14 koarl 2015-08-11 08:16:02 UTC
Same here (NB 8.0.2, Maven, JPA metamodel generated by Hibernate). Clearing the cache works (at least on Linux), but this is not an option when working with large projects on a daily basis. 

I'm using NB for over a decade now (each and every workday), but this one is driving me crazy. Please fix it.
Comment 15 Dusan Balek 2015-09-08 13:11:45 UTC
Unfortunately, I cannot reproduce the problem in the current dev build. I have tried to create a simple Maven project with eclipselink and it seems to work as expected. Could you please create a simple test project demonstrating the problem and attach it to the issue? Also, cloud you please check that your source root's cache directory contains sources generated by the eclipselink's annotation processors? (go to var/cache/index directory located in your NB userdir, in Segments file find which segment belongs to your source root and go to the proper segment directory. There should be directory java/14/sources containing all sources generated by the annotation processors). Thanks.
Comment 16 FiruzzZ 2015-09-11 10:59:08 UTC
(In reply to Dusan Balek from comment #15)

java/14 has
  /classes/projectname/test (with a few random testing classes)
  /refs
      (3 segments, .gen, .cfs)
  /sources (empty)
  /whitelist (empty)
  attributes.properties
  fqn2files.properties
  checksums.properties

Nothing related to "generated model" or any classes
Comment 17 rogerio-163 2015-10-07 12:55:29 UTC
same issue with the tutorial of code generation using Annotations Processor (https://netbeans.org/kb/docs/java/annotations-custom.html)

Any solution? I need it for a college project, please, help me.

By adding auto-generated folder in the library and then remove, the error stop, but if i save any changes in any other file, or perform a rebuild, the issue back.
Comment 18 Abrham 2015-10-13 15:34:04 UTC
Also having this problem. I can provide a little more background on what is happening in my situation.

Using EclipseLink 2.6 and Netbeans 8.0.2

The problem for me only happens when I have extended a @MappedSuperclass on my original @Entity.

When using the MetaModel Netbeans will only not recognize the @MappedSuperclass variables.

However, I can sometimes empty the cache, or clean/build to re-generate the MetaModel which sometimes resolves the problem but not all the time.
Comment 19 Dusan Balek 2015-10-20 09:38:52 UTC
To FiruzzZ: As can be seen from your caches, there were no sources generated by the annotation processors while indexing your project. Please check that annotation processing is enabled in editor for your project.

To rogerio-163: Unfortunately, I cannot reproduce the problem. I walked through the tutorial (step-by-step) and everything worked as described.

To all: Could you please create a simple test project demonstrating the problem and attach it to the issue? Thanks.
Comment 20 FiruzzZ 2015-10-20 18:56:10 UTC
(In reply to Dusan Balek from comment #15)
> ..Also, cloud you please
> check that your source root's cache directory contains sources generated by
> the eclipselink's annotation processors? (go to var/cache/index directory
> located in your NB userdir, in Segments file find which segment belongs to
> your source root and go to the proper segment directory. There should be
> directory java/14/sources containing all sources generated by the annotation
> processors). Thanks.

I double checked and result that I wasn't looking at right folder, I found the one for the project and there just a few (6 files) generated from Entities, I looked around and I found in the path:
../classes/jgestion/entity/
*.rapt (<--- those files got their proper metamodel generated)
but those with the extension *.sig (doesn't, 84 files)
I will attack those in case those could be helpful for something.
Comment 21 FiruzzZ 2015-10-20 18:59:00 UTC
Created attachment 156855 [details]
files *.rapt and *.sig
Comment 22 silva_fabio 2015-11-24 18:28:48 UTC
I had this problem on the past and didn't remember how to solve that.

After two days headache i found it!

In the persistence.xml file i removed the instruction below: 
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

Maybe it works on old netbeans versions. Actually my persistence.xml file didn't had this line on previous versions of my project, it was added when editing persistence.xml in design mode when i changed "Persistence Provider" value and back to the same.

Someone else can confirm that?
Comment 23 silva_fabio 2015-11-25 16:58:04 UTC
Still missing something in my solution :-(

It works for my office computer, but to the home no.

I uninstalled and installed the same versions (7.3 and 8.1) at home who worked in the office and used the same project that was using at the office. I have the same project using the same versions of netbeans working in the office but not at home :-(


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo