I want to use the browser binding introduced by CMIS 1.1 on Alfresco 4.2.
I can find a document with a SQL92 query but I cannot create a new one:
POST http://localhost:8180/alfresco/api/-default-/public/cmis/versions/1.1/browser?succinct=true HTTP/1.1
Host: localhost:8180
Connection: keep-alive
Content-Length: 496507
Cache-Control: no-cache
Authorization: Basic XXXXXXXXXXXXXXXXXX==
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryWVIchQ4xxZi4TwAe
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="cmisaction"
createDocument
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="propertyId[0]"
cmis:objectTypeId
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="propertyValue[0]"
cmis:document
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="propertyId[1]"
cmis:name
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="propertyValue[1]"
mydoc.jpg
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="versioningState"
none
------WebKitFormBoundaryWVIchQ4xxZi4TwAe
Content-Disposition: form-data; name="content"; filename="test.jpg"
Content-Type: image/jpeg
����
RESPONSE:
{
exception: "runtime"
message: null
stacktrace: "org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException at org.alfresco.opencmis.AlfrescoCmisExceptionInterceptor.invoke(AlfrescoCmisExceptionInterceptor.java:80) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at ...
}
It seems to be a NullPointerException. In the log file I see that getGUID() is the last call:
2014-04-14 11:49:28,701 ERROR [impl.browser.CmisBrowserBindingServlet] [http-apr-8180-exec-1]
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException
at org.alfresco.opencmis.AlfrescoCmisExceptionInterceptor.invoke(AlfrescoCmisExceptionInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy303.createDocument(Unknown Source)
at org.apache.chemistry.opencmis.server.support.CmisServiceWrapper.createDocument(CmisServiceWrapper.java:719)
at org.apache.chemistry.opencmis.server.impl.browser.ObjectService$CreateDocument.serve(ObjectService.java:102)
at org.apache.chemistry.opencmis.server.shared.Dispatcher.dispatch(Dispatcher.java:88)
at org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet.dispatch(CmisBrowserBindingServlet.java:352)
at org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet.service(CmisBrowserBindingServlet.java:231)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.alfresco.opencmis.CMISServletDispatcher.execute(CMISServletDispatcher.java:173)
at org.alfresco.opencmis.CMISWebScript.execute(CMISWebScript.java:51)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:377)
at org.alfresco.rest.api.PublicApiRepositoryContainer.transactionedExecute(PublicApiRepositoryContainer.java:45)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:529)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:341)
at org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:26)
at org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:81)
at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119)
at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88)
at org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:77)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
at org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:74)
at org.alfresco.rest.api.PublicApiWebScriptServlet.service(PublicApiWebScriptServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.alfresco.opencmis.CMISConnector.getGuid(CMISConnector.java:1139)
at org.alfresco.opencmis.CMISConnector.constructObjectId(CMISConnector.java:1194)
at org.alfresco.opencmis.CMISConnector.constructObjectId(CMISConnector.java:1181)
at org.alfresco.opencmis.CMISNodeInfoImpl.<init>(CMISNodeInfoImpl.java:91)
at org.alfresco.opencmis.CMISConnector.createNodeInfo(CMISConnector.java:1107)
at org.alfresco.opencmis.AlfrescoCmisServiceImpl.getOrCreateNodeInfo(AlfrescoCmisServiceImpl.java:207)
at org.alfresco.opencmis.AlfrescoCmisServiceImpl.getOrCreateFolderInfo(AlfrescoCmisServiceImpl.java:227)
at org.alfresco.opencmis.AlfrescoCmisServiceImpl.createDocument(AlfrescoCmisServiceImpl.java:1073)
at org.alfresco.opencmis.PublicApiAlfrescoCmisService.createDocument(PublicApiAlfrescoCmisService.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.opencmis.AlfrescoCmisStreamInterceptor.invoke(AlfrescoCmisStreamInterceptor.java:72)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.opencmis.AlfrescoCmisServiceInterceptor.invoke(AlfrescoCmisServiceInterceptor.java:101)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.opencmis.AlfrescoCmisExceptionInterceptor.invoke(AlfrescoCmisExceptionInterceptor.java:50)
... 48 more
Does anyone try to create a document via alfresco browser binding?
Use the apache CMIS workbench. You can also try the online version linked at Alfresco.
Us the following url to work with it:
<host>/alfresco/api/-default-/public/cmis/versions/1.1/browser
Use the browser binding and create an object, capture the url & request send.
A nice browser binding blog is found here, which explains a bit more than the Alfresco docs.
I found my mistake!
In order to use the cmisaction "createDocument", you need to specified the refered folderId in the query string.
Like this:
http://localhost:8180/alfresco/api/-default-/public/cmis/versions/1.1/browser
?objectId=5f2a7593-7eef-410d-9805-659dff5d4603
In that case, the new document is created into this folder.
Related
When press plus bottom for add more than 1 of product to shopping cart on WordPress, Finally product add to cart after one minute, but I see this error in console:
Request URL: https://abcds.com/cart/
Request Method: POST
Status Code: 503 Backend fetch failed
in my vcl I add this value but not work:
# The code below makes sure the AJAX "add to cart" function works
set req.url = regsub(req.url, "add-to-cart=\d+_\d+&", "");
# Do not cache AJAX requests.
if (req.http.X-Requested-With == "XMLHttpRequest") {
return(pass);
}
# Post requests will not be cached
if (req.http.Authorization || req.method == "POST") {
return (pass);
}
# also in vcl_backend_response I add this codes:
if (!(bereq.url ~ "wp-(login|admin)|login|logged-in|my-account|wc-api|resetpass|admin-ajax.php|arisn") && !(bereq.http.cookie ~ "wordpress_logged_in|woocommerce_items_in_cart|resetpass|wp_woocommerce_session_[a-zA-Z0-9]+|wordpress_logged_in_|comment_author|PHPSESSID|woocommerce_cart_hash") && !(beresp.status == 302))
{
unset beresp.http.set-cookie;
set beresp.ttl = 2h;
}
Related images links:
https://i.postimg.cc/hGPTFx0S/header.png
https://i.postimg.cc/BbQ7ztwk/cookies.png
update:
Varnish log:
<< Request >> 20751307
Begin req 20751306 rxreq
Timestamp Start: 1650725983.556894 0.000000 0.000000
Timestamp Req: 1650725983.556894 0.000000 0.000000
ReqStart 127.0.0.1 55316 a0
ReqMethod POST
ReqURL /cart/
ReqProtocol HTTP/1.0
ReqHeader X-Real-IP: 31.14.152.7
ReqHeader X-Forwarded-For: 31.14.152.7
ReqHeader X-Forwarded-Proto: https
ReqHeader X-Nginx: on
ReqHeader Host: bankketab.com
ReqHeader Connection: close
ReqHeader Content-Length: 297
ReqHeader sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Opera";v="85"
ReqHeader accept: text/html, */*; q=0.01
ReqHeader content-type: application/x-www-form-urlencoded; charset=UTF-8
ReqHeader x-requested-with: XMLHttpRequest
ReqHeader sec-ch-ua-mobile: ?0
ReqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36 OPR/85.0.4341.75
ReqHeader sec-ch-ua-platform: "Windows"
ReqHeader origin: https://bankketab.com
ReqHeader sec-fetch-site: same-origin
ReqHeader sec-fetch-mode: cors
ReqHeader sec-fetch-dest: empty
ReqHeader referer: https://bankketab.com/cart/
ReqHeader accept-encoding: gzip, deflate, br
ReqHeader accept-language: en-US,en;q=0.9
ReqHeader cookie: PHPSESSID=8beb52490b9f7ad5456f8b064a9439a5; woocommerce_recently_viewed=20077%7C20092%7C19496%7C20136; digits_countrycode=98; woocommerce_items_in_cart=1; wp_woocommerce_session_d373d61d3cf9a04133a8550c98d33197=t_df9a955c5d0c76b7f6a9ce2add86d6%7C
ReqUnset X-Forwarded-For: 31.14.152.7
ReqHeader X-Forwarded-For: 31.14.152.7, 127.0.0.1
VCL_call RECV
ReqUnset Host: bankketab.com
ReqHeader host: bankketab.com
ReqURL /cart/
VCL_return pass
VCL_call HASH
VCL_return lookup
VCL_call PASS
VCL_return fetch
Link bereq 20751308 pass
Storage malloc Transient
Timestamp ReqBody: 1650725983.557004 0.000110 0.000110
VCL_Error Uncached req.body can only be consumed once.
Timestamp Fetch: 1650726043.823773 60.266879 60.266769
RespProtocol HTTP/1.1
RespStatus 503
RespReason Backend fetch failed
RespHeader Date: Sat, 23 Apr 2022 15:00:43 GMT
RespHeader Server: Varnish
RespHeader Content-Type: text/html; charset=utf-8
RespHeader Retry-After: 5
RespHeader X-Varnish: 20751307
RespHeader Age: 0
RespHeader Via: 1.1 varnish (Varnish/6.0)
VCL_call DELIVER
RespHeader X-status: 0
RespUnset X-Varnish: 20751307
RespUnset Age: 0
RespUnset Via: 1.1 varnish (Varnish/6.0)
RespHeader X-Configured-By: ServerSetup.co
RespUnset Server: Varnish
RespHeader Server: Nitro
VCL_return deliver
Timestamp Process: 1650726043.823791 60.266897 0.000018
RespHeader Content-Length: 285
RespHeader Connection: close
Timestamp Resp: 1650726043.823839 60.266946 0.000049
ReqAcct 1166 297 1463 231 285 516
End
** << BeReq >> 20751308
-- Begin bereq 20751307 pass
-- Timestamp Start: 1650725983.556958 0.000000 0.000000
-- BereqMethod POST
-- BereqURL /cart/
-- BereqProtocol HTTP/1.0
-- BereqHeader X-Real-IP: 31.14.152.7
-- BereqHeader X-Forwarded-Proto: https
-- BereqHeader X-Nginx: on
-- BereqHeader Content-Length: 297
-- BereqHeader sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Opera";v="85"
-- BereqHeader accept: text/html, */*; q=0.01
-- BereqHeader content-type: application/x-www-form-urlencoded; charset=UTF-8
-- BereqHeader x-requested-with: XMLHttpRequest
-- BereqHeader sec-ch-ua-mobile: ?0
-- BereqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36 OPR/85.0.4341.75
-- BereqHeader sec-ch-ua-platform: "Windows"
-- BereqHeader origin: https://bankketab.com
-- BereqHeader sec-fetch-site: same-origin
-- BereqHeader sec-fetch-mode: cors
-- BereqHeader sec-fetch-dest: empty
-- BereqHeader referer: https://bankketab.com/cart/
-- BereqHeader accept-encoding: gzip, deflate, br
-- BereqHeader accept-language: en-US,en;q=0.9
-- BereqHeader cookie: PHPSESSID=8beb52490b9f7ad5456f8b064a9439a5; woocommerce_recently_viewed=20077%7C20092%7C19496%7C20136; digits_countrycode=98; woocommerce_items_in_cart=1; wp_woocommerce_session_d373d61d3cf9a04133a8550c98d33197=t_df9a955c5d0c76b7f6a9ce2add86d6%7C
-- BereqHeader X-Forwarded-For: 31.14.152.7, 127.0.0.1
-- BereqHeader host: bankketab.com
-- BereqProtocol HTTP/1.1
-- BereqHeader X-Varnish: 20751308
-- VCL_call BACKEND_FETCH
-- VCL_return fetch
-- BackendOpen 50 boot.cPanelServer 144.76.9.138 8080 144.76.9.138 34358
-- BackendStart 144.76.9.138 8080
-- Timestamp Bereq: 1650725983.557008 0.000050 0.000050
-- Timestamp Beresp: 1650725983.823515 0.266558 0.266507
-- BerespProtocol HTTP/1.1
-- BerespStatus 302
-- BerespReason Found
-- BerespHeader Connection: Keep-Alive
-- BerespHeader Expires: Wed, 11 Jan 1984 05:00:00 GMT
-- BerespHeader Cache-Control: no-cache, no-store, must-revalidate, max-age=0
-- BerespHeader X-Redirect-By: WordPress
-- BerespHeader Location: https://bankketab.com/cart/
-- BerespHeader Set-Cookie: woocommerce_cart_hash=3f7d291f9814ba9163415e03a89629cf; path=/; secure
-- BerespHeader Content-Type: text/html; charset=UTF-8
-- BerespHeader Content-Length: 0
-- BerespHeader Date: Sat, 23 Apr 2022 14:59:43 GMT
-- VCL_call BACKEND_RESPONSE
-- BerespHeader Vary: User-Agent
-- VCL_return retry
-- BackendReuse 50 boot.cPanelServer
-- Timestamp Retry: 1650725983.823536 0.266578 0.000021
-- Link bereq 19813441 retry
-- End
*** << BeReq >> 19813441
--- Begin bereq 20751308 retry
--- Timestamp Start: 1650725983.823536 0.266578 0.000000
--- BereqMethod POST
--- BereqURL /cart/
--- BereqProtocol HTTP/1.1
--- BereqHeader X-Real-IP: 31.14.152.7
--- BereqHeader X-Forwarded-Proto: https
--- BereqHeader X-Nginx: on
--- BereqHeader Content-Length: 297
--- BereqHeader sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Opera";v="85"
--- BereqHeader accept: text/html, */*; q=0.01
--- BereqHeader content-type: application/x-www-form-urlencoded; charset=UTF-8
--- BereqHeader x-requested-with: XMLHttpRequest
--- BereqHeader sec-ch-ua-mobile: ?0
--- BereqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36 OPR/85.0.4341.75
--- BereqHeader sec-ch-ua-platform: "Windows"
--- BereqHeader origin: https://bankketab.com
--- BereqHeader sec-fetch-site: same-origin
--- BereqHeader sec-fetch-mode: cors
--- BereqHeader sec-fetch-dest: empty
--- BereqHeader referer: https://bankketab.com/cart/
--- BereqHeader accept-encoding: gzip, deflate, br
--- BereqHeader accept-language: en-US,en;q=0.9
--- BereqHeader cookie: PHPSESSID=8beb52490b9f7ad5456f8b064a9439a5; woocommerce_recently_viewed=20077%7C20092%7C19496%7C20136; digits_countrycode=98; woocommerce_items_in_cart=1; wp_woocommerce_session_d373d61d3cf9a04133a8550c98d33197=t_df9a955c5d0c76b7f6a9ce2add86d6%7C
--- BereqHeader X-Forwarded-For: 31.14.152.7, 127.0.0.1
--- BereqHeader host: bankketab.com
--- BereqHeader X-Varnish: 20751308
--- BereqUnset X-Varnish: 20751308
--- BereqHeader X-Varnish: 19813441
--- VCL_call BACKEND_FETCH
--- VCL_return fetch
--- BackendOpen 50 boot.cPanelServer 144.76.9.138 8080 144.76.9.138 34358
--- BackendStart 144.76.9.138 8080
--- FetchError backend write error: 0 (Success)
--- Timestamp Bereq: 1650725983.823596 0.266638 0.000060
--- FetchError Timed out reusing backend connection
--- BackendClose 50 boot.cPanelServer
--- Timestamp Beresp: 1650726043.823712 60.266755 60.000117
--- Timestamp Error: 1650726043.823717 60.266759 0.000004
--- BerespProtocol HTTP/1.1
--- BerespStatus 503
--- BerespReason Service Unavailable
--- BerespReason Backend fetch failed
--- BerespHeader Date: Sat, 23 Apr 2022 15:00:43 GMT
--- BerespHeader Server: Varnish
--- VCL_call BACKEND_ERROR
--- BerespHeader Content-Type: text/html; charset=utf-8
--- BerespHeader Retry-After: 5
--- VCL_return deliver
--- Storage malloc Transient
--- Length 285
--- BereqAcct 2358 297 2655 394 0 394
--- End
The request body error
As mentioned in the comments, the following log output is quite interesting:
Timestamp ReqBody: 1650725983.557004 0.000110 0.000110
VCL_Error Uncached req.body can only be consumed once.
Timestamp Fetch: 1650726043.823773 60.266879 60.266769
The Uncached req.body can only be consumed once error implies that your retrying a POST call and lose the request body in the process.
The following VCL code from your VCL file has logic that could cause this behavior:
if (beresp.http.Location == "https://" + bereq.http.host + bereq.url) {
if (bereq.retries > 1)
{
unset beresp.http.Location;
}
else {
return (retry);
}
}
The fact that the request is a POST request where the output is a 302 redirect with a Location: https://bankketab.com/cart/ header triggers that part of the VCL.
The problem with retrying a request that has a request body (such as a typical POST request), is that Varnish doesn't cache the request body. That information is lost when asking for a retry.
The HTTP 503 backend fetch failure
All of this explains the VCL_Error Uncached req.body can only be consumed once. error.
The actual HTTP 503 error could be something entirely different. However, they could be related.
The logs below refer to a backend write error:
--- BackendOpen 50 boot.cPanelServer 144.76.9.138 8080 144.76.9.138 34358
--- BackendStart 144.76.9.138 8080
--- FetchError backend write error: 0 (Success)
--- Timestamp Bereq: 1650725983.823596 0.266638 0.000060
--- FetchError Timed out reusing backend connection
--- BackendClose 50 boot.cPanelServer
I'm not 100% sure, but it could be that the backend is waiting for the POST request body. It doesn't get it, times out and returns the error.
Monitoring backend health
A backend returns an HTTP 503 error when it is not available or when that backend doesn't return the expected result in a timely fashion.
Luckily there's a varnishlog command that can help us check the status of a pre-defined health probe.
Your VCL code happens to feature a backend_healthcheck health probe that polls the backend every 5 seconds.
Please run the following command to check the general health of your backend:
varnishlog -g raw -i backend_health
Every 5 seconds there should be a new log line with the status of the health check. Run it for a minute or so and see what the status is. If the backend is healthy, there is no critical problem with the backend. This can also help us conclude that the problem you're experiencing is really related to the absence of the request body in the retry.
Solving the problem
My advice is to use the std.cache_req_body() function that is described in https://varnish-cache.org/docs/6.0/reference/vmod_generated.html#func-cache-req-body to ensure the request body services a return(retry) in the VCL code.
Here's an oversimplified VCL example that features this function:
sub vcl_recv {
if(std.cache_req_body(1KB)) {
std.log("Request body accessible");
} else {
std.log("Request body not accessible");
}
}
A boolean value is returned from std.cache_req_body() describing whether or not retrieving the request body from cache was successful. You could return a synthetic error in the else path if you want.
There's no guarantee that caching the request body will solve the issue, but there are indications in the log that the failure can be caused by the absence of the request body. In any case it makes sense to run varnishlog -g raw -i backend_health to figure out what the general health is of your backend.
I noticed a bug in an old version of firefox, that was shipped with my os.
These were the sympthoms:
Guile web server failed to serve the request when data was reposted.
I came up with a minimal example to show the problem.
Steps to reproduce:
start the server script
load localhost:8080
select the test.csv file for upload, and upload it
hit the refresh button in the browser
answer yes to resend post data dialog.
test.scm:
(use-modules (web server)
(rnrs bytevectors))
(define (handler request body)
(if body
(display (utf8->string body)))
(values '((content-type . (text/html)))
(string-append "<html><body>"
"<form action=\"do\" method=\"POST\" enctype=\"multipart/form-dat\
a\">"
"<input type=\"file\" name=\"x\">"
"<input type=\"submit\">")))
(run-server handler)
test.csv:
a,b
Expected result: no error displayed on the console.
Actual result:
-----------------------------18912432064747206221264673165
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
In ice-9/boot-9.scm:
841:4 4 (with-throw-handler _ _ _)
In web/server/http.scm:
127:28 3 (_)
In web/request.scm:
205:31 2 (read-request #<closed: file 5559bbcb82a0> _)
In web/http.scm:
1141:6 1 (read-request-line _)
In ice-9/boot-9.scm:
752:25 0 (dispatch-exception _ _ _)
Bad request: Bad Request-Line: "a,b"
What am I doing wrong here?
Some additional information:
on a whireshark capture it turns out, that the following is sent on resend:
POST /do HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/do
Content-Type: multipart/form-data; boundary=---------------------------121791188820701943592108452984
Content-Length: 150
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
-----------------------------121791188820701943592108452984
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
POST /do HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/do
Content-Type: multipart/form-data; boundary=---------------------------121791188820701943592108452984
Content-Length: 150
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
-----------------------------121791188820701943592108452984
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
a,b
-----------------------------121791188820701943592108452984--
I will check the http spec if it has anything to say about this. The first http request is partial, followed by a well formed request.
UPDATE:
It turned out that guile webserver threw the error completely legitimately.
Answering my own question:
This is actually this firfox bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1434553
Fixed in firefox62.
I have multiple sites in Alfresco, uploader plus is working fine for other sites except one, throws an exception and error pop up says "operation failure".
uploader plus is working fine for the individual folders. but issue comes when we are applying this to the documentLibrary folder of a particular website.
Also not able to upload any document in that particular site, giving internal server 500 error.
Please refer attached screen shots for more details.
Let me know if you have any resolution/workaround for this issue.
Thanks in Advance.enter image description here
upload-folders-new.post.json.ftl File code :
<#escape x as jsonUtils.encodeJSONString(x)>
{
"status": ${status},
"node": {
"nodeRef": "${node.nodeRef}",
"path": "${node.displayPath}\/${node.properties.name}",
"allowedTypes": []
}
}
</#escape>
Error :
2018-09-07 06:27:26,210 ERROR [extensions.webscripts.AbstractRuntime] [http-apr-8080-exec-21] Exception from executeScript: 08070089 Wrapped Exception (with status template): 08070869 Error during processing of the template 'get(properties) failed on instance of org.alfresco.repo.template.TemplateNode. See cause exception.
The failing instruction:
==> ${node.properties.name} auto-escaped [in template "com/piridn/uploader/upload-folders-new.post.json.ftl" at line 6, column 31]'. Please contact your system administrator.
org.springframework.extensions.webscripts.WebScriptException: 08070089 Wrapped Exception (with status template): 08070869 Error during processing of the template 'get(properties) failed on instance of org.alfresco.repo.template.TemplateNode. See cause exception.
The failing instruction:
==> ${node.properties.name} auto-escaped [in template "com/piridn/uploader/upload-folders-new.post.json.ftl" at line 6, column 31]'. Please contact your system administrator.
at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1138)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:519)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:587)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:656)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:428)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:308)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:237)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:214)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.repo.webdav.auth.BaseSSOAuthenticationFilter.doFilter(BaseSSOAuthenticationFilter.java:197)
at sun.reflect.GeneratedMethodAccessor585.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy156.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.web.app.servlet.WebScriptSSOAuthenticationFilter.doFilter(WebScriptSSOAuthenticationFilter.java:121)
at sun.reflect.GeneratedMethodAccessor585.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy156.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.web.app.servlet.WebscriptCookieAuthenticationFilter.doFilter(WebscriptCookieAuthenticationFilter.java:84)
at sun.reflect.GeneratedMethodAccessor585.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:132)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy156.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: org.alfresco.service.cmr.repository.TemplateException: 08070869 Error during processing of the template 'get(properties) failed on instance of org.alfresco.repo.template.TemplateNode. See cause exception.
The failing instruction:
==> ${node.properties.name} auto-escaped [in template "com/xyz/uploader/upload-folders-new.post.json.ftl" at line 6, column 31]'. Please contact your system administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:234)
at org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:967)
at org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
... 74 more
Caused by: freemarker.template.TemplateModelException: get(properties) failed on instance of org.alfresco.repo.template.TemplateNode. See cause exception.
The failing instruction:
==> ${node.properties.name} auto-escaped [in template "com/piridn/uploader/upload-folders-new.post.json.ftl" at line 6, column 31]
at freemarker.ext.beans.BeanModel.get(BeanModel.java:222)
at freemarker.core.Dot._eval(Dot.java:76)
at freemarker.core.Expression.eval(Expression.java:111)
at freemarker.core.Dot._eval(Dot.java:74)
at freemarker.core.Expression.eval(Expression.java:111)
at freemarker.core.ListLiteral.getModelList(ListLiteral.java:126)
at freemarker.core.MethodCall._eval(MethodCall.java:94)
at freemarker.core.Expression.eval(Expression.java:111)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.EscapeBlock.accept(EscapeBlock.java:85)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.process(Environment.java:243)
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:230)
... 77 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor633.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:912)
at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:275)
at freemarker.ext.beans.BeanModel.get(BeanModel.java:182)
... 93 more
Caused by: java.lang.NullPointerException: Object cannot be null.
at com.hazelcast.impl.Util.checkSerializable(Util.java:39)
at com.hazelcast.impl.MProxyImpl.check(MProxyImpl.java:473)
at com.hazelcast.impl.MProxyImpl.access$900(MProxyImpl.java:49)
at com.hazelcast.impl.MProxyImpl$MProxyReal.get(MProxyImpl.java:778)
at com.hazelcast.impl.MProxyImpl.get(MProxyImpl.java:114)
at org.alfresco.enterprise.repo.cluster.cache.HazelcastSimpleCache.get(HazelcastSimpleCache.java:82)
at sun.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.alfresco.enterprise.repo.cluster.core.ClusteredObjectProxyFactory$AbstractClusteredObjectProxyInvoker.invoke(ClusteredObjectProxyFactory.java:293)
at org.alfresco.enterprise.repo.cluster.core.ClusteredObjectProxyFactory$CacheProxyInvoker.invoke(ClusteredObjectProxyFactory.java:204)
at com.sun.proxy.$Proxy13.get(Unknown Source)
at org.alfresco.repo.cache.TransactionalCache.getSharedCacheValue(TransactionalCache.java:454)
at org.alfresco.repo.cache.TransactionalCache.get(TransactionalCache.java:641)
at org.alfresco.repo.tagging.TagScopePropertyMethodInterceptor.getTagSummary(TagScopePropertyMethodInterceptor.java:186)
at org.alfresco.repo.tagging.TagScopePropertyMethodInterceptor.invoke(TagScopePropertyMethodInterceptor.java:127)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.enterprise.repo.sync.SyncPropertyInterceptor.invoke(SyncPropertyInterceptor.java:161)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:219)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy23.getProperties(Unknown Source)
at sun.reflect.GeneratedMethodAccessor295.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at com.sun.proxy.$Proxy23.getProperties(Unknown Source)
at sun.reflect.GeneratedMethodAccessor295.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.audit.DisableAuditableBehaviourInterceptor.invoke(DisableAuditableBehaviourInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:86)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:76)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.enterprise.repo.authorization.AuthorizationStatusInterceptor.invoke(AuthorizationStatusInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy23.getProperties(Unknown Source)
at org.alfresco.repo.template.TemplateNode.getProperties(TemplateNode.java:269)
... 99 more
2018-09-07 06:27:30,038 ERROR [solr.tracker.AbstractTracker] [org.alfresco.solr.AlfrescoCoreAdminHandler#5ed2d0e7_Worker-3] Model tracking failed
org.alfresco.error.AlfrescoRuntimeException: 080721297 archive GetModelsDiff return status is 403
at org.alfresco.solr.client.SOLRAPIClient.getModelsDiff(SOLRAPIClient.java:1181)
at org.alfresco.solr.tracker.ModelTracker.trackModelsImpl(ModelTracker.java:248)
at org.alfresco.solr.tracker.ModelTracker.trackModels(ModelTracker.java:206)
at org.alfresco.solr.tracker.ModelTracker.ensureFirstModelSync(ModelTracker.java:228)
at org.alfresco.solr.component.EnsureModelsComponent.prepare(EnsureModelsComponent.java:87)
at org.apache.solr.handler.component.AlfrescoSearchHandler.handleRequestBody(AlfrescoSearchHandler.java:292)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.alfresco.solr.Cloud.getResponse(Cloud.java:165)
at org.alfresco.solr.Cloud.getSolrDocumentList(Cloud.java:149)
at org.alfresco.solr.SolrInformationServer.getDocsWithUncleanContent(SolrInformationServer.java:722)
at org.alfresco.solr.tracker.ContentTracker.doTrack(ContentTracker.java:76)
at org.alfresco.solr.tracker.AbstractTracker.track(AbstractTracker.java:179)
at org.alfresco.solr.tracker.TrackerJob.execute(TrackerJob.java:54)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
It seems that the name of your file is null (which is not clear for me why).
This might be because the document your are uploading is not indexed yet.
Try to use the fileName of the file you uploaded instead of the name property of the node, or protect your line this way :
<#escape x as jsonUtils.encodeJSONString(x)>
{
"status": ${status},
"node": {
"nodeRef": "${node.nodeRef}",
<#if node.properties.name??>
"path": "${node.displayPath}\/${node.properties.name}",
</#if>
"allowedTypes": []
}
}
</#escape>
I'm trying to get the SAML2BearerGrantHandler in APIM 2.0.0 up and running. I'm using Auth0 as the IdP with their SAML2 add on.
I've created the IdP in carbon console, uploaded the signing cert etc.
I sort of followed this document to test the grant: https://docs.wso2.com/display/AM200/SAML+Extension+Grant
I get back an assertion, but when I try to get a token, I get this error:
[2016-12-22 14:14:07,493] DEBUG - Starting to unmarshall Apache XML-Security-based SignatureImpl element {org.opensaml.xml.signature.impl.SignatureUnmarshaller}
[2016-12-22 14:14:07,493] DEBUG - Constructing Apache XMLSignature object {org.opensaml.xml.signature.impl.SignatureUnmarshaller}
[2016-12-22 14:14:07,493] DEBUG - Adding canonicalization and signing algorithms, and HMAC output length to Signature {org.opensaml.xml.signature.impl.SignatureUnmarshaller}
[2016-12-22 14:14:07,493] DEBUG - Adding KeyInfo to Signature {org.opensaml.xml.signature.impl.SignatureUnmarshaller}
[2016-12-22 14:14:07,496] DEBUG - Attempting to validate signature using key from supplied credential {org.opensaml.xml.signature.SignatureValidator}
[2016-12-22 14:14:07,496] DEBUG - Creating XMLSignature object {org.opensaml.xml.signature.SignatureValidator}
[2016-12-22 14:14:07,496] DEBUG - Validating signature with signature algorithm URI: http://www.w3.org/2000/09/xmldsig#rsa-sha1 {org.opensaml.xml.signature.SignatureValidator}
[2016-12-22 14:14:07,496] DEBUG - Validation credential key algorithm 'RSA', key instance class 'sun.security.rsa.RSAPublicKeyImpl' {org.opensaml.xml.signature.SignatureValidator}
[2016-12-22 14:14:07,496] DEBUG - signatureMethodURI = http://www.w3.org/2000/09/xmldsig#rsa-sha1 {org.apache.xml.security.signature.XMLSignature}
[2016-12-22 14:14:07,497] DEBUG - jceSigAlgorithm = SHA1withRSA {org.apache.xml.security.signature.XMLSignature}
[2016-12-22 14:14:07,497] DEBUG - jceSigProvider = SunRsaSign {org.apache.xml.security.signature.XMLSignature}
[2016-12-22 14:14:07,498] DEBUG - PublicKey = Sun RSA public key, 2048 bits
modulus: 26353633891041219443555298896940833763013288672547189529990760782389210433157310523660493244822551263271160825380041450279478692306592200788388889392222651352619319200257986531144181422406322904036906144840963109856120111801402390951198592877952280076297215745933238289610251813795329247172444398191149065258417196041849903979764273498745394547327839617271694646395229047487503702861075929157239530326410733377150539916753245430560066336565896803919667301164361866985565847943467875326115118253431566885711860811510147756117932985644696034426336566866370975790479374077388749068216645015606582681408478883949754138717
public exponent: 65537 {org.apache.xml.security.signature.XMLSignature}
[2016-12-22 14:14:07,498] ERROR - Error while validating the signature. {org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler}
org.opensaml.xml.validation.ValidationException: Unable to evaluate key against signature
at org.opensaml.xml.signature.SignatureValidator.validate(SignatureValidator.java:74)
at org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler.validateGrant(SAML2BearerGrantHandler.java:472)
at org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer.issue(AccessTokenIssuer.java:194)
at org.wso2.carbon.identity.oauth2.OAuth2Service.issueAccessToken(OAuth2Service.java:219)
at org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint.getAccessToken(OAuth2TokenEndpoint.java:246)
at org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint.issueAccessToken(OAuth2TokenEndpoint.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1756)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.xml.security.signature.XMLSignatureException: Signature length not correct: got 0 but was expecting 256
Original Exception was java.security.SignatureException: Signature length not correct: got 0 but was expecting 256
at org.apache.xml.security.algorithms.implementations.SignatureBaseRSA.engineVerify(SignatureBaseRSA.java:93)
at org.apache.xml.security.algorithms.SignatureAlgorithm.verify(SignatureAlgorithm.java:301)
at org.apache.xml.security.signature.XMLSignature.checkSignatureValue(XMLSignature.java:723)
at org.opensaml.xml.signature.SignatureValidator.validate(SignatureValidator.java:69)
... 58 more
Caused by: java.security.SignatureException: Signature length not correct: got 0 but was expecting 256
at sun.security.rsa.RSASignature.engineVerify(RSASignature.java:189)
at java.security.Signature$Delegate.engineVerify(Signature.java:1219)
at java.security.Signature.verify(Signature.java:652)
at org.apache.xml.security.algorithms.implementations.SignatureBaseRSA.engineVerify(SignatureBaseRSA.java:91)
... 61 more
So, it seems that the assertion is read ok, but I'm stuck verifying the signature. Did anyone have this issue before and solved it?
-- UPDATE:
this is the assertion that's generated by Auth0:
<?xml version="1.0" encoding="UTF-8"?><saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="nieapeeiianlpgnhhkmildecgaajocfbpdonepgi" IssueInstant="2016-12-27T08:37:07.712Z" Version="2.0"><saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">urn:spronq.eu.auth0.com</saml:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#nieapeeiianlpgnhhkmildecgaajocfbpdonepgi">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ds saml xs xsi"/></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>z7dAuipcj9k945anY2H4BpJJ00w=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue/>
<ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIIC7jCCAdagAwIBAgIJa9PaSP2xH3taMA0GCSqGSIb3DQEBBQUAMB4xHDAaBgNVBAMTE3Nwcm9u
cS5ldS5hdXRoMC5jb20wHhcNMTYxMDEyMDYyMDQyWhcNMzAwNjIxMDYyMDQyWjAeMRwwGgYDVQQD
ExNzcHJvbnEuZXUuYXV0aDAuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0MLQ
btTBiUvTRlDMZ8ynAaNQWxuKvoL7FBI47rw1apxLfTtYnBBIeD4NC0XHkEP0hJ8cWKz/z37PmCS9
HNZpIk8yuIQS8pZiafEdMIiBBuFqrDJ1okrTt9koweAs+Gmu1oJIENpFRg5Ud81t1nWqj89m9pOp
F7MBx/z6ZZcUDKBaB+XnrOtZzH4Oo//+AlkFmPHVuU8S0Zva68RC9SLnoxLGpm+ZM4aoHFlP/tOO
kHKh+4w4HLBzXy+fzG6wktEisvGhkAgvcV4PmuVdFXZmj1JCQLGA4O4Itzl4P2337TOK4tMCwSFd
CclqhNBjtITe5tJ+CeBDZD7+8lDvNrtAXQIDAQABoy8wLTAMBgNVHRMEBTADAQH/MB0GA1UdDgQW
BBRMyIkyGViVCCV8fPj7XZY/gjzLGjANBgkqhkiG9w0BAQUFAAOCAQEAx4D72OFZ1KaTrCOYfz7E
Z6OuWHZ21R3zdvJes+JBUcp9imnzvJTBi0IkjK1lOjuBddcPsSI7aGK5Da+zqbiR2TvbWnEphlYY
rPgVsQEp1OhelQwmQALd6C/28HFVUF/rC74LmSP5akXTl5itTt2H04P0dHbTF8/sBTSqfm1PLdp/
gseJTUszQTVNE6oM1U70VAZ4cRR5B8Qkb0Y54nRGllv8FdShxVf2GBaZIOriolh8wojNE47igXOm
nfvfWeZydyV9LVFi9uaT3LOiuct9s+MeFj8WDcUy3QwumVdXwh3a8R82PlPdlTXkZC/UDqSP26t5
0bgZF3esedF3TCqA9w==</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature><saml:Subject><saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">d.kruitbosch#vanlanschot.com</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData InResponseTo="0" NotOnOrAfter="2016-12-27T08:42:07.712Z" Recipient="https://localhost:8243/token"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotBefore="2016-12-27T08:37:07.712Z" NotOnOrAfter="2016-12-27T08:42:07.712Z"><saml:AudienceRestriction><saml:Audience>https://localhost:8243/token</saml:Audience></saml:AudienceRestriction></saml:Conditions><saml:AuthnStatement AuthnInstant="2016-12-27T08:37:07.774Z"><saml:AuthnContext><saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef></saml:AuthnContext></saml:AuthnStatement><saml:AttributeStatement><saml:Attribute Name="w"><saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">s</saml:AttributeValue></saml:Attribute></saml:AttributeStatement></saml:Assertion>
Thanks,
Danny
So I solved this, with a lot of manual steps. But at least I know the saml bearer token is working.
I couldn't get it to work with the SAMLAssertionCreator.jar that's linked in the WSO2 documentation. So what I did is the following:
Changed the SAML settings in Auth0 to set the proper Audience and Recipient values.
In Auth0 used the debug tool of the SAML Addon to create an SAML assertion.
Copied the SAML response, copied <Assertion>...</Assertion> part, minified the XML and encoded it (using http://kjur.github.io/jsjws/tool_b64uenc.html).
Created a test in Postman and used the encoded assertion to get an
access token.
This works, so know I can start creating my client to use these steps and have a way to verify everything.
Regards,
Danny
POST /upload HTTP/1.1
Host: assets.drop.io
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2
009042316 Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Content-Length: 5728
Content-Type: multipart/form-data; boundary=--------MalolHCBdarysNYMHZbIvjbD
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="api_key"
0b8a12109c3a1bfc4ba94aec926e1f9cfd8bb6f0
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="drop_name"
4pgvoxc
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="version"
2.0
--------MalolHCBdarysNYMHZbIvjbD
Content-Disposition: form-data; name="rachel"; filename="rachel"
Content-Type: application/octet-stream
BMv¶
--------MalolHCBdarysNYMHZbIvjbD--
The response I get is: Bad Request. And in the HTML of the response there is this:
:MultiPartParseError: bad content body:
'
----------MalolHCBdarysNYMHZbIvjbD' should == '----------MalolHCBdarysNYMHZbIvjbD
'></td></tr>
The answer is in your question. The response says that the divider should be '----------MalolHCBdarysNYMHZbIvjbD ' instead of ' ----------MalolHCBdarysNYMHZbIvjbD'
Look at the leading and trailing spaces.
The schematic syntax of a multipart/form-data message is as follows:
Content-Type: multipart/form-data; boundary=boundary
--boundary
Content-Disposition: form-data; name="field 1"
data 1
--boundary
Content-Disposition: form-data; name="field 2"
data 2
⋮
--boundary
Content-Disposition: form-data; name="field N"
data N
--boundary--
So the inner part boundaries are --boundary (-- followed by the boundary value) and the last is --boundary-- (-- followed by the boundary value followed by --).
In your case you are just missing the leading --.