首页 > 解决方案 > 为什么wildfly17服务器显示403 jboss 6.X在我的系统中完美运行?

问题描述

我使用jboss 6.x 部署war 文件(EMC.war)并且jboss 服务器在Eclipse 中与JRE1.8.0_241 完美配合。

将服务器形式 jboss 6.X 更改为 wildfly 17 后,使用简单示例时消息总是显示 403 禁止。

我将 wildfly 版本从 8 更改为 18,但 http 消息仍然显示 4.3 禁止

有我的代码。

在此处输入图像描述

我的网址是http://localhost:8080/EMC/

环境: Eclipse JRE 1.8.0_241 Wildfly 17

谢谢!

标签: javahttpserverjbosswildfly

解决方案


我仍然收到错误 403。

这是项目结构。

在类 RestEasyServices

package com.demo.tutorials;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/rest")
public class RestEasyServices extends Application {
}

在类 EMCRESTService

package com.demo.tutorials;  

import java.io.BufferedReader;  
import java.io.InputStream;  
import java.io.InputStreamReader;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.Consumes;  
import javax.ws.rs.GET;  
import javax.ws.rs.POST;  
import javax.ws.rs.Path;  
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;  
import javax.ws.rs.core.Response;  

@Path("/abc")
public class EMCRESTService extends Application{  

     @GET
     @Path("/simple")
     public String getHelloWorldJSON() {
            return "{\"result\":\"" + "\"}";
       } 

}

在 web.xml 中

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>EMC</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>

server.log 显示执行http://localhost:8080/EMC/的消息

2020-06-02 10:08:26,761 TRACE [org.jboss.security] (default task-1) PBOX00354: Setting security roles ThreadLocal: null

http://localhost:8080/EMC/获取 403

我应该怎么做才能解决这个错误?

谢谢!


推荐阅读