I forgot to mention that my catch actually looks like

  catch(Exception e)
  {
    writer.print("Component exception : " + e.getMessage());
    ...
  }

so it seems that something is null that I don't expect. I do catch
visitObject == null so I wonder if it might be the snippetGetterMethod?

On 15 jun 2006, at 11.14, I wrote:

I've a strange problem that appears only if my Jetty server was idle
for some time. I get the following exception from one of my library
calls. Can anyone help me out here since I am having a hard time to
debug this (cannot reproduce so easily due to the idle nature of the
problem).

The component is located in a tapestry library and it uses invoke to call a database fetching method in the page's visit object. It works perfect on
start and during the run of the server but fails after the test server
was idle for a long time.
<snip>

Source:
private static String snippetGetter = "getSnippetText";
private static Method snippetGetterMethod;

protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
  IPage page = cycle.getPage();
  Object visitObject = page.getVisit();
  if(visitObject == null)
  {
    System.out.println("No visit object so far. Restarting page.");
    throw new PageRedirectException(page);
  }

  Class visitClass = visitObject.getClass();
  try
  {
    Class[] parameterTypes = new Class[] {String.class, Locale.class};
Object[] arguments = new Object[] {getSnippetID(), getSnippetLocale()};
    if(snippetGetterMethod == null)
snippetGetterMethod = visitClass.getMethod(snippetGetter, parameterTypes); >>> String txt = (String)snippetGetterMethod.invoke(visitObject, arguments);

Trace:
Component exception : null
sun.reflect.GeneratedMethodAccessor211.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
se.pardeike.tapestry.Extras.DBTextSnippet.DBTextSnippet.renderComponen t(DBTextSnippet.java:43) org.apache.tapestry.AbstractComponent.render(AbstractComponent.java: 857)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to