无法解析为某个值的替换:AWS Lambda 中的 ${akka.stream.materializer}

我有一个java应用程序,其中我正在使用.因此,基本上,我试图用代码做的是创建两个记录很少的数据集,然后将它们与必要的字段一起注册为两个表。Flink Api

 DataSet<Company> comp = env.fromElements(
                new Company("Aux", 1),
                new Company("Comp2", 2),
                new Company("Comp3", 3));

        DataSet<Employee> emp = env.fromElements(
                new Employee("Kula", 1),
                new Employee("Ish", 1),
                new Employee("Kula", 3));


        tEnv.registerDataSet("Employee", emp, "name, empId");
        tEnv.registerDataSet("Company", comp, "cName, empId");

然后我尝试使用:Table API

Table anotherJoin = tEnv.sql("SELECT Employee.name, Employee.empId, Company.cName FROM " +
                "Employee RIGHT JOIN Company on Employee.empId = Company.empId");

我只是在控制台上打印结果。这在我的机器上完全本地工作。我通过使用依赖项创建了一个,并且我正在尝试在AWS中执行它。fat-jarmaven-shade-pluginLambda

因此,当我尝试在那里执行它时,我被抛出以下异常(我只发布前几行):

reference.conf @ file:/var/task/reference.conf: 804: 无法解析对某个值的替换: ${akka.stream.materializer}: com.typesafe.config.ConfigException$UnresolvedSubstitution com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf @ file:/var/task/reference.conf: 804: 无法解析对值的替换: ${akka.stream.materializer} at com.typesafe.config.impl.ConfigReference.resolveSubstitutions(ConfigReference.java:111) atcom.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179) at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)

在 Lambda 中执行之前,我提取了 jar,碰巧看到所有依赖项都在那里。我不知道哪里出了问题?

任何帮助都可以表示赞赏。


答案 1

您需要在pom->maven-shaded-plugin->配置部分添加此代码:

<transformers>
    <!-- append default configs -->
    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
        <resource>reference.conf</resource>
    </transformer>
</transformers>

答案 2

终于能够弄清楚这一点,这是我的pom中的一些主要版本问题。然后,我将所有依赖项降级到插件中,并在插件中添加。它现在工作。我正在附加整个pom,以便有一天它会帮助某人:Flink 1.3.2<relocations>shade

<build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.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.ink.FlinkLambdaTest.FlinkToLambda</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>

<dependencies>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-table_2.10</artifactId>
      <version>1.3.2</version>
    </dependency>

    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-java</artifactId>
      <version>1.3.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-java_2.10</artifactId>
      <version>1.3.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-clients_2.10</artifactId>
      <version>1.3.2</version>
    </dependency>

    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-scala_2.10</artifactId>
      <version>1.3.2</version>
    </dependency>

    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-scala_2.10</artifactId>
      <version>1.3.2</version>
    </dependency>

    </dependencies>

确保使用您的主类更改主类


推荐