关于BDB内存数据库的异常问题,求大神解答啊

bnna8356586 2015-10-02 05:17:31
网上关于BDB数据库的资料好少,现在开发个项目,静态数据需要存在BDB数据库,我之前没弄过BDB,在测试BDB查询数据时报错,(具体代码我就不发了,毕竟太多了,而且关联甚密,)出现了以下异常,请问大家这个异常是啥意思?一般怎么修改?
com.sleepycat.je.EnvironmentLockedException: (JE 5.0.103) E:\原型系统\CMCC\CMCC\BDBEnvHome The environment cannot be locked for single writer access. ENV_LOCKED: The je.lck file could not be locked. Environment is invalid and must be closed.
at com.sleepycat.je.log.FileManager.<init>(FileManager.java:369)
at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:482)
at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:408)
at com.sleepycat.je.dbi.DbEnvPool.getEnvironment(DbEnvPool.java:178)
at com.sleepycat.je.Environment.makeEnvironmentImpl(Environment.java:252)
at com.sleepycat.je.Environment.<init>(Environment.java:233)
at com.sleepycat.je.Environment.<init>(Environment.java:177)
at com.ocs.dao.impl.BDBEnv.setup(BDBEnv.java:49)
at com.ocs.dao.impl.PackageDAOBDBImpl.<init>(PackageDAOBDBImpl.java:49)
at com.ocs.dao.impl.PackageDAOBDBImpl.getInstance(PackageDAOBDBImpl.java:41)
at BDB.BDBTest3.setUp(BDBTest3.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

...全文
285 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_41974727 2019-01-15
  • 打赏
  • 举报
回复
最后咋解决的,同样遇到这个问题,也是两个进程访问BDB数据库环境文件夹
技术宅星云 2018-07-13
  • 打赏
  • 举报
回复
引用
Your Berkeley DB is set up for "single writer access". You must have another process already writing to it and effectively locking it.

You should terminate the other process or processes and proceed. No idea if BerkeleyDB can be set up for multiple writer access, sorry.

PS - je.lck is a file in the file system that implements the lock. Deleting it might also free the DB for your process to access and revoke the other process' access.


两个进程同时访问BDB数据库环境文件夹就会报这个错
ZDarkSoul 2016-05-22
  • 打赏
  • 举报
回复
遇到同样的问题,求助。楼主解决了吗

50,520

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧