CustomCode strange exception

0 votes

hi all. i deploy a custom code. to this point everything ok. but, when I try to run it,  I always get the same error

 Exception :com.shephertz.app42.paas.sdk.java.App42Exception: Can not parse String : 
Exception Message Can not parse String : 
 
the my code is the same of the video tutorial
 
thi is the function of  to send the signal to server
 
TestMyCustomCode.java
 
public static void testMyCodeInCloud() throws Exception {

   String apiKey = "xxxxx";
   String secretKey = "xxxxxx";

   ServiceAPI sp = new ServiceAPI(apiKey, secretKey);

   CustomCodeService customCodeService = sp.buildCustomCodeService();

   String name = "customcodedemo";
   JSONObject requestJSON = new JSONObject();

   requestJSON.put("user", "demo");


   customCodeService.runJavaCode(name, requestJSON, new App42CallBack() {  
   public void onSuccess(Object response)   
   {  
       JSONObject  res= (JSONObject)response;        
       System.out.println("response is " + res) ;  
   }  
   public void onException(Exception ex)   
   {  
       System.out.println("Exception Message " + ex.getMessage());  
   }  
   });  
}

 

 
this is the server code
 
MyCustomCode.java
 
@Override
	public HttpResponseObject execute(HttpRequestObject request) {
		JSONObject body = request.getBody();

		// Build Log Service For logging in Your Code
		LogService logger = sp.buildLogService();
		//logger.debug(" Recieved Request Body : :" + body.toString(), moduleName);

		// Write Your Custom Code Here
		// ......//

		logger.info("Running Custom Code Hello World  ", moduleName);
		
		// Create JSON Response Based on Your business logic
		JSONObject jsonResponse = new JSONObject();
		try {
			jsonResponse.put("name", "App42CustomCodeTest");
			//....//
			//....//
		} catch (JSONException e) {
			// Do exception Handling for JSON Parsing
		}
		// Return JSON Response and Status Code
		return new HttpResponseObject(HTTP_STATUS_SUCCESS, jsonResponse);
	}

 

 

asked Sep 16, 2015 in App42 Cloud API-BaaS by asasolagroup (8 points)
recategorized Sep 28, 2015 by sushil

1 Answer

0 votes
Hello, Could you please let me know what is your java version? regards, Himanshu
answered Sep 16, 2015 by hs00105 (2,005 points)
jdk1.8.0_40
jre1.8.0_45
Please change to java 1.7 and deploy your custom code again, it will work for you.

Thanks
I finally solved. I had to download and install  jdk1.6 and a previous version of eclipse (kepler).
thanks for the help
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...