2 Replies Latest reply on Dec 18, 2012 7:15 AM by ashishmtiwari

    Issue in injecting Spring bean into EJB3

    ashishmtiwari

      Have created one Remote StatelessSession Bean and want to inject Spring bean into my UserServiceImpl EJB.

       

      @Stateless

      @Interceptors(SpringBeanAutowiringInterceptor.class)

      public class UserServiceImpl implements IUserService{

         

          @Autowired

          IRegisterService registerService;

       

       

      As per the docuemtation have added beanRefContext.xml into classpath which has entry for spring bean configuration.

       

      My problem is when I am trying to deploy this EJB with out @Interceptors(SpringBeanAutowiringInterceptor.class) it gets deployed and run as expected without spring bean injection.

      But when I am injecting bean into EJB deployemtn fails with following exception

       

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7

      .1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA

      .jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.

      2.GA]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_29]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_29]
          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29]

      Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

          at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:653) [rt.jar:1.6.0_29]
          at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:460) [rt.jar:1.6.0_29]
          at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286) [rt.jar:1.6.0_29]
          at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222) [rt.jar:1.6.0_29]
          at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69) [rt.jar:1.6.0_29]
          at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52) [rt.jar:1.6.0_29]
          at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070) [rt.jar:1.6.0_29]
          at java.lang.Class.getAnnotation(Class.java:3029) [rt.jar:1.6.0_29]
          at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.getRemoteBusinessInterfaces(BusinessViewAnnotat

      ionProcessor.java:150)

          at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.processViewAnnotations(BusinessViewAnnotationPr

      ocessor.java:123)

          at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.deploy(BusinessViewAnnotationProcessor.java:98)

       

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7

      .1.1.Final.jar:7.1.1.Final]

          ... 5 more

       

       

      Can anyone have experienced this issue and has solution for it?