You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Koen Serry <ta...@serry.org> on 2005/08/10 12:25:13 UTC

NullPointerException while parsing page spec.

Hi all,

I've been working with Tapestry 3 for about a year now and I have to say one of the best web frameworks I've seen so far. Now I wanted to try the new 4.0 as the hivemind thing sounded promising to me. Too bad they don't allow an easy setup of hibernate because otherwise that would have give me a reason to switch from Spring.

Ok enough chitchat, this was the 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 B3, 
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"/>


So nothing fancy so far. It looks like a bug in hivemind (hivemind-1.1-beta-2.jar) but i'm not sure.

Can anyone shed some light in this please?

Koen


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


Re: NullPointerException while parsing page spec.

Posted by Koen Serry <ta...@serry.org>.
Ok found the problem.

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. Could someone (a tapestry developer) 
confirm this is a bug?

<!-- =======================================================
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.
-->


Another point. Is there some parameter that allows you to set the base 
package name for AND the page specs AND the html templates?
This way html templates and page specs can be found in the same place. 
Somehow it seems that we're still stuck with the 3.x behaviour of 
putting all html/page-specification's in the same WEB-INF folder if we 
don't want to put a specification for every page. Which is kind of a 
bummer if you ask me.
I've already been looking in the sources but I couldn't find something 
right a way. The ApplicationSpecificationInitializer class doesn't 
reveal much.

Thanks already

Koen



Koen Serry wrote:

> Hi all,
>
> I've been working with Tapestry 3 for about a year now and I have to 
> say one of the best web frameworks I've seen so far. Now I wanted to 
> try the new 4.0 as the hivemind thing sounded promising to me. Too bad 
> they don't allow an easy setup of hibernate because otherwise that 
> would have give me a reason to switch from Spring.
>
> Ok enough chitchat, this was the 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 B3, 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"/>
>
>
> So nothing fancy so far. It looks like a bug in hivemind 
> (hivemind-1.1-beta-2.jar) but i'm not sure.
>
> Can anyone shed some light in this please?
>
> Koen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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