Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Tycho throwing a NoClassDefFoundError
Tycho throwing a NoClassDefFoundError [message #1653745] Fri, 06 March 2015 11:11 Go to next message
Eclipse UserFriend
Hello,

When doing a Tycho build, Tycho stumbles over one my test plugins, throwing a no NoClassDefFoundError over javafx/collections/FXCollections, as follows :

Quote:

Running be.groups.portfolio.service.codelist.CodelistItemsTest
Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.093 sec <<< FAILURE! - in be.groups.portfolio.service.codelist.CodelistItemsTest
testItemsLength(be.groups.portfolio.service.codelist.CodelistItemsTest) Time elapsed: 0.064 sec <<< ERROR!
java.lang.NoClassDefFoundError: javafx/collections/FXCollections
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:389)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
at be.groups.portfolio.service.codelist.CodelistItems.getLabels(CodelistItems.java:69)
at be.groups.portfolio.service.codelist.CodelistItemsTest.testItemsLength(CodelistItemsTest.java:68)

unknownLanguageShouldReturnFrench(be.groups.portfolio.service.codelist.CodelistItemsTest) Time elapsed: 0.001 sec <<< ERROR!
java.lang.NoClassDefFoundError: javafx/collections/FXCollections
at be.groups.portfolio.service.codelist.CodelistItems.getLabels(CodelistItems.java:69)
at be.groups.portfolio.service.codelist.CodelistItemsTest.unknownLanguageShouldReturnFrench(CodelistItemsTest.java:84)


Needless to say, I have neither compiling issues nor problems to launch the tests from inside the IDE.

I have no idea where as to look for this problem, any ideas ... ?

Thomas Elskens
Re: Tycho throwing a NoClassDefFoundError [message #1653937 is a reply to message #1653745] Fri, 06 March 2015 13:02 Go to previous messageGo to next message
Eclipse UserFriend
So what version of java is the build running on? Is it running on the
same computer you develop? e.g. when you run the build on a linux server
make sure you run with OracleJDK and/or an OpenJDK you downloaded
yourself because the stock one from linux distros does not holds JavaFX

Tom

On 06.03.15 12:11, Thomas Elskens wrote:
> Hello,
>
> When doing a Tycho build, Tycho stumbles over one my test plugins,
> throwing a no NoClassDefFoundError over
> javafx/collections/FXCollections, as follows :
>
> Quote:
>> Running be.groups.portfolio.service.codelist.CodelistItemsTest
>> Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.093
>> sec <<< FAILURE! - in
>> be.groups.portfolio.service.codelist.CodelistItemsTest
>> testItemsLength(be.groups.portfolio.service.codelist.CodelistItemsTest)
>> Time elapsed: 0.064 sec <<< ERROR!
>> java.lang.NoClassDefFoundError: javafx/collections/FXCollections
>> at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:389)
>>
>> at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
>>
>> at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
>>
>> at
>> org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
>>
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at
>> be.groups.portfolio.service.codelist.CodelistItems.getLabels(CodelistItems.java:69)
>>
>> at
>> be.groups.portfolio.service.codelist.CodelistItemsTest.testItemsLength(CodelistItemsTest.java:68)
>>
>>
>> unknownLanguageShouldReturnFrench(be.groups.portfolio.service.codelist.CodelistItemsTest)
>> Time elapsed: 0.001 sec <<< ERROR!
>> java.lang.NoClassDefFoundError: javafx/collections/FXCollections
>> at
>> be.groups.portfolio.service.codelist.CodelistItems.getLabels(CodelistItems.java:69)
>>
>> at
>> be.groups.portfolio.service.codelist.CodelistItemsTest.unknownLanguageShouldReturnFrench(CodelistItemsTest.java:84)
>>
>
>
> Needless to say, I have neither compiling issues nor problems to launch
> the tests from inside the IDE.
>
> I have no idea where as to look for this problem, any ideas ... ?
>
> Thomas Elskens
Re: Tycho throwing a NoClassDefFoundError [message #1654023 is a reply to message #1653937] Fri, 06 March 2015 13:51 Go to previous messageGo to next message
Eclipse UserFriend
The build runs on my personal computer (Windows 7), no server is involved.

I tried with both Java 8_40 and 8_31, with the same issue.
Re: Tycho throwing a NoClassDefFoundError [message #1654551 is a reply to message #1654023] Fri, 06 March 2015 18:50 Go to previous messageGo to next message
Eclipse UserFriend
Oh the test fails because our OSGi hook is not loaded! I need to did up how we made Jenny happy - you to add some extra code to your pom
Re: Tycho throwing a NoClassDefFoundError [message #1660788 is a reply to message #1654551] Mon, 09 March 2015 10:35 Go to previous messageGo to next message
Eclipse UserFriend
I added the following configuration for the classloader hook in the tycho surefire test plugin, but that doesn't change anything :

<plugin>
		        <groupId>org.eclipse.tycho</groupId>
		        <artifactId>tycho-surefire-plugin</artifactId>
		        <version>${tycho-version}</version>
		        <executions>
		          <execution>
		            <id>JUnitTest</id>
		            <goals>
		              <goal>test</goal>
		            </goals>
		            <!-- <phase>install</phase>-->
		            <configuration>
		              <!--<useSystemClassLoader>false</useSystemClassLoader>-->
		              <useUIHarness>true</useUIHarness>
		              <useUIThread>true</useUIThread>
		            <extraClasspathElements>
							<extraClasspathElement>
								<groupId>javafx</groupId>
								<artifactId>javafx.mvn</artifactId>
								<version>2.2.0-SNAPSHOT</version>
							</extraClasspathElement>
						</extraClasspathElements>
		            </configuration>
		          </execution>
		        </executions>
		      </plugin>	


I also tried adding the VM_Argument -"Dosgi.framework.extensions=org.eclipse.fx.osgi" to the run configuration of the Maven build... Without success either.
Re: Tycho throwing a NoClassDefFoundError [message #1661190 is a reply to message #1660788] Mon, 09 March 2015 14:19 Go to previous messageGo to next message
Eclipse UserFriend
This is the pom we generate for jemmy junit

> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <name>abcd - jemmy tests</name>
> <groupId>abcd</groupId>
> <artifactId>abcd.app.jemmy</artifactId>
> <packaging>eclipse-test-plugin</packaging>
>
> <parent>
> <groupId>abcd</groupId>
> <artifactId>abcd.app.releng</artifactId>
> <relativePath>../abcd.app.releng/pom.xml</relativePath>
> <version>1.0.0-SNAPSHOT</version>
> </parent>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-surefire-plugin</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <testSuite>abcd.app.jemmy</testSuite>
> <testClass>abcd.app.jemmy.TestSuite</testClass>
> <useUIHarness>false</useUIHarness>
> <useUIThread>false</useUIThread>
> <argLine>-Xms40m -Xmx512m -Defxclipse.osgi.hook.debug=true -Dosgi.framework.extensions=org.eclipse.fx.osgi -Dtest.jemmy.product=abcd.app.product</argLine>
> <appArgLine>-consoleLog -nosplash</appArgLine>
> <application>org.eclipse.pde.junit.runtime.coretestapplication</application>
> <dependencies>
> <dependency>
> <type>eclipse-feature</type>
> <artifactId>abcd.app.feature</artifactId>
> <version>0.0.0</version>
> </dependency>
> </dependencies>
> <frameworkExtensions>
> <frameworkExtension>
> <groupId>org.eclipse.fx.runtime</groupId>
> <artifactId>org.eclipse.fx.osgi</artifactId>
> <version>1.2.0</version>
> </frameworkExtension>
> </frameworkExtensions>
> </configuration>
> <executions>
> <execution>
> <phase>test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-maven-plugin</artifactId>
> <version>${tycho-version}</version>
> <extensions>true</extensions>
> </plugin>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>target-platform-configuration</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <resolver>p2</resolver>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <scope>test</scope>
> </dependency>
> </dependencies>
>
> </project>

The important part is the framework-extensions stuff

Tom

On 09.03.15 03:35, Thomas Elskens wrote:
> I added the following configuration for the classloader hook in the
> tycho surefire test plugin, but that doesn't change anything :
>
>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-surefire-plugin</artifactId>
> <version>${tycho-version}</version>
> <executions>
> <execution>
> <id>JUnitTest</id>
> <goals>
> <goal>test</goal>
> </goals>
> <!-- <phase>install</phase>-->
> <configuration>
>
> <!--<useSystemClassLoader>false</useSystemClassLoader>-->
> <useUIHarness>true</useUIHarness>
> <useUIThread>true</useUIThread>
> <extraClasspathElements>
> <extraClasspathElement>
> <groupId>javafx</groupId>
> <artifactId>javafx.mvn</artifactId>
> <version>2.2.0-SNAPSHOT</version>
> </extraClasspathElement>
> </extraClasspathElements>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> I also tried adding the VM_Argument
> -"Dosgi.framework.extensions=org.eclipse.fx.osgi" to the run
> configuration of the Maven build... Without success either.
Re: Tycho throwing a NoClassDefFoundError [message #1663126 is a reply to message #1661190] Tue, 10 March 2015 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Unfortunately adding this (stripping of the Jemmy specifics) doesn't work either. I get a PluginExecutionException:

Quote:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.22.0:test (default) on project be.groups.portfolio.service.codelistprovider.test: Execution default of goal org.eclipse.tycho:tycho-surefire-plugin:0.22.0:test failed:
Tycho build extension not configured for MavenProject: be.groups.portfolio:be.groups.portfolio.service.codelistprovider.test:0.0.1-SNAPSHOT @ C:\git\portfolio\be.groups.portfolio.service.codelistprovider.test\pom.xml -> [Help 1]


Maven's error message is a bit cryptic : any idea what this means? Googling it up is not of any help...
Re: Tycho throwing a NoClassDefFoundError [message #1663256 is a reply to message #1663126] Tue, 10 March 2015 10:36 Go to previous messageGo to next message
Eclipse UserFriend
You better ask at the tycho mailing list. As I'm not really a
tycho/maven expert. How does you pom.xml look like now? Did you by
chance forget to modify the packing type is should be
<packaging>eclipse-test-plugin</packaging>?

Tom

On 10.03.15 02:21, Thomas Elskens wrote:
> Unfortunately adding this (stripping of the Jemmy specifics) doesn't
> work either. I get a PluginExecutionException:
> Quote:
>> [ERROR] Failed to execute goal
>> org.eclipse.tycho:tycho-surefire-plugin:0.22.0:test (default) on
>> project be.groups.portfolio.service.codelistprovider.test: Execution
>> default of goal org.eclipse.tycho:tycho-surefire-plugin:0.22.0:test
>> failed: Tycho build extension not configured for MavenProject:
>> be.groups.portfolio:be.groups.portfolio.service.codelistprovider.test:0.0.1-SNAPSHOT
>> @
>> C:\git\portfolio\be.groups.portfolio.service.codelistprovider.test\pom.xml
>> -> [Help 1]
>
>
> Maven's error message is a bit cryptic : any idea what this means?
> Googling it up is not of any help...
Re: Tycho throwing a NoClassDefFoundError [message #1684477 is a reply to message #1663256] Wed, 18 March 2015 12:46 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I went for advice to the Tycho mailing list and the problem was the test goal : leaving the goal unspecified (with default goal integration test) solves this problem (cf. bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=440094).

I have, however, another problem now, for which the mailing list couldn't give an answer: Tycho cannot find the framework extension org.eclipse.fx.osgi :

Quote:

Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.22.0:test (default-test) on project be.groups.portfolio.service.codelistprovider.test: Failed to resolve framework extension org.eclipse.fx.runtime:org.eclipse.fx.osgi:jar: Missing:
[ERROR] ----------
[ERROR] 1) org.eclipse.fx.runtime:org.eclipse.fx.osgi:jar:0.0.0
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.eclipse.fx.runtime -DartifactId=org.eclipse.fx.osgi -Dversion=0.0.0 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.eclipse.fx.runtime -DartifactId=org.eclipse.fx.osgi -Dversion=0.0.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


The POM of my test plugin looks like this now :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<name>Tests CodelistProvider</name>
	<groupId>be.groups.portfolio</groupId>
	<artifactId>be.groups.portfolio.service.codelistprovider.test</artifactId>
	<packaging>eclipse-test-plugin</packaging>

	<parent>
		<groupId>be.groups.portfolio</groupId>
		<artifactId>be.groups.portfolio.releng</artifactId>
		<relativePath>../be.groups.portfolio.releng/pom.xml</relativePath>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-surefire-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<!--<argLine>-Defxclipse.osgi.hook.debug=true -Dosgi.framework.extensions=org.eclipse.fx.osgi</argLine>
					<appArgLine>-consoleLog -nosplash</appArgLine>
					<application>org.eclipse.pde.junit.runtime.coretestapplication</application>-->
					<frameworkExtensions>
						<frameworkExtension>
							<groupId>org.eclipse.fx.runtime</groupId>
							<artifactId>org.eclipse.fx.osgi</artifactId>
							<version>0.0.0</version>
						</frameworkExtension>
					</frameworkExtensions>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${tycho-version}</version>
				<extensions>true</extensions>
		 	</plugin>
		 	<!-- <plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<resolver>p2</resolver>
					<dependency-resolution>
			         <extraRequirements>
			            <requirement>
			               <type>eclipse-plugin</type>
			               <id>org.eclipse.fx.osgi</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			         </extraRequirements>
      </dependency-resolution>
				</configuration>
			</plugin>-->
		</plugins>
	</build>
</project>


The commented areas can be toggled on or off without impacting the error.
Do I need something more to make the extension work... ?

Thomas Elskens
Re: Tycho throwing a NoClassDefFoundError [message #1684570 is a reply to message #1684477] Wed, 18 March 2015 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Could it be that the fragment has to be installed into your local maven
repo? I will touch this area once I've managed to get TestFX through the
IP chain which unfortunately takes for a freaking long time because the
IP team is swapped with work.

Tom

On 18.03.15 13:46, Thomas Elskens wrote:
> Hello,
>
> I went for advice to the Tycho mailing list and the problem was the test
> goal : leaving the goal unspecified (with default goal integration test)
> solves this problem (cf. bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=440094).
> I have, however, another problem now, for which the mailing list
> couldn't give an answer: Tycho cannot find the framework extension
> org.eclipse.fx.osgi :
>
> Quote:
>> Failed to execute goal
>> org.eclipse.tycho:tycho-surefire-plugin:0.22.0:test (default-test) on
>> project be.groups.portfolio.service.codelistprovider.test: Failed to
>> resolve framework extension
>> org.eclipse.fx.runtime:org.eclipse.fx.osgi:jar: Missing:
>> [ERROR] ----------
>> [ERROR] 1) org.eclipse.fx.runtime:org.eclipse.fx.osgi:jar:0.0.0
>> [ERROR] [ERROR] Try downloading the file manually from the project
>> website.
>> [ERROR] [ERROR] Then, install it using the command:
>> [ERROR] mvn install:install-file -DgroupId=org.eclipse.fx.runtime
>> -DartifactId=org.eclipse.fx.osgi -Dversion=0.0.0 -Dpackaging=jar
>> -Dfile=/path/to/file
>> [ERROR] [ERROR] Alternatively, if you host your own repository you can
>> deploy the file there:
>> [ERROR] mvn deploy:deploy-file -DgroupId=org.eclipse.fx.runtime
>> -DartifactId=org.eclipse.fx.osgi -Dversion=0.0.0 -Dpackaging=jar
>> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
>
>
> The POM of my test plugin looks like this now :
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <name>Tests CodelistProvider</name>
> <groupId>be.groups.portfolio</groupId>
> <artifactId>be.groups.portfolio.service.codelistprovider.test</artifactId>
>
> <packaging>eclipse-test-plugin</packaging>
>
> <parent>
> <groupId>be.groups.portfolio</groupId>
> <artifactId>be.groups.portfolio.releng</artifactId>
> <relativePath>../be.groups.portfolio.releng/pom.xml</relativePath>
> <version>0.0.1-SNAPSHOT</version>
> </parent>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-surefire-plugin</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <!--<argLine>-Defxclipse.osgi.hook.debug=true
> -Dosgi.framework.extensions=org.eclipse.fx.osgi</argLine>
> <appArgLine>-consoleLog -nosplash</appArgLine>
>
> <application>org.eclipse.pde.junit.runtime.coretestapplication</application>-->
>
> <frameworkExtensions>
> <frameworkExtension>
> <groupId>org.eclipse.fx.runtime</groupId>
> <artifactId>org.eclipse.fx.osgi</artifactId>
> <version>0.0.0</version>
> </frameworkExtension>
> </frameworkExtensions>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-maven-plugin</artifactId>
> <version>${tycho-version}</version>
> <extensions>true</extensions>
> </plugin>
> <!-- <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>target-platform-configuration</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <resolver>p2</resolver>
> <dependency-resolution>
> <extraRequirements>
> <requirement>
> <type>eclipse-plugin</type>
> <id>org.eclipse.fx.osgi</id>
> <versionRange>0.0.0</versionRange>
> </requirement>
> </extraRequirements>
> </dependency-resolution>
> </configuration>
> </plugin>-->
> </plugins>
> </build>
> </project>
>
>
> The commented areas can be toggled on or off without impacting the
> error. Do I need something more to make the extension work... ?
> Thomas Elskens
Re: Tycho throwing a NoClassDefFoundError [message #1687064 is a reply to message #1684570] Thu, 19 March 2015 13:30 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Just in case some-one would have the same issue : following the instruction mvn install:install-file -DgroupId=org.eclipse.fx.runtime -DartifactId=org.eclipse.fx.osgi -Dversion=0.0.0 -Dpackaging=jar -Dfile=/path/to/file works very nicely.

I also tried bypassing the local Nexus server and fetch directly from Maven central, no success either.

Thomas Elskens
Re: Tycho throwing a NoClassDefFoundError [message #1688149 is a reply to message #1687064] Fri, 20 March 2015 08:28 Go to previous message
Eclipse UserFriend
Hi,

The other option is that you start kicking out the "org.eclipse.fx.osgi"
by reconfiguring Equinox to consult the ext-classpath.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=462634

Tom

On 19.03.15 14:31, Thomas Elskens wrote:
> Hello,
>
> Just in case some-one would have the same issue : following the
> instruction mvn install:install-file -DgroupId=org.eclipse.fx.runtime
> -DartifactId=org.eclipse.fx.osgi -Dversion=0.0.0 -Dpackaging=jar
> -Dfile=/path/to/file works very nicely.
>
> I also tried bypassing the local Nexus server and fetch directly from
> Maven central, no success either.
> Thomas Elskens
Previous Topic:Restart e(fx)clipse application
Next Topic:Bug 462634 - Make org.eclipse.fx.osgi optional for pure OSGi+JavaFX applications
Goto Forum:
  


Current Time: Sat Feb 08 23:40:14 GMT 2025

Powered by FUDForum. Page generated in 0.06436 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top