I highly recommend reading the servlet spec. There you will see a
servlet extends HttpServlet and overrides one or more of it's methods.
http://jcp.org/en/jsr/detail?id=154
--David
Luca Sabbio wrote:
Hi, I'm working with Java 1.5.0.06, Tomcat 5.5.16 with Xindice 1.1b4 and Cocoon
2.1.10 deployed (and working).
I try to run a simple web application based on a servlet that update the
Xindice XML DB
By the command line the PartsXupdate.java is compiled and the
PartsXupdate.class works.
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class PartsXupdate {
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://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 (XMLDBException e) {
System.err.println("XML:DB Exception occurred " + e.errorCode);
}
finally {
if (col != null) { col.close();}
}
}
}
But when I deploy the application on Tomcat
and I do my post action http://localhost:8080/PartsXupdate/PartsXupdate from the form of provajava.html
I get this error:
javax.servlet.ServletException: Class PartsXupdate is not a Servlet
I think that my web.xml is ok
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>esempio_servlet_xupdate</display-name>
<description>
Esempio di uso di servlet_xupdate
</description>
<!-- JSPC servlet mappings start -->
<servlet>
<servlet-name>PartsXupdate</servlet-name>
<servlet-class>PartsXupdate</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PartsXupdate</servlet-name>
<url-pattern>/PartsXupdate</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>provajava.html</welcome-file>
</welcome-file-list>
</web-app>
Also classpath would be ok. Is there something to set in Tomcat?
I've read many mailing list and tried some changes but without results,
any suggestion would be appreciate.
Thanks
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]