Skip to main content

Glassfish 3.1.1 EJB injection

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
3 replies [Last post]
vrcollins
Offline
Joined: 2011-03-30

The injection for Glassfish 3.1.x and Glassfish 3.2.x is not working. At first I believed that this had something to do with CDI and weld. That is what the all of the bugs referred to. However, my issues remain. There are NO issues in Glassfish 3.0.1 with regard to dependency injection. After doing some more tests, it seems as though the issues are not just tied to CDI. The EJB's are in their own jar file that is packaged in the lib directory of the deployed war. The logs show that all of the EJB's are recognized and are successfully deployed. Here is an example of what is happening using just the JSF ManagedBeans annotations.

package com.clss.base.session;

import java.io.Serializable;

import java.util.Map;

import javax.annotation.PostConstruct;

import javax.ejb.EJB;

import javax.faces.bean.ManagedBean;

import javax.faces.bean.SessionScoped;

import javax.faces.context.FacesContext;

import javax.servlet.http.HttpServletRequest;

import com.clss.ong.business.interfaces.IVendorAccessLocal;

import com.clss.ong.entity.OngUser;

import com.clss.ong.entity.OngVendor;

@ManagedBean(name = "userSession")

@SessionScoped

public class UserSession implements Serializable {

private static final long serialVersionUID = -5357959580555377L;

@EJB(name = "VendorAccess")

private IVendorAccessLocal m_vendorAccess;

@PostConstruct

protected void initialize() {

Map<String, OngVendor> v = this.m_vendorAccess.retrieveActiveVendors();

}

This code generates an error that "VendorAccess" initialization failed. Once again, this code works "as-is" in Glassfish3.0.1. There is that stack trace:

[#|2011-08-02T13:26:07.574-0500|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=20;_ThreadName=Thread-4;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception

com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean userSession

at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:229)

at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)

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:99)

at com.sun.el.parser.AstValue.getValue(AstValue.java:158)

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)

at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)

at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:224)

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:184)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)

at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:290)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:290)

at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)

at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:596)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:726)

at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1020)

at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:91)

at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:56)

at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

at java.lang.Thread.run(Thread.java:662)

Caused by: com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting invoke lifecycle method protected void com.clss.base.session.UserSession.initialize()

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:231)

at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)

... 50 more

Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting invoke lifecycle method protected void com.clss.base.session.UserSession.initialize()

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:393)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:306)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:229)

at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)

at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)

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:99)

at com.sun.el.parser.AstValue.getValue(AstValue.java:158)

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)

at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)

at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:224)

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:1759)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)

at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)

at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)

at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

... 5 more

Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:376)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:306)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:229)

at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)

at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)

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:99)

at com.sun.el.parser.AstValue.getValue(AstValue.java:158)

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)

at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)

at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:224)

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:184)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)

at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:290)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:290)

at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)

at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:596)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:726)

at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1020)

at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:91)

at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:56)

... 5 more

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.glassfish.faces.integration.GlassFishInjectionProvider$2.run(GlassFishInjectionProvider.java:382)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:376)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:306)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:229)

at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)

at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)

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:99)

at com.sun.el.parser.AstValue.getValue(AstValue.java:158)

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)

at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)

at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:224)

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:1759)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)

at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)

at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)

at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

... 5 more

Caused by: javax.ejb.NoSuchEJBException: Singleton VendorAccess is unavailable because its original initialization failed.

at com.sun.ejb.containers.AbstractSingletonContainer.checkInit(AbstractSingletonContainer.java:414)

at com.sun.ejb.containers.CMCSingletonContainer._getContext(CMCSingletonContainer.java:117)

at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2528)

at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1895)

at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)

at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)

at $Proxy203.retrieveActiveVendors(Unknown Source)

at com.clss.base.session.UserSession.initialize(UserSession.java:122)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.glassfish.faces.integration.GlassFishInjectionProvider$2.run(GlassFishInjectionProvider.java:383)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:376)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:306)

at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:229)

at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)

at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)

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:99)

at com.sun.el.parser.AstValue.getValue(AstValue.java:158)

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)

at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)

at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:224)

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:184)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)

at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)

at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:290)

at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:290)

at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)

at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:596)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:726)

at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1020)

at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:91)

at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:56)

... 5 more

|#]

When using CDI and well I am getting similar errors. Here is what the code looks like

import java.io.Serializable;

import java.util.Map;

import javax.annotation.PostConstruct;

import javax.ejb.EJB;

import javax.enterprise.context.SessionScoped;

import javax.faces.context.FacesContext;

import javax.inject.Named;

import javax.servlet.http.HttpServletRequest;

import com.clss.ong.business.interfaces.IVendorAccessLocal;

import com.clss.ong.entity.OngUser;

import com.clss.ong.entity.OngVendor;

@Named("userSession")

@SessionScoped

public class UserSession implements Serializable {

private static final long serialVersionUID = -5357959580555377L;

@EJB(name = "VendorAccess")

private IVendorAccessLocal m_vendorAccess;

private OngVendor m_vendor = null;

private OngUser m_user = null;

@PostConstruct

protected void initialize() {

Map<String, OngVendor> v = this.m_vendorAccess.retrieveActiveVendors();

}

The first error that occurs says that the @PostConstruct is not able to be invoked.

<font color="#000000"><font face="Courier 10 Pitch"><font size="2" style="font-size: 9pt">javax.servlet.ServletException: WELD-000049 Unable to invoke [method] @PostConstruct protected com.clss.base.session.UserSession.initialize() on com.clss.base.session.UserSession@1eaa8f1b</font></font></font>

The next error is the same as before. It has a problem trying to inject the VendorAccess EJB. I must stress that these issues DO NOT happen in Glassfish3.0.1. I am using the same jar files and war files. This is a problem that needs to be fixed.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cf126330
Offline
Joined: 2005-03-29

Can you enter an issue with test, steps to reproduce, and any warning and errors in server.log?

vrcollins
Offline
Joined: 2011-03-30

I am not sure I am following what you are asking completely. But I will do my best.

First, I create an ejb3.1 project. In this example, I have one Singleton ejb called VendorAccess. It implements a Local called IVendorAccessLocal. These objects are compiled and packaged into a .jar file. This .jar file is added to the main .war file (lib directory) for deployment.

In the .war project there are backing beans that serve up the JSF pages. The first one that gets called is the UserSession bean. The UserSession Bean uses (or tries to use) the VendorAccess ejb using depenency injection. When the UserSession bean tries to call the retrieveActiveVendors() method of the VendorAccess bean, the errors occur. The ouput from the sever.log file contains erros and is included in the original post.

cf126330
Offline
Joined: 2005-03-29

If you could create a bug at http://java.net/jira/browse/GLASSFISH with all the details and test case, that will be great.

I don't see this failure in our own testing. Also server.log should have logs why the singleton failed to init.