3 Replies Latest reply on Jun 10, 2009 5:07 AM by Carlo de Wolf

    EJB injection fails with "beanInterface is not unique within

    Krashan Brahmanjara Newbie

      Hi
      I got ear wit ejb and webservices web module.
      On JBoss 5.1.0DR I can't use ejb from ws.
      In my case always error "beanInterface specified, Test, is not unique within EJB TestBean " is raised.

      The same code works well on Weblogic Server.
      Do I need any extra configuration or annotations?


      My code.
      EJB module / Main bean
      @Stateless(name = "TestBean", mappedName = "Test")
      public class TestBean implements TestLocal, TestRemote {
      code implementation
      }

      EJB module / Interfaces
      public interface Test {
      }
      @Local
      public interface TestLocal extends Test {
      }
      @Remote
      public interface TestRemote extends Test {
      }

      webservices web module /webservice

      @WebService(name = "Test", serviceName = "TestService")
      @SOAPBinding(style = Style.RPC)
      public class TestWS {

      @EJB(name = "TestBeanRef")
      private Test test; /* I don't want declare TestRemote here ! */
      }

      web.xml
      (...)

      <servlet-name>TestService</servlet-name>
      <servlet-class>TestWS</servlet-class>

      <ejb-ref>
      <ejb-ref-name>TestBeanRef</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      TestRemote
      </ejb-ref>


      Stacktrace

      14:41:02,968 ERROR [InjectionException] Cannot inject field annotated with @EJB annotation: private Test TestWS.test
      org.jboss.ejb3.common.resolvers.spi.NonDeterministicInterfaceException: beanInterface specified, Test, is not unique within EJB TestBean
      at org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolverBase.isMatch(EjbReferenceResolverBase.java:186)
      at org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolverBase.getMatch(EjbReferenceResolverBase.java:119)
      at org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver.resolveEjbFromRoot(FirstMatchEjbReferenceResolver.java:105)
      at org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver.resolveEjbFromRoot(FirstMatchEjbReferenceResolver.java:121)
      at org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver.resolveEjb(FirstMatchEjbReferenceResolver.java:68)
      at org.jboss.wsf.container.jboss50.deployment.metadata.EJBBeanReferenceResolver.resolveField(EJBBeanReferenceResolver.java:81)
      at org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver.resolve(AbstractReferenceResolver.java:80)
      at org.jboss.wsf.common.injection.InjectionHelper.injectEJBAnnotatedAccessibleObjects(InjectionHelper.java:359)
      at org.jboss.wsf.common.injection.InjectionHelper.injectResources(InjectionHelper.java:111)
      at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.getTargetBean(InvocationHandlerJSE.java:85)
      at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:97)
      at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
      at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)
      14:41:02,968 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
      org.jboss.wsf.common.injection.InjectionException: Cannot inject field annotated with @EJB annotation: private Test TestWS.test
      at org.jboss.wsf.common.injection.InjectionException.rethrow(InjectionException.java:106)
      at org.jboss.wsf.common.injection.InjectionHelper.injectEJBAnnotatedAccessibleObjects(InjectionHelper.java:365)
      at org.jboss.wsf.common.injection.InjectionHelper.injectResources(InjectionHelper.java:111)
      at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.getTargetBean(InvocationHandlerJSE.java:85)
      at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:97)
      at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
      at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.ejb3.common.resolvers.spi.NonDeterministicInterfaceException: beanInterface specified, Test, is not unique within EJB TestBean
      at org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolverBase.isMatch(EjbReferenceResolverBase.java:186)
      at org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolverBase.getMatch(EjbReferenceResolverBase.java:119)
      at org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver.resolveEjbFromRoot(FirstMatchEjbReferenceResolver.java:105)
      at org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver.resolveEjbFromRoot(FirstMatchEjbReferenceResolver.java:121)
      at org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver.resolveEjb(FirstMatchEjbReferenceResolver.java:68)
      at org.jboss.wsf.container.jboss50.deployment.metadata.EJBBeanReferenceResolver.resolveField(EJBBeanReferenceResolver.java:81)
      at org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver.resolve(AbstractReferenceResolver.java:80)
      at org.jboss.wsf.common.injection.InjectionHelper.injectEJBAnnotatedAccessibleObjects(InjectionHelper.java:359)
      ... 30 more