That was it! XUpdate is working, with no problems now. Hopefully, this will also solve the problem I wrote in about a couple of weeks ago about an exception that was raised occasionally when I did a database query. (The server would raise an exception, and the query would return an empty set (even when the query should have found results.) I'm not explaining this very well...so I'll just attach the original email I sent in case someone else is having the same difficulty.
On Tue, 5 Mar 2002 [EMAIL PROTECTED] wrote: > Hi Matthew, > > Are you using jdk140? If so, I had the same problem. There is a problem with > the version of xalan that comes with jdk140. As suggested by Kimbro, put the > xalan/xerces jars into your <jre-home>/lib/endorsed folder and restart > xindice. Everything should be fine then. > > Best wishes, > > John > > > > > -----Original Message----- > > From: Matthew Egbert [mailto:[EMAIL PROTECTED] > > Sent: lundi, 4. mars 2002 15:59 > > To: [email protected] > > Subject: XUpdate > > > > > > > > Hello, > > > > I am learning how to use XUpdate with Xindice...Regardless of the > > XUpdate xml, I get the following exception: > > > > org.apache.xindice.client.corba.db.APIException: > > IDL:org/apache/xindice/client/corba/db/APIException:1.0 > > at > > org.apache.xindice.client.corba.db.APIExceptionHelper.read(Unk > > nown Source) > > at > > org.apache.xindice.client.corba.db._CollectionStub.queryCollec > > tion(Unknown > > Source) > > at > > org.apache.xindice.client.xmldb.services.XUpdateQueryServiceIm > > pl.updateResult(Unknown > > Source) > > at > > org.apache.xindice.client.xmldb.services.XUpdateQueryServiceIm > > pl.update(Unknown > > Source) > > at XUpdateTest.main(XUpdateTest.java:37) > > XML:DB Exception occured 1 Query Processing Error > > > > > > > > > > The java source is: > > ---------------------------------------------------------- > > import org.xmldb.api.base.*; > > import org.xmldb.api.modules.*; > > import org.xmldb.api.*; > > import java.io.FileReader; > > import java.io.BufferedReader; > > > > > > /** > > * Simple XML:DB API example to update the database. > > */ > > public class XUpdateTest { > > public static void main(String[] args) throws Exception { > > Collection col = null; > > try { > > String driver = > > "org.apache.xindice.client.xmldb.DatabaseImpl"; > > Class c = Class.forName(driver); > > > > Database database = (Database) c.newInstance(); > > DatabaseManager.registerDatabase(database); > > col = > > DatabaseManager.getCollection("xmldb:xindice:///db/bbs"); > > > > BufferedReader file_reader = new BufferedReader (new > > FileReader(args[0])); > > String temp; > > String xupdate=new String(); > > > > temp = file_reader.readLine(); > > while (temp != null) { > > xupdate=xupdate+temp; > > temp=file_reader.readLine(); > > } > > > > System.out.println("\nXUpdate > > Command:\n--------------------------\n"+xupdate+"\n\n\n\n"); > > > > XUpdateQueryService service = > > (XUpdateQueryService) > > col.getService("XUpdateQueryService", > > "1.0"); > > service.update(xupdate); > > } > > catch (XMLDBException e) { > > System.err.println("XML:DB Exception occured " + > > e.errorCode + > > " " + > > e.getMessage()); > > } > > finally { > > if (col != null) { > > col.close(); > > } > > } > > } > > } > > > > > > > > > > > > The xupdate xml is: > > ---------------------------------------------------------- > > <?xml version="1.0"?> > > <xupdate:modifications version="1.0" > > xmlns:xupdate="http://www.xmldb.org/xupdate"> > > > > <xupdate:insert-before select="/posting/to"> > > <xupdate:comment>updated</xupdate:comment> > > </xupdate:insert-before> > > </xupdate:modifications> > > > > > > The output is: > > ---------------------------------------------------------- > > $ java XUpdateTest eg_xupdate.xml > > > > XUpdate Command: > > -------------------------- > > <?xml version="1.0"?><xupdate:modifications > > version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate"> > > <xupdate:insert-before select="/posting/to"> > > <xupdate:comment>updated</xupdate:comment> > > </xupdate:insert-before></xupdate:modifications> > > > > > > > > > > org.apache.xindice.client.corba.db.APIException: > > IDL:org/apache/xindice/client/corba/db/APIException:1.0 > > at > > org.apache.xindice.client.corba.db.APIExceptionHelper.read(Unk > > nown Source) > > at > > org.apache.xindice.client.corba.db._CollectionStub.queryCollec > > tion(Unknown > > Source) > > at > > org.apache.xindice.client.xmldb.services.XUpdateQueryServiceIm > > pl.updateResult(Unknown > > Source) > > at > > org.apache.xindice.client.xmldb.services.XUpdateQueryServiceIm > > pl.update(Unknown > > Source) > > at XUpdateTest.main(XUpdateTest.java:37) > > XML:DB Exception occured 1 Query Processing Error > > > > > > > > > > > > > > Does anyone have any suggestions as to where to start looking for the > > problem? Is this a xindice bug/is XUpdate still in beta? > > > > Cheers, > > > > > > Matthew > > > > >
From [EMAIL PROTECTED] Tue Mar 5 11:53:51 2002 Date: Thu, 21 Feb 2002 12:14:55 +0000 (GMT) From: Matthew Egbert <[EMAIL PROTECTED]> To: [email protected] Subject: simple java-app causes Xindice-server to throw null-pointer execption Hello everyone, I am writing a simple Java application to learn the ins and outs of Xindice. A method in the Java-app I have written which performs XPath queries is occasionally causing the Xindice server to throw a Null Pointer exception. The program compiles with out any warnings or errors, and runs fine, 90% of the time. One in (roughly) every 10 executions, the null pointer exception is thrown (by the xindice server, not by my app) with the following stack trace. ---------------------------Stack Trace------------------------------------ java.lang.NullPointerException at org.apache.xindice.core.DocumentCache$CacheKey.equals(Unknown Source) at java.util.WeakHashMap.eq(WeakHashMap.java:256) at java.util.WeakHashMap.get(WeakHashMap.java:348) at org.apache.xindice.core.DocumentCache.getDocument(Unknown Source) at org.apache.xindice.core.Collection.getDocument(Unknown Source) at org.apache.xindice.core.query.XPathQueryResolver$ResultSet.prepareNextNode(Unknown Source) at org.apache.xindice.core.query.XPathQueryResolver$ResultSet.getNextNode(Unknown Source) at org.apache.xindice.client.corba.CollectionServant.queryWrapper(Unknown Source) at org.apache.xindice.client.corba.CollectionServant.queryCollection(Unknown Source) at org.apache.xindice.client.corba.db.CollectionPOA._invoke(Unknown Source) at org.openorb.adapter.poa.POA.dispatch(POA.java:975) at org.openorb.net.AbstractServerRequest.dispatch(AbstractServerRequest.java:750) at org.openorb.net.ServerManagerImpl.serve_request(ServerManagerImpl.java:1467) at org.openorb.net.ServerManagerImpl.thread_pool_main(ServerManagerImpl.java:1410) at org.openorb.net.ServerManagerImpl.access$200(ServerManagerImpl.java:77) at org.openorb.net.ServerManagerImpl$PoolThread.run(ServerManagerImpl.java:1557) ----------------------------------------------------------------------------------- The Xindice command-line commands work fine. I have used: xindice rd -c /db/bbs -n eg_submission xindice ld -c /db/bbs xindice dd -c /db/bbs -n eg_submission etc. without difficulty. I have also tried deleting the bbs collection, and creating a fresh collection. I have tried running the application and the server on the following machines. On both, the server occasionally (roughly 1 in every 10 executions) throws the null-pointer-exception. SunOS 5.8 Generic_108528-12 sun4u sparc SUNW,Ultra-1 SunOS 5.8 Generic_108528-08 sun4u sparc SUNW,Sun-Blade-1000 Here is the method which is performing the XPath query: -------------------------XPath Query Method----------------------------- public static String xPathQuery(String xpath_query) { private static final String _collection_name = new String("xmldb:xindice:///db/bbs"); private static final String _driver_name = new String("org.apache.xindice.client.xmldb.DatabaseImpl"); Collection col = null; String returnString = new String(); try{ String driver = _driver_name; Class c = Class.forName(driver); Database database = (Database) c.newInstance(); DatabaseManager.registerDatabase(database); col = DatabaseManager.getCollection(_collection_name); XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService","1.0"); //get the results of the query ResourceSet resultSet = service.query(xpath_query); //iterate through the results, getting the content and adding it to //the returnString System.out.println("\n\n\n"); //only for testing ResourceIterator results = resultSet.getIterator(); while (results.hasMoreResources()) { Resource res = results.nextResource(); returnString=returnString+res.getContent(); // returnString=returnString+"\n\n";//only for testing } System.out.println(returnString); //only for testing if(col != null) col.close(); } catch (XMLDBException e) { System.err.println("XML:DB Exception occured " + e.errorCode); } catch (Exception e) { System.err.println("Other type of Exception occured"); e.printStackTrace(); } return(returnString); } ----------------------------------------------------------------------- Does anyone have any suggestions? Has anyone had a similar problem? Short of trying to grok the Xindice-code, I'm out of ideas. Thanks very much for your time -- and if you want any more information, please don't hesitate to contact me. I'll let you know if I get anywhere with it. Cheers, Matthew Egbert
