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 141591 - LinkageError when loading org-openide-util.jar
Summary: LinkageError when loading org-openide-util.jar
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-24 17:51 UTC by scanti
Modified: 2008-07-24 19:03 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project (8.22 KB, application/x-compressed)
2008-07-24 19:03 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description scanti 2008-07-24 17:51:55 UTC
Hi, 
I am developing a RCP based on NetBeans. This RCP uses ant files to perform several tasks. Since some tasks requires to
access to the NetBeans API I use Ant ClassPath extension at runtime by adding
<filesystem>
    <folder name="Services">
        <folder name="Hidden">
             <file name="org-openide-util-antlibrary.instance">
                <attr name="SystemFileSystem.localizingBundle" stringvalue="com.streamsim.hmutils.Bundle"/>
                <attr name="instanceCreate" methodvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspath.url"/>
                <attr name="url" urlvalue="nbinst://org.openide.util/lib/org-openide-util.jar"/>
                <attr name="instanceOf" stringvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspathProvider"/>
            </file>
      </folder>
 ....

and many more.

However if I add to the classpath "org-openide-util.jar" or "org-openide-filesystems.jar"  I get a 

java.lang.LinkageError: Class org/openide/ErrorManager violates loader constraints
	at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:180)
	at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
[catch] at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)

at runtime.

This is really a blocking issue for the company I am working for, because we have the uttermost need to use NB API.
Thanks in advance for your help
Comment 1 Jesse Glick 2008-07-24 19:02:19 UTC
Using AutomaticExtraClasspathProvider for this purpose is inappropriate. AECP is _only_ for a fixed set of JARs which
are used by "optional" tasks bundled in the Ant distribution, which for historical reasons expect their 3rd-party
libraries to be available in Ant's own classpath.

When loading these JARs normally via <taskdef>, it works for me in a 6.5 dev build; see attached project.

If what you really want is for the Ant tasks to access the internals of the running platform - rather than loading fresh
copies of NB API modules with no context - then you should be using ant/nblib/*.jar as documented in the Ant integration
API.
Comment 2 Jesse Glick 2008-07-24 19:03:07 UTC
Created attachment 65576 [details]
Sample project