facebook

Running xdoclet does not modify web.xml

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #232490 Reply

    Jimmy Ray
    Member

    I have a web (set to compile with 1.4 SDK) project with a test servlet that has xdoclet web.servlet tags, but I can not get xdoclet to modify my web.xml. I am concerned that I dont have the xdoclet settings right. I cant get xdoclet tag code completion to work either.

    My tags:

    * @web.servlet name = “checksess”
    * display-name = “Check Session”
    * load-on-startup = “1”
    * @web.servlet-mapping url-pattern = “/chksess/*”

    WinXP SP1
    Eclipse Version: 3.1.0, Build id: I20050627-1435
    MyEclipse Version: 3.9.210, Build id: 20050627-4.0-Milestone-2
    SUN java version 1.5.0_02

    #232514 Reply

    Jimmy Ray
    Member

    Where is the encoding issue now?

    Ok…so I stumbled across getting the Standard Web settings for ceating the web.xml, but it now fails with the stack trace:

    Buildfile: N:\java\Projects\IFX-RIC-DWH\.xdoclet-build.tmp.xml
    N65540:
    N65581:
    [webdoclet] (XDocletMain.start 47 ) Running <deploymentdescriptor/>
    [webdoclet] Generating web.xml.
    [webdoclet] (TemplateEngine.start 420 ) An error occured while writing output to file N:\java\Projects\IFX-RIC-DWH\WebRoot\WEB-INF\web.xml
    [webdoclet] java.io.UnsupportedEncodingException:
    [webdoclet] at sun.io.Converters.getConverterClass(Converters.java:218)
    [webdoclet] at sun.io.Converters.newConverter(Converters.java:251)
    [webdoclet] at sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:68)
    [webdoclet] at sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:189)
    [webdoclet] at sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:172)
    [webdoclet] at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:72)
    [webdoclet] at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:82)
    [webdoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:405)
    [webdoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:561)
    [webdoclet] at xdoclet.TemplateSubTask.startProcessForAll(TemplateSubTask.java:617)
    [webdoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:598)
    [webdoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:201)
    [webdoclet] at xdoclet.modules.web.WebXmlSubTask.execute(WebXmlSubTask.java:379)
    [webdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
    [webdoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
    [webdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
    [webdoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    [webdoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
    [webdoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
    [webdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
    [webdoclet] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    [webdoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    [webdoclet] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [webdoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
    [webdoclet] java.lang.NullPointerException
    [webdoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:424)
    [webdoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:561)
    [webdoclet] at xdoclet.TemplateSubTask.startProcessForAll(TemplateSubTask.java:617)
    [webdoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:598)
    [webdoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:201)
    [webdoclet] at xdoclet.modules.web.WebXmlSubTask.execute(WebXmlSubTask.java:379)
    [webdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
    [webdoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
    [webdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
    [webdoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    [webdoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
    [webdoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
    [webdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
    [webdoclet] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    [webdoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    [webdoclet] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [webdoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

    BUILD FAILED
    N:\java\Projects\IFX-RIC-DWH\.xdoclet-build.tmp.xml:46: Unexpected error

    Total time: 8 seconds

    #232579 Reply

    Riyad Kalla
    Member

    Jimmy,
    I’m sorry we missed this post, sometimes a few slip by.

    What locale is windows set to? This is an sun.io exception which makes me think it’s a JDK bug, try and upgrade to 1.5.0_04 that just came out to see if that helps.

    #232581 Reply

    Jimmy Ray
    Member

    I will try this as soon as my client gives me the right to load the software.

    #233249 Reply

    Jimmy Ray
    Member

    I just installed Sun JDK 1.5.0.04 and I start eclipse with the following bat:

    SETLOCAL
    
    SET CLASSPATH=C:\jdk-1_5_0_04\jre\lib\rt.jar;
    
    SET PATH=C:\jdk-1_5_0_04\jre\bin;%PATH%;
    
    C:\eclipse\eclipse.exe -vmargs -Xmx256M 

    But…when I run xDoclet, I get two outcomes now. If the web.xml does not exist in my webroot of my project then I get the error:

    Buildfile: N:\Eclipse\IFX-RIC-DWH\.xdoclet-build.tmp.xml
    N65540:
    N65581:
    [webdoclet] (XDocletMain.start                   47  ) Running <deploymentdescriptor/>
    [webdoclet] Generating web.xml.
    [webdoclet] (TemplateEngine.start                420 ) An error occured while writing output to file N:\Eclipse\IFX-RIC-DWH\WebRoot\WEB-INF\web.xml
    [webdoclet] java.io.UnsupportedEncodingException:
    [webdoclet] at sun.io.Converters.getConverterClass(Converters.java:218)
    [webdoclet] at sun.io.Converters.newConverter(Converters.java:251)
    [webdoclet] at sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:68)
    [webdoclet] at sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:189)
    [webdoclet] at sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:172)
    [webdoclet] at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:72)
    [webdoclet] at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:82)
    [webdoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:405)
    [webdoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:561)
    [webdoclet] at xdoclet.TemplateSubTask.startProcessForAll(TemplateSubTask.java:617)
    [webdoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:598)
    [webdoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:201)
    [webdoclet] at xdoclet.modules.web.WebXmlSubTask.execute(WebXmlSubTask.java:379)
    [webdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
    [webdoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
    [webdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
    [webdoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    [webdoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
    [webdoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
    [webdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
    [webdoclet] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    [webdoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    [webdoclet] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [webdoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
    [webdoclet] java.lang.NullPointerException
    [webdoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:424)
    [webdoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:561)
    [webdoclet] at xdoclet.TemplateSubTask.startProcessForAll(TemplateSubTask.java:617)
    [webdoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:598)
    [webdoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:201)
    [webdoclet] at xdoclet.modules.web.WebXmlSubTask.execute(WebXmlSubTask.java:379)
    [webdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
    [webdoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
    [webdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105)
    [webdoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    [webdoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
    [webdoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
    [webdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
    [webdoclet] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    [webdoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    [webdoclet] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [webdoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [webdoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
    
    BUILD FAILED
    N:\Eclipse\IFX-RIC-DWH\.xdoclet-build.tmp.xml:46: Unexpected error
    
    Total time: 8 seconds

    If the web.xml file does exist, then get no error, but there is still no entries placed into the web.xml.

    Buildfile: N:\Eclipse\IFX-RIC-DWH\.xdoclet-build.tmp.xml
    N65540:
    N65581:
    [webdoclet] (XDocletMain.start                   47  ) Running <deploymentdescriptor/>
    N66027:
      [xdoclet] (XDocletMain.start                   47  ) Running <beaninfo/>
    _xdoclet_generation_:
    BUILD SUCCESSFUL
    Total time: 29 seconds

    Also…the Preview button does not seem to work when posting to this forum.

    #233262 Reply

    Riyad Kalla
    Member

    I simply can’t reproduce this, here is what I did, take a look and see where our steps differed.

    1) Created new WebProject, TestWebDoclet
    2) Created com.test package
    3) Created TestServlet in the com.test package, the contents are:

    
    package com.test;
    
    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;
    
    /**
     * @web.servlet name="checksess" display-name="Check Session" load-on-startup="1"
     * @web.servlet-mapping url-pattern="/chksess/*"
     */
    public class TestServlet extends HttpServlet {
    
        /**
         * Constructor of the object.
         */
        public TestServlet() {
            super();
        }
    
        /**
         * Destruction of the servlet. <br>
         */
        public void destroy() {
            super.destroy(); // Just puts "destroy" string in log
            // Put your code here
        }
    
        /**
         * The doGet method of the servlet. <br>
         *
         * This method is called when a form has its tag value method equals to get.
         * 
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         */
        public void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
    
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out
                    .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
            out.println("<HTML>");
            out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
            out.println("  <BODY>");
            out.print("    This is ");
            out.print(this.getClass());
            out.println(", using the GET method");
            out.println("  </BODY>");
            out.println("</HTML>");
            out.flush();
            out.close();
        }
    
        /**
         * The doPost method of the servlet. <br>
         *
         * This method is called when a form has its tag value method equals to post.
         * 
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         */
        public void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
    
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out
                    .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
            out.println("<HTML>");
            out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
            out.println("  <BODY>");
            out.print("    This is ");
            out.print(this.getClass());
            out.println(", using the POST method");
            out.println("  </BODY>");
            out.println("</HTML>");
            out.flush();
            out.close();
        }
    
        /**
         * Initialization of the servlet. <br>
         *
         * @throws ServletException if an error occure
         */
        public void init() throws ServletException {
            // Put your code here
        }
    
    }
    

    Note: At the top I tried to duplicate your XDoclet tags.

    4) Added Standard Web doclet to the project
    5) Right clicked on project > MyEclipse > Run XDoclet, got the following output:

    Buildfile: D:\My Documents\My Development\Eclipse\testing-workspace\TestWebDoclet\.xdoclet-build.tmp.xml
    N65540:
    [webdoclet] (XDocletMain.start 47 ) Running <deploymentdescriptor/>
    [webdoclet] Generating web.xml.
    [webdoclet] (XDocletMain.start 47 ) Running <jsptaglib/>
    [webdoclet] Generating taglib.tld.
    _xdoclet_generation_:
    BUILD SUCCESSFUL
    Total time: 2 seconds

    6) Opened the web.xml file, it looks like this:

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    
    <web-app >
       <distributable/>
    
        <!--
        To use non XDoclet filters, create a filters.xml file that
        contains the additional filters (eg Sitemesh) and place it in your
        project's merge dir.  Don't include filter-mappings in this file,
        include them in a file called filter-mappings.xml and put that in
        the same directory.
        -->
    
        <!--
        To use non XDoclet filter-mappings, create a filter-mappings.xml file that
        contains the additional filter-mappings and place it in your
        project's merge dir.
        -->
    
        <!--
        To use non XDoclet listeners, create a listeners.xml file that
        contains the additional listeners and place it in your
        project's merge dir.
        -->
    
       <servlet>
          <servlet-name>checksess</servlet-name>
          <display-name>Check Session</display-name>
         <servlet-class>com.test.TestServlet</servlet-class>
    
          <load-on-startup>1</load-on-startup>
    
       </servlet>
    
      <!--
      To use non XDoclet servlets, create a servlets.xml file that
      contains the additional servlets (eg Struts) and place it in your
      project's merge dir.  Don't include servlet-mappings in this file,
      include them in a file called servlet-mappings.xml and put that in
      the same directory.
      -->
    
       <servlet-mapping>
          <servlet-name>checksess</servlet-name>
          <url-pattern>/chksess/*</url-pattern>
       </servlet-mapping>
    
       <!--
       To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
       Organize mime-mappings.xml following this DTD slice:
    
       <!ELEMENT mime-mapping (extension, mime-type)>
       -->
    
       <!--
       To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
       Organize error-pages.xml following this DTD slice:
    
       <!ELEMENT error-page ((error-code | exception-type), location)>
       -->
    
      <!--
      To add taglibs by xml, create a file called taglibs.xml and place it
      in your merge dir.
      -->
    
       <!--
       To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
       Organize web-security.xml following this DTD slice:
    
       <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
       <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
       <!ELEMENT web-resource-name (#PCDATA)>
       <!ELEMENT url-pattern (#PCDATA)>
       <!ELEMENT http-method (#PCDATA)>
       <!ELEMENT user-data-constraint (description?, transport-guarantee)>
       <!ELEMENT transport-guarantee (#PCDATA)>
    
       <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
       <!ELEMENT auth-method (#PCDATA)>
       <!ELEMENT realm-name (#PCDATA)>
       <!ELEMENT form-login-config (form-login-page, form-error-page)>
       <!ELEMENT form-login-page (#PCDATA)>
       <!ELEMENT form-error-page (#PCDATA)>
       -->
    
    </web-app>
    

    Can you see where our steps might have differed? Can you try exactly whta I did?

    #233264 Reply

    Jimmy Ray
    Member

    My original project stills does not work. Would it matter that the original web project was created with Eclipse 3.0.1 and MyEclispe 3.x? That is the only thing that I can think of right now. I imported the project into the Eclipse 3.1 environment.

    #233265 Reply

    Jimmy Ray
    Member

    BTW…I forgot to mention that I did get your example to work.

    #233266 Reply

    Riyad Kalla
    Member

    jimmy,
    There is something goofy going on here, try and shut down MyEclipse and add -clean to the command line argument, then restart MyEclipse. Now try and run XDoclet, did it work?

    If not, try and create a new web project, and drag and drop your existing web project into it, overwriting everything. Now try and run Xdoclet (after possibly closing/reopening the project), did it work?

    If not, try and crteate ANOTHER new web project, and slowly move your old web project into it piece by piece, and configuring it the same way. Now run XDoclet, did THAT work?

    If NOT, then rip out some hair and check your build path of your project. Do you include XDoclet JARs or any Java runtime JARs in your buildpath other than the ones provided by the system? Do you have anything cookey that might be in the classpath when XDoclet is running casuing it to die? Are you trying to use GNU Classpath for example? GCJ? Any custom runtime libraries?

    #233267 Reply

    Jimmy Ray
    Member

    I created a new web project and copied the source files over and the xDoclet ran fine. There must be something persisted in the project that was created by the Eclipse 3.0.1, even though it was imported into 3.1.

    But…I have no idea what it could be. Thanks for your help.

    #233269 Reply

    Riyad Kalla
    Member

    Glad it’s working, I am confused as well.

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Running xdoclet does not modify web.xml

You must be logged in to post in the forum log in