這Tomcat的7
下工作,我在的Guvnor 5.5.0.Final使用:
curl -v -u {user}:{password} -H "Accept: application/json" curl-X GET localhost:8080/drools-guvnor/rest/packages
返回:
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Server auth using Basic with user '{user}'
> GET /drools-guvnor/rest/packages HTTP/1.1
> Authorization: Basic ZGF2aWQ6ZGF2aWQ=
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8080
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=68225AF4B272E5CCA962FFE83BCB008A; Path=/drools-guvnor/; HttpOnly
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Sat, 18 May 2013 17:10:51 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
[{"package":{"assets":"http:\/\/localhost:8080\/drools-guvnor\/rest\/packages\/defaultPackage\/assets\/drools","author":"{user}","binar yLink":"http:\/\/localhost:8080\/drools-guvnor\/rest\/packages\/defaultPackage\/binary","description":"The default rule package","meta data":{"archived":false,"checkinComment":"Initial","created":"2013-05-18T12:34:53.825-04:00","state":"","uuid":"ab4ae1a2-10d7-43e7-9d8 e-411c93a8e669","versionNumber":1},"published":"2013-05-18T12:34:53.833-04:00","sourceLink":"http:\/\/localhost:8080\/drools-guvnor\/r
故障排除:
HTTP Status 500 - Unable to find JAXBContext for media type: application/json
這發生錯誤因爲@sstarcher根據this post「resteasy不再在罐子裏包含json支持」。從這個答案中不清楚的是,如何解決drools-guvnor中的問題。
在這種情況下,使用drools-guvnor.5.5.0.Final,你需要下載兩個jar文件:在您的{} TOMCAT_HOME
- [jettison-1.3.3.jar][2]
- [resteasy-jettison-provider-2.2.3.GA.jar][3]
您應該將都 jar文件/ webapps /目錄drools-guvnor/WEB-INF/lib文件夾。在一些系統上看起來像這樣:
/usr/local/tomcat/apache-tomcat-7.0.35/webapps/drools-guvnor/WEB-INF/lib
接下來停止並重新啓動Web服務器。在{TOMCAT_HOME}/bin目錄 的Tomcat上,您可以使用./shutdown.sh和./startup.sh命令。
401 - 未經授權。如果您不使用-u user:pass可選參數,則會發生這種情況。開箱即用,guvnor使用假基本認證器,這需要頭文件才能工作。
404未找到。如果您沒有在請求中指定目錄或資源的正確名稱,則會發生此錯誤。
405 - 方法不允許。當你糾纏捲曲選項,忘記報價等時會發生。
406 - 不可接受。如果您使用-H選項指定了不受支持的「Accept:」標題,則會發生此錯誤。
HTH