I am using today's freshly updated GFv3 Preview. My app has a managed bean that injects a session bean in the usual way, with an @EJB field annotation.
I attach the stack trace below. As you can see, JSF asks Glassfish to do the injection, but then Glassfish can't seem to find the session bean. The bean is in WEB-INF/classes/edu/sjsu/simplequiz/session/QuizSB.class.
The only wrinkle is that the session bean has been written in Scala, not Java. I CAREFULLY checked the byte codes. The class is annotated with javax.ejb.Stateless.
So, I am at a total loss why it can't find it. I looked at the source code of com.sun.enterprise.naming.impl.TransientContext, but that did me no good--it just said that some map fails to contain the name. I would very much like to know how that map gets populated. What does Glassfish do to look for session bean classes? Apparently something there rejects my bean for some (probably spurious) reason because it is flummoxed by some Scala artifact. (If I replace the class file with one that was authored in Java, all is well.)
Thanks for any help!
Cay
--------------------------------------------------------------------------------------------------------------------
com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean quiz
at com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:213)
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:385)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:254)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:99)
at com.sun.el.parser.AstValue.getTarget(AstValue.java:127)
at com.sun.el.parser.AstValue.invoke(AstValue.java:217)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:103)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1506)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:293)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:187)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:647)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:353)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:249)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:147)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:161)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=edu.sjsu.simplequiz.managed.QuizMB/quizSB,Remote 3.x business interface=edu.sjsu.simplequiz.session.QuizSB,ejb-link=null,mappedName=edu.sjsu.simplequiz.session.QuizSB,refType=Session into class edu.sjsu.simplequiz.managed.QuizMB
at org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:98)
at com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:207)
... 44 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=edu.sjsu.simplequiz.managed.QuizMB/quizSB,Remote 3.x business interface=edu.sjsu.simplequiz.session.QuizSB,ejb-link=null,mappedName=edu.sjsu.simplequiz.session.QuizSB,refType=Session into class edu.sjsu.simplequiz.managed.QuizMB
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:439)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:217)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:132)
at org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:94)
... 45 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/edu.sjsu.simplequiz.managed.QuizMB/quizSB' in SerialContext [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=edu.sjsu.simplequiz.managed.QuizMB/quizSB,Remote 3.x business interface=edu.sjsu.simplequiz.session.QuizSB,ejb-link=null,mappedName=edu.sjsu.simplequiz.session.QuizSB,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB' [Root exception is javax.naming.NamingException: Lookup failed for 'edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB' in SerialContext [Root exception is javax.naming.NameNotFoundException: edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB not found]]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:434)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:340)
... 48 more
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=edu.sjsu.simplequiz.managed.QuizMB/quizSB,Remote 3.x business interface=edu.sjsu.simplequiz.session.QuizSB,ejb-link=null,mappedName=edu.sjsu.simplequiz.session.QuizSB,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB' [Root exception is javax.naming.NamingException: Lookup failed for 'edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB' in SerialContext [Root exception is javax.naming.NameNotFoundException: edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB not found]]
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:112)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:728)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:488)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:142)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:418)
... 50 more
Caused by: javax.naming.NamingException: Lookup failed for 'edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB' in SerialContext [Root exception is javax.naming.NameNotFoundException: edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB not found]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:434)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:108)
... 54 more
Caused by: javax.naming.NameNotFoundException: edu.sjsu.simplequiz.session.QuizSB#edu.sjsu.simplequiz.session.QuizSB not found
at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:197)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:168)
at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)
at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:100)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:420)
... 56 more
[Message sent by forum member 'cayhorstmann' (cayhorstmann)]
http://forums.java.net/jive/thread.jspa?messageID=350717