今天我用Sun的服务器运行了一个最简单的网络程序.非常有成就感,尽管一点技术含量都没有.
但是我对未来充满了信心.
一、运行J2EE tutorial例子前必须做的准备工作:
1.修改build.properties
先找到这个文件,是<INSTALL>/j2eetutorial14/examples/common/build.properties
(1)设置j2ee.home
在Win下:
j2ee.home = C:\\Sun\\AppServer
或
j2ee.home=C:/Sun/AppServer
(2)设置j2ee.tutorial.home property asant deployment and undeployment.
设置j2ee.tutorial.home.
在Unix下:
j2ee.tutorial.home=/home/username/j2eetutorial14
Windows下:
j2ee.tutorial.home=C:/j2eetutorial14
(3)You should not install the tutorial to a location with spaces in the path.
(4) If you did not use the default value (admin) for the admin user, set the admin.user property to the value you specified when you installed the Application Server.
(5) If you did not use port 8080, set the domain.resources.port property to the value specified when you installed the Application Server.
(6) Set the admin user's password in <INSTALL>/j2eetutorial14/examples/common/admin-password.txt to the value you specified when you installed the Application Server. The format of this file is AS_ADMIN_PASSWORD=password. For example:
AS_ADMIN_PASSWORD=mypassword
二、几个概念:
在J2EE架构中,web组件和静态文件比如图片等被称为web resources.
web module是最小的可扩展的web resources单元.
To deploy a WAR on the Application Server, the file must also contain a runtime deployment descriptor.
The Application Server web application runtime DD is named sun-web.xml and is located in /WEB-INF/ along with the web application DD.
三、Web Modules
1.Packaging Web Modules
打包
asant build //根据需要编译程序.
asant create-war//打包,产生的文件以war为后缀
2.Deploying Web Modules
4种方法:
Deploying with deploytool
Deploying with the Admin Console
Deploying with asadmin
asadmin deploy full-path-to-war-file
Deploying with asant
asant deploy-war
3.Updating Web Modules
先运行asant build,然后用deploytool或Admin Console下update
4.Undeploying Web Modules
4种方法:
deploytool
# Select localhost:4848 from the Servers list.
# Select the web module in the Deployed Objects list of the General tab.
# Click the Undeploy button.
Admin Console
asadmin
asadmin undeploy context_root
asant
asant undeploy-war