-
Bug
-
Resolution: Done
-
Major
-
1.1.2.Final
-
None
-
None
Following web service resource definition (see CDI 1.0 section 3.5 Resources) results in:
WELD-000025 Tried to create an EEResourceProducerField, but no @Resource, @PersistenceContext, @PersistenceUnit, @WebServiceRef or @EJB is present
public class SheepWSProducer { @Produces @WebServiceRef SheepWS sheepWS; }
There is no CDI TCK test for this yet.
The problem is very likely related to weird checking code in org.jboss.weld.bean.builtin.ee.EEResourceProducerField.checkEEResource() - the first group evaluates to false and is inverted to true with "!" operator and thus exception is thrown:
... if (! ( getWeldAnnotated().isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) ) || getWeldAnnotated().isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS) ) { throw new IllegalStateException(INVALID_RESOURCE_PRODUCER_FIELD, getWeldAnnotated()); } ...
Should be replaced with something like:
... if (! ( getWeldAnnotated().isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || getWeldAnnotated().isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS) ) ) { throw new IllegalStateException(INVALID_RESOURCE_PRODUCER_FIELD, getWeldAnnotated()); }
- relates to
-
WELD-1116 Weld 2 does not build on JDK7
- Resolved