pritidesai opened a new issue #276: Action creation with .jar fails with "The 
request content was malformed"
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/276
 
 
   **1: Create a Java file called `Hello.Java` from 
[here](https://console.ng.bluemix.net/docs/openwhisk/openwhisk_actions.html#openwhisk_actions_java)**
   
   ```
   import com.google.gson.JsonObject;
   public class Hello {
       public static JsonObject main(JsonObject args) {
           String name = "stranger";
           if (args.has("name"))
               name = args.getAsJsonPrimitive("name").getAsString();
           JsonObject response = new JsonObject();
           response.addProperty("greeting", "Hello " + name + "!");
           return response;
       }
   }
   ```
   
   **2: Compile `Hello.java` into a JAR file `hello.jar` as follows:**
   
   ```
   javac Hello.java
   jar cvf hello.jar Hello.class
   ```
   
   **3: Create `manifest.yaml` with:**
   
   ```
   package:
       name: helloworldjar
       actions:
           helloworld:
               location: src/hello.jar
               runtime: java
               main: Hello
   ```
   
   **4: Deployment fails with:**
   
   ```
   Response body received:
   {
     "error": "The request content was malformed:\n'main' must be a string 
defined in 'exec' for 'java' actions",
     "code": 4001042
   }
   2017/06/01 12:48:50 Got error creating action with error message: The 
request content was malformed:
   'main' must be a string defined in 'exec' for 'java' actions (code 4001042) 
and error code: 144.
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to