I've done a quick local test:

@Test
    public void testProxy() throws Exception {
IModel model = JAXRSClientFactory.create("http://localhost:8080";, IModel.class);
        assertNotNull(model);
model.getJsonGenericCommandDescriptor(new GenCmdDescr("description"));
    }

This throws HTTP level exception as expected, as no endpoint is listening. The proxy is created OK. The only thing I had to remove IPublishable from my example as you did not provide any source for it

I suspect some of your dependencies affecting the proxy generation.

Cheers, Sergey

On 08/05/13 07:16, eanbiso wrote:
Good morning,
the GenCmdDescr code is a class like this:

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;

@XmlRootElement(name="GenCmdDescr", namespace="http://***/";)
@XmlAccessorType(XmlAccessType.FIELD)
public class GenCmdDescr {

     @XmlAttribute private String name;
     @XmlAttribute private int profileId;
     @XmlAttribute private int objIdHigh;
     @XmlAttribute private int objIdLow;
     @XmlAttribute private short protType;

     public GenCmdDescr(){};

     public GenCmdDescr(String name, short protType, int profileId, int 
objIdHigh, int objIdLow) {
         super();
         this.name = name;
         this.profileId = profileId;
         this.objIdHigh = objIdHigh;
         this.objIdLow = objIdLow;
         this.protType = protType;
     }

     public String getName() {
         return this.name;
     }
     public void setName(String name) {
         this.name = name;
     }
     public int getProfileId() {
         return profileId;
     }
     public void setProfileId(int profileId) {
         this.profileId = profileId;
     }
     public int getObjIdHigh() {
         return objIdHigh;
     }
     public void setObjIdHigh(int objIdHigh) {
         this.objIdHigh = objIdHigh;
     }
     public int getObjIdLow() {
         return objIdLow;
     }
     public void setObjIdLow(int objIdLow) {
         this.objIdLow = objIdLow;
     }
     public short getProtType() {
         return protType;
     }
     public void setProtType(short protType) {
         this.protType = protType;
     }
}

while the ws interface is similar to this (I have reported only the method with 
problems):

@WebService(targetNamespace = "****")
public interface IModel extends IPublishable {

     @CxfWSAuthorization(group=***, roles={***})
     @GET
     @Consumes({MediaType.APPLICATION_XML})
     @Path("/getJsonGenericCommandDescriptor/{genericCommand}")
     public String getJsonGenericCommandDescriptor(
             @WebParam(name = "genericCommand") @PathParam("genericCommand") 
GenCmdDescr genericCommand) throws InstantiationException;

}


Andrea

Date: Tue, 7 May 2013 09:45:46 -0700
From: [email protected]
To: [email protected]
Subject: Re: java.lang.NoClassDefFoundError exception loading a rest endPoint 
in particular condition



        Can you give me a favor and attach an interface and GenCmdDescr source

to JIRA ? Or nabble ? I'll give it a try


Sergey

On 07/05/13 17:29, eanbiso wrote:

Thanks for the fast reply.

I do not use a concrete class and when I create the proxyFactory I use the corresponding 
ws interface class as "clazz" value.



Andrea







Date: Tue, 7 May 2013 09:01:10 -0700

From: [hidden email]

To: [hidden email]

Subject: Re: java.lang.NoClassDefFoundError exception loading a rest endPoint 
in particular condition







        Hi



On 07/05/13 15:56, eanbiso wrote:



Hi at all,



I have the following problem loading a rest endPoint using cxf.



The operations I do to load the rest endPoint after its publication are the



following:



                        



                        JAXRSClientFactoryBean proxyFactory = new 
JAXRSClientFactoryBean();



                        proxyFactory.setServiceClass(clazz);



                        address += servName;



                        proxyFactory.setAddress(address);



                        proxy = proxyFactory.create();                  



                        .....



                        



The "proxyFactory.create()" operation recall the "createWithValues" method



of JAXRSClientFactoryBean:



                        



                        public Client createWithValues(Object... varValues) {



                        ...



                        actualClient =



(Client)ProxyHelper.getProxy(Thread.currentThread().getContextClassLoader(),



                                   new Class[]{cri.getServiceClass(),



Client.class, InvocationHandlerAware.class},



                                        proxyImpl);



                        ...



                        }







Now I have the following anomalous behavior:



the "getProxy(...)" operation fails when the ws interface contains a method



that wants a "complex" input parameter like this:







        @GET



        @Consumes({MediaType.APPLICATION_XML})



        @Path("/getJsonGenericCommandDescriptor/{genericCommand}")



        public String getJsonGenericCommandDescriptor(



                        @WebParam(name = "genericCommand") 
@PathParam("genericCommand")



GenCmdDescr genericCommand) throws InstantiationException;







If the ws interface contains this method, an exception



"java.lang.NoClassDefFoundError: ___.GenCmdDescr" occurs loading the



endPoint.



If I remove this method from the ws interface the loading operation is right



and no exceptions occurs.



I do not understand why it happens.



In fact in the same ws interface I have another method that returns a



GenCmdDescr and no NoClassDefFoundError exception occurs with this.



The exception seems to occur only if the GenCmdDescr is used like an input



parameters of one of the methods and no excpetions occurs for method that



return an object GenCmdDescr.



Someone can help me?



Do you use a concrete class to create a proxy ? Example, do you use say



MyServiceImpl.class where MyServiceImpl is a root resource implementation ?





I can only think at the moment of CGLIB getting confused (which is used



to create a proxy when a concrete class like MyServiceImpl is proxified)





Cheers, Sergey





Thanks a lot,







Andrea











NOTE:



1.



The GenCmdDescr object is an object like this:







@XmlRootElement(name="GenCmdDescr", namespace="http://****/";)



@XmlAccessorType(XmlAccessType.FIELD)



public class GenCmdDescr {



        



        @XmlAttribute private String name;



        @XmlAttribute private int a;



        @XmlAttribute private int b;



        @XmlAttribute private int c;



        @XmlAttribute private short d;



        ...



}







2.



I'm using cxf 2.5.0 version















--



View this message in context: 
http://cxf.547215.n5.nabble.com/java-lang-NoClassDefFoundError-exception-loading-a-rest-endPoint-in-particular-condition-tp5727361.html
Sent from the cxf-user mailing list archive at Nabble.com.








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to