Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

subclass of BodyTagSupport - Incompatible argument in doStartTag()  RSS feed

 
Jeya Balaji
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have a subclass of BodyTagSupport
public class XPathForEachNodeTag extends BodyTagSupport {

...
public int doStartTag() throws JspException {

...
if (nodes.getLength() > 0) {
return (EVAL_BODY_TAG);
} else
return (SKIP_BODY);
}
}

This gives the error :
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: (class: com/wrox/projsp/ch11/jsp/XPathForEachNodeTag, method: doStartTag signature: ()I) Incompatible object argument for function call
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
...
...
...
root cause
java.lang.VerifyError: (class: com/wrox/projsp/ch11/jsp/XPathForEachNodeTag, method: doStartTag signature: ()I) Incompatible object argument for function call
at java.lang.Class.getMethods0(Native Method)
at java.lang.Class.getDeclaredMethods(Class.java:1039)
at java.beans.Introspector$1.run(Introspector.java:852)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:850)
...
...
Apache Tomcat/4.1.12
Long back, there was a question (Topic: TagSupport vs TagBodySupport) in this group with the same error message.
Sheriff, Carl Trusiak, answered that TagSupport subclass returning EVAL_BODY_TAG will give this error and solution will be either changing to BodyTagSupport subclass or returning SKIP_BODY.
In my case, the BodyTagSupport subclass is giving this problem.
I tried changing return (EVAL_BODY_TAG) to return(EVAL_BODY_AGAIN)
This didn't help and got the same error.

Am I missing any settings? Any help or pointers will be appreciated.
Thanks,
Balaji
 
boyet silverio
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your class extends BodyTagSupport that implements the BodyTag interface. As I recall the BodyTag interface's doStartTag's method allows only EVAL_BODY_INCLUDE, EVAL_BODY_BUFFERED and SKIP_BODY to be returned. Try changing the return value of your doStartTag to any of these that may be appropriate. The EVAL_BODY_TAG is used as a return for BodyTag's doAfterBody, and is deprecated.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!