You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alfie Kirkpatrick <Al...@ioko.com> on 2009/04/24 12:24:22 UTC

Exceptions during registry startup

Hi, I am staring at an error in my log:

 

11:02:22.617 [main] ERROR o.a.t.i.s.T.RegistryStartup - An exception
occurred during startup: java.lang.NullPointerException

 

While this is undoubtedly the result of some very poor code on my part,
the log doesn't really help me locate it!

 

Is there a way to a) tell Tapestry to give the full stack trace, b) ask
Tapestry to behave more strictly in this scenario, eg. by failing to
load the entire app. At the moment this failure might only be exposed by
a page buried deep in the site and might not be discovered until a long
time after the error occurred, making it hard to track down.

 

Trawled the list on this and didn't find anything so sorry if this has
been covered already.

 

Regards, Alfie.


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


Re: Exceptions during registry startup

Posted by Peter Niederwieser <pn...@gmail.com>.
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 Howard Lewis Ship <hl...@gmail.com>.
Which version of T5?  I had thought that it would report problems at
startup a bit better.

Can you use the debugger to catch the NPE?  If so, add an issue with
the stack trace to the NPE and I'll make sure it gets reported better.

On Fri, Apr 24, 2009 at 3:24 AM, Alfie Kirkpatrick
<Al...@ioko.com> wrote:
> Hi, I am staring at an error in my log:
>
>
>
> 11:02:22.617 [main] ERROR o.a.t.i.s.T.RegistryStartup - An exception
> occurred during startup: java.lang.NullPointerException
>
>
>
> While this is undoubtedly the result of some very poor code on my part,
> the log doesn't really help me locate it!
>
>
>
> Is there a way to a) tell Tapestry to give the full stack trace, b) ask
> Tapestry to behave more strictly in this scenario, eg. by failing to
> load the entire app. At the moment this failure might only be exposed by
> a page buried deep in the site and might not be discovered until a long
> time after the error occurred, making it hard to track down.
>
>
>
> Trawled the list on this and didn't find anything so sorry if this has
> been covered already.
>
>
>
> Regards, Alfie.
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
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>.
I think you are correct, the best thing would be to let the exception
bubble up to the top, preventing the Registry from starting up.

On Fri, Apr 24, 2009 at 3:24 AM, Alfie Kirkpatrick
<Al...@ioko.com> wrote:
> Hi, I am staring at an error in my log:
>
>
>
> 11:02:22.617 [main] ERROR o.a.t.i.s.T.RegistryStartup - An exception
> occurred during startup: java.lang.NullPointerException
>
>
>
> While this is undoubtedly the result of some very poor code on my part,
> the log doesn't really help me locate it!
>
>
>
> Is there a way to a) tell Tapestry to give the full stack trace, b) ask
> Tapestry to behave more strictly in this scenario, eg. by failing to
> load the entire app. At the moment this failure might only be exposed by
> a page buried deep in the site and might not be discovered until a long
> time after the error occurred, making it hard to track down.
>
>
>
> Trawled the list on this and didn't find anything so sorry if this has
> been covered already.
>
>
>
> Regards, Alfie.
>
>



-- 
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