Veera
Veera

Reputation: 33182

Struts 2 issue on Google App Engine (Java) - javax.swing.tree.TreeNode is a restricted class

I'm trying to use Struts 2 framework for my Google App Engine project. I have configured the struts framework properly and I have created an action in struts-config.xml file as:

<package name="myproj" namespace="/myproj" extends="struts-default">
  <action name="login">
  <result>/login.jsp</result>
</action>

And I'm trying to access the above action through: http://localhost:8080/myproj/login.action. But I'm not getting my login.jsp page as expected. Instead I'm getting the following error.

HTTP ERROR 500

Problem accessing /myproj/login.action. Reason:

    java.lang.NoClassDefFoundError: javax.swing.tree.TreeNode is a restricted class. Please see the Google  App Engine developer's guide for more details.
Caused by:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax.swing.tree.TreeNode is a restricted class. Please see the Google  App Engine developer's guide for more details.
    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
    at org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:64)
    at org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:745)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:743)
    at org.apache.jsp.getin_jsp._jspService(getin_jsp.java:102)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
    at com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)

Is there something that I need to configure to fix the above error and make Struts 2 framework work on Google App Engine?

Upvotes: 2

Views: 1459

Answers (3)

Lukasz Lenart
Lukasz Lenart

Reputation: 1017

In Struts 2.3.24 the latest version of FreeMarker is used - 2.3.22 and the above solution doesn't work anymore. Instead there is dedicated version of FreeMarker to be used with AppEngine which can be added to pom as follow:

  <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>${struts2.version}</version>
    <exclusions>
      <exclusion>
        <artifactId>freemarker</artifactId>
        <groupId>org.freemarker</groupId>
      </exclusion>
    </exclusions>
  </dependency>

  <dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker-gae</artifactId>
    <version>2.3.22</version>
  </dependency>

Upvotes: 1

Shekhar
Shekhar

Reputation: 5931

You can follow my blog tutorial http://whyjava.wordpress.com/2009/08/30/creating-struts2-application-on-google-app-engine-gae/ it contains all the information you need.

Upvotes: 2

Igor Artamonov
Igor Artamonov

Reputation: 35961

I found this issue at Appengine Groups: http://groups.google.com/group/google-appengine-java/browse_thread/thread/dd84e44f604498c4

And of course you have to follow links from Will it play on GAE

Upvotes: 2

Related Questions