我正在尝试在 Google Cloud Dataflow 上部署一个简单的管道(将一些数据从 PubSub 复制到 Bigtable),但我不断收到以下错误:
Exception in thread "main"
java.lang.StackOverflowError
at java.util.HashMap.hash(HashMap.java:338)
at java.util.HashMap.get(HashMap.java:556)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:67)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
[ multiple times ... ]
at org.apache.log4j.Category.<init>(Category.java:57)
at org.apache.log4j.Logger.<init>(Logger.java:37)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:43)
at org.apache.log4j.LogManager.getLogger(LogManager.java:45)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
java failed with exit status 1
这个错误会杀死工人。即使我的代码中没有日志记录语句或导入,并且实际上堆栈跟踪中没有引用我的代码,也会发生这种情况。我很熟悉这个问题,我可以看到(在 GCP Stackdriver 中)我的 Java命令确实 包含:log4j_to_slf4j.jar
java -Xmx5834483752 -XX:-OmitStackTraceInFastThrow -Xloggc:/var/log/dataflow/jvm-gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=2 -XX:GCLogFileSize=512K -cp /opt/google/dataflow/streaming/libWindmillServer.jar:/opt/google/dataflow/streaming/dataflow-worker.jar:/opt/google/dataflow/slf4j/jcl_over_slf4j.jar:/opt/google/dataflow/slf4j/log4j_over_slf4j.jar:/opt/google/dataflow/slf4j/log4j_to_slf4j.jar: ...
问题是这个 Java 命令是由谷歌创建的。不在log4j_to_slf4j.jar我自己的依赖项中。如何编辑此命令并将其从类路径中删除?或者有更好的解决方案吗?
蝴蝶刀刀
相关分类