Re: BeanManager lookup returing null !

2014-06-12 Thread Gerhard Petracek
hi felipe,

you pass in a scope-annotation as qualifier.
- it can't work, since a scope is no qualifier.

(fyi: please ask questions about cdi on the list for openwebbeans.)

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-06-11 23:14 GMT+02:00 Felipe Pina fop@gmail.com:

 Why beans Set (bold read line ) is empty ?

 What is my mistake ?

 Could anybody help me ?



 *My bean.*

 @javax.enterprise.context.RequestScoped
 @javax.enterprise.inject.Default
 public class Permissao extends NegocioBasePermissaoDTO {
 
 }


 *context.xml*
  Resource name=BeanManager
 auth=Container
 type=javax.enterprise.inject.spi.BeanManager
 factory=org.apache.webbeans.container.ManagerObjectFactory/


 *web.xml*

 !-- I ran with and without this resource-env-ref section --
   resource-env-ref
 descriptionObject factory for the CDI Bean Manager/description
 resource-env-ref-nameBeanManager/resource-env-ref-name

 resource-env-ref-typejavax.enterprise.inject.spi.BeanManager/resource-env-ref-type
   /resource-env-ref

 *BeanFactory*

 public class BeanFactory {
  static BeanManager getBeanManager() {
 InitialContext context;
 Object result;
 try {
 context = new InitialContext();
 result = context.lookup(java:comp/env/BeanManager); //lookup in
 Tomcat
 } catch (NamingException e) {
 try {
 context = new InitialContext();
 result = context.lookup(java:comp/BeanManager); //lookup in
 JBossAS
 } catch (NamingException ex) {
 throw new RuntimeException(BeanManager could not be found in
 JNDI, e);
 }
 }
 return (BeanManager) result;
 }
  @SuppressWarnings(unchecked)
 public static T T getContextualInstance(final ClassT type) {
  BeanManager manager = getBeanManager();
 T result = null;
 *SetBean? beans = manager.getBeans(type,
 type.getAnnotation(RequestScoped.class));*
 *   why variable beans isEmpty !!!*
 BeanT bean = (BeanT) manager.resolve(beans);
 if (bean != null) {
 CreationalContextT context =
 manager.createCreationalContext(bean);
 if (context != null) {
 result = (T) manager.getReference(bean, type, context);
 }
 }
 return result;
 }
 }

 --
 Atenciosamente,
 Felipe Pina



Re: NPE when view pooling / CACHE_EL_EXPRESSIONS == alwaysRecompile

2014-06-12 Thread Leonardo Uribe
Hi

An example to reproduce it could help in this case.

Leonardo.
On Jun 10, 2014 11:21 PM, l.pe...@senat.fr l.pe...@senat.fr wrote:

 (republished here following the advice of Gerhard Petracek on
 us...@deltaspike.apache.org)

 Dear all,

 I have the following NPE when view pooling is activated and
 CACHE_EL_EXPRESSIONS is set to alwaysRecompile :

 java.lang.NullPointerException at org.apache.myfaces.view.facelets.el.
 FaceletStateValueExpression.getValue(FaceletStateValueExpression.java:107)
 at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:68) at
 org.apache.el.parser.AstValue.getValue(AstValue.java:161) at
 org.apache.el.parser.AstEmpty.getValue(AstEmpty.java:47) at
 org.apache.el.parser.AstNot.getValue(AstNot.java:44) at org.apache.el.
 ValueExpressionImpl.getValue(ValueExpressionImpl.java:185) at
 org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression
 .getValue(ContextAwareTagValueExpression.java:96) at
 javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:377)
 at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1211)
 at 
 javax.faces.component.UIComponentBase._isPhaseExecutable(UIComponentBase.java:2440)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1386)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at javax.faces.component.UIForm.processDecodes(UIForm.java:154) at
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at 
 javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401)
 at 
 javax.faces.component.UIViewRoot._processDecodesDefault(UIViewRoot.java:1687)
 at javax.faces.component.UIViewRoot.access$500(UIViewRoot.java:77) at
 javax.faces.component.UIViewRoot$ApplyRequestValuesPhaseProcess
 or.process(UIViewRoot.java:1778) at javax.faces.component.
 UIViewRoot._process(UIViewRoot.java:1653) at javax.faces.component.
 UIViewRoot.processDecodes(UIViewRoot.java:869) at
 org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(
 ApplyRequestValuesExecutor.java:42) at org.apache.myfaces.lifecycle.
 LifecycleImpl.executePhase(LifecycleImpl.java:196) at
 org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143)
 at org.apache.deltaspike.jsf.impl.listener.request.
 DeltaSpikeLifecycleWrapper.execute(DeltaSpikeLifecycleWrapper.java:89) at
 javax.faces.lifecycle.LifecycleWrapper.execute(LifecycleWrapper.java:46)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198) at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
 ApplicationFilterChain.java:305) at org.apache.catalina.core.
 ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at
 fr.senat.faces.filters.HibernateNoCacheFilter.doFilter(
 HibernateNoCacheFilter.java:123) at org.apache.catalina.core.
 ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(
 ApplicationFilterChain.java:210) at fr.senat.faces.filters.
 HibernateSessionConversationFilter.doFilter(HibernateSessionConversationFilter.java:128)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
 ApplicationFilterChain.java:243) at org.apache.catalina.core.
 ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at
 fr.senat.faces.filters.HibernateUserFromPrincipalFilter.doFilter(
 HibernateUserFromPrincipalFilter.java:43) at org.apache.catalina.core.
 ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(
 ApplicationFilterChain.java:210) at fr.senat.faces.filters.
 SessionCreationTrackingFilter.doFilter(SessionCreationTrackingFilter.java:48)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
 ApplicationFilterChain.java:243) at org.apache.catalina.core.
 ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
 at 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
 at 
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
 at 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
 at 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
 at 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
 at 

Re: BeanManager lookup returing null !

2014-06-12 Thread Karl Kildén
Felipe,

As a side note I recommend you try Deltaspike core [1] for retrieving
beans. Alternatively you can retrieve with Omnifaces [2] too all though
since Deltaspike is composed by the makers of Weld / OWB that would be my
first bet.

[1] http://deltaspike.apache.org/core.html#beanprovider
[2] http://showcase.omnifaces.org/utils/Beans


On 12 June 2014 09:35, Gerhard Petracek gerhard.petra...@gmail.com wrote:

 hi felipe,

 you pass in a scope-annotation as qualifier.
 - it can't work, since a scope is no qualifier.

 (fyi: please ask questions about cdi on the list for openwebbeans.)

 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-06-11 23:14 GMT+02:00 Felipe Pina fop@gmail.com:

  Why beans Set (bold read line ) is empty ?
 
  What is my mistake ?
 
  Could anybody help me ?
 
 
 
  *My bean.*
 
  @javax.enterprise.context.RequestScoped
  @javax.enterprise.inject.Default
  public class Permissao extends NegocioBasePermissaoDTO {
  
  }
 
 
  *context.xml*
   Resource name=BeanManager
  auth=Container
  type=javax.enterprise.inject.spi.BeanManager
  factory=org.apache.webbeans.container.ManagerObjectFactory/
 
 
  *web.xml*
 
  !-- I ran with and without this resource-env-ref section --
resource-env-ref
  descriptionObject factory for the CDI Bean Manager/description
  resource-env-ref-nameBeanManager/resource-env-ref-name
 
 
 resource-env-ref-typejavax.enterprise.inject.spi.BeanManager/resource-env-ref-type
/resource-env-ref
 
  *BeanFactory*
 
  public class BeanFactory {
   static BeanManager getBeanManager() {
  InitialContext context;
  Object result;
  try {
  context = new InitialContext();
  result = context.lookup(java:comp/env/BeanManager); //lookup in
  Tomcat
  } catch (NamingException e) {
  try {
  context = new InitialContext();
  result = context.lookup(java:comp/BeanManager); //lookup in
  JBossAS
  } catch (NamingException ex) {
  throw new RuntimeException(BeanManager could not be found in
  JNDI, e);
  }
  }
  return (BeanManager) result;
  }
   @SuppressWarnings(unchecked)
  public static T T getContextualInstance(final ClassT type) {
   BeanManager manager = getBeanManager();
  T result = null;
  *SetBean? beans = manager.getBeans(type,
  type.getAnnotation(RequestScoped.class));*
  *   why variable beans isEmpty !!!*
  BeanT bean = (BeanT) manager.resolve(beans);
  if (bean != null) {
  CreationalContextT context =
  manager.createCreationalContext(bean);
  if (context != null) {
  result = (T) manager.getReference(bean, type, context);
  }
  }
  return result;
  }
  }
 
  --
  Atenciosamente,
  Felipe Pina
 



Re: 2.2 stability

2014-06-12 Thread Karl Kildén
I can confirm that I used c:forEach erroneously.

Myfaces 2.2.3 running great for me now

cheers


On 13 March 2014 16:27, Leonardo Uribe lu4...@gmail.com wrote:

 Hi

 @Karl  I think your problem should be something different. I closed
 MYFACES-3869, since we have positive confirmation that the fix done
 works, but we need to analyze your problem and check if there is an
 error in MyFaces or not.

 We need more information than just the stack trace. MyFaces default
 error page gives the component tree using ErrorWriter and indicate
 which component has the duplicate id. There are some tricks involving
 programmatic component manipulation that can trigger a duplicate id
 exception, but not because they are correct and myfaces has a bug but
 because they are just invalid. In JSF 2.2, with vdl.createComponent it
 is possible to create programmatically added components using facelets
 in the right way. It is useful to use ui:debug tag to see the
 component tree and describe the steps involved in the exception, to
 help us to understand what could possible happen and how to fix it.

 regards,

 Leonardo Uribe

 2014-03-13 7:19 GMT-05:00 Howard W. Smith, Jr. smithh032...@gmail.com:
  On Thu, Mar 13, 2014 at 7:34 AM, Karl Kildén karl.kil...@gmail.com
 wrote:
 
  Tried 2.2.2-20140313.024403-5
 
  Duplicate id problems are still present. I have tried for a while now to
  create a simple sample but I am unsuccessful so far.
 
 
  +1 thanks Karl for the report.