My favorites | Sign in
Project Logo
                
Search
for
Updated Jul 16, 2009 by branflake2267
gwtTomcatWarBuilder  
gwt Tomcat War Builder

Deprecated This Page

I am going to stop support on the TomcatWarBuilder shortly. I didn't realize at the time that Ant could do the job so much better. Google has come up with an excellent system in 1.6+. I am excited about using future releases because of the entire change.

AntWarBuilding - New Location to goto for building project

References

gwtTomcat - gwt tomcat setup

Tomcat War Builder

Auto Build or Compile a GWT project for tomcat server. Compile your project in a ready to go War archive. Deploy it by uploading the war file to your tomcat server. Quickly deploy your application for testing.

Directions

  1. Import this Project into eclipse or other java IDE
  2. Compile your GWT project in the eclipse GWT debugger before running this script.
  3. Set this script's variable ProjectDirectory="/home/branflake2267/workspace/gwt-Project"; to your project's home
  4. Run It, In Eclipse Right click on TomcatWarBuilder_java and hit Debug as java application
  5. Watch Console for log of events
  6. Tweak script to your like

Tomcat Setup

gwtTomcat - how to setup tomcat up.

SVN Location

Download the latest version from SVN. Source Code

Linux OS

This builder works great with linux.

Windows OS

It now works great with Windows.

Example War Created

Downloads - War file created from the RPC Advanced Eclipse project

Added

Easy Setup and Run

Example setup of a main class that runs the builder.

public class Run_WarBuilder_RpcBasic {

	/**
	 * run this from console or debug configuration in eclipse
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		
		// refer to this object for variable options
		WarBuilderData data = new WarBuilderData();
		
		// choose your operating system
		// [0=linux, 1=windows]
		data.os = 0;
		
		// project directory (examples below)
		data.projectDirectory = "/home/branflake2267/workspace/gwt-test-RPC-basic";

		// rename war file to [ROOT.war | project.war]
		// ROOT.war is the virtual host root servlet context "/" 
		data.renameWarFile = false; //true = turn on will rename the servlet context (filename)
		
		// if renameWarFile = true then rename to:
		data.renameWarFileNameTo = "ROOT.war"; 
		

		/********** OPTIONAL ***********/
		
		// go to application instead of going to index.jsp true is recommended
		data.goDirectlyToApplication = true;
		
		// Ask for credentials to use application 
		data.askForLogin = false;
		
		data.deleteTempFolder = false;
		
		/********** OPTIONAL ***********/
		
		
		// set up the object that will build the war 
		TomcatWarBuilder build = new TomcatWarBuilder();
		build.setTomcatCompileData(data);
		build.start();
	}

}

Builder Options:

public class WarBuilderData {
	
	// operating system
	// [0:linux, 1:windows]
	public int os = 0;
	
	// project directory - absolute path to your project root
	public String projectDirectory;

	// rename war file at end
	public boolean renameWarFile = true;
	
	// rename war file to [ROOT.war | project.war]
	// ROOT.war is the virtual host root servlet context "/" 
	public String renameWarFileNameTo = "ROOT.war"; 

	
	
	/********** OPTIONAL ***********/
	
	// temp build folder
	public String tempBuildFolderName = "production";
	
	// Ask for credentials to use gwt application 
	public boolean askForLogin = false;
	
	public boolean deletetempBuildFolder = true;
	
	//default location is project root. Set this for another location
	//set with no trailing slash like "/home/branflake2267/warFiles"
	//private  String TempWarFileLocation = "/home/branflake2267"; 
	public String tempWarFileLocation = null;

	// after all done - delete the temp folder
	public boolean deleteTempFolder = true; 
	
	// go to application instead of going to index.jsp - true is recommended
	// you can set this to false if you want, when you intend to include your compilation of code to another site,
	// although, you can directly copy the code from the www directory and include it in your sites setup
	public boolean  goDirectlyToApplication = true;
	
	/********** OPTIONAL END ***********/
}

Comment by cwm1949, Oct 13, 2008

I am a newbe and would really appreciate a more detailed set of instructions.

Yes I should know this but I do not.

For example first instruction is import this project into Eclipse. Sounds dumb but how do I do that?

Comment by branflake2267, Oct 13, 2008

Good point.

hmm, that will take me a little bit to go through svn then importing it.

Add Subversion to eclipse > Set SVN Connector > File > Import > From SVN > Setup new repository | select repository > Select folder from trunk > import.

I will work on a more detailed version later.

Comment by kostyando, Oct 23, 2008

Comment by kostyando, Today (moments ago)

Hi,

what is ProjectClassName? I get null for it. This is my compile file:


@java -Xmx256M -cp "%~dp0\src;%~dp0\bin;D:/gwt-1.5.3/gwt-user.jar;D:/gwt-1.5.3/gwt-dev-windows.jar" com.google.gwt.dev.GWTCompiler -out "%~dp0\www" % com.google.gwt.sample.stockwatcher.StockWatcher?
And this is a correspondent pattern from your application: "\"\\$@\"\040(.?);". I'm not good familiar with reg-exp and I cannot understand, what should I change here?

Thank you beforehand

Comment by branflake2267, Oct 27, 2008

I rewrote the code. I am hoping that I solved the regex issue. I rewrote the file path separation so it would work on windows too. I haven't tested it on windows yet. The linux version works great. I added alot more error checking for helps.

Comment by branflake2267, Nov 01, 2008

I have tested it on windows, and have rewrote the regexp. It works great.

Comment by fabella.wesley, Nov 05, 2008

A simple set of real instructions to successfully run the "script" would be handy!

Thanks a bunch.

Comment by branflake2267, Nov 05, 2008

I couldn't agree more. I think this weekend I will work that up.

By the way, I am having some issues with Windows compiling and running it on linux tomcat. I will figure this out shortly as its a real need for me.

Comment by geedeen, Feb 21, 2009

Hi,

I tried to create a sample application on RPC and built the war using TomcatWarBuilder? project (http://code.google.com/p/gwt-examples/wiki/ gwtTomcatWarBuilder) and deployed the war in Tomcat server. I have also setup security.AllPermission? in catalina.policy file as specfied in http://code.google.com/p/gwt-examples/wiki/gwtTomcat. But I'm getting 404 status error while the RPC call is made to server class. I verified web.xml in the war as well gwt.xml and everything seems to be good. I tried building test-gwt-MySQLConn project from SVN and got the same error. Kindly help me to resolve this issue.

Here are the details.

OS: Windows Tomcat : 6.0 jre : 1.6

Code snippets

ConnectionService?.java


public interface ConnectionService? extends RemoteService? {
public ApplicationModulesADT getApplicationModules();

}

ConnectionServiceAsync?.java


public interface ConnectionServiceAsync? {
public void getApplicationModules(AsyncCallback? callback);

}

ConnectionServiceImpl?.java


public class ConnectionServiceImpl? extends RemoteServiceServlet? implements ConnectionService? {
public ConnectionServiceImpl?() { }

public ApplicationModulesADT getApplicationModules() {
ApplicationModulesImpl? appModulesImpl = new ApplicationModulesImpl?

();

ApplicationModulesADT appModules =
appModulesImpl.getApplicationModules();

return appModules;
}

}

TestUI.gwt.xml


<servlet path="/ConnectionService?" class="com.nce.qc.server.services.ConnectionServiceImpl?"/>

RPC Call


private void rpcInit() {
callProvider = (ConnectionServiceAsync?) GWT.create
(ConnectionService?.class);
ServiceDefTarget? target = (ServiceDefTarget?) callProvider;

// The path is determined in ./public/.gwt.xml String moduleRelativeURL = GWT.getModuleBaseURL() +

"ConnectionService?";

//RootPanel?.get().add(new HTML(moduleRelativeURL)); target.setServiceEntryPoint(moduleRelativeURL);
}

web.xml


<servlet>
<servlet-name>TestUI</servlet-name> <servlet-class>com.nce.qc.server.services.ConnectionServiceImpl?</
servlet-class>
</servlet>
- <!-- url/path to servlet class and mapping
-->
- <servlet-mapping>
<servlet-name>TestUI</servlet-name> <url-pattern>/ConnectionService?</url-pattern> </servlet-mapping>

catalina.policy


grant codeBase "file:${catalina.home}/webapps/-" {
permission java.net.SocketPermission? "192.168.0.156:3306",
"connect";

};

grant codeBase "file:${catalina.home}/webapps/-" {

permission java.security.AllPermission?;

};

Error description


com.google.gwt.user.client.rpc.StatusCodeException?: HTTP Status 404 - /TestUI/ConnectionService? type Status report message /TestUI/ConnectionService? description The requested resource (/TestUI/ConnectionService?) is not available.

Thanks in Advance, Geeya.


Sign in to add a comment
Hosted by Google Code