lundi 10 août 2009

gwt-user.jar issue with javax.servlet java files

EDIT: I wrote this entry before google commit the modification in the trunk to solve this issue. Now, this article is deprecated because this morning scottb change the build.xml file of gwt-user to remove the javax.servelet java file. Here is the details about the commit : http://gwt-code-reviews.appspot.com/56813

In gwt-user.jar of GWT there are some java files of javax.servlet and since we need to add this jar in the classpath during compilation, maven compile these files into class file and package these class files into the war of the GWT application.

Every web server and application server provide those files too and if we deploy a war with javax.servlet class file on a server we get a linkagerror because the class are provided twice.

There are different solutions:
1/ Google remove java files from gwt-user (and optionnaly provide a gwt-user-sources)
2/ You remove javax.servlet class from you war after compilation (with a antrun remove script)
3/ You use a special gwt-user without the java files and you upload it to your company repository (gwt-user-mycompany)
4/ what else ?

So there are 2 issues in the gwt bug tracker dealing with this problem.

remove javax.servlet java files from gwt-user: NeedsInfo/Enhancement

Remove or change timestamp of javax.servlet source files in gwt-user.jar: Fixed/Defect

The official google answers are below.
1-scottb from Google says : "This is a maven compiler issue. The java files from javax.servlet should not be compiled and packaged." Here
2-scottb from Google says : "The solution is to ask to the Maven central repository maintainer (ndeloof) to changed each gwt-user release to remove the javax.servlet java files." Here
3-scottb from Google says : "The source is provided as a convenience for debugging." Here

I don't know which of those 3 answers is the best. Please vote for you favorite one.

In this topic we have gwt guest like fredsa or diaz.salvador. I hope this issue would be solved before the GWT 2.0 in a way or another.

This topic was discussed in the gwt maven plugin too: http://jira.codehaus.org/browse/MGWT-48

1 commentaire:

  1. The HttpServletResponse has methods that lets you specify the HTTP response line, response headers, and, most importantly, lets you obtain a PrintWriter used to send output back to the client. For simple servlets, most of the effort is spent in println statements that generate the desired page. Note that doGet and doPost throw two exceptions, so you are required to include them in the declaration. Also note that you have to import classes in java.io, javax.servlet, and javax.servlet.http.

    ruandischer tee

    RépondreSupprimer