コードに含まれていないがマックでコマンド+ F9を使用してジェネリック型パラメータがFLINK-CEPにパターンを検出するためのFLINK-CEP
// Generate temperature warnings for each matched warning pattern
DataStream<TemperatureEvent> warnings = tempPatternStream.select(
(Map<String, MonitoringEvent> pattern) -> {
TemperatureEvent first = (TemperatureEvent) pattern.get("first");
return new TemperatureEvent(first.getRackID(), first.getTemperature()) ;
}
);
の下に表示され、次のエラーが
を示していますException in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: The generic type parameters of 'Map' are missing.
It seems that your compiler has not stored them into the .class file.
Currently, only the Eclipse JDT compiler preserves the type information necessary to use the lambdas feature type-safely.
See the documentation for more information about how to compile jobs containing lambda expressions.
at org.apache.flink.api.java.typeutils.TypeExtractor.validateLambdaGenericParameter(TypeExtractor.java:1316)
at org.apache.flink.api.java.typeutils.TypeExtractor.validateLambdaGenericParameters(TypeExtractor.java:1302)
at org.apache.flink.api.java.typeutils.TypeExtractor.getUnaryOperatorReturnType(TypeExtractor.java:346)
at org.apache.flink.cep.PatternStream.select(PatternStream.java:64)
at org.stsffap.cep.monitoring.CEPMonitoring.main(CEPMonitoring.java:85
しかしusign mvn clean install
を構築し、コントロール+ Rの出力を示し介して実行して、
なぜこれはいつも起こっているのだろうか?
これを行う方法はありますか?
PS:ただし、私はeclipse JDT Pluginを使用していますが、ログにエラーが表示されています。 pom.xmlの内容は、
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerId>jdt</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>0.21.0</version>
</dependency>
</dependencies>
</plugin>
提案は、あなたのjdk
バージョンを確認し、
残念ながら、私も同じ問題に直面しています。問題は、Eclipse JDTコンパイラを使用してプロジェクトを構築する必要があり、IntelliJまたはEclipse以外の他のIDEを使用している可能性があるため、コードを変更してください。それ以外の場合は、型情報を削除するデフォルトのコンパイラが使用されます。 今のところ毎週Mavenを使用したビルドが唯一の解決策です(AFAIK) –