Guvnor rules encoding

时间秒杀一切 提交于 2019-12-11 00:43:30

问题


I have a Drools decision table in Excel, and some of the strings used in rules have "Á" characters. When I build rules package in Guvnor from this decision table, I get wrong characters in rules source.

For instance,

in spreadsheet -> Área de Lazer|POR,

in built drl file -> �rea de Lazer|POR

Is there any way Guvnor can be tuned to support UTF-8 in this case? Had anyone faced similar issue?

Thanks


@Geoffrey De Smet

Hi,

I have added following code to ExcelParser.java:

WorkbookSettings ws = new WorkbookSettings();
        ws.setEncoding("UTF-8");
        Workbook workbook = Workbook.getWorkbook( inStream , ws);

I have successfully built drools project from git-hub, but when I try building guvnor-webapp to test this, either with maven 2.2.1 or maven 3.0.3, I get the same error:

[ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] org/apache/commons/io/IOUtils org.apache.commons.io.IOUtils [INFO] ------------------------------------------------------------------------ [INFO] Trace java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils at org.codehaus.mojo.gwt.AbstractGwtMojo.checkGwtUserVersion(AbstractGwtMojo.java:289) at org.codehaus.mojo.gwt.AbstractGwtMojo.getGwtUserJar(AbstractGwtMojo.java:251) at org.codehaus.mojo.gwt.shell.CompileMojo.compile(CompileMojo.java:268) at org.codehaus.mojo.gwt.shell.CompileMojo.doExecute(CompileMojo.java:255) at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:119) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.IOUtils at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195) at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255) at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274) at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

Any help on this would be appreciated!

Thank you!

P.S. I have read README document, and proceeded as described.


回答1:


The issue is still open and not easy to fix because excel file encoding differs from locale to locale.

One known workaround (suggested by Amer Zec) is to start the app server on which Guvnor runs with -Djxl.encoding=cp1252 (if you're West-European, otherwise use another encoding than cp1252).



来源:https://stackoverflow.com/questions/5298748/guvnor-rules-encoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!