Skip to main content

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

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


Back to the top