一·背景

操作系统:win10
dbeaver版本:5.2.2
一直用的好好的dbeaver突然不能正常使用了,下载新版本依然不行,提示:发生了错误。请参阅日志文件,

二·错误日志

来到提示的目录 C:\Users\bin.dbeaver4.metadata 查看.log错误日志 如下:

!SESSION 2018-10-08 17:23:58.845 -----------------------------------------------
eclipse.buildId=unknown
java.version=11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
Command-line arguments:  -os win32 -ws win32 -arch x86_64

!ENTRY org.jkiss.dbeaver.model 4 0 2018-10-08 17:24:00.778
!MESSAGE 尚未创建工作台。
!STACK 0
java.lang.IllegalStateException: 尚未创建工作台。
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
	at org.jkiss.dbeaver.core.application.DBeaverApplication.shutdown(DBeaverApplication.java:290)
	at org.jkiss.dbeaver.core.application.DBeaverApplication.start(DBeaverApplication.java:165)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)

!ENTRY org.eclipse.osgi.compatibility.state.nls 2 0 2018-10-08 17:24:00.808
!MESSAGE Could not resolve module: org.eclipse.osgi.compatibility.state.nls [241]
  Unresolved requirement: Fragment-Host: org.eclipse.osgi.compatibility.state
  Unresolved requirement: Fragment-Host: org.eclipse.osgi.compatibility.state


!ENTRY org.eclipse.core.filesystem.win32.x86_64.nls 2 0 2018-10-08 17:24:00.809
!MESSAGE Could not resolve module: org.eclipse.core.filesystem.win32.x86_64.nls [253]
  Unresolved requirement: Fragment-Host: org.eclipse.core.filesystem.win32.x86_64
  Unresolved requirement: Fragment-Host: org.eclipse.core.filesystem.win32.x86_64


!ENTRY org.eclipse.osgi 4 0 2018-10-08 17:24:00.824
!MESSAGE 应用程序错误
!STACK 1
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: 尚未创建工作台。)
	at org.eclipse.swt.SWT.error(SWT.java:4533)
	at org.eclipse.swt.SWT.error(SWT.java:4448)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4213)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3820)
	at org.eclipse.swt.widgets.Display.release(Display.java:3874)
	at org.eclipse.swt.graphics.Device.dispose(Device.java:298)
	at org.jkiss.dbeaver.core.application.DBeaverApplication.start(DBeaverApplication.java:174)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
Caused by: java.lang.IllegalStateException: 尚未创建工作台。
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
	at org.jkiss.dbeaver.core.WorkbenchContextListener.<init>(WorkbenchContextListener.java:57)
	at org.jkiss.dbeaver.core.WorkbenchContextListener.registerInWorkbench(WorkbenchContextListener.java:254)
	at org.jkiss.dbeaver.core.DBeaverUI.lambda$0(DBeaverUI.java:124)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	... 17 more

!ENTRY org.eclipse.e4.ui.workbench 4 0 2018-10-08 17:24:00.835
!MESSAGE FrameworkEvent ERROR
!STACK 0
java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
	at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
	at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
	at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
	at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99)
	at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168)
	at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
	at org.eclipse.osgi.container.Module.doStop(Module.java:634)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 21 more

简单分析一下错误日志
java.version=11 表示我使用的jdk版本,最近操作系统升级到了jdk11,dbeaver我下载的是外置jre版本,所以这里打印的版本是11。
关键异常信息:java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
PreDestroy 找不到是因为 Jdk9开始使用模块化,PreDestroy需要手动添加才可以支持。
我们来到dbeaver的根目录 打开 dbeaver.ini

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-showsplash
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
-Xms64m
-Xmx1024m

发现参数内 已经有了add-modules=ALL-SYSTEM 还是NoClassDefFoundError。不知道是不是dbeaver还不兼容jdk11 ,换其他的解决方案。

三·解决方案

打开dbeaver根目录下的readme.txt

  -f <sql-file1 [sql-file2..]>
    Open specified SQL file(s) in SQL editor.
    This command can be used to associate SQL files with DBeaver in shell.

  -nosplash
    Do not show splash screen

  -data <path>
    Store all projects/configuration in folder <path>. By default DBeaver
	stores all its data in user's home ".dbeaver4" folder.
	<path> can be an absolute or relative directory name.
	If you want to use DBeaver as redistributable program start it
	with arguments like "dbeaver -data workspace".

  -nl locale
    Use specified locale instead of default one.
    Example: -nl en (use English locale).

  -vm <java vm path>
    Use Java VM installed in <java vm path> folder instead of default
    location.

  -vmargs <jvm parameters>
    Allows to pass any number of additional parameters to JVM.
    Additional parameters may be used to customize environment or
    3-rd party jdbc drivers.

  -clean
    Clears all Eclipse caches. Use it if DBeaver fails to start after version upgrade.

我们使用-vm参数 指定jdk为jdk8的目录。
1·右键点击dbeaver.exe发送到桌面快捷方式
在这里插入图片描述

目标处填写-vm参数:D:\dbeaver\dbeaver.exe -vm “C:\Program Files\Java\jdk1.8.0_45\bin”
使dbeaver 启动的时候 使用指定的Jdk即可。

GitHub 加速计划 / db / dbeaver
38.73 K
3.35 K
下载
DBeaver 是一个通用的数据库管理工具,支持跨平台使用。* 支持多种数据库类型,如 MySQL、PostgreSQL、MongoDB 等;提供 SQL 编辑、查询、调试等功能;支持数据迁移和比较。* 特点:免费开源;界面友好;功能丰富。
最近提交(Master分支:3 个月前 )
4c33020d 3 个月前
83d4cee8 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐