Exception in thread "main" java.lang.UnsatisfiedLinkError: libmawt.so: libXtst.so.6: cannot open

本文探讨了一种特定情况下的Java UnsatisfiedLinkError异常,该异常与libXtst.so.6文件缺失有关。文章详细分析了在使用Apache POI生成Excel报告时遇到的问题,并提出了解决方案。
摘要由CSDN通过智能技术生成

 

Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/opt/jre/1.6.0_20_x64/lib/amd64/xawt/libmawt.so: libXtst.so.6: cannot open shared object file: No such file or directory
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(Unknown Source)
 at java.lang.ClassLoader.loadLibrary(Unknown Source)
 at java.lang.Runtime.load0(Unknown Source)
 at java.lang.System.load(Unknown Source)
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(Unknown Source)
 at java.lang.ClassLoader.loadLibrary(Unknown Source)
 at java.lang.Runtime.loadLibrary0(Unknown Source)
 at java.lang.System.loadLibrary(Unknown Source)
 at sun.security.action.LoadLibraryAction.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.awt.Toolkit.loadLibraries(Unknown Source)
 at java.awt.Toolkit.<clinit>(Unknown Source)
 at java.awt.Font.<clinit>(Unknown Source)
 at java.awt.font.TextLayout.singleFont(Unknown Source)
 at java.awt.font.TextLayout.<init>(Unknown Source)
 at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1701)
 at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1662)
 at com.xxx.batch.report.handler.impl.ExcelFileHandler.processFile(ExcelFileHandler.java:115)
 at com.xxx.batch.report.base.impl.ReportServiceImpl.processReport(ReportServiceImpl.java:136)
 at com.xxx.batch.report.base.impl.ReportServiceImpl.handleReport(ReportServiceImpl.java:48)
 at com.xxx.batch.report.main.ReportGenerator.runOneReport(ReportGenerator.java:94)
 at com.xxx.batch.report.main.ReportGenerator.runOneGroupReport(ReportGenerator.java:108)
 at com.xxx.batch.report.main.ReportGenerator.main(ReportGenerator.java:50)

===============

we have a job xxxAfterEODReportBatch on uat server peculnx1u.nam.nsroot.net, it also was deployed to our production:xxx 

when we force start it(sendevent -J xxxAfterEODReportBatch -E FORCE_STARTJOB), it will fail, but when we execute its command manully(/export/opt/xxx/rel_ver/batchReport/scripts/batchReport.sh prod /export/opt/xxx/rel_ver REPORTGROUP AfterEODGrp ), it will succeed.

 

the error is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/opt/jre/1.6.0_20_x64/lib/amd64/xawt/libmawt.so: libXtst.so.6: cannot open shared object file: No such file or directory

 

The job definition is :

insert_job: xxxAfterEODReportBatch   job_type: c

command: /export/opt/xxx/rel_ver/batchReport/scripts/batchReport.sh uat /export/opt/xxx/rel_ver REPORTGROUP AfterEODGrp

machine: Vxxx

#owner: xxx@xxx

permission: gx,ge,wx,we,mx,me

date_conditions: 1

days_of_week: mo,tu,we,th,fr

start_times: "23:52"

condition: s(xxxEOD_Calculations)

description: "Produce xxx Daily Reports After EOD Calculation Job Finished"

std_out_file: /export/opt/xxx/rel_ver/log/autosyslog/xxxAfterEODRpt.out.`date +%Y%m%d`

std_err_file: /export/opt/xxx/rel_ver/log/autosyslog/xxxAfterEODRpt.err.`date +%Y%m%d`

alarm_if_fail: 1

 

 

 

its very strange that When I update this job by addprofile, it can be force started successfully.

 

insert_job: xxxAfterEODReportBatch   job_type: c

command: /export/opt/xxx/rel_ver/batchReport/scripts/batchReport.sh uat /export/opt/xxx/rel_ver REPORTGROUP AfterEODGrp

machine: Vxxx

#owner: xxx@xxx

permission: gx,ge,wx,we,mx,me

date_conditions: 1

days_of_week: mo,tu,we,th,fr

start_times: "23:52"

condition: s(xxx_EOD_Calculations)

description: "Produce xxx Daily Reports After EOD Calculation Job Finished"

std_out_file: /export/opt/xxx/rel_ver/log/autosyslog/xxxAfterEODRpt.out.`date +%Y%m%d`

std_err_file: /export/opt/xxx/rel_ver/log/autosyslog/xxxAfterEODRpt.err.`date +%Y%m%d`

alarm_if_fail: 1

            profile: /export/opt/xxx/rel_ver/scripts/envForAutosys.sh

 

===========envForAutosys.sh

#!/bin/sh
#ident "%W%"
#
INSDIR=/export/opt/xxx/rel_ver
FEEDDIR=/export/opt/xxxftp

 

 

=================

The key reason is the environment variableDISPLAY .

 

If we add profile in autosy job definition, this variable wont be set, then the autosys job will be executed successfully,

but if we dont addprofile, autosys  will set DISPLAY=:0.0 default, then the autosys job wont be executed successfully.

 

 

Because we only made some enhancement for Portfolio Net Collateral Report by generating excel report instead of CSV, so we guess thatDISPLAY variable has something to do with Excel report generation, but we still dont know the root cause, we will investigate more.

 

 

When we call shell scripts directly, it works well, and variable “DISPLAY” is not set in the environment;

But when we call this shell script by autosys job, autosys job will invoke “/etc/auto.profile” automatically, and in this auto.profile,

it set variable “DISPLAY=:0.0”, then it will cause the issue.

Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/opt/jre/1.6.0_20_x64/lib/amd64/xawt/libmawt.so: libXtst.so.6: cannot open shared object file: No such file or directory

 

If we add command “unset DISPLAY” in our scripts, the job is good, even it still call “/etc/auto.profile”;

We print all environment variables for both success job and failed job, and compare them by cmd "set"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值