I'm using GDAPI in an RCP environment, and get the following problem:
When using GDAPI in a JUnit testcase, or in a scrapbook, everything goes fine using the sample code :
JGDQuery query = new JGDQuery("gmail"); // constructs a new query (registration of GDAPI is started if it's the first time)
query.setNum( 5 );
Results results = query.execute();
int count = results.getCount();
System.out.println("count = " + count);
List l = results.getResult();
[...]
I'm packaging GDAPI in a plugin - as a folder containing gdapi.jar, jacob.jar, x86/jacob.dll.
Here is the code I'm using :
import jgd.JGDError;
import jgd.JGDQuery;
import jgd.jaxb.Results;
import jgd.register.JGDRegister;
import junit.framework.Assert;
public class GDSResults {
private Results results = null;
private JGDQuery query = null;
public GDSResults() {
try {
query = new JGDQuery("");
}
catch (JGDError e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
System.out.println("That's where it fails : " + e);
}
query.setNum(5);
}
[...]
When I run the application, I get the following:
That's where it fails : java.lang.IllegalArgumentException: URI scheme is not "file"
I don't understand this ; I've had other error messages before, due to errors in linking the JAR or DLL, but this I don't get.
Maybe this has something to do with the registration cookie, which is supposed to be created next to the DLL, and since I'm packaging the DLL in a plugin, it fails?
I tried to "manually" register - using your sample code testRegistration() - but I get the same error message when trying to create the JGDRegister instance!
Thanks very much for your suggestions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've found an explanation : gdapi is not supposed to work as an RCP plugin, because it uses Classloader to find the path to the gdapi.jar, and then the jacob.dll file. In the case of a plugin, Classloader doesn't give a full path, but a "logical" path to the plugin - hence the error message "URI scheme is not "file"".
I had to modify the source of gdapi and re-create a gdapi.jar, which searches the .dll in the windows/system32 directory - I modified the "CalculateDLLPath" method.
Maybe there was a more clever way to "force" the method, but I couldn't find one.
Please help if you think of another way to do this, or could this be a feature in a next release?
Thanks anyway
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I am also interested in integrating GDAPIv2 in my RCP application. I didn't quite understand your response. Is there now a new version of the gdapi.jar in CVS? Or do I need to build it from the current source? Thanks for any advice on this.
Carlos S. Zamudio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using GDAPI in an RCP environment, and get the following problem:
When using GDAPI in a JUnit testcase, or in a scrapbook, everything goes fine using the sample code :
JGDQuery query = new JGDQuery("gmail"); // constructs a new query (registration of GDAPI is started if it's the first time)
query.setNum( 5 );
Results results = query.execute();
int count = results.getCount();
System.out.println("count = " + count);
List l = results.getResult();
[...]
I'm packaging GDAPI in a plugin - as a folder containing gdapi.jar, jacob.jar, x86/jacob.dll.
Here is the code I'm using :
import jgd.JGDError;
import jgd.JGDQuery;
import jgd.jaxb.Results;
import jgd.register.JGDRegister;
import junit.framework.Assert;
public class GDSResults {
private Results results = null;
private JGDQuery query = null;
public GDSResults() {
try {
query = new JGDQuery("");
}
catch (JGDError e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
System.out.println("That's where it fails : " + e);
}
query.setNum(5);
}
[...]
When I run the application, I get the following:
That's where it fails : java.lang.IllegalArgumentException: URI scheme is not "file"
I don't understand this ; I've had other error messages before, due to errors in linking the JAR or DLL, but this I don't get.
Maybe this has something to do with the registration cookie, which is supposed to be created next to the DLL, and since I'm packaging the DLL in a plugin, it fails?
I tried to "manually" register - using your sample code testRegistration() - but I get the same error message when trying to create the JGDRegister instance!
Thanks very much for your suggestions.
I've found an explanation : gdapi is not supposed to work as an RCP plugin, because it uses Classloader to find the path to the gdapi.jar, and then the jacob.dll file. In the case of a plugin, Classloader doesn't give a full path, but a "logical" path to the plugin - hence the error message "URI scheme is not "file"".
I had to modify the source of gdapi and re-create a gdapi.jar, which searches the .dll in the windows/system32 directory - I modified the "CalculateDLLPath" method.
Maybe there was a more clever way to "force" the method, but I couldn't find one.
Please help if you think of another way to do this, or could this be a feature in a next release?
Thanks anyway
Hi.
I am also interested in integrating GDAPIv2 in my RCP application. I didn't quite understand your response. Is there now a new version of the gdapi.jar in CVS? Or do I need to build it from the current source? Thanks for any advice on this.
Carlos S. Zamudio