You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by purecharger <rn...@gmail.com> on 2012/08/09 01:57:23 UTC

Upgrading 2.2 to 2.6

My web services are deployed using CXF 2.2.5, using the default databinding
of JAXB 2.1. I'm attempting to upgrade to CXF 2.6, and I'm getting this
error when starting up services:


FAILURE invoking publish of
org.apache.cxf.jaxws.spring.EndpointDefinitionParser$SpringEndpointImpl
java.lang.reflect.InvocationTargetException
...
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
MyInterface is an interface, and JAXB can't handle interfaces.

With my interface carrying @WebMethod annotations:

@WebService
public interface MyInterface {

    @WebMethod(action = "receive")
    public void receive(@WebParam(name = "id") String id);

}

@WebService(endpointInterface = "MyInterface")
public class MyClass implements MyInterface {

    public void receive(String id){
    }

}

I have quite a few interface/implementations defined this way, and from the
CXF How-To documentation this is perfectly valid. I'm trying to find out
whether this is a known change from JAXB 2.1 to 2.2 that I need to update if
I'm going to use CXF 2.6, or am I missing something in the databinding
configuration?

Thank you,
Ryan




--
View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Upgrading 2.2 to 2.6

Posted by Glen Mazza <gm...@talend.com>.
There's an inheritance JAXB plugin 
(http://www.jroller.com/gmazza/entry/enhancing_jaxb_artifacts#Plugin) 
that might solve your problem.

HTH,
Glen

On 08/08/2012 07:57 PM, purecharger wrote:
> My web services are deployed using CXF 2.2.5, using the default databinding
> of JAXB 2.1. I'm attempting to upgrade to CXF 2.6, and I'm getting this
> error when starting up services:
>
>
> FAILURE invoking publish of
> org.apache.cxf.jaxws.spring.EndpointDefinitionParser$SpringEndpointImpl
> java.lang.reflect.InvocationTargetException
> ...
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
> of IllegalAnnotationExceptions
> MyInterface is an interface, and JAXB can't handle interfaces.
>
> With my interface carrying @WebMethod annotations:
>
> @WebService
> public interface MyInterface {
>
>      @WebMethod(action = "receive")
>      public void receive(@WebParam(name = "id") String id);
>
> }
>
> @WebService(endpointInterface = "MyInterface")
> public class MyClass implements MyInterface {
>
>      public void receive(String id){
>      }
>
> }
>
> I have quite a few interface/implementations defined this way, and from the
> CXF How-To documentation this is perfectly valid. I'm trying to find out
> whether this is a known change from JAXB 2.1 to 2.2 that I need to update if
> I'm going to use CXF 2.6, or am I missing something in the databinding
> configuration?
>
> Thank you,
> Ryan
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: Upgrading 2.2 to 2.6

Posted by purecharger <rn...@gmail.com>.
It seems Daniel fixed this behavior in CXF-3128, as of v2.3.1. I have split
my interface into two: ManagerWS and Manager. ManagerWS contains only the
exposed web service method definitions, while Manager extends ManagerWS,
adding the add/removeListener methods accepting interfaces as arguments.

Thanks for the help.



--
View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216p5712298.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Upgrading 2.2 to 2.6

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Yeah, this is per JAX-WS spec,  you can't set @WebMethod(exclude=true) on SEI,  you must put it on Impl class.
• Any of its methods MAY carry a javax.jws.WebMethod annotation (see 7.11.2).
• javax.jws.WebMethod if used, MUST NOT have the exclude element set to true.

Freeman

-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-10, at 上午4:09, purecharger wrote:

> Thanks for the reply, Daniel. I had started down this path and found that I
> can't actually use the 'exclude' attribute on any @WebMethod annotations in
> the interface. Unfortunately these interfaces are used both as external
> service endpoints and internally by many different classes. The 
> add/removeListener methods are never used by the web service, so it looks
> like I'll need to rework the interfaces.
> 
> Do you know why it is that I can't use the 'exclude' attribute at the SEI
> level?
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216p5712268.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: Upgrading 2.2 to 2.6

Posted by purecharger <rn...@gmail.com>.
Thanks for the reply, Daniel. I had started down this path and found that I
can't actually use the 'exclude' attribute on any @WebMethod annotations in
the interface. Unfortunately these interfaces are used both as external
service endpoints and internally by many different classes. The 
add/removeListener methods are never used by the web service, so it looks
like I'll need to rework the interfaces.

Do you know why it is that I can't use the 'exclude' attribute at the SEI
level?



--
View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216p5712268.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Upgrading 2.2 to 2.6

Posted by Daniel Kulp <dk...@apache.org>.
It was likely a bug in 2.2 that this would have worked.   Most likely, 2.2 ignored these methods since they are not supportable.   You most likely will need to remove the @WebMethod annotation off those or make them:
@WebMethod(exclude=true)
to mark them as excluded.

Dan



On Aug 9, 2012, at 12:49 PM, purecharger <rn...@gmail.com> wrote:

> The stack trace is a little misleading. It turns out that the "JAXB can't
> handle interfaces" is caused by specifying the interface as a web param on
> another service:
> 
> public interface Manager {
>    @WebMethod
>    public void addListener(MyInterface listener);
> 
>    @WebMethod
>    public void removeListener(MyInterface listener);
> }
> 
> Causing the exception during JAXB data binding:
> 
> 
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
> of IllegalAnnotationExceptions
> com.mycompany.MyInterface is an interface, and JAXB can't handle interfaces.
> 	this problem is related to the following location:
> 		at com.mycompany.MyInterface
> 		at private com.mycompany.MyInterface
> com.mycompany.jaxws_asm.AddListener.arg0
> 		at com.mycompany.jaxws_asm.AddListener
> 
> With JAXB 2.1 / CXF 2.2.5, these services deployed without exception.
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216p5712248.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Upgrading 2.2 to 2.6

Posted by purecharger <rn...@gmail.com>.
The stack trace is a little misleading. It turns out that the "JAXB can't
handle interfaces" is caused by specifying the interface as a web param on
another service:

public interface Manager {
    @WebMethod
    public void addListener(MyInterface listener);

    @WebMethod
    public void removeListener(MyInterface listener);
}

Causing the exception during JAXB data binding:


Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
com.mycompany.MyInterface is an interface, and JAXB can't handle interfaces.
	this problem is related to the following location:
		at com.mycompany.MyInterface
		at private com.mycompany.MyInterface
com.mycompany.jaxws_asm.AddListener.arg0
		at com.mycompany.jaxws_asm.AddListener

With JAXB 2.1 / CXF 2.2.5, these services deployed without exception.



--
View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216p5712248.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Upgrading 2.2 to 2.6

Posted by purecharger <rn...@gmail.com>.
Freeman-2 wrote
> 
> Hmm, the SEI and Impl looks good to me, not really sure how the exception
> comes from.
> Could you please elaborate how you publish the endpoint? You use CXF
> standalone or embed it in some container?
> 
> Freeman
> 

The endpoint is deployed via Spring in my Tomcat app server:

    <jaxws:endpoint id="MyClass2"
        xmlns:s="http://api.mycompany.com/"
        serviceName="s:MyClass" name="MyClass"
        implementor="#MyClass" address="/MyClass">
    </jaxws:endpoint>

with the bean defined by:

<bean id="MyClass" class="com.mycompany.MyClass"></bean>




--
View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216p5712243.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Upgrading 2.2 to 2.6

Posted by Freeman Fang <fr...@gmail.com>.
Hmm, the SEI and Impl looks good to me, not really sure how the exception comes from.
Could you please elaborate how you publish the endpoint? You use CXF standalone or embed it in some container?

Freeman
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-9, at 上午7:57, purecharger wrote:

> My web services are deployed using CXF 2.2.5, using the default databinding
> of JAXB 2.1. I'm attempting to upgrade to CXF 2.6, and I'm getting this
> error when starting up services:
> 
> 
> FAILURE invoking publish of
> org.apache.cxf.jaxws.spring.EndpointDefinitionParser$SpringEndpointImpl
> java.lang.reflect.InvocationTargetException
> ...
> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
> of IllegalAnnotationExceptions
> MyInterface is an interface, and JAXB can't handle interfaces.
> 
> With my interface carrying @WebMethod annotations:
> 
> @WebService
> public interface MyInterface {
> 
>    @WebMethod(action = "receive")
>    public void receive(@WebParam(name = "id") String id);
> 
> }
> 
> @WebService(endpointInterface = "MyInterface")
> public class MyClass implements MyInterface {
> 
>    public void receive(String id){
>    }
> 
> }
> 
> I have quite a few interface/implementations defined this way, and from the
> CXF How-To documentation this is perfectly valid. I'm trying to find out
> whether this is a known change from JAXB 2.1 to 2.2 that I need to update if
> I'm going to use CXF 2.6, or am I missing something in the databinding
> configuration?
> 
> Thank you,
> Ryan
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Upgrading-2-2-to-2-6-tp5712216.html
> Sent from the cxf-user mailing list archive at Nabble.com.