1
我想在Camunda BPM示例項目(嵌入式彈簧休息)中使用RESTEasy的異步HTTP請求處理功能。爲了測試現有的pom file是否可以,我在RestProcessEngineDeployment.java
中輸入了對Suspend
和AsynchronousResponse
的聲明。但是編譯失敗了。編譯錯誤:找不到符號掛起和AsynchronousResponse
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project camunda-quickstart-embedded-spring-rest: Compilation failure: Compilation failure:
[ERROR] /home/vagrant/works/eclipse-workspace/camunda-bpm-examples/deployment/embedded-spring-rest/src/main/java/org/camunda/bpm/example/loanapproval/rest/RestProcessEngineDeployment.java:[7,19] cannot find symbol
[ERROR] symbol: class Suspend
[ERROR] location: package javax.ws.rs
[ERROR] /home/vagrant/works/eclipse-workspace/camunda-bpm-examples/deployment/embedded-spring-rest/src/main/java/org/camunda/bpm/example/loanapproval/rest/RestProcessEngineDeployment.java:[8,24] cannot find symbol
[ERROR] symbol: class AsynchronousResponse
[ERROR] location: package javax.ws.rs.core
POM file看起來沒問題。它包含必要的依賴關係:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.8.Final</version>
</dependency>
web.xml file也看起來沒問題。它包含filter
和filter-mapping
,如RESTEasy user guide中所建議的。
<filter>
<filter-name>Resteasy</filter-name>
<filter-class>
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
</filter-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Resteasy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
我錯過了什麼嗎?任何線索,我怎麼能找出問題?
也許你想['javax.ws.rs.container.AsyncResponse'] (https://docs.oracle.com/javaee/7/api/javax/ws/rs/container/AsyncResponse.html)和['@ javax.ws.rs.container.Suspended'](https:// docs .oracle.com/JavaEE的/ 7/API /的javax/WS/RS /容器/ Suspended.html)。很難說沒有看到一些代碼。 – 2014-12-07 11:48:34
@peeskillet,你是對的!我提出錯誤的進口陳述。我應該注意到,在[RESTEasy用戶指南](http://docs.jboss.org/resteasy/docs/3.0.9.Final/userguide/html_single/index。)中,導入語句和實際使用的接口/註釋是不同的。 HTML#Asynchronous_HTTP_Request_Processing)。 – 2014-12-07 12:03:46
@peeskillet您能否將評論作爲答案。我想接受答案。它解決了這個問題。 – 2014-12-07 23:39:52