OpenWhsik Java Deployment

openwhisk

#1

I am trying to use the openwhisk-java-plugin and here is the serverless.yaml

service: helloworld
frameworkVersion: ">=1.2.0 <2.0.0"

provider:
  name: openwhisk
  runtime: java
  ignore_certs: true

package:
 artifact: target/demo-function.jar

functions:
  demo:
    handler: com.example.FunctionApp

plugins:
  - "serverless-openwhisk"

When I try to deploy the function I get the following error :frowning:

Serverless: Packaging function: demo...

  Serverless Error ---------------------------------------

  Function handler (com.example.FunctionApp) does not exist.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           10.0.0
     Serverless Version:     1.27.2

I assume the handler for Java with jar should pass that as appropriate parameter to the underlying provider.

Can you please let me know if something missing ???

-Kamesh


#2

The Java template looks like the default serverless.yml contains a bug.

If you change the configuration to the following template it works.

service: helloworld

provider:
  name: openwhisk
  runtime: java

# you can add packaging information here
functions:
  demo:
    handler: target/demo-function.jar:com.example.FunctionApp

plugins:
  - "serverless-openwhisk"

#3

Thanks James, with that modified configuration I could move past the original error. However there is a new error:

$ sls deploy
Serverless: Packaging service...
Serverless: Compiling Functions...

  Serverless Error ---------------------------------------

  Unable to read handler file in function demo

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           8.11.2
     Serverless Version:     1.32.0

I extracted the .jar and the .class is definitely there.


#4

It looks like Shaz found the fix for this issue