share-import-export icon indicating copy to clipboard operation
share-import-export copied to clipboard

Error importing site/content to 5.0.d created under 4.2.c

Open aingham opened this issue 9 years ago • 6 comments

I'm receiving an error when running import-site.py. I've used "-d" option and looks as though problem is with the:

POST http://localhost:8080/share/service/modules/create-site

...call, which is returning:

reply: 'HTTP/1.1 400 Bad Request\r\n'

I've run the same import on the 4.2.c installation that the export was run on (after purging the site) and that seems to work ok. Might this be due to the difference in versions?

aingham avatar Sep 07 '15 17:09 aingham

Are you able to post the output from running with debug on? Obviously feel free to sanitize the output if you need to. Any logs from the Alfresco server would also help, there is probably a stacktrace there which might yield more info.

wabson avatar Oct 19 '15 16:10 wabson

Hi, I have the same error and I dont know the source of the probleme. i used alf version 5.0.d as source and destination. here the full trace of the -d option :
python import-site.py file.json --username=xxxxxx --password=xxxxxx --import-tags --url=http://alfresco:8080/share/ -d Log in (xxxxxxx) POST http://alfresco:8080/share/login send: 'POST /share/login HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 120\r\nAccept-Language: en-gb,en;q=0.5\r\nConnection: close\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7\r\nHost: alfresco:8080\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nusername=admin&failure=%2Fshare%2Fpage%2Ftype%2Flogin%3Ferror%3Dtrue&password=admin&success=%2Fshare%2Fpage%2Fsite-index' reply: 'HTTP/1.1 404 Not Found\r\n' header: Server: Apache-Coyote/1.1 header: Content-Type: text/html;charset=utf-8 header: Content-Language: en header: Content-Length: 973 header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close POST http://alfresco:8080/share/page/dologin send: 'POST /share/page/dologin HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 120\r\nAccept-Language: en-gb,en;q=0.5\r\nConnection: close\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7\r\nHost: alfresco:8080\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nusername=admin&failure=%2Fshare%2Fpage%2Ftype%2Flogin%3Ferror%3Dtrue&password=admin&success=%2Fshare%2Fpage%2Fsite-index' reply: 'HTTP/1.1 302 Found\r\n' header: Server: Apache-Coyote/1.1 header: X-Frame-Options: SAMEORIGIN header: X-Content-Type-Options: nosniff header: X-XSS-Protection: 1; mode=block header: Set-Cookie: JSESSIONID=EAFA58BDF006693165602D4340BD29F6; Path=/share/; HttpOnly header: Set-Cookie: alfLogin=1445976967; Expires=Tue, 03-Nov-2015 20:16:07 GMT; Path=/share header: Set-Cookie: alfUsername3=admin; Expires=Tue, 03-Nov-2015 20:16:07 GMT; Path=/share header: Location: http://alfresco:8080/share/page/site-index header: Content-Length: 0 header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close send: 'GET /share/page/site-index HTTP/1.1\r\nAccept-Encoding: identity\r\nAccept-Language: en-gb,en;q=0.5\r\nConnection: close\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7\r\nHost: alfresco:8080\r\nCookie: JSESSIONID=EAFA58BDF006693165602D4340BD29F6; alfLogin=1445976967; alfUsername3=admin\r\n\r\n' reply: 'HTTP/1.1 302 Found\r\n' header: Server: Apache-Coyote/1.1 header: X-Frame-Options: SAMEORIGIN header: X-Content-Type-Options: nosniff header: X-XSS-Protection: 1; mode=block header: Cache-Control: no-cache header: Location: http://alfresco:8080/share/page/user/admin/dashboard header: Content-Type: text/html;charset=utf-8 header: Content-Language: en-GB header: Content-Length: 0 header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close send: 'GET /share/page/user/admin/dashboard HTTP/1.1\r\nAccept-Encoding: identity\r\nAccept-Language: en-gb,en;q=0.5\r\nConnection: close\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7\r\nHost: alfresco:8080\r\nCookie: JSESSIONID=EAFA58BDF006693165602D4340BD29F6; alfLogin=1445976967; alfUsername3=admin\r\n\r\n' reply: 'HTTP/1.1 200 OK\r\n' header: Server: Apache-Coyote/1.1 header: X-Frame-Options: SAMEORIGIN header: X-Content-Type-Options: nosniff header: X-XSS-Protection: 1; mode=block header: Cache-Control: no-cache header: Content-Type: text/html;charset=utf-8 header: Content-Language: en-GB header: Transfer-Encoding: chunked header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close Create site 'azerty' POST http://alfresco:8080/share/service/modules/create-site send: 'POST /share/service/modules/create-site HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 2915\r\nAccept-Language: en-gb,en;q=0.5\r\nHost: alfresco:8080\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7\r\nConnection: close\r\nCookie: JSESSIONID=EAFA58BDF006693165602D4340BD29F6; alfLogin=1445976967; alfUsername3=admin\r\nContent-Type: application/json; charset=UTF-8\r\n\r\n{"node": "/alfresco/s/api/node/workspace/SpacesStore/c0ebc729-8100-4d7e-a6eb-618525eac0da", "tagScope": "/alfresco/s/api/tagscopes/workspace/SpacesStore/c0ebc729-8100-4d7e-a6eb-618525eac0da", "description": "", "title": "azerty", "url": "/alfresco/s/api/sites/azerty", "dashboardConfig": {"dashboardPage": "site/azerty/dashboard", "dashlets": [{"url": "/components/dashlets/colleagues", "regionId": "component-1-1", "config": {"height": "504"}}, {"url": "/components/dashlets/docsummary", "regionId": "component-2-1"}, {"url": "/components/dashlets/activityfeed", "regionId": "component-2-2"}], "templateId": "dashboard-2-columns-wide-right"}, "sitePages": [{"pageId": "documentlibrary"}], "isPublic": true, "sitePreset": "site-dashboard", "memberships": [{"url": "/alfresco/s/api/sites/azerty/memberships/admin", "isMemberOfGroup": false, "role": "SiteManager", "authority": {"userName": "admin", "firstName": "Administrator", "url": "/alfresco/s/api/people/admin", "lastName": "", "authorityType": "USER", "fullName": "admin"}}], "visibility": "PUBLIC", "siteManagers": ["admin"], "shortName": "azerty", "metadata": {"mimetype": "application/octet-stream", "nodeRef": "workspace://SpacesStore/c0ebc729-8100-4d7e-a6eb-618525eac0da", "aspects": ["{http://www.alfresco.org/model/content/1.0}tagscope", "{http://www.alfresco.org/model/content/1.0}titled", "{http://www.alfresco.org/model/content/1.0}auditable", "{http://www.alfresco.org/model/system/1.0}referenceable", "{http://www.alfresco.org/model/system/1.0}localized", "{http://www.alfresco.org/model/system/1.0}undeletable"], "properties": {"{http://www.alfresco.org/model/system/1.0}store-protocol": "workspace", "{http://www.alfresco.org/model/content/1.0}title": "azerty", "{http://www.alfresco.org/model/system/1.0}node-uuid": "c0ebc729-8100-4d7e-a6eb-618525eac0da", "{http://www.alfresco.org/model/content/1.0}tagScopeSummary": ["onicl=1"], "{http://www.alfresco.org/model/content/1.0}name": "azerty", "{http://www.alfresco.org/model/content/1.0}modifier": "admin", "{http://www.alfresco.org/model/content/1.0}created": "2015-10-27T19:29:41.893Z", "{http://www.alfresco.org/model/system/1.0}node-dbid": 854, "{http://www.alfresco.org/model/site/1.0}siteVisibility": "PUBLIC", "{http://www.alfresco.org/model/system/1.0}store-identifier": "SpacesStore", "{http://www.alfresco.org/model/content/1.0}description": "", "{http://www.alfresco.org/model/system/1.0}locale": "fr_FR", "{http://www.alfresco.org/model/content/1.0}creator": "admin", "{http://www.alfresco.org/model/site/1.0}sitePreset": "site-dashboard", "{http://www.alfresco.org/model/content/1.0}tagScopeCache": "contentUrl=store://2015/10/27/20/48/7f33ef17-f35a-4240-96e2-1564282866a5.bin|mimetype=text/plain|size=7|encoding=UTF-8|locale=en_US|id=257", "{http://www.alfresco.org/model/content/1.0}modified": "2015-10-27T20:08:33.877Z"}, "type": "{http://www.alfresco.org/model/site/1.0}site"}}' reply: 'HTTP/1.1 400 Bad Request\r\n' header: Server: Apache-Coyote/1.1 header: Cache-Control: no-cache header: Expires: Thu, 01 Jan 1970 00:00:00 GMT header: Pragma: no-cache header: Content-Type: application/json;charset=UTF-8 header: Content-Length: 359 header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close Log out (admin) GET http://alfresco:8080/share/page/dologout send: 'GET /share/page/dologout HTTP/1.1\r\nAccept-Encoding: identity\r\nAccept-Language: en-gb,en;q=0.5\r\nConnection: close\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7\r\nHost: alfresco:8080\r\nCookie: JSESSIONID=EAFA58BDF006693165602D4340BD29F6; alfLogin=1445976967; alfUsername3=admin\r\n\r\n' reply: 'HTTP/1.1 405 Method Not Allowed\r\n' header: Server: Apache-Coyote/1.1 header: X-Frame-Options: SAMEORIGIN header: X-Content-Type-Options: nosniff header: X-XSS-Protection: 1; mode=block header: Allow: HEAD, POST, OPTIONS header: Content-Type: text/html;charset=utf-8 header: Content-Language: en header: Content-Length: 1045 header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close POST http://alfresco:8080/share/page/dologout send: 'POST /share/page/dologout HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 0\r\nAccept-Language: en-gb,en;q=0.5\r\nHost: alfresco:8080\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8\r\nUser-Agent: ShareImportExport/1.0\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nConnection: close\r\nCookie: JSESSIONID=EAFA58BDF006693165602D4340BD29F6; alfLogin=1445976967; alfUsername3=admin\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n' reply: 'HTTP/1.1 401 Unauthorized\r\n' header: Server: Apache-Coyote/1.1 header: X-Frame-Options: SAMEORIGIN header: X-Content-Type-Options: nosniff header: X-XSS-Protection: 1; mode=block header: Set-Cookie: alfUsername3=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/share header: Location: /share header: Content-Length: 0 header: Date: Tue, 27 Oct 2015 20:16:07 GMT header: Connection: close Traceback (most recent call last): File "import-site.py", line 264, in main(sys.argv[1:]) File "import-site.py", line 186, in main sc.createSite(sd) File "/home/mehdi/share-import-export-master/shareclient/alfresco.py", line 527, in createSite return self.doJSONPost('service/modules/create-site', json.dumps(siteData)) File "/home/mehdi/share-import-export-master/shareclient/alfresco.py", line 294, in doJSONPost resp = self.doPost(path, dataStr, 'application/json; charset=UTF-8', method) File "/home/mehdi/share-import-export-master/shareclient/alfresco.py", line 275, in doPost return self.doRequest(method, path, data, dataType) File "/home/mehdi/share-import-export-master/shareclient/alfresco.py", line 263, in doRequest raise SurfRequestError(method, e.url, e.code, e.msg, e.hdrs, e.fp) alfresco.SurfRequestError: Spring Surf Error 400 (Bad Request): "error.unableToCreate"

tamtamaouy avatar Oct 27 '15 20:10 tamtamaouy

Re Hi :) I found That we ned to add the JSSESSIONID to the json request to autheticate. I dont know if its true for this case but i share it anyway with you.

http://www.ixxus.com/blog201203creating-alfresco-share-sites-javascript/

the test with the commands below create d site for me : curl -v -d @login.txt -H "Content-Type:application/x-www-form-urlencoded" http://alfresco:8080/share/page/dologin (to get de JESSIONID)

and this one to create de site using the JSESSIONID to authenticate :

curl -v -d @file.json -H "Cookie:JSESSIONID=732A6D32F62CECAA7D09FD6FF252814C" -H "Content-Type:application/json" -H "Accept:application/json" http://alfresco:8080/share/service/modules/create-site

tamtamaouy avatar Oct 27 '15 20:10 tamtamaouy

The scripts use urllib2's cookie support to make the requests, so JSESSIONID should be passed back on subsequent requests once set.

wabson avatar Oct 28 '15 09:10 wabson

Hi, First excuse my english im not well english speaker. I found the source of the problem it was mine. I tried to importe a site that exist in share with the same name :( thats why i got the error. I apologize for the disturbe.

But now i have a question about the import of site content frome 3.4 to 5.0.d did you tried to do this kind of export import? And do you think it will work? Thnx a lot for your help.

tamtamaouy avatar Oct 28 '15 10:10 tamtamaouy

@wabson Many thanks for getting back to me on this, but unfortunately I didn't get time to follow up and no longer working on this project.

aingham avatar Nov 29 '15 19:11 aingham