在部署和尝试访问Wildfly上的EAR文件时禁止403

发布于 2025-02-13 03:12:49 字数 3218 浏览 1 评论 0 原文

首先,我发现的一个问题都没有解决我的问题。 附近,但是评论中建议的解决方案无法解决我的问题,因为我index.html及其资产被复制到Web-Inf文件夹中。

我部署了我的应用程序,并且在浏览器中被禁止使用403,就好像index.html缺少,但事实并非如此。

我正在使用Wildfly 15,并从Eclipse 2022-06部署。

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
  <display-name>IdeaProjects</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>IdeaProjectsImport</groupId>
  <artifactId>IdeaProjectsImport</artifactId>
  <version>0.0.1</version>
  <packaging>war</packaging>
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
</plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <!-- MAVEN-ASSEMBLY -->
      <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>3.4.0</version>
      <configuration>
      <archive>
      <manifest>
      <mainClass>VorlagenWerkWebService.VorlagenWerkService.src.main.java.com.example.vorlagenwerk.HelloWorldServiceImpl</mainClass></manifest></archive></configuration>
      <executions>
      <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal>
        </goals>
      </execution></executions>
      </plugin>
    </plugins>
  </build>
</project>

First of all, none of the questions I found solved my issue. Error - 403 forbidden on accessing my war deployed on web logic 9.x comes near, but the solution recommended in the comments doesn't solve my issue, since my index.html and its assets were copy-pasted into the WEB-INF folder.

I deployed my application and I get 403 forbidden in the browser as if the index.html was missing, but it ain't.

I am using WildFly 15 and deploying from Eclipse 2022-06 if that matters.

My web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
  <display-name>IdeaProjects</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

My pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>IdeaProjectsImport</groupId>
  <artifactId>IdeaProjectsImport</artifactId>
  <version>0.0.1</version>
  <packaging>war</packaging>
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
</plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <!-- MAVEN-ASSEMBLY -->
      <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>3.4.0</version>
      <configuration>
      <archive>
      <manifest>
      <mainClass>VorlagenWerkWebService.VorlagenWerkService.src.main.java.com.example.vorlagenwerk.HelloWorldServiceImpl</mainClass></manifest></archive></configuration>
      <executions>
      <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal>
        </goals>
      </execution></executions>
      </plugin>
    </plugins>
  </build>
</project>

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文