aspose file tools*
The moose likes Web Services and the fly likes Getting exception serialization error:  java.lang. NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Getting exception serialization error:  java.lang. NullPointerException" Watch "Getting exception serialization error:  java.lang. NullPointerException" New topic
Author

Getting exception serialization error: java.lang. NullPointerException

bikkie bansal
Greenhorn

Joined: Oct 14, 2008
Posts: 17
Hello All,

I am calling web service using jax rpc call. My web service is returning list type. my code of calling web service is as follow:



when i am calling web service using
method i am getting following exception :


serialization error: serialization error: java.lang.NullPointerException
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:196)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.initialize(LiteralResponseSerializer.java:230)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcLiteralResponseSerializer(BasicCall.java:757)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:690)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:486)
at callbyregistry.CallHISServices.executeQuery(CallHISServices.java:220)
at callbyregistry.CallHISServices.main(CallHISServices.java:45)

CAUSE:

serialization error: java.lang.NullPointerException
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.doSetTargetClass(ValueTypeLiteralSerializer.java:113)
at com.sun.xml.rpc.encoding.literal.GenericLiteralObjectSerializer.setTargetClass(GenericLiteralObjectSerializer.java:117)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.<init>(ValueTypeLiteralSerializer.java:104)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.createLiteralValueTypeSerializer(DynamicInternalTypeMappingRegistry.java:768)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:190)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.initialize(LiteralResponseSerializer.java:230)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcLiteralResponseSerializer(BasicCall.java:757)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:690)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:486)
at callbyregistry.CallHISServices.executeQuery(CallHISServices.java:220)
at callbyregistry.CallHISServices.main(CallHISServices.java:45)

CAUSE:

java.lang.NullPointerException
at sun.reflect.misc.ReflectUtil.checkPackageAccess(ReflectUtil.java:101)
at sun.reflect.misc.ReflectUtil.isPackageAccessible(ReflectUtil.java:123)
at java.beans.Introspector.getBeanInfo(Introspector.java:154)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.introspectTargetClass(ValueTypeLiteralSerializer.java:120)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.doSetTargetClass(ValueTypeLiteralSerializer.java:110)
at com.sun.xml.rpc.encoding.literal.GenericLiteralObjectSerializer.setTargetClass(GenericLiteralObjectSerializer.java:117)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.<init>(ValueTypeLiteralSerializer.java:104)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.createLiteralValueTypeSerializer(DynamicInternalTypeMappingRegistry.java:768)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:190)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.initialize(LiteralResponseSerializer.java:230)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcLiteralResponseSerializer(BasicCall.java:757)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:690)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:486)
at callbyregistry.CallHISServices.executeQuery(CallHISServices.java:220)
at callbyregistry.CallHISServices.main(CallHISServices.java:45)

CAUSE:

serialization error: java.lang.NullPointerException
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.doSetTargetClass(ValueTypeLiteralSerializer.java:113)
at com.sun.xml.rpc.encoding.literal.GenericLiteralObjectSerializer.setTargetClass(GenericLiteralObjectSerializer.java:117)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.<init>(ValueTypeLiteralSerializer.java:104)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.createLiteralValueTypeSerializer(DynamicInternalTypeMappingRegistry.java:768)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:190)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.initialize(LiteralResponseSerializer.java:230)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcLiteralResponseSerializer(BasicCall.java:757)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:690)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:486)
at callbyregistry.CallHISServices.executeQuery(CallHISServices.java:220)
at callbyregistry.CallHISServices.main(CallHISServices.java:45)

CAUSE:

java.lang.NullPointerException
at sun.reflect.misc.ReflectUtil.checkPackageAccess(ReflectUtil.java:101)
at sun.reflect.misc.ReflectUtil.isPackageAccessible(ReflectUtil.java:123)
at java.beans.Introspector.getBeanInfo(Introspector.java:154)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.introspectTargetClass(ValueTypeLiteralSerializer.java:120)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.doSetTargetClass(ValueTypeLiteralSerializer.java:110)
at com.sun.xml.rpc.encoding.literal.GenericLiteralObjectSerializer.setTargetClass(GenericLiteralObjectSerializer.java:117)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.<init>(ValueTypeLiteralSerializer.java:104)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.createLiteralValueTypeSerializer(DynamicInternalTypeMappingRegistry.java:768)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:190)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.initialize(LiteralResponseSerializer.java:230)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcLiteralResponseSerializer(BasicCall.java:757)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:690)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:486)
at callbyregistry.CallHISServices.executeQuery(CallHISServices.java:220)
at callbyregistry.CallHISServices.main(CallHISServices.java:45)

CAUSE:

java.lang.NullPointerException
at sun.reflect.misc.ReflectUtil.checkPackageAccess(ReflectUtil.java:101)
at sun.reflect.misc.ReflectUtil.isPackageAccessible(ReflectUtil.java:123)
at java.beans.Introspector.getBeanInfo(Introspector.java:154)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.introspectTargetClass(ValueTypeLiteralSerializer.java:120)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.doSetTargetClass(ValueTypeLiteralSerializer.java:110)
at com.sun.xml.rpc.encoding.literal.GenericLiteralObjectSerializer.setTargetClass(GenericLiteralObjectSerializer.java:117)
at com.sun.xml.rpc.encoding.literal.ValueTypeLiteralSerializer.<init>(ValueTypeLiteralSerializer.java:104)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.createLiteralValueTypeSerializer(DynamicInternalTypeMappingRegistry.java:768)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:190)
at com.sun.xml.rpc.encoding.literal.LiteralResponseSerializer.initialize(LiteralResponseSerializer.java:230)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcLiteralResponseSerializer(BasicCall.java:757)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:690)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:486)
at callbyregistry.CallHISServices.executeQuery(CallHISServices.java:220)
at callbyregistry.CallHISServices.main(CallHISServices.java:45)


Please help me out.

regards,
vikas
[ December 16, 2008: Message edited by: vikas kumar bansal ]
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
The limitations to Java web services (with Axis) is that the user defined (or complex) objects are not handled - only primitive data types are actually passed . Thus, cannot pass trhough wire without flattening them. If your Java class follows the standard JavBean standard of mutators, you can leverage the services of BeanSerializer (with Axis2).

The simpler method would be to store the references as primitive data types (String values for example) in a HashMap which can be accessed through the client.


[ December 16, 2008: Message edited by: Nitin Pathak ]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Originally posted by Nitin Pathak:
The simpler method would be to store the references as primitive data types (String values for example) in a HashMap which can be accessed through the client.


The choice of a HashMap would prove problematic.

Web Services Programming Tips and Tricks: Use collection types with SOAP
Hashtables in WSDL
Object that contain ArrayList


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
bikkie bansal
Greenhorn

Joined: Oct 14, 2008
Posts: 17
Hello Peer,

Thanks for reply.
As describe in tutorial Web Services Programming Tips and Tricks: Use collection types with SOAP

I have created wrapper for my service in which i am converting my list type to string array type.



but still I am getting exception when I am invoking my operation.

when I set my return type by using


and invoke my operation I got following exception :



when I set retun type as follow :



and then invoke operation then I am getting following exception:


please help me.

regards,
vikas
[ December 29, 2008: Message edited by: vikas kumar bansal ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting exception serialization error: java.lang. NullPointerException
 
Similar Threads
trouble with f:selectItems
JetSpeed2 - alot of exceptions
dii client returning custom types
Exception in thread "AWT-EventQueue-1"
Problem with configurate Spring and Hibernate