不要初始化 GeneralWURFLEngine

Don't initialize GeneralWURFLEngine

我使用 wurfl 检测移动设备。 我初始化了 GeneralWURFLEngine 但它无法初始化

我的代码:

public static final String path = "wurfl.zip";
private static ThreadLocal<WURFLEngine> wulEngine = new ThreadLocal<WURFLEngine>() {
        protected WURFLEngine initialValue() {
            return new GeneralWURFLEngine(path);
        };
    };
Device device = wulEngine.get()
                    .getDeviceForRequest(userAgentString);

错误:

ERROR core.GeneralWURFLEngine (GeneralWURFLEngine.java:274) - cannot initialize: net.sourceforge.wurfl.core.resource.exc.WURFLResourceException: WURFL unexpected exception
net.sourceforge.wurfl.core.resource.exc.WURFLResourceException: WURFL unexpected exception
        at net.sourceforge.wurfl.core.resource.XMLResource.readData(XMLResource.java:350)
        at net.sourceforge.wurfl.core.resource.XMLResource.getData(XMLResource.java:154)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.init(DefaultWURFLModel.java:118)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.<init>(DefaultWURFLModel.java:110)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.init(GeneralWURFLEngine.java:293)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.initIfNeeded(GeneralWURFLEngine.java:272)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.getDeviceForRequest(GeneralWURFLEngine.java:41

我该如何修复错误?谢谢你的帮助

这是初始化 GeneralWURFLEngine 的工作示例

import net.sourceforge.wurfl.core.Device;
import net.sourceforge.wurfl.core.EngineTarget;
import net.sourceforge.wurfl.core.GeneralWURFLEngine;

public static void main(String[] args) {
    GeneralWURFLEngine wurfl = new GeneralWURFLEngine("wurfl.zip");
    wurfl.setEngineTarget(EngineTarget.performance);
    Device device = wurfl.getDeviceForRequest("User-Agent/5 FooBar");
    System.out.println(device.getCapability('model_name'));
}