Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-11381

Generating a portlet with init parameter leads to invalid portlet.xml

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.3.0.Beta3
    • 3.2.1.Final
    • portal-gatein
    • None
    • Hide
      1. Use JBDS to create a Dynamic Web Project with JBoss Core Portlet 2.0 facet.
      2. Go to FileNew > Other and select Java Portlet to launch the Create Portlet wizard.
      3. Choose the class name, Next.
      4. Next. You should now be on the screen where you can add init params.
      5. Add an init param w/ a non-empty name, value and description (e.g. Name=test, Value=test, Description=test).
      6. Next, Finish.
      Show
      Use JBDS to create a Dynamic Web Project with JBoss Core Portlet 2.0 facet. Go to File >  New > Other and select Java Portlet to launch the Create Portlet wizard. Choose the class name, Next . Next . You should now be on the screen where you can add init params. Add an init param w/ a non-empty name, value and description (e.g. Name=test, Value=test, Description=test). Next , Finish .

      If you follow the Steps to reproduce section and use the Create Portlet wizard in JBDS to generate a portlet with init parameter, you will end up with a portlet.xml file which is not valid with respect to its XML Schema (http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd).

      Namely, the following fragment of code is generated:

      <init-param>
        <name>test</name>
        <value>test</value>
        <description>test</description>
      </init-param>
      

      The problem here is the position of the description element in the init-param section, which should be before the name and value, i.e. the code should look like this:

      <init-param>
        <description>test</description>
        <name>test</name>
        <value>test</value>
      </init-param>
      

      With strict validation enabled by default in newer versions of GateIn/EPP, this causes the following error during deployment:

      ERROR [PortletApplicationDeployer] Cannot read portlet.xml jndi:/localhost/portlet-generic-jbds-5/WEB-INF/portlet.xml
      org.xml.sax.SAXParseException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'description'. No child element is expected at this point.
      

            snjeza_jira Snjezana Peco (Inactive)
            mcupak Miroslav Cupak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: