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 196595 - Duplicated service class prevents MISL from loading either
Summary: Duplicated service class prevents MISL from loading either
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Lookup (show other bugs)
Version: 6.x
Hardware: All All
: P4 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
: 201017 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-11 14:25 UTC by wz2b
Modified: 2012-04-10 08:52 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log for the time period of the failed upgrade (72.61 KB, text/plain)
2011-03-14 12:28 UTC, wz2b
Details
Core side of such a patch (4.40 KB, patch)
2011-03-17 14:20 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description wz2b 2011-03-11 14:25:58 UTC
Netbeans 6.9.1 has been nagging me to update itself.  It said it had 15 updates.  I just let it upgrade, and now it has lost all maven support.  There is no more maven tab in the Tools/Options menu.  There don't appear to be any missing plugins.  It can no longer open POM files as if they were projects.


Product Version = NetBeans IDE 6.9.1 (Build 201011082200)
Operating System = Linux version 2.6.32-27-generic running on i386
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) Client VM 17.1-b03
Comment 1 wz2b 2011-03-11 14:35:34 UTC
This appears to be a problem others have had where when you go to open the project dir it shows:

<unrecognized project; missing plug-in?>

however, these are projects that were maven projects working perfectly fine before I allowed this update.  There is no nbproject.xml as it's a maven project so I wasn't able to find the exact problem in other tickets.
Comment 2 wz2b 2011-03-11 14:37:54 UTC
I figured it out.  The main plugins for java and basic ide were deactivated.  Why would they deactivate themselves on an update?
Comment 3 Marian Mirilovic 2011-03-14 12:13:46 UTC
(In reply to comment #2)
> I figured it out.  The main plugins for java and basic ide were deactivated. 
> Why would they deactivate themselves on an update?

Thanks for evaluation, we need your messages.log file from the time you were updating , see http://wiki.netbeans.org/FaqLogMessagesFile . Please attach it here and reopen, thanks in advance.
Comment 4 wz2b 2011-03-14 12:28:26 UTC
Created attachment 106977 [details]
messages.log for the time period of the failed upgrade

The messages.log for the time period in question is attached.  I see a number of messages like this:

INFO [org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser]: Unpaired license E8A93F66 without any module.

could that be the problem?
Comment 5 Marian Mirilovic 2011-03-14 12:34:48 UTC
(In reply to comment #4)
> INFO [org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser]:
> Unpaired license E8A93F66 without any module.
> 
> could that be the problem?

Thanks we will look at this.
Comment 6 Jaroslav Tulach 2011-03-14 16:32:09 UTC
java.lang.ClassNotFoundException: Will not load class org.netbeans.modules.spellchecker.bindings.java.JavaSemanticTokenList$FactoryImpl arbitrarily from one of ModuleCL@d5a2a9[org.netbeans.modules.spellchecker.bindings.java] and ModuleCL@be9340[org.netbeans.modules.spellchecker.bindings] starting from SystemClassLoader[440 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
	at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:244)
Comment 7 Jan Lahoda 2011-03-16 10:45:39 UTC
org.netbeans.modules.spellchecker.bindings is the code name of a contrib module, that was moved (and renamed to ....java) to std. distro about a year ago:
http://hg.netbeans.org/main-silver/rev/b0b06bf961ed
http://hg.netbeans.org/main/contrib/rev/af28c506d90b
and was removed from the (dev) AUC config:
http://hg.netbeans.org/main-silver/rev/9694aa18a012

I do no see it on the dev AUC, so it is not very clear to me why and from where it got installed.

Sorry, but the only thing I could do in the code would be to create a fake module on dev AUC just to mask out the deleted one. This seems like an overkill to me. The module can be easily deleted manually: please stop the IDE, go to the IDE's userdir, which should contain these files:
config/Modules/org-netbeans-modules-spellchecker-bindings.xml
modules/org-netbeans-modules-spellchecker-bindings.jar
update_tracking/org-netbeans-modules-spellchecker-bindings.xml
Thanks.

A meta-comment: is the IDE really so fragile that installing two modules with the same classes crashes unrelated functionality? That does not seem right to me.
Comment 8 Jaroslav Tulach 2011-03-16 11:57:19 UTC
OK, let it be. 

The problem is not loading the class from the module directly, but trying to load it using SystemClassLoader. It has the benefit of seeing all the classes in the system and the drawback of not knowing which one is the correct one when it is duplicated.
Comment 9 Jan Lahoda 2011-03-16 12:34:06 UTC
It is clear that the (duplicated) org.netbeans.modules.spellchecker.bindings.java.JavaSemanticTokenList$FactoryImplcannot be load through the global Lookup. The whole Java bindings for the spellchecker would not probably work in this situation, and that is "fine" (from the point of view of the whole IDE), IMO. But the maven support stopped to work for the user, and my point is that if this is/was caused by the spellchecker bindings module (which I assume was the reason to pass it to me), the IDE is very fragile, and that this is not really good.
Comment 10 Jaroslav Tulach 2011-03-16 14:11:14 UTC
Having two different modules with the same classes make the IDE fragile. Right.
Comment 11 Jesse Glick 2011-03-16 15:02:12 UTC
A bug in MetaInfServicesLookup that it asks the SCL to load a class by name; should rather be asking in the particular module loader defining the service entry. Since ClassLoader.getResource{,s,AsStream} returns a plain URL with no indication of the defining loader, this is not solvable generically; could be solved for module loaders by defining some interface in openide.util.lookup such as

public interface ClassLoaderWithResourceDefinitions {
  Iterable<(URL,ClassLoader)> getResourceDefinitions(String name);
}

to be implemented by ModuleClassLoader, so that MISL would know exactly where to load from. Not needed for standard distro, but would improve robustness.


I'm still not clear what the relation to the Maven support is. Sounds like a possibly unrelated issue, that Plugin Manager disabled the Java support. Log file shows Maven-related modules disabled, but not the reason for this.
Comment 12 Jaroslav Tulach 2011-03-17 09:34:50 UTC
If this shall really be done, then I rather hack it by asking

urlConnection.getContent(ClassLoader.class)

(or something similar without NetBeans specific class) and reply to this query in somewhere startup.
Comment 13 Jesse Glick 2011-03-17 14:20:41 UTC
Created attachment 107072 [details]
Core side of such a patch
Comment 14 Jaroslav Tulach 2011-08-27 23:14:20 UTC
ergonomics#69e552913da8
Comment 15 Jesse Glick 2011-08-29 14:38:29 UTC
There is a JRE RFE for a more suitable API.
Comment 16 Quality Engineering 2011-08-30 14:22:40 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/69e552913da8
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #196595: Load classes from the same classloader that provides the META-INF/services/ registration preferrably
Comment 17 Jan Lahoda 2012-04-10 08:52:01 UTC
*** Bug 201017 has been marked as a duplicate of this bug. ***