项目需求,在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