You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Niederwieser <pn...@gmail.com> on 2010/09/16 15:20:32 UTC

Re: Exceptions during registry startup

What's the status on this? Seems the problem still exists in 5.2. No matter
which log level I choose, I never see stack traces of exceptions thrown from
a module's @Startup method.

Cheers,
Peter
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Exceptions-during-registry-startup-tp2431019p2842239.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Exceptions during registry startup

Posted by Peter Niederwieser <pn...@gmail.com>.
My @Startup method does get invoked, and I do see "Error invoking startup
method" in the log file. However, I never get a stack trace, neither in the
log file nor on system out/err. Does this mean I've misconfigured something?

Cheers,
Peter
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/Exceptions-during-registry-startup-tp2431019p2845126.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Exceptions during registry startup

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Thu, Sep 16, 2010 at 6:20 AM, Peter Niederwieser <pn...@gmail.com> wrote:
>
> What's the status on this? Seems the problem still exists in 5.2. No matter
> which log level I choose, I never see stack traces of exceptions thrown from
> a module's @Startup method.
>
> Cheers,
> Peter
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Exceptions-during-registry-startup-tp2431019p2842239.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

The startup handling code doesn't log the exception, it wraps and
rethrows it in a RuntimeException.  I'm not saying that's correct, I'm
just stating how its coded.

    public void startup(ModuleBuilderSource moduleSource,
ObjectLocator locator, OperationTracker tracker, Logger logger)
    {
        Map<Class, Object> resourceMap = CollectionFactory.newMap();

        resourceMap.put(ObjectLocator.class, locator);
        resourceMap.put(Logger.class, logger);

        InjectionResources injectionResources = new
MapInjectionResources(resourceMap);

        Throwable fail = null;

        Object moduleInstance = InternalUtils.isStatic(startupMethod)
? null : moduleSource
                .getModuleBuilder();

        try
        {
            Object[] parameters = InternalUtils.calculateParametersForMethod(
                    startupMethod,
                    locator,
                    injectionResources, tracker);

            startupMethod.invoke(moduleInstance, parameters);
        }
        catch (InvocationTargetException ex)
        {
            fail = ex.getTargetException();
        }
        catch (Exception ex)
        {
            fail = ex;
        }

        if (fail != null)
            throw new RuntimeException(
                    format("Error invoking startup method %s: %s",
asString(startupMethod), toMessage(fail)), fail);
    }


Are you sure your @Startup methods are being invoked (i.e., check with
debugger). I thought @Startup was broken until Igor pointed out for me
that the method has to be public.


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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