users@glassfish.java.net

Remote EJB injection problem

From: Willem Viljoen <willemnviljoen_at_gmail.com>
Date: Thu, 24 Feb 2011 16:00:31 +0200

Hi,

I'm having trouble trying to remotely inject an EJB from another app server
instance. I'm using the portable JNDI name as described in the GlassFish
FAQ, and when I inject the bean from localhost, it works, but not when I
inject from another host. Here is a brief description of my environment:

--- On application server 1: (willem-laptop.int.spacialdev.com, GlassFish
3.0.1) ---

/*
 * PersonFacade.java
 * inside EJB.jar
 * which is inside Logic.ear
 */

@Stateless
public class PersonFacade extends EntityFacade<Person> implements
PersonFacadeLocal, PersonFacadeRemote {
// ...
}

--
/*
 * Logic.ear/classlibrary.jar/PersonFacadeRemote.java
 */
@Remote
public interface PersonFacadeRemote {
// ...
}
-- From the server log, I have this portable JNDI name for the bean --
java:global/Logic/EJB/PersonFacade!com.spacial.common.remote.PersonFacadeRemote
-- On application server 2: (willem-desktop.int.spacialdev.com, GlassFish
3.0.1) --
/*
 * User.java
 * inside Website.war
 */
@ManagedBean(name = "user")
@ViewScoped
public class User extends AbstractManagedBean implements Serializable {
// ..
@EJB(name="ejb/PersonFacade")
private PersonFacadeRemote personFacade;
// ..
}
-- PersonFacadeRemote.java is available to the WAR through the included
class library --
-- In sun-web.xml --
    <ejb-ref>
        <ejb-ref-name>ejb/PersonFacade</ejb-ref-name>
        <jndi-name>corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade!com.spacial.common.remote.PersonFacadeRemote
</jndi-name>
    </ejb-ref>
--
The WAR deploys without problems, but as soon as I try to access a page that
user the User managed bean, the following exception gets thrown:
WARNING: 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 user
        at
com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:211)
        at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:103)
        at
com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:405)
        at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:267)
        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.getValue(AstValue.java:158)
        at
com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
        at
org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:71)
        at
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:102)
        at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
        at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
        at javax.faces.component.UIOutput.getValue(UIOutput.java:168)
        at
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
        at
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:338)
        at
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
        at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
        at
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620)
        at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
        at
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
        at
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
        at
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
        at
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
        at
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
        at
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
        at
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
        at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
        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:313)
        at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        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:325)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
        at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        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
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        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 to inject Remote ejb-ref name=ejb/PersonFacade,Remote 3.x
interface
=com.spacial.common.remote.PersonFacadeRemote,ejb-link=null,lookup=null,mappedName=,jndi-name=corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade!com.spacial.common.remote.PersonFacadeRemote,refType=Sessioninto
class com.spacialaudio.spacialmedia.web.User
        at
org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:98)
        at
com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:205)
        ... 55 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException:
Exception attempting to inject Remote ejb-ref name=ejb/PersonFacade,Remote
3.x interface
=com.spacial.common.remote.PersonFacadeRemote,ejb-link=null,lookup=null,mappedName=,jndi-name=corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade!com.spacial.common.remote.PersonFacadeRemote,refType=Sessioninto
class com.spacialaudio.spacialmedia.web.User
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:614)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:168)
        at
org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:94)
        ... 56 more
Caused by: javax.naming.NamingException: Lookup failed for
'java:comp/env/ejb/PersonFacade' in SerialContext  [Root exception is
javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref
name=ejb/PersonFacade,Remote 3.x interface
=com.spacial.common.remote.PersonFacadeRemote,ejb-link=null,lookup=null,mappedName=,jndi-name=corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade!com.spacial.common.remote.PersonFacadeRemote,refType=Session'
.  Actual (possibly internal) Remote JNDI name used for lookup is
'corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade__3_x_Internal_RemoteBusinessHome__'
[Root exception is org.omg.CORBA.BAD_PARAM:   vmcid: OMG  minor code: 9
 completed: No]]
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:513)
        ... 59 more
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote
ejb-ref name=ejb/PersonFacade,Remote 3.x interface
=com.spacial.common.remote.PersonFacadeRemote,ejb-link=null,lookup=null,mappedName=,jndi-name=corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade!com.spacial.common.remote.PersonFacadeRemote,refType=Session'
.  Actual (possibly internal) Remote JNDI name used for lookup is
'corbaname:iiop:
willem-laptop.int.spacialdev.com:3700#java:global/Logic/EJB/PersonFacade__3_x_Internal_RemoteBusinessHome__'
[Root exception is org.omg.CORBA.BAD_PARAM:   vmcid: OMG  minor code: 9
 completed: No]
        at
com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:174)
        at
com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1040)
        at
com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:688)
        at
com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:657)
        at
com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148)
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428)
        ... 61 more
Caused by: org.omg.CORBA.BAD_PARAM:   vmcid: OMG  minor code: 9  completed:
No
        at
com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1075)
        at
com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1093)
        at
com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:228)
        at
com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:154)
        at
com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:144)
        at
com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:954)
        at
com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:167)
        ... 66 more
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:
omg.org/CosNaming/NamingContext/NotFound:1.0
        at
org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
        at
org.omg.CosNaming._NamingContextExtStub.resolve_str(_NamingContextExtStub.java:165)
        at
com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:222)
        ... 70 more
--
Has anyone encountered this problem? Please help.
Thanks
Willem