1

我创建了一个 Remote StatelessSession Bean,我想将 Spring bean 注入到我的 UserServiceImpl EJB 中。

@Stateless

@Interceptors(SpringBeanAutowiringInterceptor.class)

public class UserServiceImpl implements IUserService{


    @Autowired

    IRegisterService registerService; 

根据文档,我已将 beanRefContext.xml 添加到具有 Spring bean 配置条目的类路径中。

我的问题是,当我尝试不使用@Interceptors(SpringBeanAutowiringInterceptor.class).

但是,当我将 bean 注入 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

有没有人遇到过这个问题并有解决方案?

4

1 回答 1

0

我确切地知道为什么会发生这种异常,这是由 JDK 错误JDK-7183985引起的。根本问题可能是您的容器无法加载SpringBeanAutowiringInterceptor。这可能是您的应用程序中的包装问题。请提供有关如何打包应用程序以及如何在应用程序中打包 Spring 的更多详细信息。

于 2014-10-22T17:16:00.020 回答