hadoop configuration error in runtime with openjdk11

800 Views Asked by At

I am migrating our application to openjdk11 and with this setup my application is throwing below error. PLease help on this Note : With Jdk 1.8 the same code and configurations are working fine . Java version: openjdk 11 Springboot-hadoop : 2.4.0 RELEASE

application properties

        spring.hadoop.fsshell.enabled=false
        #hadoop security properties
        hadoop.config.key=hadoop.security.authentication
        hadoop.config.value=Kerberos
        #Hive connection properties
        hive.datasource.keytab=/config/security/sit.001.keytab
        hive.datasource.drivername=org.apache.hive.jdbc.HiveDriver
        hive.datasource.username=ssit.001
        #hive.datasource.password=password
        hive.truststore.file=/config/security/hivetrust.jks
        hive.krb5.conf=/config/security/krb5.conf
        hive.datasource.url=url
        hive.krb5.conf.debug.prop=sun.security.krb5.debug
        hive.krb5.conf.isdebug=true
            

Java changes

@Value("${hive.datasource.drivername}")
        private String driverName;
    
        @Value("${hive.datasource.url}")
        private String jdbcUrl;
    
        @Value("${hive.datasource.username}")
        private String userId;
    
        @Value("${hive.datasource.keytab}")
        private String keytab;
    
        @Value("${hive.krb5.conf}")
        private String kerberosConf;
    
        @Value("${hadoop.config.key}")
        public String hadoopConfigKey;
    
        @Value("${hadoop.config.value}")
        public String hadoopConfigValue;
    
        @Bean(name = "hiveDS")
        public DataSource configureHiveDataSource() throws IOException, ClassNotFoundException, SQLException {
            Connection con = null;
    
            // System.setProperty("hadoop.home.dir", hadoopHome);
            System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
            System.setProperty("java.security.krb5.conf", kerberosConf);
            org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();
            conf.set(hadoopConfigKey, hadoopConfigValue);
            UserGroupInformation.setConfiguration(conf);
            UserGroupInformation.loginUserFromKeytab(userId, keytab);
    
            Class.forName(driverName);
    
            con = DriverManager.getConnection(jdbcUrl);
            LOGGER.info("Hive Db Connected");
    
            DriverManagerDataSource dataSource = new DriverManagerDataSource();
            dataSource.setDriverClassName(driverName);
            dataSource.setUrl(jdbcUrl);
            return dataSource;
        }
        
        @Bean(name = "hiveJdbc")
        public JdbcTemplate getHiveJdbcTemplate(@Qualifier("hiveDS") DataSource hiveDS) {
            return new JdbcTemplate(hiveDS);
        }
        
        @Bean(name = "hiveNamedJdbc")
        public NamedParameterJdbcTemplate getHiveNamedJdbcTemplate(@Qualifier("hiveDS") DataSource hiveNamedDS) {
            return new NamedParameterJdbcTemplate(hiveNamedDS);
        }
    }
    

2021-04-28T21:18:18.829+0530 [main] ERROR o.s.d.h.c.c.a.AbstractConfiguredAnnotationBuilder - Failed to perform build. Returning null java.lang.IllegalArgumentException: Bean name must not be null at org.springframework.util.Assert.notNull(Assert.java:201) Error creating bean with name 'hadoopConfiguration' defined in class path resource [org/springframework/data/hadoop/config/annotation/configuration/SpringHadoopConfiguration.class]: Bean instantiation via factory method failed; nested exception is **org.springframework.beans.BeanInstantiationException: Failed to instantiate **[org.apache.hadoop.conf.Configuration]: Factory method 'configuration' threw exception; nested exception is java.lang.NullPointerException

0

There are 0 best solutions below