ImageJ2 Plugin Tutorials

When I have cloned the ImageJ2 tutorial plugins, some of the maven projects are not runnable – in the picture, metadata and swing-example are. And also I get a bunch of errors like the ones shown. It happened after I did “Help->Refresh ImageJ”.


What can be the reason? It correctly shows it is running ImageJ2, but somehow my annotation with @Plugin does not get picked up, although most of the tutorial project do work…

It would help if you post the full stack trace as text. From the screenshot I cannot see what the problem is.

I don’t have that command in the menu. Do you mean Help > Update ImageJ…? If so, please report what version of ImageJ 1.x (ij.jar) you’re now running.

Thanks again, Jan.
Here is the stacktrace when running “using-ops” example from the tutorials.

    java.lang.IllegalArgumentException: Cannot handle replace call to create in ij.gui.Toolbar's public void itemStateChanged(java.awt.event.ItemEvent e)
	at net.imagej.patcher.CodeHacker.replaceCallInMethod(CodeHacker.java:725)
	at net.imagej.patcher.CodeHacker.replaceCallInMethod(CodeHacker.java:650)
	at net.imagej.patcher.LegacyExtensions.addEditorExtensionPoints(LegacyExtensions.java:368)
	at net.imagej.patcher.LegacyExtensions.injectHooks(LegacyExtensions.java:289)
	at net.imagej.patcher.LegacyInjector.inject(LegacyInjector.java:308)
	at net.imagej.patcher.LegacyInjector.injectHooks(LegacyInjector.java:109)
	at net.imagej.patcher.LegacyEnvironment.initialize(LegacyEnvironment.java:101)
	at net.imagej.patcher.LegacyEnvironment.applyPatches(LegacyEnvironment.java:495)
	at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:397)
	at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:376)
	at net.imagej.legacy.LegacyService.<clinit>(LegacyService.java:132)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:302)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
	at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
	at org.scijava.Context.<init>(Context.java:279)
	at org.scijava.Context.<init>(Context.java:235)
	at org.scijava.Context.<init>(Context.java:175)
	at org.scijava.Context.<init>(Context.java:161)
	at net.imagej.ImageJ.<init>(ImageJ.java:77)
	at UsingOps.main(UsingOps.java:21)
Caused by: javassist.CannotCompileException: No code replaced!
	at net.imagej.patcher.CodeHacker$EagerExprEditor.instrument(CodeHacker.java:1280)
	at net.imagej.patcher.CodeHacker.replaceCallInMethod(CodeHacker.java:722)
	... 29 more
java.lang.IllegalArgumentException: Cannot handle replace call to installFile in ij.Menus's void installStartupMacroSet()
	at net.imagej.patcher.CodeHacker.replaceCallInMethod(CodeHacker.java:725)
	at net.imagej.patcher.CodeHacker.replaceCallInMethod(CodeHacker.java:650)
	at net.imagej.patcher.LegacyExtensions.overrideStartupMacrosForFiji(LegacyExtensions.java:529)
	at net.imagej.patcher.LegacyExtensions.injectHooks(LegacyExtensions.java:293)
	at net.imagej.patcher.LegacyInjector.inject(LegacyInjector.java:308)
	at net.imagej.patcher.LegacyInjector.injectHooks(LegacyInjector.java:109)
	at net.imagej.patcher.LegacyEnvironment.initialize(LegacyEnvironment.java:101)
	at net.imagej.patcher.LegacyEnvironment.applyPatches(LegacyEnvironment.java:495)
	at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:397)
	at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:376)
	at net.imagej.legacy.LegacyService.<clinit>(LegacyService.java:132)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:302)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
	at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
	at org.scijava.Context.<init>(Context.java:279)
	at org.scijava.Context.<init>(Context.java:235)
	at org.scijava.Context.<init>(Context.java:175)
	at org.scijava.Context.<init>(Context.java:161)
	at net.imagej.ImageJ.<init>(ImageJ.java:77)
	at UsingOps.main(UsingOps.java:21)
Caused by: javassist.CannotCompileException: No code replaced!
	at net.imagej.patcher.CodeHacker$EagerExprEditor.instrument(CodeHacker.java:1280)
	at net.imagej.patcher.CodeHacker.replaceCallInMethod(CodeHacker.java:722)
	... 29 more
log4j:WARN No appenders could be found for logger (org.bushe.swing.event.EventService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

As regards version, I believe it is ImageJ2 and 1.52e.

–S

Sorry for the >1 year delay in reply, but I am fairly certain this exception was fixed quite a long time ago. If not, please reply as a new topic with details and I’ll investigate further.