On Sun, 2004-01-18 at 03:36, jiesheng zhang wrote:
> I think someone already have answer for this question.
> However the search function in sourceforge does not
> work. I have to post this list.

As well as SourceForge, there's other places that archive the list and
can be searched.  e.g.
http://www.mail-archive.com/index.php?hunt=xdoclet

> I have a simple servlet which is subclass of
> org.apache.webapp.admin.ApplicationServlet. (By the
> way, the org.apache.webapp.admin.ApplicationServlet is
> a subclass of org.apache.struts.action.ActionServlet).
> After doclet parsed this class,  the web.xml contained
> the security-role and servlet-mapping declared in the
> servlet source. Howevr, It did not contains the
> <servlet> and all the initialization parameter which
> were also declared in the source together with the
> security role.

Short answer (longer analysis below) - do you have the Struts jar on the
webdoclet task's classpath?

> Does anyone have a clue? Or tell me how to debug the
> webdoclet.

How to debug it?  Well, looking through the template to see what it's
doing is a good start :-)

The section of the template containing the <servlet> bits is contained
in
 <XDtClass:forAllClasses type="javax.servlet.Servlet" abstract="false">
  <XDtClass:forAllClassTags tagName="web:servlet" superclasses="false">
tags; the <servlet-mapping> is contained in
  <XDtClass:forAllClasses>
  <XDtClass:forAllClassTags tagName="web:servlet-mapping">
while the <security-role> bit uses
 <XDtWeb:forAllSecurityRoles>
Looking in the relevant tag handler (WebTagsHandler.java), we see that
this just uses
ClassTagsHandler.forAllDistinctClassTags(getEngine(), template,
"web:security-role", "role-name");

So the chief differences are that restriction to javax.servlet.Servlet
subclasses and the tag names used; since you're getting the
security-role and servlet-mapping entries appearing in the DD, it looks
like either you've got a typo in the "web.servlet" tag, or it doesn't
know that your class extends javax.servlet.Servlet.  And since you
mention Struts, I suspect the latter - have you included the struts jar
in the webdoclet task's classpath?  Otherwise, although xdoclet knows
that your class extends org.apache.webapp.admin.ApplicationServlet, it
has no way of knowing that ApplicationServlet extends
javax.servlet.Servlet, and hence that your class does.

If that's not the case, then there's something weird going on and
possibly a bug.  You could try using "ant -verbose" and/or enabling the
log4j debugging to see if that gives you any more information.  Beyond
that, you're left with adding your own debug trace output in the code
and rebuilding the module, or you could try stepping through the whole
thing with the java debugger.  I've never tried that with any Ant tasks
myself, so don't know how you'd specify the JPDA parameters.  Probably
need to edit the ant.bat script, I suspect.


Andrew.



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to