• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No Such Method Error

 
Shobhit Tyagi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using tomcat 5 and jdk 1.6. When I run my webapp, I get the welcome file correctly. But when I click on a link on the first jsp, there appears an error. Following is the code :

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.NoSuchMethodError: org.w3c.dom.Element.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object;
org.jbpm.pvm.internal.xml.DomBuilder.startElement(DomBuilder.java:318)
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.jbpm.pvm.internal.xml.Parser.buildDom(Parser.java:452)
org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:389)
org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:158)
org.jbpm.pvm.internal.wire.xml.WireParser.<clinit>(WireParser.java:284)
org.jbpm.pvm.internal.cfg.ConfigurationParser.<init>(ConfigurationParser.java:46)
org.jbpm.pvm.internal.cfg.ConfigurationParser.<clinit>(ConfigurationParser.java:49)
org.jbpm.pvm.internal.cfg.ConfigurationImpl.parse(ConfigurationImpl.java:139)
org.jbpm.pvm.internal.cfg.ConfigurationImpl.setResource(ConfigurationImpl.java:118)
org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:76)
org.jbpm.api.Configuration.buildProcessEngine(Configuration.java:105)
JBPMDao.redeployProcess(JBPMDao.java:18)
JBPMServlet.doGet(JBPMServlet.java:30)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.

Please help.

regds.

Shobhit.
 
Jessid Leon Velez Gutierrez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. It would be easier to help you if you include some code and/or your web.xml file. Perhaps this exception is thrown because you havent configured your servlet in your web.xml or better yet, you havent implemented the doXXX method in your servlet. If you say you are having troubles when clicking a link in your welcome page, it means you are doing request using the HTTP GET method, so you should implement the doGet method.

I hope this is of some help.
 
Shobhit Tyagi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for replying.

I have implemented doGet method. My servlet looks like this :

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class JBPMServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static String processName;

@Override
public void init() throws ServletException {

// Get the value of an initialization parameter
processName = getServletConfig().getInitParameter("processName");
}

@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = new PrintWriter(response.getOutputStream());

JBPMDao dao = new JBPMDao();
String html = null;
String action = request.getParameter("action");

if (action.equals("deploy")) {
html = dao.redeployProcess("sample.jpdl.xml");
} else if (action.equals("start")) {
html = dao.startNewProcessInstance(processName);
} else if (action.equals("list")) {
html = dao.readProcessInstances(processName);
}// else if (action.equals("signal")) {
// html = dao.signalProcess(processName, request.getParameter("id"));
// }

out.println(html);
out.println("<br />");
out.println("<a href='index.jsp'>Back</a>");
out.close();
}

}

Also I have configured the servlet in web.xml.

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>JBPMWeb</display-name>
<servlet>
<servlet-name>JBPMServlet</servlet-name>
<servlet-class>JBPMServlet</servlet-class>
<init-param>
<param-name>processName</param-name>
<param-value>sample</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JBPMServlet</servlet-name>
<url-pattern>/jbpmServlet</url-pattern>
</servlet-mapping>

</web-app>


On clicking the link deploy, following method is called :


public class JBPMDao
{
private static Configuration configuration = new Configuration();


public String redeployProcess(String processName)
{
ProcessEngine processEngine= configuration.buildProcessEngine();
try
{
RepositoryService repositoryService=processEngine.getRepositoryService();
repositoryService.createDeployment().addResourceFromClasspath(processName).deploy();

return "process "+processName+" deployed successfully";
}
finally
{

}
}
...
...
...

These are jbpm api. And I am adding all the jars required to the classpath.

regds.

Shobhit
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


ALL classes used in servlets should be in a package - very common error prevents the servlet object from being created.

How this problem ends up throwing an error from the DomBuilder - I have no idea.

Bill
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible you have some quite old DOM and/or XML libraries somewhere in the classpath? That particular method did not exist until DOM Level 3 (which came out in 2004 and became part of Java 5). But maybe some older XML/DOM implementation libraries are inadvertently part of your app.
 
Shobhit Tyagi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying ulf and bill.

Ulf, how do I check the libraries. or mainly what all libraries?

regds.

Shobhit
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything with "xml" or "dom" in its name would be a good start. You can use the "jar" tool to peek inside of the files; what you want to avoid is duplicate classes in the classpath.
 
Shobhit Tyagi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Again Ulf
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic