对unicode资源文件进行反native2ascii化

本文解决在使用Apache Derby数据库过程中遇到的“请求的时间内无法获取锁”异常问题,通过转换locale和利用native2ascii工具定位并解决锁超时错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在使用derby时,出现了
[list]
[*]Caused by: org.apache.derby.client.am.SqlException: 请求的时间内无法获取锁异常
[/list]google了一下没有结果,改为google
[list]
[*]Caused by: org.apache.derby.client.am.SqlException: lock
[/list]
出来了一大堆信息,其中有很多是

[list]
[*]Caused by: org.apache.derby.client.am.SqlException: A lock could not be obtained within the time requested
[/list]
为了确认“请求的时间内无法获取锁”即对应于“A lock could not be obtained within the time requested”,需要把locale为zh_CN的一大堆properties文件里的中文字符的unicode信息反native2ascii出来,进行查找,将查找到的key到locale为en_US中进行比对。写了个小程序如下:

	public static void native2asciiReverse() {
File srcFolder = new File("d:/loc");
File[] srcFiles = srcFolder.listFiles();
for (File file : srcFiles) {
if (file.isFile()) {
try {
String command = "C:/Program Files/Java/jdk1.5.0_06/bin/native2ascii.exe -reverse "
+ file.getAbsolutePath()
+ " d:/loc_new/"
+ file.getName().replaceAll(".properties", ".txt");
Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

这样就能在文件系统中查找“请求的时间内无法获取锁”了。
PS:目标文件后缀改为txt是因为windows文件系统查找不到properties里的字符串。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值