Ich habe ein Spring-Boot-Maven-Projekt mit Apache Drill erstellt und bin in der Lage, die Daten aus der Datei erfolgreich abzufragen. Als ich versuchte, das Projekt auf PCF bereitzustellen, stürzte jedes Mal, wenn meine Instanz mehrere slf4j
Bindings abstürzte.Apache Drill Deployment auf Pivotal Cloud Flow
@SpringBootApplication
public class Drill {
static final String JDBC_DRIVER = "org.apache.drill.jdbc.Driver";
public static final String DRILL_JDBC_LOCAL_URI = "jdbc:drill:drillbit=xx.xx.xxx.xx;
public static void main(String[] args) throws IOException {
SpringApplication.run(Drill.class, args);
boolean result = false;
try {
result = sqlResult();
} catch (FileNotFoundException e) {
//TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(result);
}
public static boolean sqlResult() throws IOException {
try {
Class.forName(JDBC_DRIVER);
} catch (ClassNotFoundException ce) {
ce.printStackTrace();
}
long d = 1;
try {
Connection conn = DriverManager.getConnection(DRILL_JDBC_LOCAL_URI, "usrname","passwrd");
Statement stmt = conn.createStatement();
String sql = "select * from dfs.`/Users/system.user/Desktop/123.csv`";
ResultSet rs = stmt.executeQuery(sql);
long currentTimeMillis = System.currentTimeMillis();
while (rs.next()) {
System.out.println("columns: "+rs.getString(1));
d++;
}
long currentTimeMillisEnd = System.currentTimeMillis();
System.out.println(" start: "+currentTimeMillis+" end "+currentTimeMillisEnd +" size: "+d);
rs.close();
} catch (Exception se) {
System.out.println("last count is: "+d);
se.printStackTrace();
}
return false;
}
}
pom.xml:<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<org.slf4j-version>1.7.5</org.slf4j-version>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>jul-to-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.drill.exec</groupId>
<artifactId>drill-jdbc-all</artifactId>
<version>1.1.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>jul-to-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Dies ist die Fehlermeldung erhalte ich:
[ERR] SLF4J: Class path contains multiple SLF4J bindings.
[ERR] SLF4J: Found binding in [jar:file:/home/vcap/app/BOOT-INF/lib/drill-jdbc-all-1.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[ERR] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[ERR] SLF4J: Found binding in [jar:file:/home/vcap/app/BOOT-INF/lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[ERR] SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
[ERR] Exception in thread "main" java.lang.reflect.InvocationTargetException
[ERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERR] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
[ERR] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
[ERR] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
[ERR] Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.readValue(Ljava/lang/String;Lcom/fasterxml/jackson/core/type/TypeReference;)Ljava/lang/Object;
[ERR] at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
[ERR] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
[ERR] at pack.drill.Drill.main(Drill.java:26)
ich die mögliche Hilfe all auf Netz zur Verfügung versucht, aber ich bin nicht in der Lage, das Problem zu verstehen. Ich verstehe nicht, warum es in einer lokalen Umgebung einwandfrei funktioniert und warum es nicht einmal auf PCF bereitgestellt wird.