How to create a war file?

153 views
Skip to first unread message

Ali

unread,
Dec 10, 2006, 6:04:32 PM12/10/06
to Google Web Toolkit
Hello,

I am very new to GWT and Java. I have just build my first application
with rpc and i can run it from the Netbeans IDE 5.5.

How do i create a war file which i can deploy (Sun Application Server,
or Tomcat)?

I know it must be the very basics... :-(

Many thanks,

Ali

Javid

unread,
Dec 10, 2006, 11:53:44 PM12/10/06
to Google Web Toolkit

Sandy

unread,
Dec 11, 2006, 4:36:44 AM12/11/06
to Google Web Toolkit

Ali

unread,
Dec 11, 2006, 7:11:25 AM12/11/06
to Google Web Toolkit
Many thanks!

I thought it could be solved with a double click or so.

Chad Bourque

unread,
Dec 11, 2006, 9:08:43 AM12/11/06
to Google-We...@googlegroups.com
Ali,

It can be pretty simple. The war file is just a zip file with a war extension. When I'm ready to deploy, I run the compile script that GWT created, then I export my source folder to a jar file (which I store in a lib folder inside a WEB-INF folder inside com....Project folder GWT creates inside the www folder when you compile). I also put a web.xml file in that WEB-INF folder (this is a one time thing). After that, I zip the contents of the com....Project folder and name it Project.war (whatever the project is). That's it. I just put that war file in my Tomcat webapps folder and initial deployment is done. For redeployment, I just use Tomcat's Management page to Redeploy the app.

HTH,
Chad

Ali

unread,
Dec 11, 2006, 4:51:20 PM12/11/06
to Google Web Toolkit
Dear Chad,

Thanks for the reply.

I am getting more and more confused. :-S

Which folder should i compress? Has the Netbeans IDE already run that
compile script?

Here is the directory structure of the Netbeans project folder:


[ C:\Projects\GWTcalc\build\classes\GWTcalc\client ]
addition.class 1 KB
additionAsync.class 1 KB
gui$1.class 2 KB
gui$2.class 1 KB
gui$3.class 1 KB
gui$4.class 1 KB
gui$5.class 2 KB
gui.class 5 KB
Main.class 1 KB

[ C:\Projects\GWTcalc\build\classes\GWTcalc ]
Main.gwt.xml 1 KB

[ C:\Projects\GWTcalc\build\classes\GWTcalc\public ]
Main.html 1 KB

[ C:\Projects\GWTcalc\build\classes\GWTcalc\server ]
additionImpl.class 1 KB

[ C:\Projects\GWTcalc\build\www\GWTcalc.Main ]
6016743E132F36A50F07F2BFAA504415.cache.h 63 KB
6016743E132F36A50F07F2BFAA504415.cache.x 2 KB
9E6343AB5E94943D4A72DE8F1203738C.cache.h 63 KB
9E6343AB5E94943D4A72DE8F1203738C.cache.x 2 KB
B53D3E26E99AC6C01F3DB7F834548EDD.cache.h 63 KB
B53D3E26E99AC6C01F3DB7F834548EDD.cache.x 2 KB
D96A4E8681278DB21CB799E581960FE9.cache.h 63 KB
D96A4E8681278DB21CB799E581960FE9.cache.x 2 KB
gwt.js 17 KB
GWTcalc.Main.nocache.html 3 KB
history.html 1 KB
Main.html 1 KB
tree_closed.gif 1 KB
tree_open.gif 1 KB
tree_white.gif 1 KB

[ C:\Projects\GWTcalc ]
build.xml 4 KB

[ C:\Projects\GWTcalc\dist ]
GWTcalc.jar 13 KB

[ C:\Projects\GWTcalc\GWTcalc.Main ]
6016743E132F36A50F07F2BFAA504415.cache.h 63 KB
6016743E132F36A50F07F2BFAA504415.cache.x 2 KB
9E6343AB5E94943D4A72DE8F1203738C.cache.h 63 KB
9E6343AB5E94943D4A72DE8F1203738C.cache.x 2 KB
B53D3E26E99AC6C01F3DB7F834548EDD.cache.h 63 KB
B53D3E26E99AC6C01F3DB7F834548EDD.cache.x 2 KB
D96A4E8681278DB21CB799E581960FE9.cache.h 63 KB
D96A4E8681278DB21CB799E581960FE9.cache.x 2 KB
gwt.js 17 KB
GWTcalc.Main.nocache.html 3 KB
history.html 1 KB
Main.html 1 KB
tree_closed.gif 1 KB
tree_open.gif 1 KB
tree_white.gif 1 KB

[ C:\Projects\GWTcalc\nbproject ]
build-gwt.xml 1 KB
build-impl.xml 27 KB
genfiles.properties 1 KB

[ C:\Projects\GWTcalc\nbproject\private ]
private.properties 1 KB
private.xml 1 KB

[ C:\Projects\GWTcalc\nbproject ]
project.properties 2 KB
project.xml 1 KB

[ C:\Projects\GWTcalc\src\GWTcalc\client ]
addition.java 1 KB
additionAsync.java 1 KB
gui.java 5 KB
Main.java 1 KB

[ C:\Projects\GWTcalc\src\GWTcalc ]
Main.gwt.xml 1 KB

[ C:\Projects\GWTcalc\src\GWTcalc\public ]
Main.html 1 KB

[ C:\Projects\GWTcalc\src\GWTcalc\server ]
additionImpl.java 1 KB

[ C:\Projects\GWTcalc\tomcat\conf ]
web.xml 17 KB

[ C:\Projects\GWTcalc\tomcat\webapps\ROOT\WEB-INF ]
web.xml 1 KB

[ C:\Projects\GWTcalc\tomcat\work\gwt\localhost\_ ]
SESSIONS.ser 1 KB
tldCache.ser 1 KB

Many thanks in advance,

Ali

Chad Bourque

unread,
Dec 11, 2006, 5:12:30 PM12/11/06
to Google-We...@googlegroups.com
Ali,

I've not used the Netbeans IDE so I don't know if this process would be different from happens in Eclipse. But, your folder:

C:\Projects\GWTcalc\build\www\GWTcalc.Main

This is the output folder for the files after compiled. This is the folder that gets archived. But, by default, it is missing a few things. You'll need to create (one time) a folder named WEB-INF in that folder. In your new WEB-INF folder, you'll need a folder named lib and a file named web.xml. Now, in your new lib folder is where you'll put any external jar files you used in your project. You'll also want your jar from your project (Main.jar) in there as well.

Then, you should be able to just zip up the folder above (with all subfolders) and name it Main.war. I usually set it to use Best compression. I also use WinRar to archive the files, but I set it to zip format.

This may not be the best way and obviously it's not the only way, but it's how I do it.

One more thing, when you create your jar file for your project... Start your export at the src folder level and make sure to include source code and a manifest file. I let Eclipse auto-generate a manifest file for me.

HTH,
Chad

On 12/11/06, Ali < ali.b...@gmail.com> wrote:

Ali

unread,
Dec 12, 2006, 12:32:41 PM12/12/06
to Google Web Toolkit
Hello,

Thanks for the help.

Unfortunately i still can't deploy my application. When trying
http://localhost:8080/GWTcalc the browser opens the war file like it
was a directory. I will send the war file to you in e-mail.

Ali

unread,
Dec 12, 2006, 5:10:53 PM12/12/06
to Google Web Toolkit
Dear Chad,

Many thanks for the help. There were some missing classes but it was
easy to identify them with C:\Sun\AppServer\bin\verifier.bat. After
that i could deploy the application without any problem and it works
fine! :)

Thank you for your help!

Ali

Chad Bourque

unread,
Dec 12, 2006, 5:14:11 PM12/12/06
to Google-We...@googlegroups.com
Glad I could help.

Chad
Reply all
Reply to author
Forward
0 new messages