Discussion:
: Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null
COURTAULT Francois
2017-11-27 10:56:41 UTC
Permalink
Hello Romain,

OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?

Best Regards.

-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: lundi 27 novembre 2017 11:47
To: ***@tomee.apache.org
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null

Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO";
}
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting WebserviceContext
returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext returns
null
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
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.
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
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/sr
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.ja
v
a
, 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
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.
________________________________ 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 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 dam
Romain Manni-Bucau
2017-11-27 11:05:27 UTC
Permalink
I have to confess I think it is not specified at all (JAX-WS not being
updated for this case) but feel free to propose a fix on github. No
blocker to enrich it.

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO";
}
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting WebserviceContext
returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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/sr
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.ja
v
a
, 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
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.
________________________________ 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 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.
COURTAULT Francois
2017-11-27 11:36:38 UTC
Permalink
Hello Romain,

How can I do that ? Pull-request on master branch ? Go directly to JIRA ?

Best Regards.

-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: lundi 27 novembre 2017 12:05
To: ***@tomee.apache.org
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null

I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO";
}
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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/s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.j
a
v
a
, 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
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.
________________________________ 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 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 a transmi
Romain Manni-Bucau
2017-11-27 13:08:41 UTC
Permalink
PR on master on github yes or patch attached to a jira (but review
will be a bit longer)

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
How can I do that ? Pull-request on master branch ? Go directly to JIRA ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 12:05
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null
I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO";
}
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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/s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.j
a
v
a
, 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
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.
________________________________ 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 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 a transmitted virus.
COURTAULT Francois
2017-11-27 14:36:06 UTC
Permalink
Hello Romain,

Done.
#114 Tomee 7.0.4 issue with CDI interceptor and WebServiceContext resource injection

I have still a question, in order to create a pull request, I have to have a base branch and a compare branch, right ?
So I have set the base branch to Master and the compare branch to tome-7.0.4-prepare: is it correct ?

Best Regards.

-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: lundi 27 novembre 2017 14:09
To: ***@tomee.apache.org
Subject: [+SPAM+]: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null

PR on master on github yes or patch attached to a jira (but review will be a bit longer)

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
How can I do that ? Pull-request on master branch ? Go directly to JIRA ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 12:05
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO";
}
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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/
s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.
j
a
v
a
, 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
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.
________________________________ 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 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 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 tr
Romain Manni-Bucau
2017-11-27 14:59:03 UTC
Permalink
base branch = master
compare = your branch

no?

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Done.
#114 Tomee 7.0.4 issue with CDI interceptor and WebServiceContext resource injection
I have still a question, in order to create a pull request, I have to have a base branch and a compare branch, right ?
So I have set the base branch to Master and the compare branch to tome-7.0.4-prepare: is it correct ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 14:09
Subject: [+SPAM+]: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null
PR on master on github yes or patch attached to a jira (but review will be a bit longer)
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
How can I do that ? Pull-request on master branch ? Go directly to JIRA ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 12:05
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO";
}
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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/
s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.
j
a
v
a
, 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
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.
________________________________ 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 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 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.
COURTAULT Francois
2017-11-27 15:29:03 UTC
Permalink
Hello Romain,

Agreed but no so familiar with that.

If the compare has to be set on my branch:
- First, I need to create a new one from master, right ?
- Second, I have to submit a code change in TomEE, right ?

May be it should be easier, for me, to submit an issue on TomEE Jira.

Best Regards.

-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: lundi 27 novembre 2017 15:59
To: ***@tomee.apache.org
Subject: [++SPAM++]: Re: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null

base branch = master
compare = your branch

no?

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Done.
#114 Tomee 7.0.4 issue with CDI interceptor and WebServiceContext
resource injection
I have still a question, in order to create a pull request, I have to have a base branch and a compare branch, right ?
So I have set the base branch to Master and the compare branch to tome-7.0.4-prepare: is it correct ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 14:09
Subject: [+SPAM+]: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
PR on master on github yes or patch attached to a jira (but review
will be a bit longer)
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
How can I do that ? Pull-request on master branch ? Go directly to JIRA ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 12:05
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO"; }
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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
/
s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.
j
a
v
a
, 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
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.
________________________________ 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 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 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 f
Romain Manni-Bucau
2017-11-27 15:41:42 UTC
Permalink
Post by COURTAULT Francois
Hello Romain,
Agreed but no so familiar with that.
- First, I need to create a new one from master, right ?
- Second, I have to submit a code change in TomEE, right ?
1. fork tomee repository
2. clone your fork (git clone https://github.com/<you>/tomee)
3. create a local branch (git branch -b fix/my-super-fix)
4. push on your fork the branch (git push origin fix/my-super-fix)
5. go on github UI and create a PR selecting the branch in github UI
and clicking on "New Pull Request" button
Post by COURTAULT Francois
May be it should be easier, for me, to submit an issue on TomEE Jira.
Attaching a patch here is fine as well.
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 15:59
Subject: [++SPAM++]: Re: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null
base branch = master
compare = your branch
no?
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Done.
#114 Tomee 7.0.4 issue with CDI interceptor and WebServiceContext
resource injection
I have still a question, in order to create a pull request, I have to have a base branch and a compare branch, right ?
So I have set the base branch to Master and the compare branch to tome-7.0.4-prepare: is it correct ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 14:09
Subject: [+SPAM+]: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
PR on master on github yes or patch attached to a jira (but review
will be a bit longer)
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
How can I do that ? Pull-request on master branch ? Go directly to JIRA ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 12:05
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Subject: [++SPAM++]: Re: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO"; }
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext returns
null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs so
not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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
/
s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.
j
a
v
a
, 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
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.
________________________________ 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 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 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.
COURTAULT Francois
2017-11-27 16:00:41 UTC
Permalink
Hello Romain,

More familiar with JIRA: https://issues.apache.org/jira/browse/TOMEE-2150

Best Regards.

-----Original Message-----
From: Romain Manni-Bucau [mailto:***@gmail.com]
Sent: lundi 27 novembre 2017 16:42
To: ***@tomee.apache.org
Subject: [++SPAM++]: Re: Re: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting WebserviceContext returns null
Post by COURTAULT Francois
Hello Romain,
Agreed but no so familiar with that.
- First, I need to create a new one from master, right ?
- Second, I have to submit a code change in TomEE, right ?
1. fork tomee repository
2. clone your fork (git clone https://github.com/<you>/tomee) 3. create a local branch (git branch -b fix/my-super-fix) 4. push on your fork the branch (git push origin fix/my-super-fix) 5. go on github UI and create a PR selecting the branch in github UI and clicking on "New Pull Request" button
Post by COURTAULT Francois
May be it should be easier, for me, to submit an issue on TomEE Jira.
Attaching a patch here is fine as well.
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 15:59
Subject: [++SPAM++]: Re: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
base branch = master
compare = your branch
no?
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Done.
#114 Tomee 7.0.4 issue with CDI interceptor and WebServiceContext
resource injection
I have still a question, in order to create a pull request, I have to have a base branch and a compare branch, right ?
So I have set the base branch to Master and the compare branch to tome-7.0.4-prepare: is it correct ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 14:09
Subject: [+SPAM+]: Re: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
PR on master on github yes or patch attached to a jira (but review
will be a bit longer)
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
How can I do that ? Pull-request on master branch ? Go directly to JIRA ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 12:05
Subject: [++SPAM++]: Re: : Re: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
I have to confess I think it is not specified at all (JAX-WS not being updated for this case) but feel free to propose a fix on github. No blocker to enrich it.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
OK but this didn't happen with the other App Servers. The only I haven't tried is Liberty but I can if you want.
So for me it's a bug, right ?
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:47
Injecting WebserviceContext returns null
Back to the first post I think: you get a proxy and the proxy gets the injections properly but this is not your business instance.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
@Inherited
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Nonbinding
String logLevel() default "INFO"; }
@Logged
@Interceptor
public class LoggingInterceptor {
private Class<?> intercepted;
@AroundInvoke
public Object logMethod(final InvocationContext ctx) throws
Exception { .....
}
}
@WebService(name = "MyManager", targetNamespace
public class MyManager implements IMyManager {
@Resource
private WebServiceContext wsc; //=>=> ALWAYS null on TomEE 7.0.4!!!
....
}
That's the test case I built which doesn't work on TomEE 7.0.4 but works, as I have already mentioned, on Glassfish 4.1.2/5.0, Weblogic Server 12.2.1.3 and Wildfly 10.0.1/11.0.0.
Best Regards.
-----Original Message-----
Sent: lundi 27 novembre 2017 11:08
Subject: [++SPAM++]: Re: : Re: : Re: : Re: Injecting
WebserviceContext returns null
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by COURTAULT Francois
Hello Romain,
Sorry to come back to you about this topic.
But I think there is a real issue with CDI interceptor in TomEE 7.0.4.
@Inject
@Intercepted
private Bean<?> intercepted;
And replace it by
private Class<?> intercepted;
Then, I revert back the update I have done (eg make the WS endpoint also an EJB), that is to say that my WS endpoint is now a pure POJO.
@Resource
private WebServiceContext wsc;
I tested this on Wildfly 10.0.1/11.0.0, Glassfish 4.1.2/5.0 and
Weblogic 12.2.1.3 (eg 3 different app servers with also different versions for some of them), and every time, wsc is not null This is not the case with TomEE 7.0.4.
Best Regards.
-----Original Message-----
From: COURTAULT Francois
Sent: vendredi 24 novembre 2017 15:43
Subject: RE: : Re: : Re: : Re: Injecting WebserviceContext
returns null
Hello Romain,
That's it.
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 15:34
Subject: [++SPAM++]: Re: : Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
Hello Romain,
I have found another workaround which seems to be more portable as it works for TomEE and Wildfly as expected.
I updated the Webservice POJO to become also a stateless EJB.
also? so you deploy it twice potentially with different settings? EJB integration should be more reliable yes since more mainstream and spec are more up to date with CDI.
yes but versions are likely different and the integration is not the same for sure.
Post by COURTAULT Francois
A communication failure occurred during the delivery of this message. Please try to resend the message later. If the problem continues, contact your helpdesk.
The following organization rejected your message: lb01.groups.io.
Anything I can do to make the sending to this mailing-list work ? Have you any advice or tricks ?
Not sure to be honest, JAX-WS is not the highest priority specs
so not really sure what is the current state :s
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: vendredi 24 novembre 2017 10:46
Subject: [++SPAM++]: Re: : Re: Injecting WebserviceContext
returns null
Post by COURTAULT Francois
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.
@Resource
private WebServiceContext wsc;
private WebServiceContext wsc;
@Resource
public void setServiceContext(WebServiceContext wsc) {
this.wsc = wsc;
}
1 counts of IllegalAnnotationExceptions javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
This is funny it takes it as a jaxb class but setting the jaxb
access to NONE on the class should be a workaround
Post by COURTAULT Francois
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.
j
a
va:32)
@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.
Did you try the lookup? I don't fully recall the jndi name but the resource should be accessible through a jndi lookup in the invocation context.
Post by COURTAULT Francois
How can I provide some feedback to Java EE spec members about this issue ?
fear we are in a migration state but entry point would be
https://javaee.github.io/metro-jax-ws/
Post by COURTAULT Francois
Best Regards.
-----Original Message-----
Sent: jeudi 23 novembre 2017 16:30
Subject: [++SPAM++]: Re: Injecting WebserviceContext returns
null
Post by COURTAULT Francois
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.
Post by COURTAULT Francois
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
Post by COURTAULT Francois
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-cx
f
/
s
r
c
/
t
e s
t/java/org/apache/openejb/server/cxf/PojoWebServiceContextTest.
j
a
v
a
, 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
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.
________________________________ 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 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 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
Loading...