Hi
I'm always running the verifier tool during deployment, and never get any warning or failure.
To give you the full picture, I have 4 EJB modules, deployed in separate jar files (not in a ear file)
limbsAuthzEJB, that contains the Stateless SB: AuthzManagerBean (with mapped name of ejb/AuthzManager defined in ejb-jar.xml)
limbsBusinessLoggerEJB, that contains the MDB: BusinessLoggerBean
limbsSessionStoreEJB, that contains the Stateless SB: SessionStoreBean (with mapped name of ejb/SessionStore defined in ejb-jar.xml)
limbsMessageBrokerEJB, that contains the Stateless SB: SessionCollectorBean (with mapped name of ejb/SessionCollector defined in ejb-jar.xml) and the MDB: MessageBrokerBean.
AuthzManagerBean depends on SessionStoreBean
MessageBrokerBean depends on SessionCollectorBean and SessionStoreBean
All EJBs are defined with the @Stateless annotation, with no further parameter. It is in the ejb-jar.xml that I specify the mapped name (global jndi name)
All references to EJB are defined using the @Resource annotation, with the name and mappedname attributes set.
The test client I'm using invokes a method on AuthzManagerBean; this method tries to invoke a method on SessionStore, and that's where I get the exception in GlassFish logs:
[#|2007-03-21T09:50:59.914+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=14;_ThreadName=p: thread-pool-1; w: 4;|EJB5070: Exception creating stateless session bean : [{0}]
com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref SessionStoreBean_at_jndi: ejb/SessionStore_at_null@org.limbs.broker.session.SessionStore_at_Session@null into class org.limbs.broker.authz.AuthzManagerBean
and later
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfaceorg.limbs.broker.session.SessionStore [Root exception is java.lang.IllegalArgumentException: object is not an instance of declaring class]
This occurs after restarting GlassFish domain (with all modules deployed).
What is really strange though is that if I then redeploy the limbsAuthzManagerEJB module, then my test client can successfully invoke the method on AuthzManager, that in turn invokes the SessionStore method.
The next problem is that this AuthzManager method also posts a JMS message to the queue on which MessageBroker is listening, and this causes the same kind of injection problem:
[#|2007-03-21T10:08:25.262+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.ejb.mdb|_ThreadID=18;_ThreadName=p: thread-pool-1; w: 6;limbsMessageBrokerEJB:MessageBrokerBean;com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref SessionStoreBean_at_jndi: ejb/SessionStore_at_null@org.limbs.broker.session.SessionStore_at_null@null into class org.limbs.broker.messageBroker.MessageBrokerBean;_RequestID=3d373afc-5aa3-4749-a925-71af7a94bc53;|MDB00050: Message-driven bean [limbsMessageBrokerEJB:MessageBrokerBean]: Exception in creating message-driven ejb : [com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref SessionStoreBean_at_jndi: ejb/SessionStore_at_null@org.limbs.broker.session.SessionStore_at_null@null into class org.limbs.broker.messageBroker.MessageBrokerBean]|#]
And here also, if I then redeploy the lilmbsMessageBrokerEJB module, then everything works fine.
Would you have any idea why injection only works after modules have been redeployed? Am I missing something in my code or deployment? I attach some excerpts of the generated deployment descriptors below
Thanks a lot for your help
Jean-Noel Colin
######################################################################
In the ejb-jar.xml of SessionStore (under generated/xml/...), here's how the ejb is defined:
<ejb-name>SessionStoreBean</ejb-name>
<mapped-name>ejb/SessionStore</mapped-name>
<business-remote>org.limbs.broker.session.SessionStore</business-remote>
<ejb-class>org.limbs.broker.session.SessionStoreBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
In the sun-ejb-jar.xml of SessionStore (under generated/xml/...), here's how the ejb is defined:
<ejb>
<ejb-name>SessionStoreBean</ejb-name>
<jndi-name>ejb/SessionStore</jndi-name>
In the ejb-jar.xml of AuthzManager (under generated/xml/...), here's the reference to the ejb:
<ejb-ref>
<ejb-ref-name>SessionStoreBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>org.limbs.broker.session.SessionStore</remote>
<mapped-name>ejb/SessionStore</mapped-name>
<injection-target>
<injection-target-class>org.limbs.broker.authz.AuthzManagerBean</injection-target-class>
<injection-target-name>sessionStore</injection-target-name>
</injection-target>
</ejb-ref>
in the sun-ejb-jar.xml of AuthzManager (under generated/xml/...), I find:
<ejb-ref>
<ejb-ref-name>SessionStoreBean</ejb-ref-name>
<jndi-name>ejb/SessionStore</jndi-name>
</ejb-ref>
[Message sent by forum member 'jncolin' (jncolin)]
http://forums.java.net/jive/thread.jspa?messageID=209132