This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 210271 - Maven OSGi: cannot find symbol
Summary: Maven OSGi: cannot find symbol
Status: RESOLVED INCOMPLETE
Alias: None
Product: projects
Classification: Unclassified
Component: Maven OSGi bundles (show other bugs)
Version: 7.1
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-28 12:46 UTC by puce
Modified: 2012-12-10 09:57 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description puce 2012-03-28 12:46:06 UTC
The Projects view and the Java editor show an error (cannot find symbol) though a clean & build works fine.

This is very annoying!

- Maven 3 with maven-bundle-plugin
- Java SE 7
- NetBeans 7.1
Comment 1 Milos Kleint 2012-03-28 13:11:30 UTC
please create a sample project demonstrating the problem.
Comment 2 puce 2012-03-28 13:25:27 UTC
Currently, I cannot give you a sample project, sorry.

It just happens now and then (but quite often actually), so I'm filing issues here.

The whole IDE feels less stable lately. Maybe its also due to the combination of Maven / OSGi/ Java SE 7 which I didn't use before.

Maybe you could try out this combination and see if it pops up after a while?
Comment 3 Milos Kleint 2012-03-28 13:27:52 UTC
(In reply to comment #2)

> Maybe you could try out this combination and see if it pops up after a while?

Well, that's why was asking for a sample project in the first place. Having such an easy to use and reproduce scenario significantly increases the chances of fixing the problem.
Comment 4 puce 2012-03-28 13:29:22 UTC
This issue is marked as Resolved already?
Comment 5 Milos Kleint 2012-03-28 13:32:27 UTC
It's resolved incomplete, once you add additional information, please reopen (if you forget or don't know that, I will reopen myself once there is something that can be reproduced, tracked etc..)
Comment 6 puce 2012-03-28 13:45:59 UTC
Product Version: NetBeans IDE 7.1 (Build 201112071828)
Java: 1.7.0_02; Java HotSpot(TM) Client VM 22.0-b10
System: Linux version 2.6.38-13-generic-pae running on i386; UTF-8; de_CH (nb)
Comment 7 Milos Kleint 2012-03-28 16:25:14 UTC
please submit the sample project. I have myself no clue how is the bundle plugin project configured. Or make sure you can reproduce with a sample java project.
Comment 8 Milos Kleint 2012-03-29 08:35:17 UTC
Tomas, Jan: anything rings a bell? I couldn't find an existing duplicate of this issue in maven bugs, maybe you have some in java support?
Comment 9 Tomas Zezula 2012-03-29 11:26:30 UTC
I don't know about any similar issue.
1st) Can someone provide test case?
2nd) Is the class path of the file with error correct? (The classapaths for file can be seen in files properties panel)
3rd) Isn't the error type generated by annotation processor?
Comment 10 Jesse Glick 2012-03-29 17:45:39 UTC
(In reply to comment #9)
> The classapaths for file can be seen in files properties panel

Project Metadata Inspector (on AU) gives more thorough information.
Comment 11 vavasilev 2012-04-20 07:58:17 UTC
I also have similar problem. It is a combination of Maven/OSGi/SVN/Net Beans Platform projects. A workaround that worked for me is:
1.	Close the IDE
2. Delete the following directories:
- C:\Documents and Settings\<user>\.netbeans\7.1\var\cache\mavencachedirs
- C:\Documents and Settings\<user>\.netbeans\7.1\var\cache\svncache
3. Start the IDE again. You will still have error markers, but if you mouse-over the error icon you will see the error is kind of “Error parsing file”. Open the file – in a fiew moments the error will disappear not only in the current file but on the others as well.  This will fix the problems within similar folders, ex. “Source Packages”. If you have errors for example on “Test Packages”, you have to repeat the procedure with a file from there.

I found that other people have this problem as well: http://stackoverflow.com/questions/8961164/cannot-find-symbol-errors-in-netbeans
Comment 12 Milos Kleint 2012-04-20 09:14:38 UTC
(In reply to comment #11)
> I also have similar problem. It is a combination of Maven/OSGi/SVN/Net Beans
> Platform projects. A workaround that worked for me is:
> 1.    Close the IDE
> 2. Delete the following directories:
> - C:\Documents and Settings\<user>\.netbeans\7.1\var\cache\mavencachedirs
> - C:\Documents and Settings\<user>\.netbeans\7.1\var\cache\svncache

this is very, very unlikely. mavencachedirs contains mostly nothing or only profiler related stuff, AFAIK nothing related to java parsing, compilation. Same applies to svncache as well IMHO.
The only cache directory related to java infrastructure is var/cache/index

AGAIN, without a sample project where we can reproduce the issue, there is not much we can do. The problem could be all over the IDE's codebase and without seeing and debugging it, it's impossible to find. Alternatively download the mentioned Project Metadata Inspector module and provide additional information about your projects..

Also please try the upcoming beta of 7.2 where we have fixed a bunch of possibly related issues.
Comment 13 viljoenp 2012-08-07 09:59:20 UTC
7.2 has the same problem :
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.6.0_33; Java HotSpot(TM) 64-Bit Server VM 20.8-b03-424
System: Mac OS X version 10.7.4 running on x86_64; MacRoman; af_ZA (nb)


It is really hard to make a sample project, since the issue only occurs with many dependant project.. Sometimes (well it worked once) it helps to refactor the class (the class it claims it cannot find) in the source project and make ALL references explicit ( ie NO imports ). this does not work always though so it must be a bit more complicated...
Comment 14 viljoenp 2012-08-07 12:26:19 UTC
Given
Project A ( Java Library Project )
Project B ( Java Application Project )


Just to confirm I don't use maven in these projects nor OSGI , this has nothing to do with those components. It is purely an IDE internal compiler issue. 
The project DO a clean & build without error but the IDE will claim it has an error in Project B ( note no errors is shown in Project A ) , it claims that it cannot find a class that was supplied by Project A to Project B.

I have managed to again fix this by removing ALL import statements from the offending class in Project A , even imports like java.util.List and changed the source to explicitly use the fully qualified name of ALL classes referenced. This managed to clear the error message in the IDE for Project B.

This is a bit of a simplistic explanation , we have 30+ projects ( mostly java library projects ) that are inter dependent and only noticed this behaviour in since netbeans 7.x when we reference many many projects. A simple pair of Projects dont seem to be able to reproduce this issue.. 


Is there some way I can see all internal errors that occured during a project scan ?, perhaps I can see from such logs why it gets a compile error on these dependent classes. Memory or recursion depth or something ?

There is nothing special about the classes that give errors , they can vary from simple beans to more complex factories..
Comment 15 jose.gisbert 2012-12-10 09:57:49 UTC
I've had the same issue. This is the way that I solve it:

  - First close the project from which you import the symbols Netbeans
    doesn't find.
  - After that, reopen the project you've closed, but you must do it from
    dependent project dependencies folder.

Again, it's very expensive to create a sample project cause it must be a
multimodule Maven project.