-
1. Re: Call EJB Jar from MBean inside sar
jaikiran Jun 7, 2011 9:35 AM (in response to ab_99)Can't say much without looking at the exception stacktrace and the configuration files.
-
2. Re: Call EJB Jar from MBean inside sar
ab_99 Jun 8, 2011 12:55 AM (in response to jaikiran)The jboss-service.xml is defined as follows -
<server>
<mbean code="com.registration.Registration" name="registration.mbeans..com:service=Registration">
<depends>jboss.j2ee:jndiName=com/ejb/configuration/ConfigurationLocal,service=EJB</depends>
</mbean>
</server>
The jar containing the EJB and the SAR is deployed in one ear file.
The start method of the mbean invokes a POJO method which in turn calls an EJB methof
The stack trace -
2011-06-08 10:22:31,756 ERROR [com.utility.adapter.Adapter] envLookUp
javax.naming.NameNotFoundException: env not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
Please let me know if you need any more information.
--Anurag
-
3. Re: Call EJB Jar from MBean inside sar
ab_99 Jun 8, 2011 12:58 AM (in response to ab_99)Also, if I invoke the start() method of the MBean from the JMX console after the server has started; the lookup works without any exceptions.
-
4. Re: Call EJB Jar from MBean inside sar
jaikiran Jun 9, 2011 3:23 AM (in response to ab_99)Anurag Bhatia wrote:
The jboss-service.xml is defined as follows -
<server>
<mbean code="com.registration.Registration" name="registration.mbeans..com:service=Registration">
<depends>jboss.j2ee:jndiName=com/ejb/configuration/ConfigurationLocal,service=EJB</depends>
</mbean>
</server>
That's an incorrect value in the <depends>. The value should be of the form:
<depends>jboss.j2ee:ear=YourEARName.ear,jar=YourEJBJarName.jar,name=YourBeanName,service=EJB3</depends>
If the bean is deployed in a standalone jar instead of a ear, then the JMX ObjectName will not the the ear=xyz key/value:
<depends>jboss.j2ee:jar=YourEJBJarName.jar,name=YourBeanName,service=EJB3</depends>
-
5. Re: Call EJB Jar from MBean inside sar
jaikiran Jun 9, 2011 3:25 AM (in response to jaikiran)After posting my previous reply, I now see that you have tagged your question with "JBoss AS 4.2". So what version of JBoss AS are you using and what version of EJB? EJB2.x or EJB3?
-
6. Re: Call EJB Jar from MBean inside sar
kkkppp May 20, 2012 3:29 PM (in response to jaikiran)Bumping old thread
I have tried to use this syntax in AS 7.1.1 Final and it seems doesn't work. Is this feature not supported anymore?
Here is fragment of my jboss-service.xml
<mbean code="com.supportwizard.seance.registry.SeanceRegistry" name="supportwizard:service=seanceregistry"> <depends>jboss.j2ee:jar=SWSeance-ejb.jar,name=SeanceE,service=EJB3</depends> In log I see:
23:21:39,142 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.mbean.service.supportwizard:service=seanceregistry.createjboss.mbean.service.\"jboss.j2ee:jar=SWSeance-ejb.jar,name=SeanceE,service=EJB3\".createMissing[jboss.mbean.service.supportwizard:service=seanceregistry.createjboss.mbean.service.\"jboss.j2ee:jar=SWSeance-ejb.jar,name=SeanceE,service=EJB3\".create]","jboss.mbean.service.supportwizard:service=seanceregistry.startjboss.mbean.service.\"jboss.j2ee:jar=SWSeance-ejb.jar,name=SeanceE,service=EJB3\".startMissing[jboss.mbean.service.supportwizard:service=seanceregistry.startjboss.mbean.service.\"jboss.j2ee:jar=SWSeance-ejb.jar,name=SeanceE,service=EJB3\".start]"]}}}
However bean was deployed 10 seconds earlier:
23:21:29,251 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-15) JNDI bindings for session bean named SeanceE in deployment unit deployment "SWSeance-ejb.jar" are as follows:
java:global/SWSeance-ejb/SeanceE!com.supportwizard.seance.interfaces.SeanceELocal
java:app/SWSeance-ejb/SeanceE!com.supportwizard.seance.interfaces.SeanceELocal
...
I looked at sources and cannot understand how it supposed to work. It looks like only optional-attribute counts:
public class ParsedServiceDeploymentProcessor implements DeploymentUnitProcessor {
...
final JBossServiceDependencyConfig[] dependencyConfigs = mBeanConfig.getDependencyConfigs();
if (dependencyConfigs != null) {
final Service<Object> createDestroyService = mBeanServices.getCreateDestroyService();
for (final JBossServiceDependencyConfig dependencyConfig : dependencyConfigs) {
final Injector<Object> injector = getInjector(dependencyConfig, mBeanClassHierarchy, createDestroyService);
mBeanServices.addDependency(dependencyConfig.getDependencyName(), injector);
}
}
...
private static Injector<Object> getInjector(final JBossServiceDependencyConfig dependencyConfig, final List<ClassReflectionIndex<?>> mBeanClassHierarchy, final Service<Object> service) {
final String attrName = dependencyConfig.getOptionalAttributeName();
return attrName != null ? getPropertyInjector(attrName, mBeanClassHierarchy, service, Values.injectedValue()) : NullInjector.getInstance();
}
-
7. Re: Call EJB Jar from MBean inside sar
hmburgett Aug 13, 2012 7:34 AM (in response to kkkppp)I'm having similar issues getting an mbean to depend on and use an ejb (both sar & ejb.jar deployed in the same ear). Did you ever find an answer?
-
8. Re: Call EJB Jar from MBean inside sar
ab_99 Aug 20, 2012 5:38 AM (in response to hmburgett)Unfortunately, I did not. I had to modify my design.
-
9. Re: Call EJB Jar from MBean inside sar
prashamsjain Nov 26, 2013 1:23 AM (in response to kkkppp)I'm having similar issue("JBAS014771: Services with missing/unavailable dependencies") getting an mbean to depend on and use an ejb (both sar & ejb.jar deployed in the same ear).
Did anyone found an answer?