java访问windows注册表 method native_java读写注册表问题

项目需求,在Tomcat服务器启动后通过Quartz自动向windows注册表写入相关信息,我采用了jRegistryKey来操作注册表,项目中导入jRegistryKey.jar,jRegistryKey.dll放到jdk的bin目录下,部分代码如下

RegistryKey myKey=new RegistryKey(RootKey.HKEY_CURRENT_USER,"Software\\MyKey");

if( myKey.hasValue("MyKey")){…………………………}

通过Tomcat6.exe启动服务器时,一切正常,但以服务的方式即Tomcat6w.exe启动服务器,通过查看Tomcat日志发现在执行if判断的时候出现如下异常:

ca.beq.util.win32.registry.Win32Exception: 系统找不到指定的文件。

at ca.beq.util.win32.registry.RegistryKey.hasValue(Native Method)

at com.driverexam.dao.meta.VersionDAO.validate(VersionDAO.java:52)

at com.driverexam.exam.service.TaskQuartzService.quartzDriverExamInit(TaskQuartzService.java:58)

at com.driverexam.exam.service.TaskQuartzService$$FastClassByCGLIB$$90343c47.invoke()

at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)

at com.driverexam.exam.service.TaskQuartzService$$EnhancerByCGLIB$$5903a3f5.quartzDriverExamInit()

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)

at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)

at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)

at org.quartz.core.JobRunShell.run(JobRunShell.java:202)

at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

把jRegistryKey.dll复制到windows/system32下也不行,请问这是怎么回事啊?谢谢~

2012年6月05日 10:52

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值