SerializationException on blazeds-spring-boot-starter.4.7.3

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SerializationException on blazeds-spring-boot-starter.4.7.3

skara
Hi
I am using blazeds-spring-boot-starter.4.7.3 snapshot.
I got an error
"Creation validation for class 'example.dto.BasicDto' failed."
at the time sending object data from flex to java.

Any pointers to the cause and the solution will be a great help.

error message:
Deserializing AMF/HTTP request
Version: 3
  (Message #0 targetURI=null, responseURI=/4)
    (Array #0)
      [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
        source = null
        operation = "paramObject"
        messageId = "4251E583-6ECC-0999-7C77-D56D4D77044E"
        body = (Array #1)
          [0] =
Serializing AMF/HTTP response
Version: 3
  (Message #0 targetURI=/4/onStatus, responseURI=)
    (Typed Object #0 'flex.messaging.messages.ErrorMessage')
      headers = (Object #1)
      clientId = null
      destination = null
      messageId = "C3102DF1-0C0F-701D-8503-DF6B335245A7"
      faultDetail = null
      body = null
      timeToLive = 0.0
      faultCode = "Client.Message.Encoding"
      faultString = "Creation validation for class 'example.dto.BasicDto' failed."
      rootCause = null
      correlationId = null
      timestamp = 1.489639403468E12
      extendedData = null

sample code:
--- MovementServiceImpl .java ---
package example;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Service;
import example.dto.BasicDto;
 
@Service("movementService")
@RemotingDestination
public class MovementServiceImpl {
        // OK
        public String paramDate(Date date){
        Calendar cal1 = Calendar.getInstance();
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        cal1.setTime(date);
        cal1.add(Calendar.MONTH, 1);
                return sdf1.format(cal1.getTime());
        }
       
    // NG
    public BasicDto paramObject(BasicDto dto) {
        dto.id = 100;
        dto.name = dto.name + " from Java";
        dto.date = new Date();
        return dto;
    }
}

--- BasicDto.java ---
package example.dto;
import java.util.Date;
public class BasicDto {
        public Integer id;
        public String name;
        public Date date;
}

--- Main.mxml ---
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
        <fx:Declarations>
                <s:RemoteObject id="moveService"
                                                destination="movementService"
                                                endpoint="http://localhost:8080/messagebroker/short-polling-amf"
                                                fault="onFault(event)" result="onResult(event)">
                        <s:method name="paramObject"/>
                        <s:method name="paramDate"/>
                </s:RemoteObject>
        </fx:Declarations>
        <fx:Script>
               
<![CDATA[
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			import mx.utils.ObjectUtil;
			import example.dto.BasicDto;

			private function onFault(event:FaultEvent):void{
				trace(event);
			}
			private function onResult(event:ResultEvent):void{
				trace(ObjectUtil.toString(event.result));
			}
			protected function param1_clickHandler(event:MouseEvent):void
			{
				var dto:BasicDto = new BasicDto();
				dto.id = 700;
				dto.name = "from Flex";
				dto.date = new Date();

				moveService.paramObject(dto);
			}
		]]>

        </fx:Script>
        <s:HGroup width="100%" height="100%">
                <s:Button label="Object Param" click="param1_clickHandler(event)"/>
                <s:Button label="Date Param" click="moveService.paramDate(new Date())"/>
        </s:HGroup>
</s:Application>

--- BasicDto.as ---
package example.dto
{
        [RemoteClass(alias="example.dto.BasicDto")]
        public class BasicDto
        {
                public var id:Number;
                public var name:String;
                public var date:Date;
        }
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SerializationException on blazeds-spring-boot-starter.4.7.3

Jaabax
did you fix this?

I fixed it rolling back the version to 4.7.2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SerializationException on blazeds-spring-boot-starter.4.7.3

Jaabax
as Josh Tynjala says:

According to the release notes for BlazeDS 4.7.3, classes must be
whitelisted in order to be deserialized by ClassDeserializationValidator.
Perhaps that is what you are encountering.

resolved
Loading...