war文件可以部署在任何服务器上吗?

发布于 2024-08-28 18:35:52 字数 308 浏览 1 评论 0原文

如果这个问题很愚蠢,请原谅我。假设我使用 Spring 框架和 MS SQL-Server 数据库以及 WebSphere 应用程序服务器开发一个 J2EE Web 应用程序。我后来为此应用程序创建了一个 WAR 文件。

我可以在不更改代码的情况下将此 WAR 文件部署到 Tomcat 服务器上吗?或者我的问题是这可以由仅提供 Tomcat 服务器的网络托管托管吗?如果是,是否需要更改代码?

如果无法部署,请您建议我该怎么做,因为我还没有在tomcat服务器上开发任何应用程序。我开发的所有应用程序都在使用 RAD 的 Websphere App Server 上。

Please pardon me if this question is silly. Suppose I develop a J2EE web application using Spring framework and a MS SQL-Server database, using a WebSphere application server. I later create a WAR file for this application.

Can I deploy this WAR file on a Tomcat server without any change in code? Or my question is can this be hosted by web hosting which provides only Tomcat servers? If yes, is there any change in code required?

If it cannot be deployed, can you please suggest me what to do, because I havent developed any application on a tomcat server. All the applications that I have developed have been on Websphere App Server using RAD.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

强辩 2024-09-04 18:35:52

原则上,WAR 文件应该可以跨 Java EE 服务器移植。在实践中,我预计不会出现很多可移植性问题,但这在很大程度上取决于应用程序的细节以及您是否严格遵守 Java EE 标准。此外,仅仅将应用程序部署到不同的环境(您的开发计算机与托管环境)可能会遇到障碍,与其说是 WAS 与 Tomcat,不如说是这个环境与那个环境。

可能的问题,可能性降序排列:

1)。您的目标是相同版本的标准吗?

2)。您是否使用了任何超出 Java EE 规范的 WebSphere 特定扩展。大多数供应商都有一些额外的好东西,你用过吗?

3)。您已经对一些在目标平台上以不同方式访问的资源(文件、目录、打印机、数据库)进行了硬编码。

4)。您是否遇到了规格歧义?是否存在 WAS 行为与 Tomcat 行为不同的极端情况?

5)。您依赖于 WAS 或您的平台确实快速执行的某些操作,而您的 taget 平台则不然。

我对可移植性的一般规则是:始终尽早在您的预期部署平台范围内进行测试。几乎总是有一些陷阱。如果您及早发现,您可以轻松修复。

In principle, yes WAR files should be portable across Java EE servers. In practice I would not expect many portability problems, but it very much depends upon the details of your application and whether you've stuck very closely to Java EE standards. Also, just deploying your app into a different environment (your dev machine versus a hosting environment) might hit snags, not so much a WAS v Tomcat as this environment v that environment.

Possible issues, descending order of likelyhood:

1). Are you targetting the same versions of the standards.

2). Did you use any WebSphere specific extensions beyond the Java EE specs. Most vendors have some extra goodies, did you use any.

3). You've hard-coded some resource (file, directory, printer, database) that is accessed differently on your target platform.

4). Did you hit a spec ambiguity? Is there some corner case where WAS behaviour differes from Tomcat behaviour.

5). You depend upon something that WAS or your platform does really quickly and your taget platform doesn't.

My general rule for portability: always test early across your range of intended deployment platforms. There's nearly always some gotcha. If you find out early you can fix with little pain.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文