On 17.01.2008 05:45, Harald Entner wrote:

In normal mode everything runs fine. But when running a jmeter test with 40 concurrent users, the AbstractWidgetDefinitionBuilder throws a NullPointerException. see the full stacktrace at (1)

java.lang.NullPointerException
at org.apache.cocoon.forms.formmodel.AbstractWidgetDefinitionBuilder.setupDefinition(AbstractWidgetDefinitionBuilder.java:109)
(... see 1)

Probably the reason for this error is that the function

public WidgetDefinition buildWidgetDefinition(Element widgetElement, WidgetDefinitionBuilderContext context)
   throws Exception {
  it is not thread-save.

I tried the same test with a little modification (buildWidgetDefinition is synchronized)

public synchronized WidgetDefinition buildWidgetDefinition(Element widgetElement, WidgetDefinitionBuilderContext context)
   throws Exception {

The error (1) doesn't occur anymore, but another one: (see 2) It seems that the cause for this is very similar to the one above.

Has one of you seen this error when running a stress test? What could i do to avoid that problem? (i could go on and modify this function to synchronized as well, but hopefully there is a better solution for this. )

Hmm, this does not look good but like a major flaw in Cocoon Forms. Following the Javadoc of WidgetDefinitionBuilder implementations of this interface have to be thread-safe - which they are not because of the context field. There is one quick fix you can do: Make the context a ThreadLocal variable.

Joerg

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

Reply via email to