Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ant-dev] loader constraints violated when linking org/apache/tools/ant/BuildListener

I don't know if this matches your particular case, but we have seen the
"loader constraints violated" problem when a class with the same fully
qualified name is loaded by two different plugins.  Is there any chance
that a class with the name "org/apache/tools/ant/BuildListener" is defined
in two or more plugin jar files?  Again, this might not be the case, but
it's one thing to look into.  See the following bug report for more
details:

http://dev.eclipse.org/bugs/show_bug.cgi?id=18263


If this doesn't fix it, please enter a bug report against Platform Ant.




                                                                                                                       
                      "arunchalam P"                                                                                   
                      <arun.chalam@xxxxxxxxx>         To:      platform-ant-dev@xxxxxxxxxxx                            
                      Sent by:                        cc:                                                              
                      platform-ant-dev-admin@         Subject: [platform-ant-dev] loader constraints violated when     
                      eclipse.org                     linking org/apache/tools/ant/BuildListener                       
                                                                                                                       
                                                                                                                       
                      08/25/2002 08:41 AM                                                                              
                      Please respond to                                                                                
                      platform-ant-dev                                                                                 
                                                                                                                       
                                                                                                                       



Hi,
Problem:
********
loader constraints violated when linking org/apache/tools/ant/BuildListener
class

Setup:
******
We use Eclipse 2.0 under windows NT.


Class relationship diagram:
***************************

***********        *************
* Builder *---->* AntRunner *
***********        *************
                                     |
                               *********************
***********************************
                         * SampleBuildLogger *----->*
   Test                         *
                         *********************
***********************************
                                                                *
BuildListener getBuildListener()*

***********************************

Description:
************
We have a plugin which has a "Builder" class. It uses "AntRunner" class to
execute ANT script. The following code snippet shows the same.

             AntRunner runner = new AntRunner();
             runner.addBuildLogger(BUILD_LOGGER);
             runner.run();

Here, BUILD_LOGGER class is "SampleBuildLogger" implementing "BuildLogger"
interface. This is is packaged a separate jar and put under the lib folder
of the plugin.
The following contribution  is made in the "plugin.xml" of the plugin
   <extension
         point="org.eclipse.ant.core.extraClasspathEntries">
      <extraClasspathEntry
            library="lib/buildlib.jar">
      </extraClasspathEntry>
   </extension>

The "SampleBuildLogger" Class creates an instance of "Test". The "Test"
class has the following method
             BuildListener getBuildListener()


Problem:
********
Invoking the build is producing the following error
             java.lang.reflect.InvocationTargetException:
java.lang.LinkageError : loader constraints violated when linking
org/apache/tools/ant/BuildListener class


Tried as part of debugging:
***************************
             Try 1:
                         If we change the return type of  "getBuildListener
()" from "BuildListener" to some thing else
 say "IBuildListener"(custom interface), it goes OK. (But, we need to use
org.apache.BuildListener only)

             Try 2:
                         As a Java application(not plugin), trying to
create "SampleBuildLogger" instance which in turn
       will create "Test" having "BuildListener getBuildListener()" method,
goes OK. (But, we need to having a                     plugin. It will use
AntRunner to speak to listener )

Guess:
******
We guess that the problem is something to do with the way we access the
listener classes in reference to Ant class loader.

Request:
********
Please kindly throw some light on how the problem can be solved?


Thanks in advance

:)
Arun


__________________________________________________________
Outgrown your current e-mail service? Get a 25MB Inbox, POP3 Access,
No Ads and No Taglines with LYCOS MAIL PLUS.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus
_______________________________________________
platform-ant-dev mailing list
platform-ant-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-ant-dev






Back to the top