1. java.sql.SQLException: No suitable driver
这个错误是因为,连接Redshift时需要一个driver,而程序执行时找不到能用的driver,所以报错。AWS提供了多个版本连接Redshift的driver,点击查看。
2. java.lang.NoClassDefFoundError: com/amazonaws/services/kinesis/model/Record
经过几次尝试发现,直接使用AWS提供的驱动可以连上Redshift,打印出表结构,但是不能加载数据,一加载数据会报这个奇怪的错误,表结构都可以打印出来,为什么不能加载数据呢?我想不通。几番查询,找到了一个包装库,github地址。
3. java.lang.IllegalArgumentException: AWS Access Key ID and Secret Access Key must be specified as the username or password (respectively) of a s3n URL, or by setting the fs.s3n.awsAccessKeyId or fs.s3n.awsSecretAccessKey properties (respectively).
按照2里面的github库里的文档说明配置好后,可能会报这个错。因为spark-redshift用到了S3,所以要配置key和secret才可以。文档里也提供了几种方式&#