COURTAULT Francois
2017-11-24 09:36:26 UTC
Hello Romain,
I have tested my sample application on Glassfish 4.1.2 and on Wildfly 10.1.0 and I get the same behavior.
But, I have found a workaround on TomEE 7.0.4.
Using the @Logged annotation, instead of having:
@Resource
private WebServiceContext wsc;
I updated with this:
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
This workaround works for TomEE 7.0.4 but if I tried this solution on Glassfish 4.1.2, I can't deploy my application. The error message I get is:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
Using Wildfly 10.1.0, I was able to deploy my application but at runtime I got the following exception:
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
...
Caused by: java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.NullPointerException
at com.mycompany.jaxws.LoggingInterceptor.logMethod(LoggingInterceptor.java:32)
The LoggingInterceptor looks like this:
@Inject
@Intercepted
private Bean<?> intercepted;
....
line 32 Logged loggedAnnotation = intercepted.getBeanClass().getAnnotation(Logged.class);
So definitively, there is an issue with resource injection and CDI interceptor because I can't find a portable solution except if I use standard interceptor instead of CDI interceptor but, with this solution, we lose the facility to use annotation for interceptor.
How can I provide some feedback to Java EE spec members about this issue ?
Best Regards.
-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: jeudi 23 novembre 2017 16:30
To: ***@tomee.apache.org
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by
I have tested my sample application on Glassfish 4.1.2 and on Wildfly 10.1.0 and I get the same behavior.
But, I have found a workaround on TomEE 7.0.4.
Using the @Logged annotation, instead of having:
@Resource
private WebServiceContext wsc;
I updated with this:
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
This workaround works for TomEE 7.0.4 but if I tried this solution on Glassfish 4.1.2, I can't deploy my application. The error message I get is:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
Using Wildfly 10.1.0, I was able to deploy my application but at runtime I got the following exception:
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
...
Caused by: java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.NullPointerException
at com.mycompany.jaxws.LoggingInterceptor.logMethod(LoggingInterceptor.java:32)
The LoggingInterceptor looks like this:
@Inject
@Intercepted
private Bean<?> intercepted;
....
line 32 Logged loggedAnnotation = intercepted.getBeanClass().getAnnotation(Logged.class);
So definitively, there is an issue with resource injection and CDI interceptor because I can't find a portable solution except if I use standard interceptor instead of CDI interceptor but, with this solution, we lose the facility to use annotation for interceptor.
How can I provide some feedback to Java EE spec members about this issue ?
Best Regards.
-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: jeudi 23 novembre 2017 16:30
To: ***@tomee.apache.org
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
Romain,
My interceptor is linked to an annotation and is declared in the beans.xml in order to work so I guess it is a cdi interceptor and, according to what you have said, a new proxy is created and so the injection is not done on the right proxy, right ?
But, in this case, is it a bug ?
Would do the same I think.My interceptor is linked to an annotation and is declared in the beans.xml in order to work so I guess it is a cdi interceptor and, according to what you have said, a new proxy is created and so the injection is not done on the right proxy, right ?
But, in this case, is it a bug ?
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 15:57
Subject: Re: Injecting WebserviceContext returns null
annotation = cdi interceptor? if so it leads to a proxy and the
injection happens on the wrong instance I think
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
________________________________-----Original Message-----
Sent: jeudi 23 novembre 2017 15:57
Subject: Re: Injecting WebserviceContext returns null
annotation = cdi interceptor? if so it leads to a proxy and the
injection happens on the wrong instance I think
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Hello Romain,
I think I have found the issue.
In fact, we used a custom annotation for a logging interceptor which targets METHOD and TYPE.
If we remove this annotation on our WS endpoint (eg TYPE target) , then the injection is resolved.
Do you know why we have this side effect ? Is it a bug ?
I have a test case if you want.
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 14:25
Subject: Re: Injecting WebserviceContext returns null
Looks close to
https://github.com/apache/tomee/blob/master/server/openejb-cxf/src/te
s t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.java
, what can be the difference?
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
________________________________I think I have found the issue.
In fact, we used a custom annotation for a logging interceptor which targets METHOD and TYPE.
If we remove this annotation on our WS endpoint (eg TYPE target) , then the injection is resolved.
Do you know why we have this side effect ? Is it a bug ?
I have a test case if you want.
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 14:25
Subject: Re: Injecting WebserviceContext returns null
Looks close to
https://github.com/apache/tomee/blob/master/server/openejb-cxf/src/te
s t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.java
, what can be the difference?
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Hello,
It looks quite similar to the sample provided in the JAX-WS 2.3 specification (maintenance release 5), page 82, §5.3 (javax.xml.ws.WebServiceContext) except that the annotation, in our development, uses attributes like name, ...
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 13:34
Subject: Re: Injecting WebserviceContext returns null
Hi François,
did you test with an EJB webservice?
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
________________________________It looks quite similar to the sample provided in the JAX-WS 2.3 specification (maintenance release 5), page 82, §5.3 (javax.xml.ws.WebServiceContext) except that the annotation, in our development, uses attributes like name, ...
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 13:34
Subject: Re: Injecting WebserviceContext returns null
Hi François,
did you test with an EJB webservice?
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Hello,
@WebService(name = "MyManager", targetNamespace =
"http://xxx.yyy.test..com/", serviceName = "MyManager",
wsdlLocation =
"wsdl/MyManager.wsdl") public class MyManagerService implements
MyManager {
@Resource
WebServiceContext webServiceContext; ....
}
And the webServiceContet is always null ! Any clue ?
Best Regards.
________________________________
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
________________________________@WebService(name = "MyManager", targetNamespace =
"http://xxx.yyy.test..com/", serviceName = "MyManager",
wsdlLocation =
"wsdl/MyManager.wsdl") public class MyManagerService implements
MyManager {
@Resource
WebServiceContext webServiceContext; ....
}
And the webServiceContet is always null ! Any clue ?
Best Regards.
________________________________
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by