2010年2月2日星期二

gwt 部署到Tomact Production Mode

在网上搜索了很多部署gwt到tomcat的blog,吸取了大家的经验,又发现一些问题,总结一下
我是用的Google Plugin for Eclipse ,跟用gwt的sdk编译有点点不一样
1、在gwt项目右键Google > GWT Compile,就会在项目中的war中得到编译后的文件
To run the application as JavaScript in what GWT calls "production mode", compile the application by right-

clicking the project and choosing Google > GWT Compile.
参考:http://code.google.com/webtoolkit/usingeclipse.html#compiling
2、将war中这些文件复制到tomcat webapp/应用 目录下
看一下WEB-INF\classes是不是有相应的class文件,要是没有用eclipse编译后复制过来
3、这样就需要gwt-user.jar了
url中也不需要?gwt.codesvr=172.20.66.140:9997这样的参数了
4、打开tomcat访问相应html可能什么都出不来,或者访问数据库时出错,查看gwt编译时控制台输出,是不是跟web.xml中配的

Servlet mapping是不是对应,
比如
Linking into D:\spring\workspace\fusionchart\war\olap.
Link succeeded
Compilation succeeded -- 92.640s
我的web.xml原来是
<servlet-mapping>
<servlet-name>olap</servlet-name>
<url-pattern>/com.capinfo.cdss.gwt.olap.Olap/olap</url-pattern>
</servlet-mapping>
要改成
<servlet-mapping>
<servlet-name>olap</servlet-name>
<url-pattern>/olap/olap</url-pattern>
</servlet-mapping>
相应html中原来是
<script type="text/javascript" language="javascript" src="com.capinfo.cdss.gwt.olap.Olap/com.capinfo.cdss.gwt.olap.Olap.nocache.js"></script>
改成
<script type="text/javascript" language="javascript" src="olap/olap.nocache.js"></script>
还没闹清楚为什么会这样
跟eclipse自动编译有关?高人告知啊

连接Sql Azure

连接Sql Azure
微软早就公布Sql Azure可以使用了,今天切身体验了一下,方法看下面链接
http://blogs.msdn.com/sqlcrd/archive/2009/12/28/sql-azure.aspx

测试asp.net连接时,启动项目报错:
Windows Azure Tools: Failed to initialize the Development Storage service. Unable to start Development Storage.

Failed to start Development Storage: the SQL Server instance ‘localhost\SQLExpress’ could not be found.   Please configure the SQL Server instance for Development Storage using the ‘DSInit’ utility in the Windows Azure SDK.
解决方法:
go to the "Windows Azure SDK Command Prompt"
执行:
DSInit /sqlInstance:. /forceCreate

再次重新启动,惊喜,报一堆这样的错误:

命名空间“http://schemas.microsoft.com/developer/msbuild/2003”中的“PropertyGroup”。 的子元素
命名空间“http://schemas.microsoft.com/developer/msbuild/2003”中的“ServiceHostingSDKInstallDir”。
无效。应为可能元素的列表: 命名空间“http://schemas.microsoft.com/developer/msbuild/2003”中的“Property”。。   

C:\Program Files\MSBuild\Microsoft\Cloud Service\v1.0\Microsoft.CloudService.targets    9    6    杂项文件

闹了半天是因为刚才
开着"Windows Azure SDK Command Prompt"
关了就OK了