问题
在以下环境中在Google App Engine上开发Struts2。
- 支撑杆2.3.1.2
- Freemaker 2.3.18
- JDK 1.6
- Eclipse 3.7 + Eclipse的Google插件
- Google App Engine Java SDK 1.6.3.1
GAE抱怨javax.swing.tree.TreeNode
是本地开发中的受限类,如果部署在实际的GAE生产环境中,则错误消息将消失。
Caused by:
java.lang.NoClassDefFoundError: javax.swing.tree.TreeNode is a restricted class.
Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at freemarker.core.TextBlock.isIgnorable(TextBlock.java:375)
at freemarker.core.TextBlock.heedsTrailingWhitespace(TextBlock.java:337)
解
不知道为什么它可以在GAE生产环境中工作,对于本地GAE环境,您可以重载TextBlock
类,编译以下代码并将其移至WEB-INF / classes ,以便它可以重载原始的TextBlock
类。
文件:TextBlock.java
/*
* Copyright (c) 2003 The Visigoth Software Society. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Visigoth Software Society (http://www.visigoths.org/)."
* Alternately, this acknowledgement may appear in the software
itself,
* if and wherever such third-party acknowledgements normally
appear.
*
* 4. Neither the name "FreeMarker", "Visigoth", nor any of the names
of the
* project contributors may be used to endorse or promote products
derived
* from this software without prior written permission. For written
* permission, please contact visigo...@visigoths.org.
*
* 5. Products derived f