2 Replies Latest reply on Jul 7, 2017 1:10 PM by drwesmunsil

    Error invoking ejbTimeout

    asookazian

      I'm using JBoss4.2.1.GA and Seam2.0.0.GA for a POC project here.

      error:

      Error invoking ejbTimeout: java.lang.RuntimeException: java.lang.IllegalStateException: Attempted to invoke a Seam component outside the an initialized application


      Please refer to the following thread for details on this problem:

      http://seamframework.org/Community/ErrorInvokingEjbTimeout

      I need to know not only the root cause of this error but also how does JBoss create a timer and store that information so that it knows to execute a specified method on an interval basis.

      When I deleted my JBoss extraction and re-extracted and deployed my app, the error went away until I ran the test case the first time after re-deployment.

      Please point me to a JBoss internals doc or section in the timer service (chapter 18) of the EJB3 core spec to answer these questions.

      The server.log output as well as source code for the session beans is listed in the original thread (see link above).

      Also, I am seeing the following behavior after placing some breakpoints in the eclipse debugger.

      @Stateless
      @AutoCreate
      @Scope(ScopeType.APPLICATION)
      @Name("EJBPollingProcessorBean")
      public class EJBPollingProcessorBean implements EJBPollingProcessorLocal {
      
       //TO DO: map needs to be stored in application context as it is session-independent data
       //TO DO: convert this into an ArrayList of map objects b/c we will need a map
       // for every drop-down in each app
       private Map<String,String> map; // = new ArrayList<Map<String,String>>();
      
       @Logger Log log;
      
       public Timer schedulePoller(@Expiration Date when, @IntervalDuration Long interval, String distinguishedGroupName)
       {
       log.info("when = " + when);
       log.info("interval = " + interval);
       log.info("distinguishedGroupName = "+distinguishedGroupName);
      
       String searchBase = CoxProperties.getPropertyObject().getProperty(CoxConstants.ACTIVE_DIRECTORY_SEARCH_BASE);
       String providerUrl = CoxProperties.getPropertyObject().getProperty(CoxConstants.ACTIVE_DIRECTORY_PROVIDER_URL);
       String principal = CoxProperties.getPropertyObject().getProperty(CoxConstants.ACTIVE_DIRECTORY_USER);
       String credentials = CoxProperties.getPropertyObject().getProperty(CoxConstants.ACTIVE_DIRECTORY_PWD);
      
       // Declare holders search result's
       SearchAdapterResult<UserItem> userSearchResults = null;
       List<UserItem> userItemList = null;
      
       // Create a new instance of CADILS search adapter
       SearchAdapter sa = new SearchAdapter(searchBase, providerUrl, principal, credentials);
      
       try {
       String groupSearchFilter = "*)(memberOf=" + distinguishedGroupName;
       userSearchResults = sa.searchBySAMAccountName(groupSearchFilter);
      
       if (userSearchResults.hasItems()) {
       //List of all the AD users who belong to your group
       userItemList = userSearchResults.getItemList();
       }
       }
       catch (SearchFailedException sfe) {
       log.error(sfe);
       }
       Iterator<UserItem> it = userItemList.iterator();
      
       if (map != null) {
       map.clear();
       }
      
       while(it.hasNext()) {
       UserItem ui = it.next();
       log.info("ui.getDisplayName() = " + ui.getDisplayName());
       log.info("ui.getADSPath() = " + ui.getADSPath());
      
       map.put(ui.getDisplayName(), ui.getSAMAccountName());
       log.info("after map.put()");
       }
      
       return null;
       }
       public Map<String,String> getMap() {
       return map;
       }
      
      
      }


      server.log after startup:

      16:57:10,470 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 55s:278ms
      17:07:19,030 INFO [EJBPollingProcessorBean] when = Mon Feb 25 16:40:35 PST 2008
      17:07:19,030 INFO [EJBPollingProcessorBean] interval = 600060
      17:07:19,030 INFO [EJBPollingProcessorBean] distinguishedGroupName = CN=!CCI ORG APP - SHIMS Tech,OU=Groups,OU=Orange County,OU=CCI,DC=CORP,DC=COX,DC=com
      17:07:19,795 INFO [EJBPollingProcessorBean] ui.getDisplayName() = Bell, Michael (CCI-Orange County)
      17:07:19,795 INFO [EJBPollingProcessorBean] ui.getADSPath() = CN=Michael Bell (CCI-Orange County),OU=Users,OU=Admin Users,OU=Users and Computers,OU=Orange County,OU=CCI,DC=CORP,DC=COX,DC=com
      17:07:19,811 ERROR [TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBTransactionRolledbackException



      so you see that the log output ("after map.put()") is not being writtern to the server.log. Presumably it is not being executed. The exception is being thrown after map.put(..) execs.

      #schedule Quartz for every minute, value in milliseconds
      activeDirectoryPollingInterval=600060

      this is 10 min's although I'm going to change this to 1 min for testing purposes.

      any help is appreciated as this is becoming a mystery to me. not sure if how the vendor implementations handle this are enforced in the ejb3 spec...

        • 1. Re: Error invoking ejbTimeout
          asookazian

          I looked at the JMX console and determined that the DefaultDS was being used (HSQLDB). Also, GeneralPurposeDatabasePersistencePlugin class indicates that a table named TIMERS is being created and timer scheduling instances are being inserted into that table.

          I deleted all the records and the errors during startup of JBoss went away. However, this does not address/identify the root cause of the errors...

          • 2. Re: Error invoking ejbTimeout
            drwesmunsil

            This is an ancient thread, but in case someone else stumbles onto it with a similar problem: I found I had to delete the INSERT INTO TIMERS statements from $JBOSS_HOME/server/default/data/hypersonic/localDB.script.