RAD提供两种WebSphere Application Server publishing设置选项: 1) Run server with resources within the workspace, 和 2) Run server with resources on Server. 当"Run/Debug on Server"时, 如果使用"within the workspace"选项, 应用程序运行于workspace中, 当使用"on Server"选项时, RAD首先将应用程序部署到WAS服务器上,然后从WAS服务器上运行。
如果在开发环境中有本地的WAS服务器, RAD缺省使用"within the workspace"选项, 与“on Server”相比,该设置的发布时间较短。 然而,该设置不适用于使用WTP并选择Workspace Resolution的Maven项目。
举例而言, 一个Maven项目包含两个模块 - core和web, 并在Maven选项中使用Workspace Resolution, 当使用within the workspace"选项运行"Run/Debug on Server"时, RAD并不会将core jar文件发布到workspace发布目录(一般位于.metadata\.plugins\org.eclipse.wst.server.core\tmp1\ 目录下), 而是使用两个不同的class loader来装载core jar和Web应用程序。 由此可能造成的问题包括:
- web模块中的spring xml无法使用如下代码来载入core模块中的spring xml,<import resource="classpath:com/test/resources/spring-core-beans.xml" />
- web模块中无法使用ResourceBundle.getBundle(baseName) 来载入core模块中的资源。
上述问题的解决方法时使用"Run server with resources on Server"选项进行应用程序的发布。

本文探讨了RAD提供的两种WebSphere Application Server发布设置:在工作区中运行服务器与在服务器上运行服务器的区别。前者使应用程序直接在工作区内运行,后者则先部署至WAS服务器再运行。文章还特别指出了在特定情况下,如使用Maven项目的Workspace Resolution时,选择在服务器上运行的优势。
7499

被折叠的 条评论
为什么被折叠?



