Closed aksagar closed 10 years ago
I think this will be fixed by https://github.com/scijava/scijava-common/pull/88...
javax.script.ScriptException: java.lang.reflect.InvocationTargetException
Unfortunately, this is not quite as informative as the full output... i.e. the full stacktrace. Remember, the ScriptException
just wraps an InvocationTargetException
which in turn wraps another exception. It is that wrapped exception that is the culprit... Now, I seem to remember that I saw on your screen that it said "URI is not hierarchical" but please include this information in bug reports: my memory is not always to be trusted, and other developers who could address the issue do not have access to my memory at all...
Now back to the problem. I think I fixed it. Could you remove the scijava-common-2.24.0.jar
file from your Fiji.app/jars/
directory and place a downloaded http://jenkins.imagej.net/view/SciJava/job/SciJava-common/lastSuccessfulBuild/artifact/target/scijava-common-2.24.1-SNAPSHOT.jar into said directory instead, then try again to run the plugin in the script editor? Thank you!
@dscho Sorry for not being detailed in the issue. I downloaded the jar file and placed it in the folder you mentioned but I am getting the same error. Here is the detailed error.
javax.script.ScriptException: java.lang.reflect.InvocationTargetException
at org.scijava.plugins.scripting.java.MainJavaRunner.run(MainJavaRunner.java:68)
at org.scijava.plugins.scripting.java.DefaultJavaService.run(DefaultJavaService.java:61)
at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:178)
at org.scijava.script.ScriptModule.run(ScriptModule.java:172)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.scijava.plugins.scripting.java.MainJavaRunner.run(MainJavaRunner.java:59)
... 12 more
Caused by: java.lang.IllegalArgumentException: Invalid service: net.imagej.legacy.DefaultLegacyService
at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:279)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:230)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:193)
at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:165)
at org.scijava.Context.
Thanks @aksagar. The problem is not specific to Windows; it happens on OS X too, and very likely also on Linux. I updated the description above to reflect the gist of the problem.
You can work around it by using the following block of code instead:
import net.imagej.ImageJ;
import net.imagej.ops.Op;
import org.scijava.command.Command;
import org.scijava.plugin.Parameter;
public class UsingOps implements Command {
@Parameter
private ImageJ ij;
public void run() {
ij.ui().showDialog("Hello world");
// do more stuff with ij...
}
}
@dscho: I'm sort of amazed that this is the very first time anyone has tried constructing a new SciJava context in the Script Editor. And I'm not sure of the best way to fix it, or if we even should do so...
I do not think that it makes sense to allow creating new contexts in the script editor. The whole point of the script editor being run in a context is to reuse it.
So I close the bug with the suggestion to use the script editor to develop Command
s in the style as mentioned in the comment above.
I was trying to compile a small Java code block in Fiji(Windows 32 bit)
And I got the following error:
The problem is that the
new ImageJ()
call creates a new full-blown SciJavaContext
with its ownLegacyService
, but more than one simultaneous such service is not allowed due to limitations in the design of ImageJ 1.x.