Thanks Gordon. After better understanding how autoservice work, I resolved the issue by adding below into my build.gradle file:
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc6' Without this, the project can compile but the autoservice class cannot be generated appropriately. Sorry I am not clear that I am using gradle. Cheers! On Tue, Nov 10, 2020 at 9:44 PM Tzu-Li (Gordon) Tai <tzuli...@apache.org> wrote: > Hi Lian, > > Sorry, I didn't realize that the issue you were bumping into was caused by > the module not being discovered. > You're right, the harness utility would not help here. > > As for the module discovery problem: > > - Have you looked at the contents of your jar, and see that a > META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule > has indeed been generated by AutoService? > - Just to rule out the obvious first: besides the > auto-service-annotations dependency, you also have to add the auto-service > compiler plugin, as demonstrated here: > https://github.com/apache/flink-statefun/blob/master/pom.xml#L192 > > Only after adding the build plugin mentioned above, the META-INF metadata > will be generated for classes annotated with @AutoService. > > Please let us know if this resolves the issue for you. > > Cheers, > Gordon > > On Wed, Nov 11, 2020 at 3:15 AM Lian Jiang <jiangok2...@gmail.com> wrote: > >> Igal, >> >> I am using AutoService and I don't need to add auto-service-annotations >> since it is provided by statefun-flink-core. Otherwise, my project cannot >> even build. I did exactly the same as >> >> >> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java >> >> I did below test: >> In statefun-greeter-example project, replace greeter jar with my jar in >> Dockerfile, running this project can NOT find my module. >> >> In my project, replace my jar with the greeter jar in Dockerfile, running >> this project can find the greeter module. >> >> So I am really puzzled about what is wrong with my jar. >> >> >> >> Gorden, >> >> harness test plumbing of ingress/egress. But it may not help me debug why >> Flink cannot discover my module. Correct? >> >> Thanks guys. >> >> >> >> >> >> >> >> >> >> On Tue, Nov 10, 2020 at 9:11 AM Igal Shilman <i...@ververica.com> wrote: >> >>> Hi Lian, >>> >>> If you are using the statefun-sdk directly (an embedded mode) then, most >>> likely is that you are missing a >>> META-INF/services/org.apache.flink.statefun.sdk.spi.StatefulFunctionModule >>> file that would point to your modules class. We are using Java SPI [1] >>> to load all the stateful functions modules at runtime. >>> Alternatively, you can use the @AutoService annotation [2] (you will >>> need to add a maven dependency for that [3]) >>> >>> If you are using the remote functions deployment mode, then please make >>> sure that your module.yaml file is present in your Dockerfile. (for example >>> [4]) >>> >>> Good luck, >>> Igal. >>> >>> [1] https://docs.oracle.com/javase/tutorial/ext/basics/spi.html >>> [2] >>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-greeter-example/src/main/java/org/apache/flink/statefun/examples/greeter/GreetingModule.java#L30 >>> [3] https://github.com/apache/flink-statefun/blob/master/pom.xml#L85,L89 >>> [4] >>> https://github.com/apache/flink-statefun/blob/master/statefun-examples/statefun-python-greeter-example/Dockerfile#L20 >>> >>> On Tue, Nov 10, 2020 at 4:47 PM Tzu-Li (Gordon) Tai <tzuli...@apache.org> >>> wrote: >>> >>>> Hi, >>>> >>>> StateFun provide's a Harness utility exactly for that, allowing you to >>>> test a StateFun application in the IDE / setting breakpoints etc. >>>> You can take a look at this example on how to use the harness: >>>> https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-flink-harness-example >>>> . >>>> >>>> Cheers, >>>> Gordon >>>> >>>> On Tue, Nov 10, 2020 at 5:04 AM Lian Jiang <jiangok2...@gmail.com> >>>> wrote: >>>> >>>>> >>>>> Hi, >>>>> >>>>> I created a POC by mimicing statefun-greeter-example. However, it >>>>> failed due to: >>>>> >>>>> Caused by: java.lang.IllegalStateException: There are no ingress >>>>> defined. >>>>> at >>>>> org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:25) >>>>> ~[statefun-flink-core.jar:2.2.0] >>>>> at >>>>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:71) >>>>> ~[statefun-flink-core.jar:2.2.0] >>>>> at >>>>> org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:47) >>>>> ~[statefun-flink-core.jar:2.2.0] >>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> ~[?:1.8.0_265] >>>>> at >>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >>>>> ~[?:1.8.0_265] >>>>> at >>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >>>>> ~[?:1.8.0_265] >>>>> at java.lang.reflect.Method.invoke(Method.java:498) >>>>> ~[?:1.8.0_265] >>>>> at >>>>> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.client.program.PackagedProgramUtils.getPipelineFromProgram(PackagedProgramUtils.java:150) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:77) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:101) >>>>> ~[statefun-flink-distribution.jar:2.2.0] >>>>> at >>>>> org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:55) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunnerFactory.createDispatcherRunner(DefaultDispatcherRunnerFactory.java:51) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:194) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:216) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:169) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> at >>>>> org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:168) >>>>> ~[flink-dist_2.12-1.11.1.jar:1.11.1] >>>>> >>>>> I have confirmed that something is wrong in my application causing >>>>> this error. However, it is hard to spot the issue visually and a little >>>>> tricky to debug in IDE (e.g. intellij). For example, if I can create an >>>>> application in Intellij and step through statefun library code and my >>>>> code, >>>>> it will be easier to find the root cause. Any guidance on how to set this >>>>> up? Appreciate any hint. Thanks! >>>>> >>>> >> >> -- >> >> Create your own email signature >> <https://www.wisestamp.com/signature-in-email/?utm_source=promotion&utm_medium=signature&utm_campaign=create_your_own&srcid=5234462839406592> >> > -- Create your own email signature <https://www.wisestamp.com/signature-in-email/?utm_source=promotion&utm_medium=signature&utm_campaign=create_your_own&srcid=5234462839406592>