Re: Help for servlet!
Georg Sauer-Limbach <[email protected]> Mon, 30 Apr 2007 18:09:16 +0200
| Newsgroups | gmane.text.xml.xindice.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
to see the problem you should print the exception, not only its
detail message. Replace
out.write("Error " + e.getMessage());
by
out.write("Error " + e );
I guess you will then see something like
java.lang.ClassDefNotFoundException: org.apache.xindice.client.xmldb.DatabaseImpl
It is a common mistake in Java to output only
ex.getMessage(), but this is only the "detail
message".
Tell us which exception you got.
Regards
Georg
[email protected] wrote:
> Thank for previous help!
> Now I have a most specific problem....so, i use tomcat 5.5,cocoon 2.1 and xindice 1.1b4.
> I want make a servlet for update database. After the correction of PartsXupdate.java, i had made this servlet:
>
>
> import org.xmldb.api.base.*;
> import org.xmldb.api.modules.*;
> import org.xmldb.api.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import org.w3c.dom.*;
> import org.apache.xindice.client.xmldb.DatabaseImpl;
> import org.apache.xindice.client.xmldb.services.*;
>
> public class PartsXupdate extends HttpServlet {
>
> public void doGet(HttpServletRequest request, HttpServletResponse response)
> throws ServletException, IOException {
>
> Collection col = null;
> PrintWriter out = response.getWriter();
>
> 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://localhost:8080/db/test");
>
> String xupd = "<xupdate:modifications version=\"1.0\" xmlns:xupdate=\"http://www.xmldb.org/xupdate\">" +
> "<xupdate:insert-after select=\"/scheda/info\">" +
> "<xupdate:element name=\"commento\">Bel libro!</xupdate:element>" +
> "</xupdate:insert-after>" +
> "</xupdate:modifications>";
>
> String nome = "4.xml";
>
> /* We are using XUpdateQueryService */
> XUpdateQueryService service =
> (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
>
> service.updateResource(nome, xupd);
> }
>
> catch(Exception e) {
> out.write("Error " + e.getMessage());
> }
>
> /*
> catch (XMLDBException e) {
> System.err.println("XML:DB Exception occurred " + e.errorCode);
> }
> */
>
> finally {
> }
> }
> }
>
>
> The error message is:
>
> org.apache.xindice.client.xmldb.DatabaseImpl
>
> Where is the problem? I post my classpath:
>
> C:\xindice-1.1b4\xindice-1.1b4.jar;
> C:\xindice-1.1b4\lib\commons-logging-1.0.3.jar;
> C:\xindice-1.1b4\lib\servlet-2.3.jar;
> C:\xindice-1.1b4\lib\xalan-2.5.2.jar;
> C:\xindice-1.1b4\lib\xerces-2.6.0.jar;
> C:\xindice-1.1b4\lib\xml-apis.jar;
> C:\xindice-1.1b4\lib\xmldb-api-20030701.jar;
> C:\xindice-1.1b4\lib\xmldb-api-sdk-20030701.jar;
> C:\xindice-1.1b4\lib\xmldb-common-20030701.jar;
> C:\xindice-1.1b4\lib\xmldb-xupdate-20040205.jar;
> C:\xindice-1.1b4\lib\xmlrpc-1.1.jar;
> .;
>
> Is it correct?
> Thank for any help!
> Bye
>
>
> ------------------------------------------------------
> Leggi GRATIS le tue mail con il telefonino i-modeâ„¢ di Wind
> http://i-mode.wind.it/
>
>
>
>