Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: restore

Wiki Markup
{scrollbar}

Div
stylefloat:right
titleRelated Articles
classaui-label
Content by Label
showLabelsfalse
showSpacefalse
titleRelated Articles
cqllabel = "errors" and space = currentSpace()

Why do I get the exception "No service implements the interface org.apache.tapestry5.internal.InternalComponentResources" when trying to use the BeanEditForm component?

...

Only component classes should go in the Tapestry-controlled packages (pages, components, mixins and base under your application's root package). By convention, simple data objects should go in a data package, and Hibernate entities should go in an entities package.

Note

This is likely a bit different in 5.3 than in 5.2 (because 5.3 builds a very different constructor into the component) and needs to be tested in 5.3 to see what exact exception will occur.

I get an error about "Page did not generate any markup when rendered." but I have a template, what happened?

...

My application fails with the error PermGen, how do I fix this?

In Java versions prior to JDK 1.8, PermGen refers to the part of the Java memory space devoted to permanent objects, which are mostly loaded classes. When developing under Tapestry, many more classes and class loaders are created than normal; this is part of live class reloading. Because of this, you will want to increase the amount of memory Java devotes to this.

The In JDK 1.7 and earlier, the solution is to add -XX:MaxPermSize=512m to your command line. You may also want to increase the regular amount of heap space with -Xmx600M. Of course, you may need to adjust the amount of memory in each category to match your actual application, but these are good starting values.

Java Virtual Machine arguments can be specified inside an Eclipse launch configuration:

 

Why do I sometimes get a java.lang.NoSuchMethodError exception after reloading my page?

Tapestry's live class reloading is not perfect. It tends to use a lot of Java ClassLoaders on top of the normal ClassLoaders used by the Java Virtual Machine and the servlet container. When you change non-component classes and interfaces that are referenced by components and pages, such as to add or change a method, only the component classes are reloaded. The non-component classes are frozen as they were when they were first loaded.

Unfortunately, this is one of the areas where you must restart your application entirely in order to force the new versions of the non-component classes to be loaded into memory.

...

In every known scenario except the last, these errors are harmless and you probably want to redirect the user to the page the form is on – and avoid logging an error. That's not too hard to do. Just add code like the following to your module class (usually AppModule.java):

Code Block
languagejava
titleAppModule.java (partial)
    /**
     * Redirect the user to the intended page when browsing through
     * tapestry forms through browser history or over-eager autocomplete
     */
    public RequestExceptionHandler decorateRequestExceptionHandler(
            final ComponentSource componentSource,
            final Response response,
            final RequestExceptionHandler oldHandler)
    {
        return new RequestExceptionHandler()
        {
            @Override
            public void handleRequestException(Throwable exception) throws IOException
            {
                if (!exception.getMessage().contains("Forms require that the request method be POST and that the t:formdata query parameter have values"))
                {
                    oldHandler.handleRequestException(exception);
                    return;
                }
                ComponentResources cr = componentSource.getActivePage().getComponentResources();
                Link link = cr.createEventLink("");
                String uri = link.toRedirectURI().replaceAll(":", "");
                response.sendRedirect(uri);
            }
        };
    }

Thanks to Lenny Primak for the above code. A slightly less fragile approach is described here. When TAP5-1733 is fixed a much less fragile solution may be possible.

 

Wiki Markup
{scrollbar}