REST-API - Deleted-Nodes Restore Problem

cancel
Showing results for 
Search instead for 
Did you mean: 
mbasoft
Active Member

REST-API - Deleted-Nodes Restore Problem

Jump to solution

Hi,

I have a problem to restore deleted files or folders by using the following Alfresco REST-API-Method:

POST /deleted-nodes/{nodeId}/restore

I upgraded my Server to Alfresco 6.x  (6.1 or 6.2GA) and since than each time I try to restore a file or folder by calling the restore method I get a HTTP error code 400 (Bad Request). See the following log fragment from the alfresco.log below.

POST /alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/cfc3eb1c-4cd8-4847-b683-9acbd1e06fac/restore HTTP/1.0" 400 316

With Alfresco 5.2 the same method call works without any problem. I posted this problem a year ago, but it seams nobody else is having such a problem too.

Would be nice if someone from Alfresco or the community can help to get rid of this problem. Thank you.

Best regards, Matthias

 

Old Post:

https://hub.alfresco.com/t5/alfresco-content-services-forum/alfresco-6-1-1-rest-api-problem/m-p/3033...

1 Solution

Accepted Solutions
abhinavmishra14
Advanced

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

There are two errors in the log, one is related to sending emails.

java.net.UnknownHostException: smtp.example.com. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1;  nested exception is:	java.net.UnknownHostException: smtp.example.com; message exceptions (1) are:Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1;  nested exception is:	java.net.UnknownHostException: smtp.example.com

Looks like you have not configured outbound stmp correctly or host is not reachable from your server. If you are not using email functionality, disable it. Remove mail configuration from alfresco-global.properties.

Or disable activity feeds if not using it. 

activities.feed.notifier.enabled=false

The other error is related to number format parsing. It looks like error is thrown while parsing the content length, see here:

https://github.com/Alfresco/alfresco-community-repo/blob/master/remote-api/src/main/java/org/alfresc...

Unfortunately these classes doesn't have loggers. 

Can you check the POST request details and see whether you are passing the content lenght or not? Content lenght seems to be expecting '0' in the request and must be passed in the request.

https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-restore-trashcan-items.html

curl -X POST -H 'Content-Type: text/plain;charset=UTF-8' -H 'Content-Length: 0' -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/4bda2a4d-5013-46fa-93bd-104dd58e1596/restore' 

Copying the error here for others to see:

2020-11-30 20:28:21,553 DEBUG [org.alfresco.repo.transaction.RetryingTransactionHelper] [http-nio-8080-exec-5] Transaction commit failed:    Thread: http-nio-8080-exec-5   Txn:    UserTransaction[object=org.alfresco.util.transaction.SpringAwareUserTransaction@4b838202, status=0]   Iteration: 0   Exception follows:
java.lang.NumberFormatException: null
	at java.base/java.lang.Integer.parseInt(Integer.java:614)
	at java.base/java.lang.Integer.valueOf(Integer.java:983)
	at org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractObjFromJson(ResourceWebScriptPost.java:175)
	at org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.processRequest(ResourceWebScriptPost.java:138)
	at org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractParams(ResourceWebScriptPost.java:109)
	at org.alfresco.rest.framework.webscripts.AbstractResourceWebScript$1.execute(AbstractResourceWebScript.java:110)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
	at org.alfresco.rest.framework.webscripts.AbstractResourceWebScript.execute(AbstractResourceWebScript.java:128)
	at org.alfresco.rest.framework.webscripts.ApiWebScript.execute(ApiWebScript.java:115)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:474)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:664)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:435)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:315)
	at org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:47)
	at org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:84)
	at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:126)
	at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:95)
	at org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:80)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
	at org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:82)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

	...... (trimmed)
2020-11-30 20:28:21,560 ERROR [org.alfresco.rest.framework.webscripts.ResourceWebScriptPost] [http-nio-8080-exec-5] 5fcc213d-2170-4dba-a9c6-8ba69f5e80b7 : [java.base/java.lang.Integer.parseInt(Integer.java:614), java.base/java.lang.Integer.valueOf(Integer.java:983), org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractObjFromJson(ResourceWebScriptPost.java:175), org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.processRequest(ResourceWebScriptPost.java:138), org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractParams(ResourceWebScriptPost.java:109), org.alfresco.rest.framework.webscripts.AbstractResourceWebScript$1.execute(AbstractResourceWebScript.java:110), org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450), org.alfresco.rest.framework.webscripts.AbstractResourceWebScript.execute(AbstractResourceWebScript.java:128), org.alfresco.rest.framework.webscripts.ApiWebScript.execute(ApiWebScript.java:115), org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:474), org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:664), org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:435), org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:315), org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:47), org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:84), org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:126), org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:95), org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:80), org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399), org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210), org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:82), javax.servlet.http.HttpServlet.service(HttpServlet.java:741), jdk.internal.reflect.GeneratedMethodAccessor428.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:170), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:225), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:75), java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method), java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:132), org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212), com.sun.proxy.$Proxy170.doFilter(Unknown Source), org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.web.app.servlet.ClearSecurityContextFilter.doFilter(ClearSecurityContextFilter.java:53), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199), org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96), org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493), org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137), org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81), org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660), org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87), org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343), org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798), org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66), org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808), org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498), org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49), java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128), java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628), org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61), java.base/java.lang.Thread.run(Thread.java:834)]
2020-11-30 20:31:26,843 DEBUG [org.alfresco.rest.framework.core.ResourceLookupDictionary] [http-nio-8080-exec-11] Locating resource :/deleted-nodes/{entityId}/restore
2020-11-30 20:31:26,843 DEBUG [org.alfresco.rest.api.PublicApiRepositoryContainer] [http-nio-8080-exec-11] executeScript (-system-): [null,-system-] /alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/c7d39e39-e959-4239-ac24-95aa1aa6e898/restore
2020-11-30 20:31:26,848 DEBUG [org.alfresco.rest.framework.core.ResourceLookupDictionary] [http-nio-8080-exec-11] Locating resource :/deleted-nodes/{entityId}/restore
2020-11-30 20:31:26,848 DEBUG [org.alfresco.repo.transaction.RetryingTransactionHelper] [http-nio-8080-exec-11] Transaction commit failed:    Thread: http-nio-8080-exec-11   Txn:    UserTransaction[object=org.alfresco.util.transaction.SpringAwareUserTransaction@352c66af, status=0]   Iteration: 0   Exception follows:
java.lang.NumberFormatException: null
	at java.base/java.lang.Integer.parseInt(Integer.java:614)

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View solution in original post

7 Replies
abhinavmishra14
Advanced

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

The api just worked fine when i tried via rest client 

https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-restore-trashcan-items.html

Checked old post and logs you shared, but there is nothing in the log about the error. can you repost the alfresco.log/catalina.out logs when you get this error. 

Make sure you are using the nodeID either via admin user who has admin access to every node in repository or user which you are using to call the api is owner of the node. 

Check this thread as well: https://hub.alfresco.com/t5/alfresco-content-services-forum/allow-site-admins-to-view-items-deleted-...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
mbasoft
Active Member

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

Thank you for your response. I also tried the alfresco admin user to perform the restore, but no luck. Same error es mentioned in my previous posts. A couple a days ago i activated the debug log (see the download links below) where you can find the restore calls followed by an transaction ecxeption. I have no idea whether this relevant or not. I really need a solution for this problem. Furthermore: If I try to restore a file or folder from trash and the http 400 occurs there is no log entry within catalina.log (see the screenshots attached - only localhost_access_log... was updated with the http 400 error).

I hope someone can help to track this error down (and as i said: same code to access Alfresco 5.2 works just fine, no error at all).

Best regards, Matthias

Alfresco-Debug-Log:

https://alfrodin.com/downloads/alfrescohub/alfresco.zip 

Screenshot from log folder:

https://alfrodin.com/downloads/alfrescohub/Alfreso-Log-ChageDateTime.png 

 

abhinavmishra14
Advanced

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

So i looked up the log file, i can see only one error that is related to the failure.It says transaction is rolled back but not able to find what could have caused this. Would you mind disabling the debug log on root logger and just enable debug log for the below given packages and share the logs again?

log4j.logger.org.alfresco.repo.web=DEBUG
log4j.logger.org.alfresco.rest=DEBUG
log4j.logger.org.alfresco.repo.transaction.RetryingTransactionHelper=DEBUG

Copying the log here so others can also see:

Locating resource :/deleted-nodes/{entityId}/restore
2020-11-26 20:51:32,761 DEBUG [org.alfresco.util.transaction.SpringAwareUserTransaction] [http-nio-8080-exec-11] Began user transaction: UserTransaction[object=org.alfresco.util.transaction.SpringAwareUserTransaction@6de38503, status=0]
2020-11-26 20:51:32,761 DEBUG [org.alfresco.util.transaction.TransactionSupportUtil] [http-nio-8080-exec-11] Bound txn synch: TransactionSychronizationImpl[ txnId=2c8ce1e0-865f-40db-9594-a61053ca7a41] with txn name: http-nio-8080-exec-11-eca0a245-b426-478a-9642-ec69a1b8a888
2020-11-26 20:51:32,761 DEBUG [org.alfresco.util.transaction.SpringAwareUserTransaction] [http-nio-8080-exec-11] Exception attempting to pass transaction boundaries.
java.lang.Exception
	at org.alfresco.util.transaction.SpringAwareUserTransaction.rollback(SpringAwareUserTransaction.java:544)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:519)
	at org.alfresco.rest.framework.webscripts.AbstractResourceWebScript.execute(AbstractResourceWebScript.java:128)
	at org.alfresco.rest.framework.webscripts.ApiWebScript.execute(ApiWebScript.java:115)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:474)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:664)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:435)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:315)
	at org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:47)
	at org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:84)
	at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:126)
	at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:95)
	at org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:80)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
	at org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:82)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at jdk.internal.reflect.GeneratedMethodAccessor428.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:170)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:225)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at jdk.internal.reflect.GeneratedMethodAccessor425.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
	at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93)
	at jdk.internal.reflect.GeneratedMethodAccessor425.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
	at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:75)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:132)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
	at com.sun.proxy.$Proxy170.doFilter(Unknown Source)
	at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89)
	at jdk.internal.reflect.GeneratedMethodAccessor425.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
	at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68)
	at jdk.internal.reflect.GeneratedMethodAccessor425.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
	at org.alfresco.web.app.servlet.ClearSecurityContextFilter.doFilter(ClearSecurityContextFilter.java:53)
	at jdk.internal.reflect.GeneratedMethodAccessor425.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:834)
2020-11-26 20:51:32,762 DEBUG [org.alfresco.util.transaction.TransactionSupportUtil] [http-nio-8080-exec-11] Before completion: TransactionSychronizationImpl[ txnId=2c8ce1e0-865f-40db-9594-a61053ca7a41]
2020-11-26 20:51:32,762 DEBUG [org.alfresco.util.transaction.TransactionSupportUtil] [http-nio-8080-exec-11] After completion (rolled-back): TransactionSychronizationImpl[ txnId=2c8ce1e0-865f-40db-9594-a61053ca7a41]
2020-11-26 20:51:32,762 DEBUG [org.alfresco.util.transaction.TransactionSupportUtil] [http-nio-8080-exec-11] After Completion: DONE
2020-11-26 20:51:32,762 DEBUG [org.alfresco.util.transaction.TransactionSupportUtil] [http-nio-8080-exec-11] Clear txn resources for http-nio-8080-exec-11
2020-11-26 20:51:32,762 DEBUG [org.alfresco.util.transaction.SpringAwareUserTransaction] [http-nio-8080-exec-11] Rolled back user transaction: UserTransaction[object=org.alfresco.util.transaction.SpringAwareUserTransaction@6de38503, status=4]
~Abhinav
(ACSCE, AWS SAA, Azure Admin)
mbasoft
Active Member

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

Thank you for your response. I modified log4j.properties as suggested, restarted Alfresco and tried to restore files. Please find the log below. As far as I understand the log, a java.lang.NumberFormatException occurs during restore.

Thank you in advance to investigate this issue. 

Best regards, Matthias.

PS.: I have to add a download link again, because your system don't allow post exceeding 20,000 chars.

Logfragment (find time stamp 2020-11-30 20:28:21,553)

https://alfrodin.com/downloads/alfrescohub/alfresco-20201130.zip 

 

abhinavmishra14
Advanced

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

There are two errors in the log, one is related to sending emails.

java.net.UnknownHostException: smtp.example.com. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1;  nested exception is:	java.net.UnknownHostException: smtp.example.com; message exceptions (1) are:Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1;  nested exception is:	java.net.UnknownHostException: smtp.example.com

Looks like you have not configured outbound stmp correctly or host is not reachable from your server. If you are not using email functionality, disable it. Remove mail configuration from alfresco-global.properties.

Or disable activity feeds if not using it. 

activities.feed.notifier.enabled=false

The other error is related to number format parsing. It looks like error is thrown while parsing the content length, see here:

https://github.com/Alfresco/alfresco-community-repo/blob/master/remote-api/src/main/java/org/alfresc...

Unfortunately these classes doesn't have loggers. 

Can you check the POST request details and see whether you are passing the content lenght or not? Content lenght seems to be expecting '0' in the request and must be passed in the request.

https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-restore-trashcan-items.html

curl -X POST -H 'Content-Type: text/plain;charset=UTF-8' -H 'Content-Length: 0' -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/4bda2a4d-5013-46fa-93bd-104dd58e1596/restore' 

Copying the error here for others to see:

2020-11-30 20:28:21,553 DEBUG [org.alfresco.repo.transaction.RetryingTransactionHelper] [http-nio-8080-exec-5] Transaction commit failed:    Thread: http-nio-8080-exec-5   Txn:    UserTransaction[object=org.alfresco.util.transaction.SpringAwareUserTransaction@4b838202, status=0]   Iteration: 0   Exception follows:
java.lang.NumberFormatException: null
	at java.base/java.lang.Integer.parseInt(Integer.java:614)
	at java.base/java.lang.Integer.valueOf(Integer.java:983)
	at org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractObjFromJson(ResourceWebScriptPost.java:175)
	at org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.processRequest(ResourceWebScriptPost.java:138)
	at org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractParams(ResourceWebScriptPost.java:109)
	at org.alfresco.rest.framework.webscripts.AbstractResourceWebScript$1.execute(AbstractResourceWebScript.java:110)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
	at org.alfresco.rest.framework.webscripts.AbstractResourceWebScript.execute(AbstractResourceWebScript.java:128)
	at org.alfresco.rest.framework.webscripts.ApiWebScript.execute(ApiWebScript.java:115)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:474)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:664)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:435)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:315)
	at org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:47)
	at org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:84)
	at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:126)
	at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:95)
	at org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:80)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
	at org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:82)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

	...... (trimmed)
2020-11-30 20:28:21,560 ERROR [org.alfresco.rest.framework.webscripts.ResourceWebScriptPost] [http-nio-8080-exec-5] 5fcc213d-2170-4dba-a9c6-8ba69f5e80b7 : [java.base/java.lang.Integer.parseInt(Integer.java:614), java.base/java.lang.Integer.valueOf(Integer.java:983), org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractObjFromJson(ResourceWebScriptPost.java:175), org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.processRequest(ResourceWebScriptPost.java:138), org.alfresco.rest.framework.webscripts.ResourceWebScriptPost.extractParams(ResourceWebScriptPost.java:109), org.alfresco.rest.framework.webscripts.AbstractResourceWebScript$1.execute(AbstractResourceWebScript.java:110), org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450), org.alfresco.rest.framework.webscripts.AbstractResourceWebScript.execute(AbstractResourceWebScript.java:128), org.alfresco.rest.framework.webscripts.ApiWebScript.execute(ApiWebScript.java:115), org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:474), org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:664), org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:435), org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:315), org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:47), org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:84), org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:126), org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:95), org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:80), org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399), org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210), org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:82), javax.servlet.http.HttpServlet.service(HttpServlet.java:741), jdk.internal.reflect.GeneratedMethodAccessor428.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:170), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:225), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:75), java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method), java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:132), org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212), com.sun.proxy.$Proxy170.doFilter(Unknown Source), org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.alfresco.web.app.servlet.ClearSecurityContextFilter.doFilter(ClearSecurityContextFilter.java:53), jdk.internal.reflect.GeneratedMethodAccessor424.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:566), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282), org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279), java.base/java.security.AccessController.doPrivileged(Native Method), java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550), org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314), org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191), org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:149), org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145), java.base/java.security.AccessController.doPrivileged(Native Method), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144), org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199), org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96), org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493), org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137), org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81), org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660), org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87), org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343), org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798), org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66), org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808), org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498), org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49), java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128), java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628), org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61), java.base/java.lang.Thread.run(Thread.java:834)]
2020-11-30 20:31:26,843 DEBUG [org.alfresco.rest.framework.core.ResourceLookupDictionary] [http-nio-8080-exec-11] Locating resource :/deleted-nodes/{entityId}/restore
2020-11-30 20:31:26,843 DEBUG [org.alfresco.rest.api.PublicApiRepositoryContainer] [http-nio-8080-exec-11] executeScript (-system-): [null,-system-] /alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/c7d39e39-e959-4239-ac24-95aa1aa6e898/restore
2020-11-30 20:31:26,848 DEBUG [org.alfresco.rest.framework.core.ResourceLookupDictionary] [http-nio-8080-exec-11] Locating resource :/deleted-nodes/{entityId}/restore
2020-11-30 20:31:26,848 DEBUG [org.alfresco.repo.transaction.RetryingTransactionHelper] [http-nio-8080-exec-11] Transaction commit failed:    Thread: http-nio-8080-exec-11   Txn:    UserTransaction[object=org.alfresco.util.transaction.SpringAwareUserTransaction@352c66af, status=0]   Iteration: 0   Exception follows:
java.lang.NumberFormatException: null
	at java.base/java.lang.Integer.parseInt(Integer.java:614)

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
mbasoft
Active Member

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

Hi, 

thank you. If I set the ContentLength-Property of the HttpWebRequest for this REST-API-Call to 0 it works as it worked before in Aflresco 5.2 (without this requirement). I double checked your REST-API documentation, but there is no hint to this requirement. I think it would be helpful to update the documentation. Thank you.

Best regards, Matthias

abhinavmishra14
Advanced

Re: REST-API - Deleted-Nodes Restore Problem

Jump to solution

Glad that it works for you now as it was a long running issue @mbasoft 

I just had a look and i see that, there is content length header specifically mentioned in both 5.2 and 6.2 documentation POST Call examples. 

https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-restore-trashcan-items.html

E.g.: 

curl -X POST -H 'Content-Type: text/plain;charset=UTF-8' -H 'Content-Length: 0' -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/4bda2a4d-5013-46fa-93bd-104dd58e1596/restore' 

https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-restore-trashcan-items.html

e.g.:

curl -X POST -H 'Content-Type: text/plain;charset=UTF-8' -H 'Content-Length: 0' -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes/4bda2a4d-5013-46fa-93bd-104dd58e1596/restore' 

Seems like it was a requirement even with 5.2.x version, i am not sure how it was working. 

But good news is that it works now. 

Probably the documentation for the " /deleted-nodes/{node id}/restore " should be improved to avoid any confusion. 

Good luck.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)