0
我想解析@Context UriInfo
到另一個線程並執行一些任務。但是,當我嘗試運行它,它提供了錯誤的解析@Context UriInfo到java線程
Exception in thread "Thread-691" org.jboss.resteasy.spi.LoggableFailure: Unable to find contextual data of type: javax.ws.rs.core.UriInfo
我的代碼如下
@GET
@Path("/thread")
public void thread(@Context UriInfo url){
Runnable run = new Runnable() {
@Override
public void run() {
System.out.println(">>>>>>>>>>>> " + url.getRequestUri().getQuery());
}
};
Thread t = new Thread(run);
t.start();
}
我怎樣才能獲得UriInfo新線程?
有沒有人不知道這個問題? – DDS
你不應該在jee容器中開始自己的線程。看來你正在使用jboss/wildfly。應用程序服務器本身會將線程漫遊。你想達到什麼目的? – Schlangguru
我試圖從JBOSS發送多個帖子請求到其他服務器。 – DDS