tags:

views:

137

answers:

2

Hi ,

I was trying to connect Flex to Backend Java and I was trying to call a method in one of the classe in the Backend java and it was returning

Faultcode:Server.Processing

java.lang.NullPointerException : null

In the root cause everything is null .

.I have checked everything from RemotingConfig to the Flex calling service .

roReporting = new MeteringRemoteObject("ReportingServices"); roReporting.source = "reportmgmt.Reporting"; roReporting.addEventListener(InvokeEvent.INVOKE,invokeHandler); roReporting["getReportData"].addEventListener(ResultEvent.RESULT,graphResultHandler); roReporting["getReportData"].addEventListener(FaultEvent.FAULT, graphFaultHandler);
In the metering Remote Object I have written a code to connect to the back end .

Can somebody please let me know whether you have come across this problem .

Thanks , SUDEEP KUMAR

A: 

This has nothing to do with Flex or Flex Remoting. Your Java service just throws a NullPointerException. Check the code, use your debugger or add some debug log statements to the service method in question.

Daniel Rinser
A: 

Hi Daniel ,

I was trying to send an array which contains an array and some string and integer values to the back end and and my ActionScript VO is like

package valueObjects { import mx.collections.ArrayCollection;

[RemoteClass(alias="reportmgmt.ReportCriteria")]
[Bindable] 
public class ReportCriteria 
{  

 // Any new public properties added here, need to be duplicated down below in duplicate() function
 // remote fields
 private var _measureId:int;
 private var _locationId:Array;
 private var _startDate:Date;
 private var _endDate:Date;  
 private var _precisionLevel:String;
 private var _rowName:String;
 private var _columnName:String;
 private var _reportName:String;
 private var _reportDescription:String;


 // fields for flex use
 private var _uniqueString:String;

 public function get measureId():int {
  return _measureId;
 }
 public function set measureId(value:int):void {
  _measureId = value;   
  createUniqueString();
 }

 public function get locationId():Array {
  return _locationId;
 }
 public function set locationId(value:Array):void {
  _locationId = value;
  trace(" The length of the array is "+_locationId.length);
  createUniqueString();
 }  

 public function get startDate():Date {
  return _startDate;
 }
 public function set startDate(value:Date):void {
  _startDate = value;
  createUniqueString();
 }

 public function get endDate():Date {
  return _endDate;
 }
 public function set endDate(value:Date):void {
  _endDate = value;
  createUniqueString();
 }

 public function set PrecisionLevel(precisionLevel:String):void {
  _precisionLevel = precisionLevel;
  createUniqueString();   
 }

    public function get PrecisionLevel():String {
  return _precisionLevel;
 }

 public function get rowName():String{
  return _rowName;
 }

 public function set rowName(value:String):void{
    _rowName = value;
 }

 public function get columnName():String{
  return _columnName;   
 }

 public function set columnName(value:String):void{
  _columnName= value;
 }

 public function get reportName():String{
  return _reportName;
 }

 public function set reportName(value:String):void{

  _reportName = value;
 }

 public function get reportDescription():String{
  return _reportDescription; 

 }

 public function set reportDescription(value:String):void{
  _reportDescription = value;

 }  


 public function ReportCriteria(){

 }  

 [Transient]
 public function get uniqueString():String {
  return _uniqueString;
 }  


 private function createUniqueString():void {
  var unq:String = "";
  unq += ( !isNaN(_measureId) ? _measureId.toString() : "");
  //unq += "_" + ( !Object(_locationId) ? _locationId.toString() : "");
  unq += "_" + (_startDate != null ? _startDate.toDateString() : "");
  unq += "_" + (_startDate != null ? _startDate.toDateString() : "");
  unq += "_" + ( _precisionLevel!= null ? _precisionLevel: "");
  _uniqueString = unq;

 }

 public static function duplicate(cr:ReportCriteria):ReportCriteria {
  var newCr:ReportCriteria = new ReportCriteria();
 // newCr.locationId = cr.locationId;
  newCr.measureId = cr.measureId;
  newCr.startDate = cr.startDate;
  newCr.endDate = cr.endDate;
  newCr.meterId = cr.meterId;
  newCr.precisionLevel = cr.precisionLevel;
  newCr.rowName = cr.rowName;
  newCr.columnName = cr.columnName;
  return newCr; 
 }

}

}

and I observed that when i remove the array with in the VO then it works fine and the array with in the array is received as

public void setLocation(ArrayList locationId) on the java side . Can i use Array List on the Java server side or need to have String array .

Can you please advice ..