红联Linux门户
Linux帮助

jco异常-no sapjco3 in java.library.path(Linux系统)

发布时间:2017-06-22 15:46:35来源:linux网站作者:21世纪有为青年
本来本地系统已经完美运行的东西,一传到Linux下面就出问题。于是各种搜索找方案,发现基本全是windows下的,什么dll文件什么jar包云云。照了试了试,发现都没有用。
于是急中生智的我,想起linux服务器上还有其他的项目,有个项目也使用了jco都能正常运行,排除Linux环境配置的问题。
 
最笨的方法,一个文件一个文件地比对,然后终于让我给发现了。
没错,真相只有一个,那就是libsapjco3.so,把这个放入Linux服务器项目web-inf目录lib文件夹中,又能完美跑起来了。
 
注:windows系统不用放入该文件也能正常运行,但linux系统必须需要此文件。
 
贴一下错误:
java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
at java.lang.ClassLoader.loadLibrary (ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0 (Runtime.java:849)
at java.lang.System.loadLibrary (System.java:1088)
at com.sap.conn.jco.rt.DefaultJCoRuntime.loadLibrary (DefaultJCoRuntime.java:441)
at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods (DefaultJCoRuntime.java:307)
at com.sap.conn.jco.rt.JCoRuntime.registerNatives (JCoRuntime.java:969)
at com.sap.conn.rfc.driver.CpicDriver.<clinit> (CpicDriver.java:955)
at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion (DefaultRfcRuntime.java:43)
at com.sap.conn.rfc.api.RfcApi.RfcGetVersion (RfcApi.java:261)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit> (MiddlewareJavaRfc.java:200)
at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize (DefaultJCoRuntime.java:73)
at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit> (JCoRuntimeFactory.java:23)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName (Class.java:191)
at com.sap.conn.jco.JCo.createJCo (JCo.java:52)
at com.sap.conn.jco.JCo.<clinit> (JCo.java:26)
at com.sap.conn.jco.JCoDestinationManager.getDestination (JCoDestinationManager.java:61)
at com.changhong.vmi.admin.xfire.jco.SrmSapJCo.getGoodsPlan (SrmSapJCo.java:79)
at com.changhong.vmi.admin.xfire.service.imp. IGoodsPlanServiceImp.seizeGoodsPlan (IGoodsPlanServiceImp.java:571)
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:606)
at org.springframework.util.MethodInvoker.invoke (MethodInvoker.java:270)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:212)
at org.springframework.scheduling.quartz.QuartzJobBean.execute (QuartzJobBean.java:79)
at org.quartz.core.JobRunShell.run (JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:520)
WARN  06-19 14:15:00,147 (MethodInvokingJobDetailFactoryBean.java:215)org.springframework.scheduling.quartz. MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal 
Could not invoke method 'seizeGoodsPlan' on target object [com.changhong.vmi.admin.xfire.service.imp. IGoodsPlanServiceImp@ed5c05c] 
java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.JCo
at com.sap.conn.jco.JCoContext.end(JCoContext.java:74)
at com.changhong.vmi.admin.xfire.jco.SrmSapJCo.getGoodsPlan(SrmSapJCo.java:192)
at com.changhong.vmi.admin.xfire.service.imp.IGoodsPlanServiceImp.seizeGoodsPlan (IGoodsPlanServiceImp.java:571)
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:606)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:270)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:212)
at org.springframework.scheduling.quartz.QuartzJobBean.execute (QuartzJobBean.java:79)
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:520)
INFO  06-19 14:15:00,149 (JobRunShell.java:208)org.quartz.core.JobRunShell.run 
Job DEFAULT.getGoodsPlanDetail threw a JobExecutionException:  
org.quartz.JobExecutionException: Could not invoke method 'seizeGoodsPlan' on target object [com.changhong.vmi.admin.xfire.service.imp.IGoodsPlanServiceImp@ed5c05c] [See nested exception: java.lang.reflect.InvocationTargetException]
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:221)
at org.springframework.scheduling.quartz.QuartzJobBean.execute (QuartzJobBean.java:79)
at org.quartz.core.JobRunShell.run (JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:520)
* Nested Exception (Underlying Cause) ---------------
java.lang.reflect.InvocationTargetException
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:606)
at org.springframework.util.MethodInvoker.invoke (MethodInvoker.java:270)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:212)
at org.springframework.scheduling.quartz.QuartzJobBean.execute (QuartzJobBean.java:79)
at org.quartz.core.JobRunShell.run (JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:520)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.JCo
at com.sap.conn.jco.JCoContext.end (JCoContext.java:74)
at com.changhong.vmi.admin.xfire.jco.SrmSapJCo.getGoodsPlan (SrmSapJCo.java:192)
at com.changhong.vmi.admin.xfire.service.imp.IGoodsPlanServiceImp.seizeGoodsPlan (IGoodsPlanServiceImp.java:571)
... 9 more
WARN  06-19 14:18:00,022 (MethodInvokingJobDetailFactoryBean.java:215)org.springframework.scheduling.quartz. MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal 
Could not invoke method 'seizeGoodsPlan' on target object [com.changhong.vmi.admin.xfire.service.imp. IGoodsPlanServiceImp@ed5c05c] 
java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.JCo
at com.sap.conn.jco.JCoContext.end (JCoContext.java:74)
at com.changhong.vmi.admin.xfire.jco.SrmSapJCo.getGoodsPlan (SrmSapJCo.java:192)
at com.changhong.vmi.admin.xfire.service.imp.IGoodsPlanServiceImp.seizeGoodsPlan (IGoodsPlanServiceImp.java:571)
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:606)
at org.springframework.util.MethodInvoker.invoke (MethodInvoker.java:270)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:212)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:79)
at org.quartz.core.JobRunShell.run (JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:520)
INFO  06-19 14:18:00,023 (JobRunShell.java:208)org.quartz.core.JobRunShell.run
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31677.html