users@glassfish.java.net

Re: tough exception to crack...

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 06 Feb 2006 13:03:42 -0800

Hi Vince,

Vince.Kraemer_at_Sun.COM wrote On 02/06/06 08:17,:
> I have gotten an "appfuse" app created and deployed to GlassFish. After I register a "first users", this exception gets thrown and continues to get thrown for every access against the app.
>
> Does anybody know how to dig deeper into the "Caused by", since this exception is basically useless... none of
> my application's code appears in this stack....

appserv-core/src/java/com/sun/enterprise/util/InvocationManagerImpl.java

from which the exception is thrown, defines a "frames" ThreadLocal
which stores a thread's current stack of component invocations as an
ArrayList.

During a preInvoke(), a ComponentInvocation is pushed onto the current
thread's stack (unrelated code removed):

  public void preInvoke(ComponentInvocation inv) throws InvocationException
  {
    // Get this thread's ArrayList
    ArrayList v = (ArrayList) frames.get();

    // push this invocation on the stack
    v.add(inv);
  }

and during a postInvoke(), it is removed from the stack:

  public void postInvoke(ComponentInvocation inv) throws InvocationException
  {
    // Get this thread's ArrayList
    ArrayList v = (ArrayList) frames.get();

    int size = v.size();
    if (size == 0)
        throw new InvocationException();

    finally {
      // pop the stack
      v.remove(size - 1);
    }
  }

Therefore, the assertion is made that during a postInvoke(), the stack
must not be empty. For some reason, it is empty in your case, which is
why postInvoke() throws this InvocationException (which really
should have an error message):

    int size = v.size();
    if (size == 0)
        throw new InvocationException();

There could be 2 reasone why the stack is empty in your case: either
preInvoke() was not called, or postInvoke() was called twice in a
row.

Fortunately, J2EEInstanceListener prints out the events it receives
(which trigger a preInvoke() or a postInvoke()):

    public void instanceEvent(InstanceEvent event) {
        String eventType = event.getType();
        if(_logger.isLoggable(Level.FINEST)) {
            _logger.log(Level.FINEST,"*** InstanceEvent: " + eventType);
        }

Can you set your web-container logging to FINEST and grep for
InstanceEvent in your log?


Jan



> [#|2006-02-05T10:01:26.155-0800|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=11;_ThreadName=httpWorkerThread-8179-1;_RequestID=dadb0c32-9de3-49ee-b0a7-560c7a40f080;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exceptionjava.lang.RuntimeException: WEB5003: Exception in handleAfterEvent.
> at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:233)
> at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:96)
> at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:226)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)
> at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:61)
> at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:167)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
> at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
> at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
> at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:223)
> at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:664)
> at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:571)
> at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:846)
> at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:345)
> at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:237)
> at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:240)
> at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
> Caused by: com.sun.enterprise.InvocationException
> at com.sun.enterprise.util.InvocationManagerImpl.postInvoke(InvocationManagerImpl.java:185)
> at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:231)
> ... 30 more|#]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>