You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When following these instructions they lead to function-sample-aws and if you check that out and run it you can run into a set of problems that are difficult to understand/explain if you are new to the concepts of this project and not on windows.
It should be pretty easy to address by documenting the steps that are needed specific to the context. E.g., linux or macosx
Sample
These instructions suggest You simply execute ./mvnw clean package to generate JAR file. and since on my host (macosx) I don't use windows I translated to this You simply execute mvn clean package to generate JAR file. Pretty straightforward. However, the next steps deviate as I didn't want to run a deploy to AWS but rather switch to use AWS SAM locally FIRST, to get the hang of things.
And when I ran sam local invoke I get this:
Class not found: org.springframework.cloud.function.adapter.aws.FunctionInvoker: java.lang.ClassNotFoundException
java.lang.ClassNotFoundException: org.springframework.cloud.function.adapter.aws.FunctionInvoker
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
Which appears to be a very common problem that people ask about, however, there is no straightforward answer. There are however lots of finger pointing to AWS SAM or Spring Cloud Function etc. having the issues. In the end I was able to determine that there is indeed some expectations on AWS SAM about how the packaging of the code will be created when AWS SAM local is executed. It depends on sam build to be executed so that the artifacts will be located correctly in the container. However, when I ran sam build it chokes on the fact that I have no mvnw environment. Again, I assumed the instructions of mvn clean package were sufficient and so I missed that sam build was the only real means to get sam happy.
Specifically, I had to drop the mvnw et. al. (I literally deleted it). I also deleted the .aws-sam directory as I wanted to make sure I was clean on all accounts. Then I ran the sam build and then sam local invoke and everything worked as expected.
In other words lots of wasted time trying to get the simple 'demo' to work locally with Spring Cloud Function and AWS SAM local. And in a few post I found people just switched languages to python. 🤷
It would be ideal to document how to bootstrap for linux/macosx such that it just works on the first 10m instead of wasting time chasing ClassNotFoundException to get it to work.
The text was updated successfully, but these errors were encountered:
@roskelleycj
First, thank you for all of these details. . . . and it seems like you have spent "some time" getting it to work.
Obviously there are (as you pointed out) certain expectations for SAM that could be different then for a real deployment. . .
But I do agree it would be nice if this could be documented.
Do you mind providing a documentation PR? I can guide you thru it as well.
Describe the issue
When following these instructions they lead to function-sample-aws and if you check that out and run it you can run into a set of problems that are difficult to understand/explain if you are new to the concepts of this project and not on windows.
It should be pretty easy to address by documenting the steps that are needed specific to the context. E.g., linux or macosx
Sample
These instructions suggest
You simply execute ./mvnw clean package to generate JAR file.
and since on my host (macosx) I don't use windows I translated to thisYou simply execute mvn clean package to generate JAR file.
Pretty straightforward. However, the next steps deviate as I didn't want to run a deploy to AWS but rather switch to use AWS SAM locally FIRST, to get the hang of things.And when I ran
sam local invoke
I get this:Which appears to be a very common problem that people ask about, however, there is no straightforward answer. There are however lots of finger pointing to AWS SAM or Spring Cloud Function etc. having the issues. In the end I was able to determine that there is indeed some expectations on AWS SAM about how the packaging of the code will be created when AWS SAM local is executed. It depends on
sam build
to be executed so that the artifacts will be located correctly in the container. However, when I ran sam build it chokes on the fact that I have no mvnw environment. Again, I assumed the instructions ofmvn clean package
were sufficient and so I missed thatsam build
was the only real means to get sam happy.Specifically, I had to drop the mvnw et. al. (I literally deleted it). I also deleted the .aws-sam directory as I wanted to make sure I was clean on all accounts. Then I ran the
sam build
and thensam local invoke
and everything worked as expected.In other words lots of wasted time trying to get the simple 'demo' to work locally with Spring Cloud Function and AWS SAM local. And in a few post I found people just switched languages to python. 🤷
It would be ideal to document how to bootstrap for linux/macosx such that it just works on the first 10m instead of wasting time chasing
ClassNotFoundException
to get it to work.The text was updated successfully, but these errors were encountered: