You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/08/24 01:37:08 UTC

[jira] Updated: (TAPESTRY-560) Poor reporting of missing specificaiton file

     [ http://issues.apache.org/jira/browse/TAPESTRY-560?page=all ]

Howard M. Lewis Ship updated TAPESTRY-560:
------------------------------------------

        Summary: Poor reporting of missing specificaiton file  (was: NullPointerException while parsing page spec.)
    Description: 
stacktrace

   * org.apache.tapestry.util.xml.DocumentParseException.<init>(DocumentParseException.java:45)
   * org.apache.tapestry.parse.SpecificationParser.parseDocument(SpecificationParser.java:1676)
   * org.apache.tapestry.parse.SpecificationParser.parsePageSpecification(SpecificationParser.java:1736

Looking at the code (and running it through the debugger), I found out that the url was null even though the resouce is not.

    URL resourceURL = resource.getResourceURL();
       if (resourceURL == null)
            throw new DocumentParseException(ParseMessages.missingResource(resource), resource,null);


I'm using Tap 4.0, my application file contains the following :
<page name="Home" specification-path="/test/web/pages/Home.page"/>

and the Home.page looks like

<?xml version="1.0"?>

<page-specification class="org.apache.tapestry.html.BasePage"/>


the problem is .

according to the DTD the specification-path attribute in the page element is the "resource classpath". So this should be something like /my/package/name, alas the ContextResource class of Hivemind obtains the URL of the Resource via the ServletContext, which is NOT by classpath but by path in the servletcontext so like /WEB-INF/classes/my/package/name. Prefixing it with classpath or context don't seem to work.

<!-- =======================================================
Element: page
Contained by: application, library-specification

Defines a single page within the application.  Each application will contain
at least one of these, to define the Home page.

Attributes:
 name: A unique name for the application.
 specification-path:  The resource classpath of the component specification  for the page.
-->


  was:
stacktrace

   * org.apache.tapestry.util.xml.DocumentParseException.<init>(DocumentParseException.java:45)
   * org.apache.tapestry.parse.SpecificationParser.parseDocument(SpecificationParser.java:1676)
   * org.apache.tapestry.parse.SpecificationParser.parsePageSpecification(SpecificationParser.java:1736

Looking at the code (and running it through the debugger), I found out that the url was null even though the resouce is not.

    URL resourceURL = resource.getResourceURL();
       if (resourceURL == null)
            throw new DocumentParseException(ParseMessages.missingResource(resource), resource,null);


I'm using Tap 4.0, my application file contains the following :
<page name="Home" specification-path="/test/web/pages/Home.page"/>

and the Home.page looks like

<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="org.apache.tapestry.html.BasePage"/>


the problem is .

according to the DTD the specification-path attribute in the page element is the "resource classpath". So this should be something like /my/package/name, alas the ContextResource class of Hivemind obtains the URL of the Resource via the ServletContext, which is NOT by classpath but by path in the servletcontext so like /WEB-INF/classes/my/package/name. Prefixing it with classpath or context don't seem to work.

<!-- =======================================================
Element: page
Contained by: application, library-specification

Defines a single page within the application.  Each application will contain
at least one of these, to define the Home page.

Attributes:
 name: A unique name for the application.
 specification-path:  The resource classpath of the component specification  for the page.
-->



An NPE inside the constructor for DocumentParseException makes it really hard to figure out what went wrong.

In addition, should be possible to use a classpath: or context: prefix on the specification-path attribute of the <page> element.

> Poor reporting of missing specificaiton file
> --------------------------------------------
>
>          Key: TAPESTRY-560
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-560
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>  Environment: winxp, Java5, Jboss 4.0.2/Tomcat
>     Reporter: Koen Serry
>     Assignee: Howard M. Lewis Ship
>     Priority: Critical

>
> stacktrace
>    * org.apache.tapestry.util.xml.DocumentParseException.<init>(DocumentParseException.java:45)
>    * org.apache.tapestry.parse.SpecificationParser.parseDocument(SpecificationParser.java:1676)
>    * org.apache.tapestry.parse.SpecificationParser.parsePageSpecification(SpecificationParser.java:1736
> Looking at the code (and running it through the debugger), I found out that the url was null even though the resouce is not.
>     URL resourceURL = resource.getResourceURL();
>        if (resourceURL == null)
>             throw new DocumentParseException(ParseMessages.missingResource(resource), resource,null);
> I'm using Tap 4.0, my application file contains the following :
> <page name="Home" specification-path="/test/web/pages/Home.page"/>
> and the Home.page looks like
> <?xml version="1.0"?>
> <page-specification class="org.apache.tapestry.html.BasePage"/>
> the problem is .
> according to the DTD the specification-path attribute in the page element is the "resource classpath". So this should be something like /my/package/name, alas the ContextResource class of Hivemind obtains the URL of the Resource via the ServletContext, which is NOT by classpath but by path in the servletcontext so like /WEB-INF/classes/my/package/name. Prefixing it with classpath or context don't seem to work.
> <!-- =======================================================
> Element: page
> Contained by: application, library-specification
> Defines a single page within the application.  Each application will contain
> at least one of these, to define the Home page.
> Attributes:
>  name: A unique name for the application.
>  specification-path:  The resource classpath of the component specification  for the page.
> -->

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org