Cannot declare web service resource using @WebServiceRef
--------------------------------------------------------

                 Key: WELD-993
                 URL: https://issues.jboss.org/browse/WELD-993
             Project: Weld
          Issue Type: Bug
    Affects Versions: 1.1.2.Final
            Reporter: Martin Kouba


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*

{code}
public class SheepWSProducer {

    @Produces
    @WebServiceRef
    SheepWS sheepWS;
}
{code}

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:
{code}
...
 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());
      }
...
{code}

Should be replaced with something like:
{code}
...
 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());
      }
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
weld-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/weld-issues

Reply via email to