3 Replies Latest reply on May 7, 2015 12:25 AM by jaysensharma

    Support for JBoss EJB 3.0 extensions in wildfly

    arnab_ghosh

      I am migrating an  enterprise application from EAP 5.1.2 to Wildfly 8.2 Final.

      We use org.jboss.ejb3.annotation.Management and org.jboss.ejb3.annotation.Service to start and stop our EJB 3.0 timers.

       

      But this is not working in Wildfly. Is there any alternate API ? or is this support removed ?

      Can you please suggest an alternative approach via which we can control our timers.

       

      Regards

      Arnab

        • 1. Re: Support for JBoss EJB 3.0 extensions in wildfly
          jaysensharma

          EE6 and EE7 specifications has a specific place for the org.jboss.ejb3.annotation.Management and org.jboss.ejb3.annotation.Service.  Hence these jboss specific classes are not present in WildFly because the functionality provided by those classes are now standardized so you can try using    @Singleton to achieve the same functionality.

           

          @javax.ejb.Singleton

          @javax.ejb.Startup;

          • 2. Re: Support for JBoss EJB 3.0 extensions in wildfly
            arnab_ghosh

            Thanks for your reply. But will it be possible to have a JMX view this single ton EJB ?

            My intention was to have one Singleton SessionBean to start and cancel the EJB timers and be able to do that at run time via JMX Console.

             

            Please let me know if this is possible or if there is a alternative way to achieve this.

            • 3. Re: Support for JBoss EJB 3.0 extensions in wildfly
              jaysensharma

              The following link gives more detailed example of the same:  http://codrspace.com/codertrader/making-an-mbean-ejb3-and-wildfly-compliant/

               

              Example:

               

              private ObjectName objectName = null;
              
              @PostConstruct
                  public void registerInJMX() {       
              
                      logger.info( "Registering in JMX Console" );
                      try {
                          objectName = new ObjectName( "company:service=TimeoutServiceMBean" );
                          MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
                          mBeanServer.registerMBean( this, objectName );
                      } catch ( Exception e ) {
                          throw new IllegalStateException( "Problem during registration into JMX:" + e );
                      }
                  }
              

               

              Also as you mentioned that you want to be able to do that at run time via JMX Console.   Byt default the JMX Console is not shipped with WildFly or JBossAS7   (jmxconsole  usually is available with older version of JBoss).     If you meant to say    JConsole or some other jmx based client utility like JVisualVM  then yes,   the above link may be very useful.