服务注册中心 java反射机制 RabbitMQ 二代征信 function canvas icons vue注册组件 vue全局组件 admin框架 react脚手架 android实战项目 ipex接口 matlab区分大小写吗 matlab图像滤波 java取绝对值 pyhton中异常和模块 python迭代器 python加法 python下载安装教程 python文件 python条件判断 javaswitch java中substring java访问数据库 java运行环境配置 linux目录 电子书之家 rendercontrol beatedit 电子书制作软件 微信昵称找人的软件 汉仪文黑 天正建筑2007 流程图制作工具 pr动态字幕 平面设计软件下载 海蜘蛛软路由 字典生成器 鼠标速度怎么调
当前位置: 首页 > 学习教程  > 编程语言

flink 项目打包成jar运行异常

2020/12/28 19:32:17 文章标签:

flink项目打包成jar运行后,报如下错误。 Exception in thread "main" com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf jar:file:/D:/ProjectCode/flinkdemo/target/flinkdemo-1.0-SNAPSHOT-jar-with-dependencies.jar!/r…

flink项目打包成jar运行后,报如下错误。

Exception in thread "main" com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf @ jar:file:/D:/ProjectCode/flinkdemo/target/flinkdemo-1.0-SNAPSHOT-jar-with-dependencies.jar!/reference.conf: 875: Could not resolve substitution to a value: ${akka.stream.materializer}
        at com.typesafe.config.impl.ConfigReference.resolveSubstitutions(ConfigReference.java:111)
        at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
        at com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
        at com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)
        at com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:398)
        at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
        at com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
        at com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)
        at com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:398)
        at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
        at com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
        at com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)
        at com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:398)
        at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
        at com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
        at com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)
        at com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:398)
        at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
        at com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:379)
        at com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:312)
        at com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:398)
        at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)
        at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:231)
        at com.typesafe.config.impl.SimpleConfig.resolveWith(SimpleConfig.java:78)
        at com.typesafe.config.impl.SimpleConfig.resolve(SimpleConfig.java:68)
        at com.typesafe.config.impl.SimpleConfig.resolve(SimpleConfig.java:63)
        at com.typesafe.config.impl.SimpleConfig.resolve(SimpleConfig.java:41)
        at com.typesafe.config.impl.ConfigImpl$1.call(ConfigImpl.java:371)
        at com.typesafe.config.impl.ConfigImpl$1.call(ConfigImpl.java:364)
        at com.typesafe.config.impl.ConfigImpl$LoaderCache.getOrElseUpdate(ConfigImpl.java:65)
        at com.typesafe.config.impl.ConfigImpl.computeCachedConfig(ConfigImpl.java:92)
        at com.typesafe.config.impl.ConfigImpl.defaultReference(ConfigImpl.java:364)
        at com.typesafe.config.ConfigFactory.defaultReference(ConfigFactory.java:367)
        at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:308)
        at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:686)
        at akka.actor.RobustActorSystem.<init>(RobustActorSystem.scala:47)
        at akka.actor.RobustActorSystem$.internalApply(RobustActorSystem.scala:96)
        at akka.actor.RobustActorSystem$.apply(RobustActorSystem.scala:70)
        at akka.actor.RobustActorSystem$.create(RobustActorSystem.scala:55)
        at org.apache.flink.runtime.akka.AkkaUtils$.createActorSystem(AkkaUtils.scala:125)
        at org.apache.flink.runtime.akka.AkkaUtils$.createActorSystem(AkkaUtils.scala:113)
        at org.apache.flink.runtime.akka.AkkaUtils.createActorSystem(AkkaUtils.scala)
        at org.apache.flink.runtime.minicluster.MiniCluster.createRpcService(MiniCluster.java:743)
        at org.apache.flink.runtime.minicluster.MiniCluster.start(MiniCluster.java:270)
        at org.apache.flink.client.deployment.executors.LocalExecutor.startMiniCluster(LocalExecutor.java:117)
        at org.apache.flink.client.deployment.executors.LocalExecutor.execute(LocalExecutor.java:63)
        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1733)
        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1634)
        at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:74)
        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1620)
        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1602)
        at Application.main(Application.java:37)

网上试了好几种方式都不行,最后在stackoverflow上找到如下方法,可以正常运行。

在pom中添加如下内容。

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.spei.Application</mainClass>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>reference.conf</resource>
                            </transformer>
                        </transformers>
                        <relocations>
                            <relocation>
                                <pattern>org.codehaus.plexus.util</pattern>
                                <shadedPattern>org.shaded.plexus.util</shadedPattern>
                                <excludes>
                                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                                </excludes>
                            </relocation>
                        </relocations>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

注意以上配置文件在实际使用中,需要修改以下的入口启动类为你项目的入口启动类。    

<mainClass>com.spei.Application</mainClass>

修改成你的!
 


本文链接: http://www.dtmao.cc/news_show_550284.shtml

附件下载

相关教程

    暂无相关的数据...

共有条评论 网友评论

验证码: 看不清楚?