2012-12-18 145 views
1

我創建了一個Remote StatelessSession Bean,我想將Spring bean注入到我的UserServiceImpl EJB中。向EJB3注入Spring bean

@Stateless 

@Interceptors(SpringBeanAutowiringInterceptor.class) 

public class UserServiceImpl implements IUserService{ 


    @Autowired 

    IRegisterService registerService; 

根據文檔,我已經將beanRefContext.xml添加到具有spring bean配置條目的classpath中。

我的問題是,當我試圖部署這個EJB沒有@Interceptors(SpringBeanAutowiringInterceptor.class),它被部署並按預期運行,沒有春天的注入。

但是,當我注入豆成EJB部署失敗,以下情況除外:

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(BusinessViewAnnotationProcessor.java:150) 
     at org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor.processViewAnnotations(BusinessViewAnnotationProcessor.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 

有沒有人遇到過這個問題,有這方面的解決方案?

回答

0

我確切地知道爲什麼會發生這種異常,這是由JDK錯誤JDK-7183985引起的。潛在的問題可能是您的容器無法加載SpringBeanAutowiringInterceptor。這可能是您的應用程序中的包裝問題。請提供更多關於如何打包應用程序以及如何在應用程序中打包Spring的詳細信息。