Hi,

Yes that is what I think too.

I changed my architecture since I posted my issue.

I still have the issue but I think the best is to explain the module hierarchy :
- I have module A (netbeans module)
- the module A has a maven dependency to module B
- the module B has a dependency to a library 1 (maven java project which is not 
a Netbeans module).
- the library 1 has dependencies to maven libraries, including 
commons-configuration.

=> The library 1 includes some classes and module A has a class which inherits 
from one of this classes.
=> In the super class (in library 1), there is an attribute named 
"configuration" (which is a "org.apache.commons.configuration.Configuration").
=> The issue appends when I call a method of the inherited attribute 
"configuration" in the class of module A.

=> in module B, the package "org.apache.commons.configuration" has been 
declared as "publicPackage" in the "nbm-maven-plugin" in the POM.
I would have hope that it would be sufficient to avoid that kind of problem, 
but it is not.

The problem must be that module A and module B both add the classes of the 
apache "commons-configuration" project to their class loader.

Bastien


-----Message d'origine-----
De : Emilian Bold [mailto:emilian.b...@protonmail.ch]
Envoyé : jeudi 15 février 2018 13:13
À : GRYSPEERDT Bastien [CLEMESSY]
Cc : us...@netbeans.incubator.apache.org
Objet : Re: java.lang.LinkageError: loader constraint violation: loader

My guess is that you are bunding twice 
org/apache/commons/configuration/Configuration (ie. commons-configuration).

Maybe you have two modules that have a library wrapper? Or some other external 
JAR that also bundles it in a fat jar?

​--emi


-------- Original Message --------
 On 13 February 2018 4:21 PM, GRYSPEERDT Bastien [CLEMESSY] 
<bastien.gryspee...@eiffage.com> wrote:

>
>Hi,
>
>
>
>
>
>I have an application build on the Netbeans Platform that uses some netbeans 
>modules.
>
>
>These netbeans modules import some subprojects (that are not Netbeans
>modules). In one of the subproject, I need to call the 
>org.apache.configuration.Configuration (from “commons-configuration” Apache 
>project) class to  check that a parameter is true (if it is, I display some 
>field on a HMI).
>
>
>To set the Configuration install, I do it like this : 
>VariableSelectorGuiManager.setConfiguration(myInstance) è this is passed as 
>static.
>
>
>Then, The VariableSelectorGui class gets the configuration instance an display 
>the fields depending on the parameters of the configuration instance.
>
>
>
>
>
>The problem is the following :
>
>
>-We have a standard Java HMI (not integrated in Netbeans) in which everything 
>works fine.
>
>
>-With the Netbeans platform, the
>“VariableSelectorGuiManager.setConfiguration(myInstance)” is done in the 
>register method of our “ModuleInstall” class. When we try to display the 
>VariableSelectorGui, this error  is thrown :
>
>
>
>
>
>java.lang.LinkageError: loader constraint violation: loader (instance of 
>org/netbeans/StandardModule$OneModuleClassLoader) previously initiated loading 
>for a different type with name "org/apache/commons/configuration/Configuration"
>
>
>                at java.lang.ClassLoader.defineClass1(Native Method)
>
>
>                at
>java.lang.ClassLoader.defineClass(ClassLoader.java:760)
>
>
>                at
>org.netbeans.JarClassLoader.doLoadClass(JarClassLoader.java:311)
>
>
>                at
>org.netbeans.ProxyClassLoader.selfLoadClass(ProxyClassLoader.java:259)
>
>
>                at
>org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:217)
>
>
>                at
>java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
>
>                at
>fr.variable.selector.component.VariableSelectorGui.getCenterPane(Variab
>leSelectorGui.java:562)
>
>
>                at
>fr.variable.selector.component.VariableSelectorGui.createComponent(Vari
>ableSelectorGui.java:821)
>
>
>                at
>fr.variable.selector.component.VariableSelectorGui.lambda$getComponent$
>1(VariableSelectorGui.java:181)
>
>
>                at
>fr.variable.selector.component.VariableSelectorGui$$Lambda$116/70093424
>6.run(Unknown Source)
>
>
>                at
>com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.ja
>va:292)
>
>
>                at
>com.sun.javafx.application.PlatformImpl$$Lambda$64/1862576770.run(Unkno
>wn Source)
>
>
>                at java.security.AccessController.doPrivileged(Native
>Method)
>
>
>                at
>com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImp
>l.java:291)
>
>
>                at
>com.sun.javafx.application.PlatformImpl$$Lambda$63/2029243975.run(Unkno
>wn Source)
>
>
>[catch] at
>com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher
>.java:95)
>
>
>                at com.sun.glass.ui.win.WinApplication._runLoop(Native
>Method)
>
>
>                at
>com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java
>:102)
>
>
>                at
>com.sun.glass.ui.win.WinApplication$$Lambda$54/1859224790.run(Unknown
>Source)
>
>
>                at java.lang.Thread.run(Thread.java:745)
>
>
>The error is thrown when trying to access a method of the Configuration 
>interface.
>
>
>
>
>
>I already tried to add 
>“<publicPackage>org.apache.commons.configuration</publicPackage>” but it does 
>not work.
>
>
>I also tried to add exclusions but it does not work too.
>
>
>
>
>
>When I remove the code from the ModuleInstall>>register, the error is not 
>thrown.
>
>
>
>
>
>All the modules/projects inherit from the same version of the 
>“commons-configuration” project.
>
>
>
>
>
>Thanks,
>
>
>
>
>
>Bastien
>
>
>
> Cet e-mail et ses éventuelles pièces jointes peuvent contenir des
> informations confidentielles et sont exclusivement adressés au(x) 
> destinataire(s) mentionné(s) ci-dessus. Toute diffusion, exploitation ou 
> copie sans autorisation de cet e-mail et de ses pièces jointes est 
> strictement interdite. Si vous recevez ce message par erreur, merci de le 
> détruire et d' avertir immédiatement l'expéditeur. EIFFAGE décline toute 
> responsabilité si ce message a été modifié ou falsifié.
> This message and any attachments may contain confidential information
> and are established exclusively for his or its recipients. Any use of this 
> message, for which it was not intended, any distribution or any total or 
> partial publication is prohibited unless previously approved. If you receive 
> this message in error, please destroy it and immediately notify the sender 
> thereof. The EIFFAGE Group declines all responsibility concerning this 
> message if it has been altered or tampered with.
>
[http://www.eiffage.com/signature/image.jpg]
Cet e-mail et ses éventuelles pièces jointes peuvent contenir des informations 
confidentielles et sont exclusivement adressés au(x) destinataire(s) 
mentionné(s) ci-dessus. Toute diffusion, exploitation ou copie sans 
autorisation de cet e-mail et de ses pièces jointes est strictement interdite. 
Si vous recevez ce message par erreur, merci de le détruire et d' avertir 
immédiatement l'expéditeur. EIFFAGE décline toute responsabilité si ce message 
a été modifié ou falsifié.
This message and any attachments may contain confidential information and are 
established exclusively for his or its recipients. Any use of this message, for 
which it was not intended, any distribution or any total or partial publication 
is prohibited unless previously approved. If you receive this message in error, 
please destroy it and immediately notify the sender thereof. The EIFFAGE Group 
declines all responsibility concerning this message if it has been altered or 
tampered with.

Reply via email to