I am new to use Quip and trying to make a demo of Knowledge Base using XML technology. My problem is why I got this error “java.lang.SecurityException: Unable to create temporary file” on executing my query in my java applet. Please help.
By the way, the quip.exe is running properly on DOS prompt and GUI.
//code from Visual Age for Java 4.0
private String queryTitle(String sSearch) {
String sOut = null;
String sQuery = “\n”;
sQuery += “for $f in document(‘files.xml’)//file,\n”;
sQuery += “$t in document($f/text())//title\n”;
sQuery += “where contains($t/text(),'” + sSearch + “')\n”;
sQuery += “return\n”;
sQuery += “\n”;
sQuery += “{$t}\n”;
sQuery += “{$f}\n”;
sQuery += “\n”;
sQuery += “sortby(title)\n”;
sQuery += “”;
StringBuffer strBuff = new StringBuffer();
strBuff.append(“file://.”);
prop.put(“quipcmd”,“X:/Quip/quip.exe”);
prop.put(“home”,“X:/romenhyouji/”);
try{
Connection conex = DriverManager.getConnection(strBuff.toString(),(Properties)prop);
//error occurs here
QueryResult qres = conex.executeQuery(sQuery);
sOut = qres.getRawString();
}catch(XQueryException e){
JOptionPane.showMessageDialog(this,e.getMessage(),“Error”,JOptionPane.ERROR_MESSAGE);
}
return sOut;
}
Is the error is on the quip setting? Thank you in advance
Hi,
In the Quip Faq section called “Can I Use Quip in my Java Application?” it says “A simple Java API is provided. However, be aware that the Java application will make system calls to the Quip executable and will pass data via files.”
By default, unsigned java applets have no access to the client’s file system so this mechanism probably can’t work.
So it would only be possible to run your applet if you digitally signed it first, and if the user accepted your signature etc…
Alternatively, could you run the same code as a servlet? All the xml and temporary files would then be on the server file system, and your servlet could have full access.
HTH
Dear Mr. Leeney,
Thank you for your help. I will try you suggestion. If you have other idea to make my query simple I really appreciate it. Once again thank you.