-1

我正在使用 Java Oracle NoSQL 数据库服务器 - com.sleepycat.je

<dependency>
        <groupId>com.sleepycat</groupId>
        <artifactId>je</artifactId>
        <version>18.3.12</version>
 </dependency>

我尝试获取 Berkely DB 内容 - Centos8 docker image 中的 RPM Packages DB

import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;

import java.io.File;

public class TempMain {
public static void main(String[] args) {
    Environment myDbEnvironment = null;

    try {
        // Open the environment, creating one if it does not exist
        EnvironmentConfig envConfig = new EnvironmentConfig();
        envConfig.setAllowCreate(true);
        myDbEnvironment = new Environment(new File("C:\\Centos8\\LayerId\\var\\lib\\rpm\\Packages"),
                envConfig);

    } catch (DatabaseException dbe) {
        //  Exception handling
    }
}
}

但我收到以下错误:

Exception in thread "main" java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
at java.util.Properties.loadConvert(Properties.java:574)
at java.util.Properties.load0(Properties.java:391)
at java.util.Properties.load(Properties.java:341)
at com.sleepycat.je.dbi.DbConfigManager.applyFileConfig(DbConfigManager.java:449)
at com.sleepycat.je.Environment.setupHandleConfig(Environment.java:313)
at com.sleepycat.je.Environment.<init>(Environment.java:250)
at com.sleepycat.je.Environment.<init>(Environment.java:228)
4

1 回答 1

0

你的问题肯定与我推荐的路径有关

1.将 \\ 替换为File.pathSeparator

2.在调试中检查文件是否存在,然后再使用它

于 2020-01-02T13:31:46.523 回答