RAD Application Server Publishing 设置和基于WTP的Maven项目

来源:互联网 发布:京东买淘宝卖 编辑:程序博客网 时间:2024/06/06 05:11

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"选项进行应用程序的发布。