8 Replies Latest reply on Sep 29, 2010 1:33 AM by jaikiran

    JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException

    genman

      Testing on the latest AS build (as of today).

       

      I have a no-interface singleton/startup bean depending on a bean with a remote and local interface and seeing this error. I'm not sure what this means entirely.

       

      Caused by: org.jboss.ejb3.ejbref.resolver.spi.NonDeterministicInterfaceException: beanInterface specified, com.autodesk.lbs.afx.subscriptionmanager.SubscriptionManager, is not unique within EJB SubscriptionManagerEJB
              at org.jboss.ejb3.ejbref.resolver.ejb30.impl.EJB30MetaDataBasedEjbReferenceResolver.isMatch(EJB30MetaDataBasedEjbReferenceResolver.java:225) [:]
              at org.jboss.ejb3.ejbref.resolver.ejb31.impl.EJB31MetaDataBasedEjbReferenceResolver.isMatch(EJB31MetaDataBasedEjbReferenceResolver.java:77) [:]
              at org.jboss.ejb3.ejbref.resolver.ejb30.impl.EJB30MetaDataBasedEjbReferenceResolver.findSessionBean(EJB30MetaDataBasedEjbReferenceResolver.java:108) [:]
              at org.jboss.ejb3.ejbref.resolver.ejb30.impl.EJB30MetaDataBasedEjbReferenceResolver.resolveEjb(EJB30MetaDataBasedEjbReferenceResolver.java:76) [:]
              at org.jboss.ejb3.ejbref.resolver.ejb30.impl.ScopedEJBReferenceResolver.find(ScopedEJBReferenceResolver.java:62) [:]
              at org.jboss.ejb3.ejbref.resolver.ejb30.impl.ScopedEJBReferenceResolver.resolveWithinDeploymentUnit(ScopedEJBReferenceResolver.java:106) [:]
              at org.jboss.ejb3.ejbref.resolver.ejb30.impl.ScopedEJBReferenceResolver.resolveEjb(ScopedEJBReferenceResolver.java:77) [:]
              at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.resolveEJB(AOPBasedSingletonContainer.java:669) [:1.0.0-alpha-14]
              at org.jboss.injection.EJBRemoteHandler.ejbRefDependency(EJBRemoteHandler.java:132) [:1.5.2]
              at org.jboss.injection.EJBRemoteHandler.handleFieldAnnotations(EJBRemoteHandler.java:378) [:1.5.2]
              at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:160) [:1.5.2]
              at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:197) [:1.5.2]
              at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:680) [:1.5.2]
              at org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer.deploy(SingletonContainerDeployer.java:215) [:1.0.0-alpha-14]
              at org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer.deploy(SingletonContainerDeployer.java:85) [:1.0.0-alpha-14]
              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput.deploy(AbstractRealDeployerWithInput.java:125) [:2.2.0.Alpha7]
              ... 34 more

       

      The bean in question looks like:

       

      @Stateless
      public class SubscriptionManagerEJB implements SubscriptionManagerLocal,
              SubscriptionManager {

       

      And the local/remote interfaces look like:

       

      @Local
      public interface SubscriptionManagerLocal extends SubscriptionManager {}
      
      @Remote
      public interface SubscriptionManager { // business methods here ... 
      }

       

      This is probably not good coding, still it's a pattern in use throughout the deployment...

        • 1. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
          jaikiran

          That exception means that there's some bean which is injecting a @EJB and the JNDI name resolution isn't successful for that @EJB due to multiple beans meeting the criteria. To put in simple terms, there is a bean which does this:

          @EJB
          private com.autodesk.lbs.afx.subscriptionmanager.SubscriptionManager someField
          

           

           

          And the processing of this injection point is running into errors. Do you have multiple bean implementations which implement this interface?

          • 2. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
            genman

            No, it's the only EJB that implements that interface...

             

            The code works and deploys fine on JBoss 6 M4.

             

            From what I can tell, the newer deployment checks for inheritence and gets confused by EJB that have interfaces that extend other interfaces.

            • 3. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
              genman

              This is the decompile of the method throwing the exception ...

               

              /*     */   protected boolean isMatch(EjbReference reference, JBossSessionBeanMetaData md, ClassLoader cl)
              /*     */   {
              /* 200 */     List interfaces = new ArrayList();
              /*     */ 
              /* 203 */     interfaces.addAll(getAllParentInterfaces(getEligibleBeanInterfaces(md), cl));
              /*     */ 
              /* 206 */     String requestedInterface = reference.getBeanInterface();
              /* 207 */     assert ((requestedInterface != null) && (requestedInterface.trim().length() > 0)) : "beanInterface must be specified";
              /*     */ 
              /* 210 */     if (interfaces.contains(requestedInterface))
              /*     */     {
              /* 215 */       boolean found = false;
              /* 216 */       for (String interfaze : interfaces)
              /*     */       {
              /* 218 */         boolean equal = interfaze.equals(requestedInterface);
              /* 219 */         if ((equal) && (!(found)))
              /*     */         {
              /* 221 */           found = true;
              /*     */         }
              /* 223 */         else if ((equal) && (found))
              /*     */         {
              /* 225 */           throw new NonDeterministicInterfaceException("beanInterface specified, " + interfaze + ", is not unique within EJB " + md.getEjbName());
              /*     */         }
              /*     */ 
              /*     */       }
              /*     */ 
              /* 231 */       String ejbName = reference.getBeanName();
              /*     */ 
              /* 239 */       return ((ejbName == null) || (ejbName.trim().length() <= 0) || 
              /* 237 */         (ejbName.equals(md.getEjbName())));
              /*     */     }
              /*     */ 
              /* 248 */     return false;
              /*     */   }
              

               

              The "bug" is on line 200... The List will contain both interfaces of the bean (the "SubscriptionManager" and "SubscriptionManagerLocal"), and also the interface's parent interfaces, so "SubscriptionManager" appears again. The list will contains duplicates interfaces, triggering line 225 when requesting "SubscriptionManager" as the requested interface.

              • 4. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
                genman

                So commenting out this code seems to work for me and I'm happy. I'm not really sure what's going on here. It's not really checking if the EJB is the only one implementing that interface!

                • 5. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
                  jaikiran

                  That looks like a bug. Thanks for the details. I'll file a JIRA and get it fixed.

                  • 6. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
                    jaikiran
                    • 7. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
                      genman

                      Thanks for resolving this quickly. I downloaded JBoss AS 6 M5, though, and it does not seem to have this fix. I can't tell from the build (or .jar file) which version of ejbref's part of M5. Anyway, I can certainly wait for M6.

                      • 8. Re: JBoss AS 6 SNAPSHOT, NonDeterministicInterfaceException
                        jaikiran

                        It did not make it to M5, because M5 got tagged before we could upgrade the ejbref version.