我正在尝试部署在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
我该如何解决?
答案 0 :(得分:1)
似乎JBoss没有看到SpringBeanAutowiringInterceptor.class。在您的EAR文件中,将您的spring jar放在lib目录中。看看是否有效。
如果您使用maven来组装您的EAR文件,您可以执行以下操作: http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-module-location.html