我正在开发一个使用 H2 数据库的应用程序。过去使用此技术没有问题,但是在下载 h2 数据库的新副本并运行 jar 时,我无法使用默认设置登录!我正在跑步h2-1.4.200.jar并受到以下欢迎:
General error: "java.lang.IllegalStateException: Unable to read the page at position 2199023614787 [1.4.200/6]" [50000-200] HY000/50000 (Help)
Run Code Online (Sandbox Code Playgroud)
我试图运行默认设置只是为了连接到数据库,但似乎没有任何效果。我已经尝试了以下但没有运气,以及 github 等上的一些其他来源:
嵌入式 H2 数据库“NonTransientError: Unable to read the page at position”错误?
我在我的项目中使用以下依赖项:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
并下载相应版本的H2数据库—— 1.4.200
过去有没有其他人在 H2 数据库上遇到过这样的问题?我收到的错误如下图所示:
H2 数据库控制台错误 1:


任何帮助将不胜感激,我还尝试在我的 maven 依赖项和运行的 h2 版本中降级到 1.4.190 版本 - h2-1.4.190!
我写了一个Java类,它使用硒webdriver快速通过网站并测试各种功能。我还编写了一个单独的类,该类将用于执行takeScreenshot()方法。一旦测试命中执行屏幕截图方法的代码,浏览器就会关闭,J-Unit测试失败,并指向我正在调用takeScreenshot()方法的行。这是一个空指针异常,但我无法弄清楚出了什么问题。.我已经阅读了很多文章,也找不到答案。我已经阅读了这里的所有文章,这些文章确定了如何使用硒来截屏...代码如下:
****屏幕截图类****
public class Screenshot {
private WebDriver webDriver;
File source;
public void takeScreenshot() {
try {
source = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(source, new File ("/Users/joshuadunn/Desktop/claimsScreenShot.png"));
System.out.println("Screenshot Taken!!!!");
} catch (IOException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后,我创建一个Screenshot对象并执行其takeScreenshot()方法,如下所示:
@Test
public void testClaimsTestToCalcNode() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.id("becsStartCalculator")).click();
driver.findElement(By.id("MARITAL_STATUS_false")).click();
driver.findElement(By.id("btn_next")).click();
driver.findElement(By.id("HOME_ABROAD_false")).click();
*** This is where the null pointer is ***
*******************************
screenshot.takeScreenshot();
*******************************
driver.findElement(By.id("btn_next")).click();
driver.findElement(By.id("DETAILS_STUDENT_YOU_false")).click();
Run Code Online (Sandbox Code Playgroud)
希望你能理解我的问题!
编辑****-这不是重复的。我完全知道什么是空指针以及如何将其固定。显然,我的代码中的某些内容通过null传递,但我不知道...下面的屏幕快照是我得到的唯一错误(stacktrace)