Fixing Maven-Eclipse with imglib2

Hey there,

I somehow broke my eclipse and am unable to use ImageJFunctions to open the images via the maven based java programs I have in that project. It throws the following error:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: net.imglib2.img.array.ArrayImgFactory.<init>(Lnet/imglib2/type/NativeType;)V
 at net.imglib2.img.display.imagej.ImageJVirtualStack.getSlice(ImageJVirtualStack.java:137)
 at net.imglib2.img.display.imagej.ImageJVirtualStack.getPixelsZeroBasedIndex(ImageJVirtualStack.java:155)
 at net.imglib2.img.display.imagej.AbstractVirtualStack.getPixels(AbstractVirtualStack.java:89)
 at net.imglib2.img.display.imagej.AbstractVirtualStack.getProcessor(AbstractVirtualStack.java:111)
 at ij.ImagePlus.setStack(ImagePlus.java:694)
 at ij.ImagePlus.<init>(ImagePlus.java:154)
 at net.imglib2.img.display.imagej.ImageJFunctions.makeImagePlus(ImageJFunctions.java:299)
 at net.imglib2.img.display.imagej.ImageJFunctions.wrapFloat(ImageJFunctions.java:287)
 at net.imglib2.img.display.imagej.ImageJFunctions.wrap(ImageJFunctions.java:232)
 at net.imglib2.img.display.imagej.ImageJFunctions.show(ImageJFunctions.java:262)
 at net.imglib2.img.display.imagej.ImageJFunctions.show(ImageJFunctions.java:155)
 at net.imglib2.img.display.imagej.ImageJFunctions.show(ImageJFunctions.java:160)```

My pom.xml has scijava version 25.0.0 and these other dependencies: 

        <dependency>
 		<groupId>net.imglib2</groupId>
 		<artifactId>imglib2</artifactId>
 	</dependency>

 	<dependency>
 		<groupId>net.imglib2</groupId>
 		<artifactId>imglib2-ij</artifactId>
 	</dependency>
 	<dependency>
 		<groupId>net.imglib2</groupId>
 		<artifactId>imglib2-roi</artifactId>
 	</dependency>

 	<!-- ImageJ dependencies -->
 	<dependency>
 		<groupId>net.imagej</groupId>
 		<artifactId>ij</artifactId>
 	</dependency>

Hi @kapoorlab!

Hmm, I tried to reproduce your issue but no luck.

Maybe open your pom.xml in eclipse and compare the versions that were resolved with what Iā€™m getting:

This is the parent pom I used:

	<parent>
		<groupId>org.scijava</groupId>
		<artifactId>pom-scijava</artifactId>
		<version>25.0.0</version>
		<relativePath />
	</parent>

John

2 Likes

Thanks John, It turned out that I had a local scifio repo which was in my maven dependencies and that was causing the problem. Removing that as a dependency resolved the issue.

1 Like