0

我正在尝试在 Jboss 中部署一个使用 @Interceptros 注释的 bean。根据文档,我创建了 beanRefContext.xml,这是 Bean 代码

@Stateless
@LocalBean
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class ClienteBean implements ClienteBeanLocal {


public ClienteBean() {
    // TODO Auto-generated constructor stub
}

@Autowired
private IClienteDAO cliente;

@Override
public List<ClienteDTO> selectALL() throws Exception {
    return cliente.selectALL();
}

}

我将它部署在 EAR 中。当我尝试在 Jboss 6 中部署时,出现以下错误:

Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(Unknown Source) [:1.7.0_09]
    at sun.reflect.annotation.AnnotationParser.parseArray(Unknown Source) [:1.7.0_09]
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(Unknown Source) [:1.7.0_09]
    at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source) [:1.7.0_09]
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source) [:1.7.0_09]
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source) [:1.7.0_09]
    at java.lang.Class.initAnnotationsIfNecessary(Unknown Source) [:1.7.0_09]
    at java.lang.Class.getAnnotations(Unknown Source) [:1.7.0_09]
    at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl.readAnnotations(IntrospectionTypeInfoFactoryImpl.java:610) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl.getAnnotations(IntrospectionTypeInfoFactoryImpl.java:126) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.reflect.plugins.InheritableAnnotationHolder.getDeclaredAnnotations(InheritableAnnotationHolder.java:96) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.reflect.plugins.ClassInfoImpl.getAnnotations(ClassInfoImpl.java:181) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.reflect.plugins.AbstractAnnotatedInfo.getUnderlyingAnnotations(AbstractAnnotatedInfo.java:63) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.scanning.plugins.visitor.ClassHierarchyResourceVisitor.handleClass(ClassHierarchyResourceVisitor.java:76) [:1.0.0.GA]
    at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.doVisit(ReflectResourceVisitor.java:108) [:1.0.0.GA]
    at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.visit(ReflectResourceVisitor.java:86) [:1.0.0.GA]
    ... 53 more

我该如何解决?

4

1 回答 1

1

似乎 JBoss 没有看到 SpringBeanAutowiringInterceptor.class。在您的 EAR 文件中,将您的 spring jar 放在 lib 目录中。看看这是否有效。

如果您使用 maven 来组装您的 EAR 文件,您可以执行以下操作: http ://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-module-location.html

于 2013-02-25T10:43:11.267 回答