5 Replies Latest reply on Sep 8, 2008 9:54 AM by Prabodh Deshmukh

    Exception initializing interceptors (EJB3InterceptorsFactory

    Prabodh Deshmukh Newbie

      We are currently running JBoss 4.2.2 and using EJB 2.0 with BMP. We are also in the process of introducing EJB 3.0 and would like to package EJB 2.0 and EJB 3.0 in the same JAR. I set the version attribute of our existing ejb-jar.xml to 3.0:

      <ejb-jar version="3.0"

      Some of my existing EJB 2.0 beans now fail to deploy. Here is the exception message:

      16:40:27,430 WARN [ServiceController] Problem creating service jboss.j2ee:ear=EMS.ear,jar=Server.jar,name=TrainingWebService,service=EJB3
      java.lang.RuntimeException: An exception occurred initialising interceptors for class com.creativesolutions.ems.webservice.training.TrainingWebServiceBean.getTrainingEnrollmentWSOs
       at org.jboss.ejb3.interceptor.EJB3InterceptorsFactory.createPerJoinpoint(EJB3InterceptorsFactory.java:108)
       at org.jboss.aop.advice.AspectFactoryDelegator.createPerJoinpoint(AspectFactoryDelegator.java:119)
       at org.jboss.aop.advice.ScopedInterceptorFactory.create(ScopedInterceptorFactory.java:113)
       at org.jboss.aop.Advisor.createInterceptorChain(Advisor.java:618)
       at org.jboss.aop.Advisor.pointcutResolved(Advisor.java:888)
       at org.jboss.aop.Advisor.resolveMethodPointcut(Advisor.java:650)
       at org.jboss.ejb3.interceptor.InterceptorInfoRepository.getBeanClassAroundInvokes(InterceptorInfoRepository.java:136)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsFactory.createPerJoinpoint(EJB3InterceptorsFactory.java:101)
       ... 102 more

      Here is the code of the failing EJB method:

      public TrainingEnrollmentWSO[] getTrainingEnrollmentWSOs(int trainingClassID, boolean showConfirmedOnly, String clauseType) {
       try {
       return new TrainingEnrollmentDAO().getTrainingEnrollmentWSOs(trainingClassID, showConfirmedOnly, clauseType);
       catch(Exception e) {
       return null;

      If required, I will be happy to give more information regarding my setup and will appreciate any thoughts that can resolve this issue.


        • 1. Re: Exception initializing interceptors (EJB3InterceptorsFac
          Prabodh Deshmukh Newbie

          The EJB i.e. TrainingWebServiceBean is a stateless session bean (2.0) and implements the javax.ejb.SessionBean interface.

          • 2. Re: Exception initializing interceptors (EJB3InterceptorsFac
            Prabodh Deshmukh Newbie

            Upon further digging, the root cause seems to be the PostConstruct annotated method not liking the ejbCreate method signature (the fact that it throws checked exceptions):

            Caused by: java.lang.RuntimeException: @javax.annotation.PostConstruct annotated method has the wrong signature - public void com.creativesolutions.ems.prsbtaxtracking.ejb.PRSBTaxTrackingControllerBean.ejbCreate() throws javax.ejb.CreateException,java.rmi.RemoteException,javax.naming.NamingException
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository$ContainerInitialiser.resolveLifecycleMethod(InterceptorInfoRepository.java:782)
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository$AnnotationInitialiser.resolvePostConstruct(InterceptorInfoRepository.java:714)
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository$AnnotationInitialiser.getInfo(InterceptorInfoRepository.java:688)
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository.initialiseFromAnnotations(InterceptorInfoRepository.java:481)
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository.getOrInitialiseFromAnnotations(InterceptorInfoRepository.java:466)
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository.getBeanClassInterceptors(InterceptorInfoRepository.java:161)
             at org.jboss.ejb3.interceptor.InterceptorInfoRepository.getBeanClassAroundInvokes(InterceptorInfoRepository.java:136)
             at org.jboss.ejb3.interceptor.EJB3InterceptorsFactory.createPerJoinpoint(EJB3InterceptorsFactory.java:101)
             ... 148 more

            Any thoughts?

            • 3. Re: Exception initializing interceptors (EJB3InterceptorsFac
              jaikiran pai Master


              "pdeshmuk" wrote:
              Upon further digging, the root cause seems to be the PostConstruct annotated method not liking the ejbCreate method signature (the fact that it throws checked exceptions):

              Any thoughts?

              As per section 12.4 of EJB3 spec,

              Lifecycle callback interceptor methods defined on a bean class have the following signature:
              void <METHOD>()

              So your ejbCreate method, which you have annotated with @PostConstruct does not follow this rule.

              • 4. Re: Exception initializing interceptors (EJB3InterceptorsFac
                Prabodh Deshmukh Newbie

                Thanks Jaikiran - I figured that was the problem and removed the exceptions from the throws clause of ejbCreate(). I am able to deploy the beans now.

                Please note that these are NOT EJB 3.0 beans but EJB 2.0 beans that we are trying to package with other EJB 3.0 beans in the same JAR. Looks like the container will treat all my EJB 2.0 beans as EJB 3.0 beans because they have been packaged under the EJB 3.0 deployment descriptor. I am wondering if there are any other gotchas that we will run into as we perform more tests on the EJB 2.0 and EJB 3.0 beans that have been packaged together. I am really interested in knowing if anyone else has tried this approach (packaging EJB 2.0 and EJB 3.0 beans in the same JAR) and run into similar problems.

                • 5. Re: Exception initializing interceptors - Entity beans
                  Prabodh Deshmukh Newbie

                  We are now able to access Session EJBs, but having issues accessing our (EJB 2.0) Entity EJBs. The container does not bind them to the JNDI namespace (I checked on the JMXConsole) and I am getting a NameNotFoundException. I think it treats EJB 2.0 Entities as EJB 3.0 Entities which do not need to get bound to the JNDI namespace. Here is part of the exception trace:

                  09:40:55,941 ERROR [ContactCompositeBean] javax.naming.NameNotFoundException: PasswordHistory not bound
                  com.creativesolutions.ems.EJBUtil.EJBLoaderException: javax.naming.NameNotFoundException: PasswordHistory not bound
                  at com.creativesolutions.ems.EJBUtil.EJBLoader.getPasswordHistoryHome(EJBLoader.java:4334)
                  at com.creativesolutions.ems.compositeBean.ContactCompositeBean.savePasswordHistory(ContactCompositeBean.java:1778)
                  at com.creativesolutions.ems.compositeBean.ContactCompositeBean.changeUserPassword(ContactCompositeBean.java:586)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:585)