Unable to start Quantrix from QAPI. What is the problem?

3.30K viewsGeneral Discussion
0

Using QAPI to start Quantrix I receive the following error output:
——————————————————–
C:Program FilesQuantrix Modeler
Exception in thread “”main”” java.lang.RuntimeException: Problems initializing Quantrix instance: null
at QAPI.QuantrixFactory.getQuantrix(Source:58)
at FirstSample.main(FirstSample.java:11)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at QAPI.QuantrixFactory.getQuantrix(Source:54)
… 1 more
Caused by: java.lang.ExceptionInInitializerError
at JR.f(Source:133)
at JR.b(Source:113)
at JR.<init>(Source:106)
at JR.as_(Source:98)
at com.quantrix.qapi.impl.Bootstrapper.setup(Source:29)
… 6 more
Caused by: java.lang.NullPointerException
at ZS.a(Source:23)
at cv.<clinit>(Source:23)
… 11 more

—————————————————————
The source code that generated the above output is:

————————————————————–
public class FirstSample
{
public static void main(String[] args)
{
String pluginsPathStr = args[0];
System.out.println(pluginsPathStr);

/* get the app */
java.io.File pluginsPath = new java.io.Fil(pluginsPathStr);
QAPI.QuantrixFactory.setQuantrixLocation(pluginsPath);
QAPI.Quantrix quantrix = QAPI.QuantrixFactory.getQuantrix();
quantrix.showUserInterface();
}
}
———————————————————————–

I am currently using Quantrix 2.4 on Vista. I don’t believe there is a classpath error as I have included all the Quantrix jar files in the classpath. Can anyone tell me where the problem might lie? Is it possible that Quantrix may require administrator privileges to be run from QAPI? Any help would be greatly appreciated. Thanks!

Kris Prieb

0

Ah, right, the path-with-space bug was a problem only if you didn’t setQuantrixLocation, when it had to search for the jar (which isn’t the preferred technique).

The other qapi.jar is used internally by the modeler; it’s our qapi implementation with many more classes in the jar; it “knows too much”. QuantrixAPI.jar has a reduced set to make sure the correct classes are found when quantrix is started externally.

0

Thanks for the help, Bryan! Very much appreciated. Switching from “”qapi.jar”” to “”QuantrixAPI.jar”” did the trick.

I was already using the application root directory rather than the plugins directory as the path string (though I did make the mistake of using the plugins directory earlier on). Also, I didn’t make any modifications to the directory structure to create a non-space path name. So ultimately the problem was with the .jar files. This makes me wonder what the purpose of the other .jar file is if not to be used as part of the API.

Here is the new output:

______________________________
C:Program FilesQuantrix Modeler
FOUND: C:Program FilesQuantrix Modelerstartup.jar
WAITING on java.lang.Object@190d11
matrix name = Matrix2
done
______________________________

And the new test code:

______________________________
import QAPI.MatrixView;
import QAPI.Model;

public class FirstSample
{
public static void main(String[] args)
{
String appDirStr = args[0];
System.out.println(appDirStr);

/* get the app */
java.io.File appDirPath = new java.io.File(appDirStr);
QAPI.QuantrixFactory.setQuantrixLocation(appDirPath);
QAPI.Quantrix quantrix = QAPI.QuantrixFactory.getQuantrix();

final Model m = quantrix.createModel();
MatrixView matrix = m.createMatrix();
String name = matrix.getName();
System.out.println(“”matrix name = “” + name); // says “”Matrix2″”

quantrix.showUserInterface();
System.out.println(“”done””);
}
}
—————————————–

Kris Prieb

0

There might be a Vista permission problem involved, but there are some other things to try first. I got it working here on my XP machine on versions 2.4 and 3.0.

* Copy your quantrix installation directory to a directory that doesn’t have spaces in its name. In 2.4 we had a bug where a space got encoded as “%20” which caused a class-not-found error. In my tests I copied “C:Program FilesQuantrix Modeler” to “C:QuantrixModeler”. It doesn’t need to be reinstalled; it only needs a non-space-containing path to the jar.

* For your path string, use the modeler’s root directory, in this case C:/QuantrixModeler, not to the plugins subdirectory. The documentation for setQuantrixLocation() is a bit confusing here:
“Sets the location of the Quantrix plugins directory. The path given should be the full path of the directory [i:ur6btz69]containing [/i:ur6btz69]the Quantrix plugins directory.”
It might;ve been clearer if the first “plugins” word was omitted or replaced with “installation”.

* Set your app’s classpath to QuantrixAPI.jar, not to any others. For example, I set my eclipse build path to C:QuantrixModelerpluginscom.quantrix.qapi_2.4.0.0001QuantrixAPI.jar
Don’t include the other qapi.jar that you see in the same directory.

Let me know if that helps. Here’s the code I tested with:

package test;

import QAPI.MatrixView;
import QAPI.Model;

public class FirstSample
{
public static void main(String[] args)
{
String pluginsPathStr = “C:/QuantrixModeler”; // args[0];
System.out.println(pluginsPathStr);

/* get the app */
java.io.File pluginsPath = new java.io.File(pluginsPathStr);
QAPI.QuantrixFactory.setQuantrixLocation(pluginsPath);
QAPI.Quantrix quantrix = QAPI.QuantrixFactory.getQuantrix();

final Model m = quantrix.createModel();
MatrixView matrix = m.createMatrix();
String name = matrix.getName();
System.out.println(“matrix name = ” + name); // says “Matrix2”

quantrix.showUserInterface();
System.out.println(“done”);
}
}