Flink:jar文件中找不到程序的入口点类

如何解决Flink:jar文件中找不到程序的入口点类

我正在尝试将 Flink 有状态函数部署为 flink jar,并且我按照说明 here 进行了操作。但是,我收到错误消息,说即使在我的 pom 中添加了依赖项之后,也没有在 jar 中找到程序入口点类。

运行:

bin/flink run -c org.apache.flink.statefun.flink.core.StatefulFunctionsJob flink-statefun/statefun-examples/statefun-greeter-example/target/statefun-greeter-example-2.3-SNAPSHOT.jar

产生以下错误

org.apache.flink.client.program.ProgramInvocationException: The program's entry point class 'org.apache.flink.statefun.flink.core.StatefulFunctionsJob' was not found in the jar file.
    at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:389)
    at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:139)
    at org.apache.flink.client.program.PackagedProgram.<init>(PackagedProgram.java:61)
    at org.apache.flink.client.program.PackagedProgram$Builder.build(PackagedProgram.java:557)
    at org.apache.flink.client.cli.CliFrontend.buildProgram(CliFrontend.java:726)
    at org.apache.flink.client.cli.CliFrontend.getPackagedProgram(CliFrontend.java:242)
    at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:223)
    at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:916)
    at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:992)
    at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
    at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:992)
Caused by: java.lang.classNotFoundException: org.apache.flink.statefun.flink.core.StatefulFunctionsJob
    at java.net.urlclassloader.findClass(urlclassloader.java:382)
    at java.lang.classLoader.loadClass(ClassLoader.java:418)
    at org.apache.flink.util.FlinkUserCodeClassLoader.loadClassWithoutExceptionHandling(FlinkUserCodeClassLoader.java:61)
    at org.apache.flink.util.ChildFirstClassLoader.loadClassWithoutExceptionHandling(ChildFirstClassLoader.java:65)
    at org.apache.flink.util.FlinkUserCodeClassLoader.loadClass(FlinkUserCodeClassLoader.java:48)
    at java.lang.classLoader.loadClass(ClassLoader.java:351)
    at java.lang.class.forName0(Native Method)
    at java.lang.class.forName(Class.java:348)
    at org.apache.flink.client.program.PackagedProgram.loadMainClass(PackagedProgram.java:387)
    ... 10 more

这是我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License,Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,software distributed under the License is distributed on an
"AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND,either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>statefun-examples</artifactId>
        <groupId>org.apache.flink</groupId>
        <version>2.3-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>statefun-greeter-example</artifactId>

    <dependencies>
        
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>statefun-sdk</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>statefun-kafka-io</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>statefun-flink-core</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <!-- The following exclusion is needed since this artifacts pulls two different versions
                     of slf4j,and thus failing the maven convergence plugging.
                 -->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>statefun-flink-distribution</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <!-- The following exclusion is needed since this artifacts pulls two different versions
                     of slf4j,and thus failing the maven convergence plugging.
                 -->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.8.0</version>
        </dependency>
        
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.os72</groupId>
                <artifactId>protoc-jar-maven-plugin</artifactId>
                <version>${protoc-jar-maven-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <excludePackageNames>org.apache.flink.statefun.examples.greeter.generated</excludePackageNames>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
</project>

pom 文件的原始版本可以在这里找到

Original (No rotate)

添加 statefun-flink-distribution 的额外依赖似乎没有效果。有什么建议吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?