the exact exception is:

java.lang.NullPointerException
        at ru.evolve.innersmile.servlets.test.doGet(test.java:24)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
         ---- and here goes more catalina's stack trace

__________________________________________________________
the code is (servlet), all code was taken from developer.xml, I've just
added try-catches. note, that col.close() in finally statement is wrapped in
try-catch too, because it throws DBXMLException - i do not know, if there
should be try-catch in finally statement:

protected void doGet(HttpServletRequest request, HttpServletResponse
response)throws ServletException, java.io.IOException {
    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/root/ocs");

            String xpath = "//test[text()='Hello']";
            XPathQueryService service = (XPathQueryService)
col.getService("XPathQueryService", "1.0");// HERE IS LINE NUMBER 24
            ResourceSet resultSet = service.query(xpath);
            ResourceIterator results = resultSet.getIterator();
            System.out.println("complete, next goes results");
            while (results.hasMoreResources()) {
                Resource res = results.nextResource();
                System.out.println((String) res.getContent());
            }
            System.out.println("complete, results are above");
        }catch (XMLDBException e) {
            System.out.println("XML:DB Exception occured " + e);
        }catch (java.lang.InstantiationException e) {
            System.out.println("XML:DB Instantiation Exception occured " +
e);
        }catch (IllegalAccessException e) {
            System.out.println("XML:DB Access Exception occured " + e);
        }catch (ClassNotFoundException e) {
            System.out.println("XML:DB ClassNotFoundException occured " +
e);
        }finally{
            try{
            col.close();
            }catch(Exception e){
                System.out.println(e);
            }
        }
    }

----- Original Message -----
From: "Chris Haddad" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 08, 2002 7:17 PM
Subject: RE: why Xindice throws exception (nullPointer) with code from an
example?


> Phillip -
>
> Some troubleshooting tips:
>
> What is the exact exception thrown?
> Are you using the sample code?
> Are you running the application from the command line or from inside a
> servlet?
> Does the dbxml and dbxmladmin applications work?
>
> Can you post a portion of the code in question?
>
> /Chris
>
> ----------
> Chris Haddad
> Cobia Communications  - XML and Web Service Solutions
> 678 431 1656
> mailto:[EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Philipp Chudinov [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 08, 2002 12:49 AM
> To: [email protected]
> Subject: why Xindice throws exception (nullPointer) with code from an
> example?
>
> This string :
>  XPathQueryService service = (XPathQueryService)
> col.getService("XPathQueryService", "1.0");
> Throws an exception. I used Xindice rc, from cvs. what should i do?
>
>
>
>

Reply via email to