Re: CODI issue with CDI Observer

2014-03-24 Thread Thomas Andraschko
Ok. Rafael, could you create an issue?


2014-03-23 23:49 GMT+01:00 Gerhard Petracek gerhard.petra...@gmail.com:

 it isn't nice that we need such a workaround, however, we can add it easily
 (in codi as well as in deltaspike).

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces



 2014-03-23 23:07 GMT+01:00 Thomas Andraschko andraschko.tho...@gmail.com
 :

  Gerhard, i would add the null check but we should do it in
 AbstractContext.
  Could it break anything?
 
 
  2014-03-23 22:57 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
 
   Hi again,
  
   i just solved it in my custom scope by checking the null contextual:
  
   @Override
   public T T get(final ContextualT contextual, final
   CreationalContextT creationalContext) {
   if(creationalContext == null){
   return null;
   }
  
   i dont know what the spec says about trying to get a bean which doesnt
   have to participate in an event but in my opinion the easiest way to
 get
  DS
   compatible with GF4 is to
   do that nullcheck in deltaspike instead of waiting for GF guys...
  
  
 
 https://github.com/apache/deltaspike/blob/master/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContext.java#L79
  
  
  
   Att,
  
   Rafael M. Pestano
   Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
   Graduando em Ciência da Computação UFRGS
   http://conventions.github.io/home/
  
   http://rpestano.wordpress.com/
   @realpestano
  
  
  
   Em Domingo, 23 de Março de 2014 18:48, Rafael Pestano 
   rmpest...@yahoo.com.br escreveu:
   Hi Gerhard,
  
   i can confirm its a GF4 issue, justed added a simple custom scope and
   received the same NPE in the scope GET method:
  
   @Override
   public T T get(final ContextualT contextual, final
   CreationalContextT creationalContext) {
   Bean bean = (Bean) contextual;
   if
   (customScopeContextHolder.getBeans().containsKey(bean.getBeanClass()))
 {
   return (T)
   customScopeContextHolder.getBean(bean.getBeanClass()).instance;
   } else {
   T t = (T) bean.create(creationalContext);//NPE here,
   contextual is null
  
  
   I'll open an issue at glassfish tracker.
  
   thanks for your help
  
  
  
  
   Att,
   Rafael M. Pestano
   Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
   Graduando em Ciência da Computação UFRGS
   http://conventions.github.io/home/
  
   http://rpestano.wordpress.com/
   @realpestano
  
  
  
  
   Em Domingo, 23 de Março de 2014 18:25, Gerhard Petracek 
   gerhard.petra...@gmail.com escreveu:
   since the implementation in ds is different and it works with other
   servers, it sounds like a general glassfish-issue with custom scopes.
  
   regards,
   gerhard
  
   http://www.irian.at
  
   Your JSF/JavaEE powerhouse -
   JavaEE Consulting, Development and
   Courses in English and German
  
   Professional Support for Apache MyFaces
  
  
  
  
   2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
  
Hi gerhard,
   
same thing with ds 0.6:
   
[2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
[javax.enterprise.web.core] [tid: _ThreadID=20
_ThreadName=http-listener-1(1)] [timeMillis: 1395609260514]
  [levelValue:
900] [[
  Servlet.service() for servlet FacesServlet threw exception
java.lang.NullPointerException
at
   
  
 
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
at
   
  
 
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
at
   
  
 
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
at
   
  
 
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
at
   
  
 
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
at
   
  
 
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)
   
   
   
   
   
Att,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do
 Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/
   
http://rpestano.wordpress.com/
@realpestano
   
   
   
Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
gerhard.petra...@gmail.com escreveu:
hi rafael,
   
please test the same with deltaspike 0.6
   
regards,
gerhard
   
http://www.irian.at
   
Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German
   
Professional Support for 

Re: CODI issue with CDI Observer

2014-03-24 Thread Rafael Pestano
Hi Thomas,

here it goes: https://issues.apache.org/jira/browse/DELTASPIKE-546



 

Att, 
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/

http://rpestano.wordpress.com/
@realpestano



Em Segunda-feira, 24 de Março de 2014 5:08, Thomas Andraschko 
andraschko.tho...@gmail.com escreveu:
Ok. Rafael, could you create an issue?



2014-03-23 23:49 GMT+01:00 Gerhard Petracek gerhard.petra...@gmail.com:

 it isn't nice that we need such a workaround, however, we can add it easily
 (in codi as well as in deltaspike).

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces



 2014-03-23 23:07 GMT+01:00 Thomas Andraschko andraschko.tho...@gmail.com
 :

  Gerhard, i would add the null check but we should do it in
 AbstractContext.
  Could it break anything?
 
 
  2014-03-23 22:57 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
 
   Hi again,
  
   i just solved it in my custom scope by checking the null contextual:
  
   @Override
       public T T get(final ContextualT contextual, final
   CreationalContextT creationalContext) {
           if(creationalContext == null){
               return null;
           }
  
   i dont know what the spec says about trying to get a bean which doesnt
   have to participate in an event but in my opinion the easiest way to
 get
  DS
   compatible with GF4 is to
   do that nullcheck in deltaspike instead of waiting for GF guys...
  
  
 
 https://github.com/apache/deltaspike/blob/master/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContext.java#L79
  
  
  
   Att,
  
   Rafael M. Pestano
   Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
   Graduando em Ciência da Computação UFRGS
   http://conventions.github.io/home/
  
   http://rpestano.wordpress.com/
   @realpestano
  
  
  
   Em Domingo, 23 de Março de 2014 18:48, Rafael Pestano 
   rmpest...@yahoo.com.br escreveu:
   Hi Gerhard,
  
   i can confirm its a GF4 issue, justed added a simple custom scope and
   received the same NPE in the scope GET method:
  
   @Override
       public T T get(final ContextualT contextual, final
   CreationalContextT creationalContext) {
           Bean bean = (Bean) contextual;
           if
   (customScopeContextHolder.getBeans().containsKey(bean.getBeanClass()))
 {
               return (T)
   customScopeContextHolder.getBean(bean.getBeanClass()).instance;
           } else {
               T t = (T) bean.create(creationalContext);//NPE here,
   contextual is null
  
  
   I'll open an issue at glassfish tracker.
  
   thanks for your help
  
  
  
  
   Att,
   Rafael M. Pestano
   Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
   Graduando em Ciência da Computação UFRGS
   http://conventions.github.io/home/
  
   http://rpestano.wordpress.com/
   @realpestano
  
  
  
  
   Em Domingo, 23 de Março de 2014 18:25, Gerhard Petracek 
   gerhard.petra...@gmail.com escreveu:
   since the implementation in ds is different and it works with other
   servers, it sounds like a general glassfish-issue with custom scopes.
  
   regards,
   gerhard
  
   http://www.irian.at
  
   Your JSF/JavaEE powerhouse -
   JavaEE Consulting, Development and
   Courses in English and German
  
   Professional Support for Apache MyFaces
  
  
  
  
   2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
  
Hi gerhard,
   
same thing with ds 0.6:
   
[2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
[javax.enterprise.web.core] [tid: _ThreadID=20
_ThreadName=http-listener-1(1)] [timeMillis: 1395609260514]
  [levelValue:
900] [[
      Servlet.service() for servlet FacesServlet threw exception
java.lang.NullPointerException
        at
   
  
 
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
        at
   
  
 
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
        at
   
  
 
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
        at
   
  
 
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
        at
   
  
 
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
        at
   
  
 
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)
   
   
   
   
   
Att,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do
 Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/
   

CODI issue with CDI Observer

2014-03-23 Thread Rafael Pestano
Hi guys,

i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI events 
with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI scope, here is 
some code:

@ViewAccessScoped
@Named
public class MyBean implements Serializable{

    @Inject
    EventMyEvent myEvent;


    public void fire(){
    myEvent.fire(new MyEvent());
    }
}

@ViewAccessScoped
//@SessionScoped
@Named
public  class AnotherBean implements Serializable{

    protected Logger log = Logger.getLogger(getClass().getSimpleName());

    public void observe(@Observes(notifyObserver = Reception.IF_EXISTS) MyEvent 
event){
    log.fine(event received:+event);
    }


i receive nullpointer exception when i fire the event:

javax.faces.FacesException: #{myBean.fire}: java.lang.NullPointerException
    at 
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
    at 
org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationAwareActionListener.processAction(SecurityViolationAwareActionListener.java:56)
    at 
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerActionListener.processAction(ViewControllerActionListener.java:68)
    at 
org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)


full stacktrace is here:http://pastebin.com/fMaMqS72

Here is some observations:

- if i replace ViewAccessScoped with SessionScope i get no errors.

- if i remove notifyObserver = Reception.IF_EXISTS i receive the event without 
problems

- I have no issue with JbossAS 7, wildfly and also Glassfish 3.1.1.2



I pushed a simple project at github which reproduces the issue:

github.com/rmpestano/codi-issue


any help is appreciated.

Att, 

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/

http://rpestano.wordpress.com/
@realpestano 


Re: CODI issue with CDI Observer

2014-03-23 Thread Gerhard Petracek
hi rafael,

please test the same with deltaspike 0.6

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

 Hi guys,

 i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI
 events with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI
 scope, here is some code:

 @ViewAccessScoped
 @Named
 public class MyBean implements Serializable{

 @Inject
 EventMyEvent myEvent;


 public void fire(){
 myEvent.fire(new MyEvent());
 }
 }

 @ViewAccessScoped
 //@SessionScoped
 @Named
 public  class AnotherBean implements Serializable{

 protected Logger log = Logger.getLogger(getClass().getSimpleName());

 public void observe(@Observes(notifyObserver = Reception.IF_EXISTS)
 MyEvent event){
 log.fine(event received:+event);
 }


 i receive nullpointer exception when i fire the event:

 javax.faces.FacesException: #{myBean.fire}: java.lang.NullPointerException
 at
 com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
 at
 org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationAwareActionListener.processAction(SecurityViolationAwareActionListener.java:56)
 at
 org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerActionListener.processAction(ViewControllerActionListener.java:68)
 at
 org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)


 full stacktrace is here:http://pastebin.com/fMaMqS72

 Here is some observations:

 - if i replace ViewAccessScoped with SessionScope i get no errors.

 - if i remove notifyObserver = Reception.IF_EXISTS i receive the event
 without problems

 - I have no issue with JbossAS 7, wildfly and also Glassfish 3.1.1.2



 I pushed a simple project at github which reproduces the issue:

 github.com/rmpestano/codi-issue


 any help is appreciated.

 Att,

 Rafael M. Pestano

 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano



Re: CODI issue with CDI Observer

2014-03-23 Thread Rafael Pestano
Hi gerhard,

same thing with ds 0.6:

[2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] [] 
[javax.enterprise.web.core] [tid: _ThreadID=20 _ThreadName=http-listener-1(1)] 
[timeMillis: 1395609260514] [levelValue: 900] [[
  Servlet.service() for servlet FacesServlet threw exception
java.lang.NullPointerException
    at 
org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
    at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
    at 
org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
    at 
org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
    at 
org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
    at 
org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
    at 
org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)



 

Att, 
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/

http://rpestano.wordpress.com/
@realpestano



Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
gerhard.petra...@gmail.com escreveu:
hi rafael,

please test the same with deltaspike 0.6

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

 Hi guys,

 i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI
 events with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI
 scope, here is some code:

 @ViewAccessScoped
 @Named
 public class MyBean implements Serializable{

     @Inject
     EventMyEvent myEvent;


     public void fire(){
         myEvent.fire(new MyEvent());
     }
 }

 @ViewAccessScoped
 //@SessionScoped
 @Named
 public  class AnotherBean implements Serializable{

     protected Logger log = Logger.getLogger(getClass().getSimpleName());

     public void observe(@Observes(notifyObserver = Reception.IF_EXISTS)
 MyEvent event){
         log.fine(event received:+event);
     }


 i receive nullpointer exception when i fire the event:

 javax.faces.FacesException: #{myBean.fire}: java.lang.NullPointerException
     at
 com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
     at
 org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationAwareActionListener.processAction(SecurityViolationAwareActionListener.java:56)
     at
 org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerActionListener.processAction(ViewControllerActionListener.java:68)
     at
 org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)


 full stacktrace is here:http://pastebin.com/fMaMqS72

 Here is some observations:

 - if i replace ViewAccessScoped with SessionScope i get no errors.

 - if i remove notifyObserver = Reception.IF_EXISTS i receive the event
 without problems

 - I have no issue with JbossAS 7, wildfly and also Glassfish 3.1.1.2



 I pushed a simple project at github which reproduces the issue:

 github.com/rmpestano/codi-issue


 any help is appreciated.

 Att,

 Rafael M. Pestano

 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano



Re: CODI issue with CDI Observer

2014-03-23 Thread Gerhard Petracek
since the implementation in ds is different and it works with other
servers, it sounds like a general glassfish-issue with custom scopes.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

 Hi gerhard,

 same thing with ds 0.6:

 [2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
 [javax.enterprise.web.core] [tid: _ThreadID=20
 _ThreadName=http-listener-1(1)] [timeMillis: 1395609260514] [levelValue:
 900] [[
   Servlet.service() for servlet FacesServlet threw exception
 java.lang.NullPointerException
 at
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
 at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
 at
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
 at
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
 at
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
 at
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
 at
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)





 Att,
 Rafael M. Pestano
 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano



 Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
 gerhard.petra...@gmail.com escreveu:
 hi rafael,

 please test the same with deltaspike 0.6

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces




 2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

  Hi guys,
 
  i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI
  events with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI
  scope, here is some code:
 
  @ViewAccessScoped
  @Named
  public class MyBean implements Serializable{
 
  @Inject
  EventMyEvent myEvent;
 
 
  public void fire(){
  myEvent.fire(new MyEvent());
  }
  }
 
  @ViewAccessScoped
  //@SessionScoped
  @Named
  public  class AnotherBean implements Serializable{
 
  protected Logger log = Logger.getLogger(getClass().getSimpleName());
 
  public void observe(@Observes(notifyObserver = Reception.IF_EXISTS)
  MyEvent event){
  log.fine(event received:+event);
  }
 
 
  i receive nullpointer exception when i fire the event:
 
  javax.faces.FacesException: #{myBean.fire}:
 java.lang.NullPointerException
  at
 
 com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
  at
 
 org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationAwareActionListener.processAction(SecurityViolationAwareActionListener.java:56)
  at
 
 org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerActionListener.processAction(ViewControllerActionListener.java:68)
  at
 
 org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)
 
 
  full stacktrace is here:http://pastebin.com/fMaMqS72
 
  Here is some observations:
 
  - if i replace ViewAccessScoped with SessionScope i get no errors.
 
  - if i remove notifyObserver = Reception.IF_EXISTS i receive the event
  without problems
 
  - I have no issue with JbossAS 7, wildfly and also Glassfish 3.1.1.2
 
 
 
  I pushed a simple project at github which reproduces the issue:
 
  github.com/rmpestano/codi-issue
 
 
  any help is appreciated.
 
  Att,
 
  Rafael M. Pestano
 
  Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
  Graduando em Ciência da Computação UFRGS
  http://conventions.github.io/home/
 
  http://rpestano.wordpress.com/
  @realpestano
 



Re: CODI issue with CDI Observer

2014-03-23 Thread Rafael Pestano
Hi Gerhard,

i can confirm its a GF4 issue, justed added a simple custom scope and received 
the same NPE in the scope GET method:

@Override
    public T T get(final ContextualT contextual, final CreationalContextT 
creationalContext) {
    Bean bean = (Bean) contextual;
    if 
(customScopeContextHolder.getBeans().containsKey(bean.getBeanClass())) {
    return (T) 
customScopeContextHolder.getBean(bean.getBeanClass()).instance;
    } else {
    T t = (T) bean.create(creationalContext);//NPE here, contextual is 
null


I'll open an issue at glassfish tracker.

thanks for your help


 

Att, 
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/

http://rpestano.wordpress.com/
@realpestano



Em Domingo, 23 de Março de 2014 18:25, Gerhard Petracek 
gerhard.petra...@gmail.com escreveu:
since the implementation in ds is different and it works with other
servers, it sounds like a general glassfish-issue with custom scopes.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

 Hi gerhard,

 same thing with ds 0.6:

 [2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
 [javax.enterprise.web.core] [tid: _ThreadID=20
 _ThreadName=http-listener-1(1)] [timeMillis: 1395609260514] [levelValue:
 900] [[
   Servlet.service() for servlet FacesServlet threw exception
 java.lang.NullPointerException
     at
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
     at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
     at
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
     at
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
     at
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
     at
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
     at
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)





 Att,
 Rafael M. Pestano
 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano



 Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
 gerhard.petra...@gmail.com escreveu:
 hi rafael,

 please test the same with deltaspike 0.6

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces




 2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

  Hi guys,
 
  i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI
  events with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI
  scope, here is some code:
 
  @ViewAccessScoped
  @Named
  public class MyBean implements Serializable{
 
      @Inject
      EventMyEvent myEvent;
 
 
      public void fire(){
          myEvent.fire(new MyEvent());
      }
  }
 
  @ViewAccessScoped
  //@SessionScoped
  @Named
  public  class AnotherBean implements Serializable{
 
      protected Logger log = Logger.getLogger(getClass().getSimpleName());
 
      public void observe(@Observes(notifyObserver = Reception.IF_EXISTS)
  MyEvent event){
          log.fine(event received:+event);
      }
 
 
  i receive nullpointer exception when i fire the event:
 
  javax.faces.FacesException: #{myBean.fire}:
 java.lang.NullPointerException
      at
 
 com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
      at
 
 org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationAwareActionListener.processAction(SecurityViolationAwareActionListener.java:56)
      at
 
 org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerActionListener.processAction(ViewControllerActionListener.java:68)
      at
 
 org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)
 
 
  full stacktrace is here:http://pastebin.com/fMaMqS72
 
  Here is some observations:
 
  - if i replace ViewAccessScoped with SessionScope i get no errors.
 
  - if i remove notifyObserver = Reception.IF_EXISTS i receive the event
  without problems
 
  - I have no issue with JbossAS 7, wildfly and also Glassfish 3.1.1.2
 
 
 
  I pushed a simple project at github which reproduces the issue:
 
  github.com/rmpestano/codi-issue
 
 
  any help is appreciated.
 
  Att,
 
  Rafael M. Pestano
 
  Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
  Graduando em Ciência da 

Re: CODI issue with CDI Observer

2014-03-23 Thread Rafael Pestano
Hi again,

i just solved it in my custom scope by checking the null contextual:

@Override
    public T T get(final ContextualT contextual, final CreationalContextT 
creationalContext) {
    if(creationalContext == null){
    return null;
    }

i dont know what the spec says about trying to get a bean which doesnt have to 
participate in an event but in my opinion the easiest way to get DS compatible 
with GF4 is to 
do that nullcheck in deltaspike instead of waiting for GF guys...
https://github.com/apache/deltaspike/blob/master/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContext.java#L79



Att, 

Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/

http://rpestano.wordpress.com/
@realpestano



Em Domingo, 23 de Março de 2014 18:48, Rafael Pestano rmpest...@yahoo.com.br 
escreveu:
Hi Gerhard,

i can confirm its a GF4 issue, justed added a simple custom scope and received 
the same NPE in the scope GET method:

@Override
    public T T get(final ContextualT contextual, final CreationalContextT 
creationalContext) {
    Bean bean = (Bean) contextual;
    if 
(customScopeContextHolder.getBeans().containsKey(bean.getBeanClass())) {
    return (T) 
customScopeContextHolder.getBean(bean.getBeanClass()).instance;
    } else {
    T t = (T) bean.create(creationalContext);//NPE here, contextual is 
null


I'll open an issue at glassfish tracker.

thanks for your help


 

Att, 
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventions.github.io/home/

http://rpestano.wordpress.com/
@realpestano




Em Domingo, 23 de Março de 2014 18:25, Gerhard Petracek 
gerhard.petra...@gmail.com escreveu:
since the implementation in ds is different and it works with other
servers, it sounds like a general glassfish-issue with custom scopes.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

 Hi gerhard,

 same thing with ds 0.6:

 [2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
 [javax.enterprise.web.core] [tid: _ThreadID=20
 _ThreadName=http-listener-1(1)] [timeMillis: 1395609260514] [levelValue:
 900] [[
   Servlet.service() for servlet FacesServlet threw exception
 java.lang.NullPointerException
     at
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
     at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
     at
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
     at
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
     at
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
     at
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
     at
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)





 Att,
 Rafael M. Pestano
 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano



 Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
 gerhard.petra...@gmail.com escreveu:
 hi rafael,

 please test the same with deltaspike 0.6

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces




 2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

  Hi guys,
 
  i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI
  events with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI
  scope, here is some code:
 
  @ViewAccessScoped
  @Named
  public class MyBean implements Serializable{
 
      @Inject
      EventMyEvent myEvent;
 
 
      public void fire(){
          myEvent.fire(new MyEvent());
      }
  }
 
  @ViewAccessScoped
  //@SessionScoped
  @Named
  public  class AnotherBean implements Serializable{
 
      protected Logger log = Logger.getLogger(getClass().getSimpleName());
 
      public void observe(@Observes(notifyObserver = Reception.IF_EXISTS)
  MyEvent event){
          log.fine(event received:+event);
      }
 
 
  i receive nullpointer exception when i fire the event:
 
  javax.faces.FacesException: #{myBean.fire}:
 java.lang.NullPointerException
      at
 
 com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
      at
 
 

Re: CODI issue with CDI Observer

2014-03-23 Thread Thomas Andraschko
Gerhard, i would add the null check but we should do it in AbstractContext.
Could it break anything?


2014-03-23 22:57 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

 Hi again,

 i just solved it in my custom scope by checking the null contextual:

 @Override
 public T T get(final ContextualT contextual, final
 CreationalContextT creationalContext) {
 if(creationalContext == null){
 return null;
 }

 i dont know what the spec says about trying to get a bean which doesnt
 have to participate in an event but in my opinion the easiest way to get DS
 compatible with GF4 is to
 do that nullcheck in deltaspike instead of waiting for GF guys...

 https://github.com/apache/deltaspike/blob/master/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContext.java#L79



 Att,

 Rafael M. Pestano
 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano



 Em Domingo, 23 de Março de 2014 18:48, Rafael Pestano 
 rmpest...@yahoo.com.br escreveu:
 Hi Gerhard,

 i can confirm its a GF4 issue, justed added a simple custom scope and
 received the same NPE in the scope GET method:

 @Override
 public T T get(final ContextualT contextual, final
 CreationalContextT creationalContext) {
 Bean bean = (Bean) contextual;
 if
 (customScopeContextHolder.getBeans().containsKey(bean.getBeanClass())) {
 return (T)
 customScopeContextHolder.getBean(bean.getBeanClass()).instance;
 } else {
 T t = (T) bean.create(creationalContext);//NPE here,
 contextual is null


 I'll open an issue at glassfish tracker.

 thanks for your help




 Att,
 Rafael M. Pestano
 Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
 Graduando em Ciência da Computação UFRGS
 http://conventions.github.io/home/

 http://rpestano.wordpress.com/
 @realpestano




 Em Domingo, 23 de Março de 2014 18:25, Gerhard Petracek 
 gerhard.petra...@gmail.com escreveu:
 since the implementation in ds is different and it works with other
 servers, it sounds like a general glassfish-issue with custom scopes.

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces




 2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

  Hi gerhard,
 
  same thing with ds 0.6:
 
  [2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
  [javax.enterprise.web.core] [tid: _ThreadID=20
  _ThreadName=http-listener-1(1)] [timeMillis: 1395609260514] [levelValue:
  900] [[
Servlet.service() for servlet FacesServlet threw exception
  java.lang.NullPointerException
  at
 
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
  at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
  at
 
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
  at
 
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
  at
 
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
  at
 
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
  at
 
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)
 
 
 
 
 
  Att,
  Rafael M. Pestano
  Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
  Graduando em Ciência da Computação UFRGS
  http://conventions.github.io/home/
 
  http://rpestano.wordpress.com/
  @realpestano
 
 
 
  Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
  gerhard.petra...@gmail.com escreveu:
  hi rafael,
 
  please test the same with deltaspike 0.6
 
  regards,
  gerhard
 
  http://www.irian.at
 
  Your JSF/JavaEE powerhouse -
  JavaEE Consulting, Development and
  Courses in English and German
 
  Professional Support for Apache MyFaces
 
 
 
 
  2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
 
   Hi guys,
  
   i'm facing an issue with CODI on Glassfish 4 which i can't observe CDI
   events with notifyObserver = Reception.IF_EXISTS if my bean uses a CODI
   scope, here is some code:
  
   @ViewAccessScoped
   @Named
   public class MyBean implements Serializable{
  
   @Inject
   EventMyEvent myEvent;
  
  
   public void fire(){
   myEvent.fire(new MyEvent());
   }
   }
  
   @ViewAccessScoped
   //@SessionScoped
   @Named
   public  class AnotherBean implements Serializable{
  
   protected Logger log =
 Logger.getLogger(getClass().getSimpleName());
  
   public void observe(@Observes(notifyObserver = Reception.IF_EXISTS)
   MyEvent event){
   log.fine(event received:+event);
   }

Re: CODI issue with CDI Observer

2014-03-23 Thread Gerhard Petracek
it isn't nice that we need such a workaround, however, we can add it easily
(in codi as well as in deltaspike).

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2014-03-23 23:07 GMT+01:00 Thomas Andraschko andraschko.tho...@gmail.com:

 Gerhard, i would add the null check but we should do it in AbstractContext.
 Could it break anything?


 2014-03-23 22:57 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:

  Hi again,
 
  i just solved it in my custom scope by checking the null contextual:
 
  @Override
  public T T get(final ContextualT contextual, final
  CreationalContextT creationalContext) {
  if(creationalContext == null){
  return null;
  }
 
  i dont know what the spec says about trying to get a bean which doesnt
  have to participate in an event but in my opinion the easiest way to get
 DS
  compatible with GF4 is to
  do that nullcheck in deltaspike instead of waiting for GF guys...
 
 
 https://github.com/apache/deltaspike/blob/master/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/viewaccess/ViewAccessContext.java#L79
 
 
 
  Att,
 
  Rafael M. Pestano
  Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
  Graduando em Ciência da Computação UFRGS
  http://conventions.github.io/home/
 
  http://rpestano.wordpress.com/
  @realpestano
 
 
 
  Em Domingo, 23 de Março de 2014 18:48, Rafael Pestano 
  rmpest...@yahoo.com.br escreveu:
  Hi Gerhard,
 
  i can confirm its a GF4 issue, justed added a simple custom scope and
  received the same NPE in the scope GET method:
 
  @Override
  public T T get(final ContextualT contextual, final
  CreationalContextT creationalContext) {
  Bean bean = (Bean) contextual;
  if
  (customScopeContextHolder.getBeans().containsKey(bean.getBeanClass())) {
  return (T)
  customScopeContextHolder.getBean(bean.getBeanClass()).instance;
  } else {
  T t = (T) bean.create(creationalContext);//NPE here,
  contextual is null
 
 
  I'll open an issue at glassfish tracker.
 
  thanks for your help
 
 
 
 
  Att,
  Rafael M. Pestano
  Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
  Graduando em Ciência da Computação UFRGS
  http://conventions.github.io/home/
 
  http://rpestano.wordpress.com/
  @realpestano
 
 
 
 
  Em Domingo, 23 de Março de 2014 18:25, Gerhard Petracek 
  gerhard.petra...@gmail.com escreveu:
  since the implementation in ds is different and it works with other
  servers, it sounds like a general glassfish-issue with custom scopes.
 
  regards,
  gerhard
 
  http://www.irian.at
 
  Your JSF/JavaEE powerhouse -
  JavaEE Consulting, Development and
  Courses in English and German
 
  Professional Support for Apache MyFaces
 
 
 
 
  2014-03-23 22:15 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
 
   Hi gerhard,
  
   same thing with ds 0.6:
  
   [2014-03-23T18:14:20.514-0300] [glassfish 4.0] [WARNING] []
   [javax.enterprise.web.core] [tid: _ThreadID=20
   _ThreadName=http-listener-1(1)] [timeMillis: 1395609260514]
 [levelValue:
   900] [[
 Servlet.service() for servlet FacesServlet threw exception
   java.lang.NullPointerException
   at
  
 
 org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:178)
   at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
   at
  
 
 org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
   at
  
 
 org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
   at
  
 
 org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:124)
   at
  
 
 org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessContext.get(ViewAccessContext.java:83)
   at
  
 
 org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:67)
  
  
  
  
  
   Att,
   Rafael M. Pestano
   Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
   Graduando em Ciência da Computação UFRGS
   http://conventions.github.io/home/
  
   http://rpestano.wordpress.com/
   @realpestano
  
  
  
   Em Domingo, 23 de Março de 2014 17:44, Gerhard Petracek 
   gerhard.petra...@gmail.com escreveu:
   hi rafael,
  
   please test the same with deltaspike 0.6
  
   regards,
   gerhard
  
   http://www.irian.at
  
   Your JSF/JavaEE powerhouse -
   JavaEE Consulting, Development and
   Courses in English and German
  
   Professional Support for Apache MyFaces
  
  
  
  
   2014-03-23 18:23 GMT+01:00 Rafael Pestano rmpest...@yahoo.com.br:
  
Hi guys,
   
i'm facing an issue with CODI on Glassfish 4 which i can't observe
 CDI
events with notifyObserver = Reception.IF_EXISTS if my bean uses a
 CODI
scope, here is some code: