0 Replies Latest reply on Jul 22, 2016 9:45 AM by Chanchal Pillai

    How to get default work Manager in JBOSS EAP 6.4,  Not able to locate through MBeanServerLocator

    Chanchal Pillai Newbie

      Hi,

       

      We are migrating from JBOSS 4.2.3 eap to JBOSS 6.4 eap and we facing issue to geting Default WorkManager of JBOSS while creating beans.

       

      Please find below related details,

       

      We are getting workmanager in our existing code as,


      return (WorkManager) getInstanceFromMBean('org.jboss.resource.work.JBossWorkManagerMBean', 'jboss.jca:service=WorkManager');

      public Object getInstanceFromMBean(String mbeanClassName, String objectName)
              throws ClassNotFoundException, MalformedObjectNameException, NamingException, NoSuchMethodException,
              IllegalAccessException, InvocationTargetException {
              Object mbeanProxy = getMBeanProxy(mbeanClassName, objectName);
              Method getInstanceMethod = mbeanProxy.getClass().getMethod("getInstance", ArrayUtils.EMPTY_CLASS_ARRAY);
              Object ret = getInstanceMethod.invoke(mbeanProxy, ArrayUtils.EMPTY_OBJECT_ARRAY);
              return ret;
        }


      Spring configuration in jboss-bean.xml


      <bean id="jndiConfiguration" class="com.company.cms.vela.commons.service.conf.JndiConfiguration">

              <constructor-arg value="${jboss.security.principal}"/>

              <constructor-arg value="${jboss.security.credentials}"/>

          </bean>

       

       

          <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">

              <property name="environment">

                  <util:property-path path="jndiConfiguration.jndiEnvironment"/>

              </property>

          </bean>

       

       

          <bean id="jbossBean" class="com.company.cms.vela.commons.service.util.JBossBean">

              <property name="jndiTemplate" ref="jndiTemplate"/>

          </bean>

       

       

          <bean id="jbossServerHost" class="java.lang.String">

              <constructor-arg>

                  <util:property-path path="jbossBean.httpHost"/>

              </constructor-arg>

          </bean>

          <bean id="jbossServerPort" class="java.lang.String">

              <constructor-arg>

                  <util:property-path path="jbossBean.httpPort"/>

              </constructor-arg>

          </bean>

       

       

          <bean id="jbossWorkManagerTaskExecutor" class="com.company.cms.vela.commons.service.util.JBossWorkManagerTaskExecutor">

              <property name="jndiEnvironment">

                  <util:property-path path="jndiConfiguration.jndiEnvironment"/>

              </property>

              <property name="blockUntilStarted" value="true"/>

              <property name="jbossBean" ref="jbossBean"/>

          </bean>

       

       

          <bean id="jbossMbeanServer" factory-bean="jbossBean" factory-method="locateMBeanServer" />

       

       

          <bean id="jbossTransactionTimeout" class="java.lang.Long">

              <constructor-arg><value>#{jbossBean.getMbeanAttribute('jboss:service=TransactionManager', 'TransactionTimeout')}</value></constructor-arg>

          </bean>

       

       

      </beans>


      Can someone please help us, how to get default jca work manager.


      Thanks in advance!