1

我们很难让我们的堆栈跟踪反混淆功能正常工作。

每当我们遇到异常时,我们的堆栈跟踪如下所示:

2013-05-13T20:43:36.990952+00:00 stg-cardit1 hermione: PermutationStrongName: 4212E9F1A585F0854FEF253CBA77BD18 
2013-05-13T20:43:36.998257+00:00 stg-cardit1 hermione: ERROR:Unhandled client exception[0]java.lang.RuntimeException: Crash 
2013-05-13T20:43:36.998386+00:00 stg-cardit1 hermione: Caused by: 
2013-05-13T20:43:36.998479+00:00 stg-cardit1 hermione: EXCEPTION: Crash(java.lang.RuntimeException) 
2013-05-13T20:43:36.998567+00:00 stg-cardit1 hermione: Unknown.Pp(StackTraceCreator.java:174) 
2013-05-13T20:43:36.998653+00:00 stg-cardit1 hermione: Unknown.qd(StackTraceCreator.java:508) 
2013-05-13T20:43:36.998739+00:00 stg-cardit1 hermione: Unknown.td(Exception.java:29) 
2013-05-13T20:43:36.998824+00:00 stg-cardit1 hermione: Unknown.wo(RuntimeException.java:29) 
2013-05-13T20:43:36.998910+00:00 stg-cardit1 hermione: Unknown.Mid(CardServiceImpl.java:207) 
2013-05-13T20:43:36.998996+00:00 stg-cardit1 hermione: Unknown.u4c(MasterActivity.java:404) 
2013-05-13T20:43:36.999136+00:00 stg-cardit1 hermione: Unknown.m5c(MasterActivity.java:368) 
2013-05-13T20:43:36.999241+00:00 stg-cardit1 hermione: Unknown.p5c(MasterActivity.java:367) 
2013-05-13T20:43:36.999332+00:00 stg-cardit1 hermione: Unknown.Xjd(FlickrServiceImpl.java:79) 
2013-05-13T20:43:36.999418+00:00 stg-cardit1 hermione: Unknown.dkd(FlickrServiceImpl.java:92) 
2013-05-13T20:43:36.999503+00:00 stg-cardit1 hermione: Unknown.akd(FlickrServiceImpl.java:49) 
2013-05-13T20:43:36.999588+00:00 stg-cardit1 hermione: Unknown.rBd(SevogleRequestBuilder.java:29) 
2013-05-13T20:43:36.999673+00:00 stg-cardit1 hermione: Unknown.uE(Request.java:258) 
2013-05-13T20:43:36.999797+00:00 stg-cardit1 hermione: Unknown.gF(RequestBuilder.java:412) 
2013-05-13T20:43:36.999893+00:00 stg-cardit1 hermione: Unknown.anonymous(XMLHttpRequest.java:351) 
2013-05-13T20:43:36.999980+00:00 stg-cardit1 hermione: Unknown.hp(Impl.java:189) 
2013-05-13T20:43:37.000065+00:00 stg-cardit1 hermione: Unknown.kp(Impl.java:242) 
2013-05-13T20:43:37.000150+00:00 stg-cardit1 hermione: Unknown.anonymous(Impl.java:70) 

我已经更新了我们的 gwt.xml 文件,使其具有以下几行:

<!-- Stack track info -->
<set-property name="compiler.stackMode" value="emulated" />
<set-property name="compiler.useSourceMaps" value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true" />
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true" />

我们遇到的第一个问题是 gwtc 正在创建名为“null_symbolMap0.json”的符号映射文件

我们手工编写了我们的 ant 构建脚本,让它将排列名称放入文件名中

WEB-INF/symbolMaps/${permutation_name}_sourceMap0.json

我也用

WEB-INF/symbolMaps/${permutation_name}.sourceMap0.json 

然后在 .war 文件中。

当我们去调用这个时,我们使用以下命令

getServletContext().getRealPath("/");

StackTraceDeobfuscator deob = new StackTraceDeobfuscator(getServletContext().getRealPath("/WEB-INF/symbolMaps")); 
StackTraceElement[] elements = deob.deobfuscateStackTrace(jsElements.toArray(new StackTraceElement[0]), gwtPermutationStrongName);

其中 gwtPermutationStrongName 与文件中的名称相同。

符号映射中的 json 如下所示:

{
"version":3,
"file":"sourceMap0",
"lineCount":8439,
"mappings":"A;AAwCA,aAAA,CAAA,CAAA......AA,IAAA;",
"sources":["com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/SeedUtil.java","com/google/gwt/emul/java/lang/Object.java",...,"com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java"],
"names":[]
}

查看源图,“名称”字段似乎为空。但是我不确定该怎么做,因为我已经设置了上面的标志。

构建是在 ANT 中进行的,具有以下内容

<property name="gwt.args" value="-localWorkers 8 -extra war/WEB-INF/classes/" />
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="war/WEB-INF/classes/*.jar" />
<pathelement location="war/WEB-INF/lib/*.jar" />
<pathelement location="src" />
<pathelement location="gen" />
<path refid="project.class.path" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx2524M" />
            <!-- <arg line="-compileReport" />
            <arg line="-XsoycDetailed" /> -->
<arg line="-war" />
<arg value="war" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="com.sevogle.hermione.Hermione" />
</java>

我看到一些评论说,如果你启用了闭包编译器,堆栈跟踪功能将不起作用,但除非它默认启用,否则我们不会启用它。

https://code.google.com/p/google-web-toolkit/issues/detail?id=7803

您可以在此处查看这两个文件: https ://www.dropbox.com/sh/h1bwe9e8jr2040x/RVlEdqrvHg

在此先感谢您的时间。

亚当

4

1 回答 1

1

尝试使用https://code.google.com/p/gwt-log/配置起来非常简单。

于 2014-02-22T01:31:25.343 回答