amazon-redshift 相关问题

Amazon Redshift是一种PB级数据仓库服务,它使用现有的商业智能工具来分析数据。 Redshift是一个基于ParAccel的面向列的MPP数据库

SQL 查询电话号码 IN [已关闭]

对于 3000 个号码运行 WHERE Phone_number IN ('phone_number_1', 'phone_number_2', ..., 'phone_number_n') 是否安全? 运行它并等待很长的时间 来自“x”。“成员” 哪里

回答 1 投票 0

使用 Spark 写入 Redshift 时 AWS Glue 出错:ORA-01722:无效数字

我正在尝试使用 Pyspark 从 Oracle 数据库读取数据并写入 Redshift 表 # 从Oracle中读取数据 oracle_df = Spark.read \ .format("jdbc") \ .选项(“网址”,

回答 1 投票 0

如何使用 Boto3 恢复 Redshift 快照?

我正在尝试使用 Boto3 以编程方式恢复 Redshift 快照,但我不确定从哪里获取执行此操作的所有详细信息。这是文档:https://boto3.amazonaws.com/v1/documen...

回答 1 投票 0

redshift 选择包含 NULL 的不同行(按列分组)

从包含 5 亿条记录的表中获取不同记录的最佳方法是什么?表结构为id1、id2、id3、upload_date。样本数据 id1 id2 id3 上传日期 1 张 ab cd ...

回答 1 投票 0

如何通过 AWS API 确定 Redshift 集群的 ARN?

我正在尝试使用 CreateTags 将标签添加到 Redshift 集群,http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateTags.html,您会注意到它需要资源的 ARN 。 布...

回答 3 投票 0

Redshift 托管 VPC 端点

我正在尝试创建 Redshift 管理的 VPC 端点,但在屏幕上我无法选择我的集群 ID,事实上,列表是空的。 我想在我的

回答 1 投票 0

Amazon Redshift unnest(array[]) 不可用

我们之前使用的是天蓝色数据库并迁移到亚马逊红移,所以我正在移动报告查询。我有相当多的 unnest(array[]) 函数,但我不确定...

回答 1 投票 0

C# 中的 Redshift 查询超时

我在 AWS 上有一个 Redshift 实例。 我的应用程序在与 Redshift 集群位于同一区域的 EC2 上作为 Windows 服务运行。我有一个查询,平均需要约 45 秒和红移

回答 4 投票 0

在单个查询中查询两个独立的 Redshift 集群?

我正在设计我的数据库结构,想知道是否可以针对两个单独的 Redshift 集群运行单个查询? 如果可能的话,对区域、可用区、VPC 组等的任何限制...

回答 3 投票 0

在 Redshift 中查找分区内的非唯一值

我有一个 2B+ 行外部表,我正在使用 Redshift Spectrum 读取该表。有两个相关列 - key_col (BIGINT) 和partition_col (VARCHAR)。 partition_col 是分区列,并且...

回答 1 投票 0

AWS Redshift Workload Management 中的用户组和查询组有什么区别?

在 AWS Redshift 中手动实现查询队列时,我很难理解用户组和查询组之间的区别。实施上有何不同?

回答 2 投票 0

从表“tb2”中选择列“name”或“nm”,一次仅存在 1 列“name”或“nm”

在亚马逊红移表中,我需要从表 tb2 中选择列 以下条件: 表每天刷新,因此它将具有列“name”或“nm” 如果名称存在,则名称的值应...

回答 1 投票 0

如何解决 Redshift 存储过程中无法将类型整数转换为日期的问题?

我有一个过程,我正在使用 call cross_ref_var_procedure('2023-05-31'::date,'2023-05-08'::Date,aws_access_key,aws_secret_key) 调用该过程。 我收到的错误为 SQL 错误 [42846]:

回答 1 投票 0

在 Redshift 中使用按子句分区时,日期值格式无效

我在红移方面面临一个新问题。当我尝试在 row_number 函数中使用 Partition by 子句时,我想要的日期转换格式无效。 前任: 选择 日期_列, To_char(

回答 1 投票 0

将 parquet 文件加载到 redshift 时如何格式化时间戳字段?

我有一堆带有不同格式的时间戳字段的镶木地板文件。我想在将数据加载到红移表时统一格式。但下面的语法不起作用,它会抛出...

回答 2 投票 0

Redshift:如果子查询中不匹配,则字段默认为零

当使用 * 而不是命名字段并使用 NVL 或 COALESCE 时没有返回结果时,有什么方法可以将子查询聚合函数中的字段值默认为零吗? 例如她...

回答 1 投票 0

错误:XX000:无法在 redshift 上创建物化视图

大家好, 我正在尝试创建一个物化视图并命令抛出以下错误。红移物化视图有什么限制吗?请在这里帮助我。 **错误:XX000:

回答 1 投票 0

Redshift - 字符串列被截断

我们利用 AWS Glue 爬网程序提取存储在 Amazon S3 中的 Parquet 文件。爬网程序检测 Parquet 文件的架构和元数据,并在 Amazon Redshift 中创建外部架构/表....

回答 2 投票 0

从根用户在 Redshift Serverless 中安排查询时,没有显示 IAM 角色

我正在尝试使用查询调度程序 v2 在 Redshift Serverless 中安排查询。 我创建了一个角色 copy-s3-to-redshift,权限为 AmazonEventBridgeFullAccess AmazonRedshiftDataFullAc...

回答 1 投票 0

尝试连接到亚马逊红移驱动程序时出现“Caused by: java.lang.ClassNotFoundException: java.sql.SQLException”

下面是POM依赖 com.amazon.redshift redshift-jdbc42 下面是POM依赖 <dependency> <groupId>com.amazon.redshift</groupId> <artifactId>redshift-jdbc42</artifactId> <version>2.1.0.28</version> </dependency> 数据库连接代码包含在以下路径中 src -> main -> utils -> DatabaseConnection.java import java.sql.Driver; import java.util.Properties; import java.sql.*; public class DatabaseConnection { Logger logger = LoggerFactory.getLogger(DatabaseConnection.class); Connection connection = null; Properties props = new Properties(); public void getDataBaseConnection() { try { Class.forName("com.amazon.redshift.jdbc42.Driver"); logger.info("Connecting to database..."); String jdbcUrl = "jdbc:redshift://endpoint:port/dbname"; String dbUsername = "username"; String dbPassword = "password"; jdbcUrl = jdbcUrl + "?AccessKeyID=" + dbUsername + "&SecretAccessKey=" + dbPassword + "&DbUser=admin&ssl=true&tcpKeepAlive=true"; props.setProperty("ssl", "true"); props.setProperty("user", dbUsername); props.setProperty("password", dbPassword); connection = DriverManager.getConnection(jdbcUrl, props); if (connection != null) { logger.info("Connected to the database!"); } else { logger.info("Failed to make connection!"); } } catch (Exception e) { e.printStackTrace(); } } } 并在testng文件的以下路径中调用上面的代码 src->测试->java->测试->名称->sample_test.java import utils.DatabaseConnection; public class sample_test extends TestBase { DatabaseConnection dbconn = new DatabaseConnection(); @Test public void db_test(){ dbconn.getDataBaseConnection(); } } 执行上述操作后,出现以下错误 at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) Caused by: org.apache.maven.plugin.MojoFailureException: Exception in provider at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException (SurefirePlugin.java:328) at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary (SurefirePlugin.java:318) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:892) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:755) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) Caused by: org.apache.maven.surefire.booter.SurefireExecutionException: Exception in provider at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess (InPluginVMSurefireStarter.java:87) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider (AbstractSurefireMojo.java:1010) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:862) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:755) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) Caused by: org.testng.TestNGException: Cannot instantiate class tests.name.sample_test at org.testng.internal.objects.InstanceCreator.newInstance (InstanceCreator.java:41) at org.testng.ITestObjectFactory.newInstance (ITestObjectFactory.java:18) at org.testng.internal.objects.SimpleObjectDispenser.instantiateUsingDefaultConstructor (SimpleObjectDispenser.java:178) at org.testng.internal.objects.SimpleObjectDispenser.createInstance (SimpleObjectDispenser.java:87) at org.testng.internal.objects.SimpleObjectDispenser.dispense (SimpleObjectDispenser.java:40) at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense (GuiceBasedObjectDispenser.java:28) at org.testng.internal.ClassImpl.getDefaultInstance (ClassImpl.java:106) at org.testng.internal.ClassImpl.getInstances (ClassImpl.java:136) at org.testng.TestClass.getInstances (TestClass.java:129) at org.testng.TestClass.initTestClassesAndInstances (TestClass.java:109) at org.testng.TestClass.init (TestClass.java:101) at org.testng.TestClass.<init> (TestClass.java:66) at org.testng.TestRunner.initMethods (TestRunner.java:465) at org.testng.TestRunner.init (TestRunner.java:333) at org.testng.TestRunner.init (TestRunner.java:286) at org.testng.TestRunner.<init> (TestRunner.java:176) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner (SuiteRunner.java:635) at org.testng.SuiteRunner.init (SuiteRunner.java:221) at org.testng.SuiteRunner.<init> (SuiteRunner.java:114) at org.testng.TestNG.createSuiteRunner (TestNG.java:1338) at org.testng.TestNG.createSuiteRunners (TestNG.java:1314) at org.testng.TestNG.runSuitesLocally (TestNG.java:1160) at org.testng.TestNG.runSuites (TestNG.java:1092) at org.testng.TestNG.run (TestNG.java:1060) at org.apache.maven.surefire.testng.TestNGExecutor.run (TestNGExecutor.java:132) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass (TestNGDirectoryTestSuite.java:112) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute (TestNGDirectoryTestSuite.java:99) at org.apache.maven.surefire.testng.TestNGProvider.invoke (TestNGProvider.java:147) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2 (ReflectionUtils.java:202) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke (ProviderFactory.java:155) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider (ProviderFactory.java:81) at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess (InPluginVMSurefireStarter.java:82) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider (AbstractSurefireMojo.java:1010) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:862) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:755) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) Caused by: java.lang.reflect.InvocationTargetException at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance (Constructor.java:490) at org.testng.internal.objects.InstanceCreator.newInstance (InstanceCreator.java:38) at org.testng.ITestObjectFactory.newInstance (ITestObjectFactory.java:18) at org.testng.internal.objects.SimpleObjectDispenser.instantiateUsingDefaultConstructor (SimpleObjectDispenser.java:178) at org.testng.internal.objects.SimpleObjectDispenser.createInstance (SimpleObjectDispenser.java:87) at org.testng.internal.objects.SimpleObjectDispenser.dispense (SimpleObjectDispenser.java:40) at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense (GuiceBasedObjectDispenser.java:28) at org.testng.internal.ClassImpl.getDefaultInstance (ClassImpl.java:106) at org.testng.internal.ClassImpl.getInstances (ClassImpl.java:136) at org.testng.TestClass.getInstances (TestClass.java:129) at org.testng.TestClass.initTestClassesAndInstances (TestClass.java:109) at org.testng.TestClass.init (TestClass.java:101) at org.testng.TestClass.<init> (TestClass.java:66) at org.testng.TestRunner.initMethods (TestRunner.java:465) at org.testng.TestRunner.init (TestRunner.java:333) at org.testng.TestRunner.init (TestRunner.java:286) at org.testng.TestRunner.<init> (TestRunner.java:176) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner (SuiteRunner.java:635) at org.testng.SuiteRunner.init (SuiteRunner.java:221) at org.testng.SuiteRunner.<init> (SuiteRunner.java:114) at org.testng.TestNG.createSuiteRunner (TestNG.java:1338) at org.testng.TestNG.createSuiteRunners (TestNG.java:1314) at org.testng.TestNG.runSuitesLocally (TestNG.java:1160) at org.testng.TestNG.runSuites (TestNG.java:1092) at org.testng.TestNG.run (TestNG.java:1060) at org.apache.maven.surefire.testng.TestNGExecutor.run (TestNGExecutor.java:132) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass (TestNGDirectoryTestSuite.java:112) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute (TestNGDirectoryTestSuite.java:99) at org.apache.maven.surefire.testng.TestNGProvider.invoke (TestNGProvider.java:147) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2 (ReflectionUtils.java:202) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke (ProviderFactory.java:155) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider (ProviderFactory.java:81) at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess (InPluginVMSurefireStarter.java:82) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider (AbstractSurefireMojo.java:1010) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:862) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:755) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) Caused by: java.lang.NoClassDefFoundError: java/sql/SQLException at tests.name.sample_test.<init> (sample_test.java:30) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance (Constructor.java:490) at org.testng.internal.objects.InstanceCreator.newInstance (InstanceCreator.java:38) at org.testng.ITestObjectFactory.newInstance (ITestObjectFactory.java:18) at org.testng.internal.objects.SimpleObjectDispenser.instantiateUsingDefaultConstructor (SimpleObjectDispenser.java:178) at org.testng.internal.objects.SimpleObjectDispenser.createInstance (SimpleObjectDispenser.java:87) at org.testng.internal.objects.SimpleObjectDispenser.dispense (SimpleObjectDispenser.java:40) at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense (GuiceBasedObjectDispenser.java:28) at org.testng.internal.ClassImpl.getDefaultInstance (ClassImpl.java:106) at org.testng.internal.ClassImpl.getInstances (ClassImpl.java:136) at org.testng.TestClass.getInstances (TestClass.java:129) at org.testng.TestClass.initTestClassesAndInstances (TestClass.java:109) at org.testng.TestClass.init (TestClass.java:101) at org.testng.TestClass.<init> (TestClass.java:66) at org.testng.TestRunner.initMethods (TestRunner.java:465) at org.testng.TestRunner.init (TestRunner.java:333) at org.testng.TestRunner.init (TestRunner.java:286) at org.testng.TestRunner.<init> (TestRunner.java:176) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner (SuiteRunner.java:635) at org.testng.SuiteRunner.init (SuiteRunner.java:221) at org.testng.SuiteRunner.<init> (SuiteRunner.java:114) at org.testng.TestNG.createSuiteRunner (TestNG.java:1338) at org.testng.TestNG.createSuiteRunners (TestNG.java:1314) at org.testng.TestNG.runSuitesLocally (TestNG.java:1160) at org.testng.TestNG.runSuites (TestNG.java:1092) at org.testng.TestNG.run (TestNG.java:1060) at org.apache.maven.surefire.testng.TestNGExecutor.run (TestNGExecutor.java:132) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass (TestNGDirectoryTestSuite.java:112) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute (TestNGDirectoryTestSuite.java:99) at org.apache.maven.surefire.testng.TestNGProvider.invoke (TestNGProvider.java:147) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2 (ReflectionUtils.java:202) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke (ProviderFactory.java:155) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider (ProviderFactory.java:81) at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess (InPluginVMSurefireStarter.java:82) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider (AbstractSurefireMojo.java:1010) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:862) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:755) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) Caused by: java.lang.ClassNotFoundException: java.sql.SQLException at java.net.URLClassLoader.findClass (URLClassLoader.java:476) at java.lang.ClassLoader.loadClass (ClassLoader.java:588) at java.lang.ClassLoader.loadClass (ClassLoader.java:521) at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass (IsolatedClassLoader.java:97) at tests.name.sample_test.<init> (sample_test.java:30) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance (Constructor.java:490) at org.testng.internal.objects.InstanceCreator.newInstance (InstanceCreator.java:38) at org.testng.ITestObjectFactory.newInstance (ITestObjectFactory.java:18) at org.testng.internal.objects.SimpleObjectDispenser.instantiateUsingDefaultConstructor (SimpleObjectDispenser.java:178) at org.testng.internal.objects.SimpleObjectDispenser.createInstance (SimpleObjectDispenser.java:87) at org.testng.internal.objects.SimpleObjectDispenser.dispense (SimpleObjectDispenser.java:40) at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense (GuiceBasedObjectDispenser.java:28) at org.testng.internal.ClassImpl.getDefaultInstance (ClassImpl.java:106) at org.testng.internal.ClassImpl.getInstances (ClassImpl.java:136) at org.testng.TestClass.getInstances (TestClass.java:129) at org.testng.TestClass.initTestClassesAndInstances (TestClass.java:109) at org.testng.TestClass.init (TestClass.java:101) at org.testng.TestClass.<init> (TestClass.java:66) at org.testng.TestRunner.initMethods (TestRunner.java:465) at org.testng.TestRunner.init (TestRunner.java:333) at org.testng.TestRunner.init (TestRunner.java:286) at org.testng.TestRunner.<init> (TestRunner.java:176) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner (SuiteRunner.java:635) at org.testng.SuiteRunner.init (SuiteRunner.java:221) at org.testng.SuiteRunner.<init> (SuiteRunner.java:114) at org.testng.TestNG.createSuiteRunner (TestNG.java:1338) at org.testng.TestNG.createSuiteRunners (TestNG.java:1314) at org.testng.TestNG.runSuitesLocally (TestNG.java:1160) at org.testng.TestNG.runSuites (TestNG.java:1092) at org.testng.TestNG.run (TestNG.java:1060) at org.apache.maven.surefire.testng.TestNGExecutor.run (TestNGExecutor.java:132) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass (TestNGDirectoryTestSuite.java:112) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute (TestNGDirectoryTestSuite.java:99) at org.apache.maven.surefire.testng.TestNGProvider.invoke (TestNGProvider.java:147) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2 (ReflectionUtils.java:202)) 注意:如果我使用 main() 方法执行,代码可以正常工作。但是用上面的配置运行就失败了。 它应该与数据库连接 您使用什么版本的 JDK 来运行该程序?

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.