java - 为什么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
谢谢!
解决方案
我仍然收到错误 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
我应该怎么做才能解决这个错误?
谢谢!
推荐阅读
- java - 如何使 java 应用程序作为在特定时间自动打开的服务运行
- python - 将另一个 python 文件中的变量使用到我当前的文件中
- python - 多元线性回归的预测函数
- python - 是否可以在不改变位置的情况下重命名字典中的键?
- java - Kafka 流时间戳提取器在 KGroupedStream 失败
- java - 如何在 BroadcastReceiver 服务中获取经纬度值?
- azure - 通过仅允许操作组调用来保护具有 Http 触发器的逻辑应用程序
- bash - 检查目录中是否存在文件
- javascript - 没有 vuex 的 Vue 计算属性覆盖全局状态
- google-apps-script - 如何将我的目标工作表以 pdf 格式发送到电子邮件地址