3 Replies Latest reply on May 31, 2015 10:57 PM by pmwqld

    Why is a ClientMarshaller running on server side instead of a ServerMarshaller

    pmwqld

      Here are a pair of marshallers for the object DateMillis.

       

      @ClientMarshaller(DateMillis.class)

      public class DateMillisClientMarshaller extends DateMillisMarshaller {

          // this class has been deliberately left blank as this is a simple pass through.

          // the server marshaller does the real work

      }

       

      @ServerMarshaller(DateMillis.class)

      public class DateMillisServerMarshaller extends DateMillisMarshaller {

          @Override

          protected DateMillis beforeMarshall(final DateMillis dm) {

              TimeZoneUtils.calculateClientMillis(dm);

              return dm;

          }

       

          @Override

          protected DateMillis afterDemarshall(final DateMillis dm) {

              TimeZoneUtils.calculateServerDate(dm);

              return dm;

          }

      }

       

      Their packages are as follows, BaseMarshaller located at xxx.client.shared.yyy; ClientMarshaller located at xxx.client.local.marshallers; and ServerMarshaller is located at xxx.server.dto

       

      So here is the problem, when BOTH the client and server marshaller are on the classpath together it is ambiguous as to which marshaller is called on the server side. Sometimes it is the server marshaller other times it is the client marshaller. This occurs on the following occassions

      * in dev mode when both appear on the server class path, and

      * in production mode if the war file contains both the client and server marshallers.

       

      The production mode problem was easily resolved by ensuring the newly created marshalling package was under the "client.local" package. :-)

      However, in dev mode when both marshallers are on the classpath,  the ServerMarshallingFactoryImpl contains the client marshalling instance on some occasions. I think this is a bug.

       

      Does anyone have an explanation as to why this is happening or a work around?

      Furthermore I cannot see the source code for the generated ServerMarshallingFactoryImpl.

       

      Thanks.