NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #920 (closed defect: fixed)

Opened 2012-01-24T10:35:08-06:00

Last modified 2012-02-06T15:23:39-06:00

Legacy layer issues with Linux

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b1-initial
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

Running Ubuntu 11.10 with OpenJDK 1.6.0_23. At launch time exception is thrown (below). Any operation that requires the legacy layer is then inoperable.

[ERROR] Invalid service: imagej.legacy.LegacyService
java.lang.reflect.InvocationTargetException

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at imagej.ServiceHelper.createService(ServiceHelper.java:184)
at imagej.ServiceHelper.createExactService(ServiceHelper.java:148)
at imagej.ServiceHelper.loadService(ServiceHelper.java:130)
at imagej.ServiceHelper.loadServices(ServiceHelper.java:108)
at imagej.ImageJ.createContext(ImageJ.java:85)
at imagej.ImageJ.createContext(ImageJ.java:57)
at imagej.Main.main(Main.java:51)

Caused by: java.lang.NoClassDefFoundError: Lcom/sun/tools/javac/Main;

at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
at java.lang.Class.getDeclaredField(Class.java:1897)
at imagej.util.ClassUtils.getField(ClassUtils.java:214)
at imagej.legacy.OptionsSynchronizer.setIJ1CompilerTarget(OptionsSynchronizer.java:605)
at imagej.legacy.OptionsSynchronizer.compilerOptions(OptionsSynchronizer.java:195)
at imagej.legacy.OptionsSynchronizer.updateIJ1SettingsFromIJ2(OptionsSynchronizer.java:97)
at imagej.legacy.LegacyService.updateIJ1Settings(LegacyService.java:196)
at imagej.legacy.LegacyService.<init>(LegacyService.java:138)
... 11 more

Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main

at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 20 more

Change History

comment:1 Changed 2012-01-24T10:37:06-06:00 by bdezonia

Perhaps we need to avoid OpenJDK. But I cannot find such a recommendation on our webserver.

comment:2 Changed 2012-01-31T11:53:54-06:00 by bdezonia

  • Owner changed from bdezonia to curtis
  • Status changed from new to assigned

Installed Sun's Java and get similar (same?) errors.

Last edited 2012-01-31T12:01:16-06:00 by bdezonia

comment:3 Changed 2012-01-31T12:32:51-06:00 by bdezonia

Orignal stack trace is from my home laptop's Linux OS Ubuntu 11.10 install using OpenJDK.

Here is the stack trace on my virtual Linux OS Ubuntu 11.10 install using Sun's java:

[ERROR] Invalid service: imagej.legacy.LegacyService
java.lang.reflect.InvocationTargetException

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at imagej.ServiceHelper.createService(ServiceHelper.java:184)
at imagej.ServiceHelper.createExactService(ServiceHelper.java:148)
at imagej.ServiceHelper.loadService(ServiceHelper.java:130)
at imagej.ServiceHelper.loadServices(ServiceHelper.java:108)
at imagej.ImageJ.createContext(ImageJ.java:85)
at imagej.ImageJ.createContext(ImageJ.java:57)
at imagej.Main.main(Main.java:51)

Caused by: java.lang.NoClassDefFoundError: Lcom/sun/tools/javac/Main;

at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredField(Unknown Source)
at imagej.util.ClassUtils.getField(ClassUtils.java:214)
at imagej.legacy.OptionsSynchronizer.setIJ1CompilerTarget(OptionsSynchronizer.java:605)
at imagej.legacy.OptionsSynchronizer.compilerOptions(OptionsSynchronizer.java:195)
at imagej.legacy.OptionsSynchronizer.updateIJ1SettingsFromIJ2(OptionsSynchronizer.java:97)
at imagej.legacy.LegacyService.updateIJ1Settings(LegacyService.java:196)
at imagej.legacy.LegacyService.<init>(LegacyService.java:138)
... 11 more

Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main

at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 20 more

comment:4 Changed 2012-02-06T15:21:50-06:00 by bdezonia

  • Owner changed from curtis to bdezonia

comment:5 Changed 2012-02-06T15:23:39-06:00 by bdezonia

  • Status changed from assigned to closed
  • Resolution set to fixed

Johannes pointed out that this has to do with an unconfigured Java compiler. In e23f5a82d4ea99f9a39024308d77c01b48dda694 updated OptionsSynchronizer to safely handle when class loading of the compiler fails.