我想在 WAS8.5.5.2 中部署一个应用程序。我用结构做了耳朵:
serverEar.ear
-- serverWar.war
---- WEB-INF
---- 'web' 目录内容
我有application.xml :
<application version="6" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" >
<module>
<web>
<web-uri> serverWar.war</web-uri>
<context-root>serverWar</context-root>
</web>
</module>
<library-directory> web/lib</library-directory>
</application>
Run Code Online (Sandbox Code Playgroud)
网页.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>p1</servlet-name>
<servlet-class>com.test.Server</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>p1</servlet-name>
<url-pattern>/server</url-pattern>
</servlet-mapping>
<security-constraint>
<display-name/>
<web-resource-collection>
<web-resource-name/>
<description/>
<url-pattern>/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<user-data-constraint>
<description/>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
</web-app>
Run Code Online (Sandbox Code Playgroud)
我有目录结构:
我已经从 WAS ibm/console 安装了该应用程序。安装目录就是..\Desktop\Test\out\artifacts\serverEar我的ear文件所在的地方(不知道安装目录会不会影响这个?)。
应用程序已成功安装并启动。
我已经尝试过网址:https://my_server:9443/serverWar/server,它给了我:Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /server
我以前从未处理过 WAS,并且不确定我可能哪里出错了。
任何建议,指针是高度赞赏!
好的,现在问题已经解决了。问题是context root未设置为 serverWar,因此它无法识别 serverWar/服务器 url。因此,我按照以下步骤从 IBM 控制台设置上下文根。
解决这个问题后,我又遇到了另一个相关问题:
Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet: Could not find required class
看来我们需要在 中拥有类目录WEB-INF,由于某种原因 IntelliJ 没有创建该目录,并且上述结构适用于 WildFly 和 WebLogic。因此,在 WAS 上部署 Ear 文件时,您所需要做的就是从production目录中复制类。它使我的应用程序按预期工作。
完成上述所有更改后,我可以成功访问网址https://my_server:9443/serverWar/server。
希望这对刚接触 WAS 的人有所帮助!
| 归档时间: |
|
| 查看次数: |
35176 次 |
| 最近记录: |