glassfish
  1. glassfish
  2. GLASSFISH-20775

<managed-bean-class>java.util.Date</managed-bean-class> causes java.lang.NullPointerException at org.glassfish.weld.DeploymentImpl.findRootBda

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0_b89_RC5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      GF4 b89 on Win7 x64

      Description

      When a java.util.Date managed bean is declared in faces-config.xml as follows:

      <managed-bean>
          <managed-bean-name>now</managed-bean-name>
          <managed-bean-class>java.util.Date</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
      

      Then GlassFish 4.0 b89 throws the following exception:

      java.lang.NullPointerException
      	at org.glassfish.weld.DeploymentImpl.findRootBda(DeploymentImpl.java:700)
      	at org.glassfish.weld.DeploymentImpl.getBeanDeploymentArchive(DeploymentImpl.java:682)
      	at org.jboss.weld.manager.BeanManagerLookupService.lookupBeanManager(BeanManagerLookupService.java:48)
      	at org.jboss.weld.manager.BeanManagerLookupService.lookupBeanManager(BeanManagerLookupService.java:60)
      	at org.jboss.weld.manager.BeanManagerImpl.getInjectionTargetFactory(BeanManagerImpl.java:1381)
      	at org.jboss.weld.manager.BeanManagerImpl.createInjectionTarget(BeanManagerImpl.java:1039)
      	at org.glassfish.weld.services.JCDIServiceImpl.injectManagedObject(JCDIServiceImpl.java:283)
      	at org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:189)
      	at com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:203)
      	at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:101)
      	at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
      	at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
      	at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
      	at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
      	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      	at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
      	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
      	at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
      	at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:227)
      	at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:150)
      	at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
      	at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
      	at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
      	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
      	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
      	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
      	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
      	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      

      This problem does not occur when e.g. java.util.HashMap is used instead, or a concrete backing bean class.

        Activity

        Hide
        balusc added a comment -

        Note: this construct has always worked fine in all other servers, including GF2/3, Tomcat 6/7, JBoss 6/7 and TomEE 1.

        Such a bean is been declared in JSF utility library OmniFaces and therefore blocking its usage. See also https://code.google.com/p/omnifaces/issues/detail?id=234

        Show
        balusc added a comment - Note: this construct has always worked fine in all other servers, including GF2/3, Tomcat 6/7, JBoss 6/7 and TomEE 1. Such a bean is been declared in JSF utility library OmniFaces and therefore blocking its usage. See also https://code.google.com/p/omnifaces/issues/detail?id=234
        Hide
        arjan tijms added a comment -

        If you declare a type that directly extends from java.util.Data, but doesn't contain any functionality, then things do work:

        package org.omnifaces.showcase;
        
        import java.util.Date;
        
        public class OmniDate extends Date {
            private static final long serialVersionUID = -9196263323752494128L;
        }
        
        <managed-bean>
            <managed-bean-name>now</managed-bean-name>
            <managed-bean-class>org.omnifaces.showcase.OmniDate</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        
        Show
        arjan tijms added a comment - If you declare a type that directly extends from java.util.Data , but doesn't contain any functionality, then things do work: package org.omnifaces.showcase; import java.util.Date; public class OmniDate extends Date { private static final long serialVersionUID = -9196263323752494128L; } <managed-bean> <managed-bean-name> now </managed-bean-name> <managed-bean-class> org.omnifaces.showcase.OmniDate </managed-bean-class> <managed-bean-scope> request </managed-bean-scope> </managed-bean>
        Hide
        djmj added a comment -

        Updating to GF 4.1 build 13 this issue seems to be resolved.

        I have no problem anymore using one of the following lines:

        #{now}
        
        <p:calendar mindate="#{now}" maxdate="#{el:addToDate(now, Calendar.DATE, 5)}"/>
        
        #{of:formatDateWithTimezone(now, 'hh:mm', 'de')}-#{of:formatDateWithTimezone(el:addToDate(now, Calendar.MINUTE, 60), 'hh:mm', 'de')}
        
        Show
        djmj added a comment - Updating to GF 4.1 build 13 this issue seems to be resolved. I have no problem anymore using one of the following lines: #{now} <p:calendar mindate= "#{now}" maxdate= "#{el:addToDate(now, Calendar.DATE, 5)}" /> #{of:formatDateWithTimezone(now, 'hh:mm', 'de')}-#{of:formatDateWithTimezone(el:addToDate(now, Calendar.MINUTE, 60), 'hh:mm', 'de')}

          People

          • Assignee:
            michael.y.chen
            Reporter:
            balusc
          • Votes:
            8 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: