Hello,

I'm having some errors while doing a stress testing on my application. If I 
make a single request it works fine. Even if I make a single request and after 
that do the stress test, it works fine. The problem occurs when doing the 
stress test on a just started server.

For the stress test I'm using WebLOAD to make requests to the same URL during 5 
minutes, beginning with 5 concurrent users until 500 concurrent users. The 
problem is arising at the very beginning of the test.

I have wrapped the Application object  in order to do additional processing 
when creating a composite component of my own:

public class BKSApplication extends ApplicationWrapper {

      /** Component type for views */
      private static final String COMPONENT_TYPE_VIEW = "rigel.faces.View";

      private volatile Application wrapped;

      public BKSApplication(Application application) {
            super();
            wrapped = application;
      }

      [...]

      @Override
      public UIComponent createComponent(FacesContext context, Resource 
componentResource) {
            UIComponent comp = wrapped.createComponent(context, 
componentResource);
            // get componentType
            BeanInfo info = (BeanInfo) 
comp.getAttributes().get(UIComponent.BEANINFO_KEY);
            String compType = (String) ((ValueExpression) 
info.getBeanDescriptor().getValue(UIComponent.COMPOSITE_COMPONENT_TYPE_KEY)).getValue(context.getELContext());
            if (COMPONENT_TYPE_VIEW.equals(compType)) {
                  UIView uiView = (UIView) comp;
                  // do some processing with UIView
                  [...]
            }
            return comp;
      }
}

In my faces-config.xml, I have associated "rigel.faces.View" with my own 
component class:

<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee";
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd";
                    version="2.0">

      <factory>
            
<application-factory>com.isb.rigel.srvcimpl.presentation.faces.application.BKSApplicationFactoryImpl</application-factory>
      </factory>
      <component>
            <component-type>rigel.faces.View</component-type>
            
<component-class>com.isb.rigel.srvcimpl.presentation.faces.component.view.UIView</component-class>
      </component>

</faces-config>


So the above code should always return an instance of UIView when the component 
type is "rigel.faces.View". But when doing stress test I get a 
ClassCastException:

java.lang.ClassCastException: javax.faces.component.UINamingContainer 
incompatible with 
com.isb.rigel.srvcimpl.presentation.faces.component.view.UIView
                at 
com.isb.rigel.srvcimpl.presentation.faces.application.BKSApplication.createComponent(BKSApplication.java:124)
                at 
org.apache.myfaces.view.facelets.tag.composite.CompositeComponentResourceTagHandler.createComponent(CompositeComponentResourceTagHandler.java:108)
                at 
org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.createComponent(ComponentTagHandlerDelegate.java:497)
                at 
org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:263)
                ...

This error should never happen, but it is happening only when doing a stress 
test.

Just to check if there is a synchronization problem I have synchronized the 
call to Application.createComponent, this way:

      @Override
      public UIComponent createComponent(FacesContext context, Resource 
componentResource) {
            UIComponent comp = null;
            synchronized (this) {
comp = wrapped.createComponent(context, componentResource);
            }
            // get componentType
            BeanInfo info = (BeanInfo) 
comp.getAttributes().get(UIComponent.BEANINFO_KEY);
            String compType = (String) ((ValueExpression) 
info.getBeanDescriptor().getValue(UIComponent.COMPOSITE_COMPONENT_TYPE_KEY)).getValue(context.getELContext());
            if (COMPONENT_TYPE_VIEW.equals(compType)) {
                  UIView uiView = (UIView) comp;
                  // do some processing with UIView
                  [...]
            }
            return comp;
      }

When this call is synchronized the error is never happening at all, even doing 
a stress test it works fine.

So I think there is a synchronization problem when several threads call, at the 
same time, the method Application.createComponent(FacesContext context, 
Resource componentResource)


Greetings,

Jesús Pérez Alcaide
Lab. Banksphere - Runtime
Tlf:  91 470 5223



*********************AVISO LEGAL **********************
Este mensaje es privado y confidencial y solamente para la persona a la que va 
dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, 
distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y 
borre dicho mensaje y cualquier documento adjunto que pudiera contener. No hay 
renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión 
errónea o mal funcionamiento.
Cualquier opinión expresada en este mensaje pertenece únicamente al autor 
remitente, y no representa necesariamente la opinión de ISBAN, a no ser que 
expresamente se diga y el remitente esté autorizado para hacerlo.
Los correos electrónicos no son seguros, no garantizan la confidencialidad ni 
la correcta recepción de los mismos, dado que pueden ser interceptados, 
manipulados, destruidos, llegar con demora o incompletos, o con virus. ISBAN no 
se hace responsable de los cambios, alteraciones, errores u omisiones que 
pudieran hacerse al mensaje una vez enviado.
Este mensaje sólo tiene una finalidad de información, y no debe interpretarse 
como una oferta de venta o de compra de valores ni de instrumentos financieros 
relacionados.

**********************DISCLAIMER*****************
This message is private and confidential and it is intended exclusively for the 
addressee. If you receive this message by mistake, you should not disseminate, 
distribute or copy this e-mail. Please inform the sender and delete the message 
and attachments from your system. No confidentiality nor any privilege 
regarding the information is waived or lost by any mistransmission or 
malfunction.
Any views or opinions contained in this message are solely those of the author, 
and do not necessarily represent those of ISBAN, unless otherwise specifically 
stated and the sender is authorized to do so.
E-mail transmission cannot be guaranteed to be secure, confidential, or 
error-free, as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses. ISBAN does not accept 
responsibility for any changes, errors or omissions in the contents of this 
message after it has been sent.
This message is provided for informational purposes and should not be construed 
as a solicitation or offer to buy or sell any securities or related financial 
instruments.

Reply via email to