I have change "L" by "l" and I get the same error.
It´s not the cause.

Un saludo
Jose Manuel Prieto

2016-01-28 13:31 GMT+01:00 John D. Ament <[email protected]>:

> Just wondering.  Your definition uses long serialVersionUID =
> 9179138257757325575L;  This is an implicit type cast from Long to long.
> Have you tried using a primitive long in the value, e.g. long
> serialVersionUID = 9179138257757325575l;
>
> On Thu, Jan 28, 2016 at 7:20 AM José Manuel Prieto <
> [email protected]> wrote:
>
> > HI,
> >
> > I Test with Jetty my CXF service implementation.
> > At the end I comment the method "convertFaultBean", of class
> > org.apache.cxf.interceptor.ClientFaultConverter.
> >
> > My test method is:
> > ...
> > @Test
> > public void testMyWebService() {
> > try {
> > String address = "http://localhost:9000/ServiciosDocumento";;
> > JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
> > svrFactory.setServiceClass(ServiciosDocumento.class);
> > svrFactory.setAddress(address);
> > svrFactory.setServiceBean(serviciosDocumentoClass);
> > svrFactory.create();
> >
> > JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> > factory.setServiceClass(ServiciosDocumento.class);
> > factory.setAddress(address);
> > ServiciosDocumento client = (ServiciosDocumento) factory.create();
> >
> > Documento doc = client.obtenerDocumento("1", 1);
> > Assert.assertNotNull(doc);
> > } catch (ServiceException e) {
> > Assert.assertTrue(ExceptionUtils.getRootCauseMessage(e), false);
> > }
> > }
> > ...
> >
> > Error in console:
> >
> > 13:06:56.872 [main] INFO  o.a.c.i.ClientFaultConverter - Exception
> occurred
> > while creating exception: Can not set static final long field
> > es.trafico.scgd.comun.exception.ServiceException.serialVersionUID to
> > java.lang.Long
> > java.lang.IllegalAccessException: Can not set static final long field
> > es.trafico.scgd.comun.exception.ServiceException.serialVersionUID to
> > java.lang.Long
> > at
> >
> >
> sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76)
> > ~[na:1.8.0_65]
> > at
> >
> >
> sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80)
> > ~[na:1.8.0_65]
> > at
> >
> >
> sun.reflect.UnsafeQualifiedStaticLongFieldAccessorImpl.set(UnsafeQualifiedStaticLongFieldAccessorImpl.java:77)
> > ~[na:1.8.0_65]
> > at java.lang.reflect.Field.set(Field.java:764) ~[na:1.8.0_65]
> > at
> >
> >
> org.apache.cxf.interceptor.ClientFaultConverter.convertFaultBean(ClientFaultConverter.java:348)
> > [cxf-core-3.1.4.jar:3.1.4]
> > ...
> >
> > My exception class, implements Serializable:
> >
> > @WebFault(faultBean =
> "es.trafico.scgd.comun.dto.ServiceExceptionDetails",
> > name = "ServiceExceptionDetails", targetNamespace = "
> > http://scgd.trafico.es/servicios";)
> > public class ServiceException extends Exception implements Serializable {
> >
> > /**
> > * UID
> > */
> > private static final long serialVersionUID = 9179138257757325575L;
> > private ServiceExceptionDetails faultInfo;
> >
> > public ServiceException(String message) {
> > super(message);
> > }
> > ...
> >
> > The class org.apache.cxf.interceptor.ClientFaultConverter:
> > in the method:
> >
> >     private Exception convertFaultBean(Class<?> exClass, Object
> faultBean,
> > Fault fault) throws Exception {
> >         Constructor<?> constructor = exClass.getConstructor(new
> > Class[]{String.class});
> > // my coment: all Exception must be a constructor with String. I dont
> know
> > why.
> >         Exception e = (Exception)constructor.newInstance(new
> > Object[]{fault.getMessage()});
> >
> >         //Copy fault bean fields to exception
> >         for (Class<?> obj = exClass; !obj.equals(Object.class);  obj =
> > obj.getSuperclass()) {
> >             Field[] fields = obj.getDeclaredFields();
> >             for (Field f : fields) {
> >                 try {
> >                     Field beanField =
> > faultBean.getClass().getDeclaredField(f.getName());
> > // my comment: should be an IF, question about parameter: if has get/set
> or
> > if it is "static final"
> >                     ReflectionUtil.setAccessible(beanField);
> >                     ReflectionUtil.setAccessible(f);
> >                     f.set(e, beanField.get(faultBean));
> > // my comment: ¿why try to set a private field serialVersionUID?
> >                 } catch (NoSuchFieldException e1) {
> >                     //do nothing
> >                 }
> >             }
> >         }
> >
> > Thanks in advance.
> > Jose Manuel Prieto
> >
>

Reply via email to