cancel
Showing results for 
Search instead for 
Did you mean: 

Import Users Into Alfresco (.xml file)

joaotpd
Champ on-the-rise
Champ on-the-rise
Hi all!

I'm using alfresco-labs-tomcat-3Stable on Linux.
I'm trying to import users through a xml file:
people.xml

<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0">

  <cm:person view:childName="cm:person">
    <cm:userName>test01</cm:userName>
    <cm:firstName>firstNametest01</cm:firstName>
    <cm:lastName>lastNametest01</cm:lastName>
    <cm:middleName></cm:middleName>
    <cm:email>test01@somecompany.org</cm:email>
  </cm:person>

  <cm:person view:childName="cm:person">
    <cm:userName>test02</cm:userName>
    <cm:firstName>firstNametest02</cm:firstName>
    <cm:lastName>lastNametest02</cm:lastName>
    <cm:middleName></cm:middleName>
    <cm:email>test02@somecompany.org</cm:email>
  </cm:person>

</view:view>
I'm not sure where to run the import command and what is the correct command to import users.
I've already tried this (on Linux terminal console placed in /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/):
import -user admin -pwd adminpass -store workspace://SpacesStore -path /sys:system/sys:people people.xml
but i'm getting:
import: unable to open X server `'.
Anyone with the same problem?! …
Please help!! …
Thanks in advance… Smiley Wink

João Duarte
10 REPLIES 10

joaotpd
Champ on-the-rise
Champ on-the-rise
I still don't have it!!…
Anyone?? …
Thanks again….

João Duarte

manders
Champ in-the-making
Champ in-the-making
Hi João,

Chances are that the 'import' command you're trying to run is executing from /usr/bin/import and is actually part of the ImageMagick suite, rather than an Alfresco command. Executing ImageMagick's import on a shell accessed without an X-server (such as through putty or another ssh client) would yield that exact error message.

I'm unsure where Alfresco's import command resides, or where you'd get that tool. If you figure it out, please post about it - I'd be interested hearing about your solution and what your experience will be with importing users this way.

stevewickii
Champ in-the-making
Champ in-the-making
on your unix prompt type:  which import

This command will tell you whether or not you are executing the import command you intended to execute.

To ensure that you are executing the import script in your current working directory type something like this:  ./import -user ….
Notice the leading "./" characters.  These characters tell unix to execute the import command that physically resides in your current working directory.

stevewickii
Champ in-the-making
Champ in-the-making
I am trying to figure out how to import people.xml as well.

I did an export of the people node in my Alfresco 2.9.0B installation with this command:  export -user admin -pwd <PROTECTED> -s user://alfrescoUserStore -path /sys:system/sysSmiley Tongueeople people

Then I did an import of the people.xml file into my Alfresco 3.0 Stable with this command:  import -user admin -pwd <PROTECTED> -s user://alfrescoUserStore -path /sys:system/sysSmiley Tongueeople people

When I started up Alfresco 3, I couldn't see the users in the User Management console, but I can see them in the Node Browser.

I tried deleting my alf_data/lucene-indexes folder, and started up Alfresco 3.0 with index.recovery.mode=FULL, and I still cannot see the imported users.

I was successfull in exporting and importing Groups using this exact same method.

stevewickii
Champ in-the-making
Champ in-the-making
Eww.  I figured it out!

There's another place where users are stored.

Store:  workspace://SpacesStore
Path:  /sys:system/sysSmiley Tongueeople

I exported the space with the command:  C:\alfresco30>export -user admin -pwd admin -s workspace://SpacesStore -p /sys:system/s
ysSmiley Tongueeople -verbose spacesstore-people-prod

I removed the <cmSmiley Tongueerson> element for "admin" and "guest" from spacesstore-people-prod, because these users already exist and will create a conflict, because their UUIDs do not match.

I imported the space with the command:  C:\alfresco30>import -user admin -pwd admin -s workspace://SpacesStore -p /sys:system/s
ysSmiley Tongueeople -uuidBinding UPDATE_EXISTING -verbose spacesstore-people-prod

To migrate users and groups from one Alfresco installation to another with the Alfresco Import and Export Tools:
1.  Export the users from the user://alfrescoUserStore.  This will generate an alfrescoUserStore-people.xml file.  Command:  export -user admin -pwd <PROTECTED> -s user://alfrescoUserStore -path /sys:system/sysSmiley Tongueeople -verbose alfrescoUserStore-people
2.  Remove the 'admin' account from alfrescoUserStore-people.xml
3.  Export the groups from the user://alfrescoUserStore.  This will generate an alfrescoUserStore-authorities.xml file.  Command:  export -user admin -pwd <PROTECTED> -s user://alfrescoUserStore -path /sys:system/sys:authorities -verbose alfrescoUserStore-authorities
4.  Export the users from the workspace://SpacesStore.  This will generate an spacesstore-people.xml file.  Command:  export -user admin -pwd admin -s workspace://SpacesStore -p /sys:system/sysSmiley Tongueeople -verbose spacesstore-people
5.  Remove the <cmSmiley Tongueerson> element for the "admin" and "guest" accounts from the spacesstore-people.xml file.
6.  Copy alfrescoUserStore-people.xml, alfrescoUserStore-authorities.xml and spacesstore-people.xml to the target Alfresco system.
7.  Import the users into user://alfrescoUserStore.  Command:  import -user admin -pwd <PROTECTED> -s user://alfrescoUserStore -p /sys:system/sysSmiley Tongueeople -uuidBinding UPDATE_EXISTING -verbose alfrescoUserStore-people
8.  Import groups into user://alfrescoUserStore.  Command:  import -user admin -pwd <PROTECTED> -s user://alfrescoUserStore -p /sys:system/sys:authorities -uuidBinding UPDATE_EXISTING -verbose alfrescoUserStore-authorities
9.  Import users into workspace://SpacesStore.  Command:  import -user admin -pwd <PROTECTED> -s workspace://SpacesStore -p /sys:system/sysSmiley Tongueeople -uuidBinding UPDATE_EXISTING -verbose spacesstore-people
10.  Restart Alfresco where the users were imported.

Optionally:  If you cannot see the users and groups in the web client Administration Console, then you may need to reindex alfresco (recreate the Lucene indexes for Alfresco).  You do that by deleting the folder alf_data/lucene-indexes, setting the property "index.recovery.mode=FULL" in your custom-repository.properties, and starting up Alfresco.

joaotpd
Champ on-the-rise
Champ on-the-rise
Hi!! Smiley Happy

Thanks for all the answers… After read them I still don't understand where to run your import/export commands…
If I type "which import" on my unix prompt I get "-bash: which: command not found"… as expected…  :?
I understand that typing "import" on my unix prompt it's a call to a program that have nothing to do with Alfresco… right?! … so… it's necessary to run an import script?… Where can I find it in the Alfresco file system? … I have to build it? …
Thanks again…

João Duarte

pjcaracuel
Champ in-the-making
Champ in-the-making
Hi,

see that post

http://forums.alfresco.com/en/viewtopic … 28&t=14004

Regards

sumit057
Champ in-the-making
Champ in-the-making
I still did,t got it where are u running these commands. when i run the export command on the prompt ie C:\Alfresco\bin> export i get command not recognized as error??

sumit057
Champ in-the-making
Champ in-the-making
C:\Alfresco\tomcat\webapps\alfresco\WEB-INF>java -classpath classes;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-repository-3.2.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-linkvalidation.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\xercesImpl-2.8.0.jar;C:\Alfresco
\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-remote-api-3.2.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-vti.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-web-client-3.2.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\myfaces-api-1.1.5.jar;C:\Alfresco\tomcat\webap
ps\alfresco\WEB-INF\lib\alfresco-rm.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\xmlrpc.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jcr-1.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\rhino-js-1.6R7.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\spring-ws-1.5.0.jar;C:\Alf
resco\tomcat\webapps\alfresco\WEB-INF\lib\spring-2.0.8.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\springmodules-jbpm31.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\subetha-smtp.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-jlan-embed-3.2.jar;C:\Alfresco\tomcat\webapps\
alfresco\WEB-INF\lib\JMagick.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-mbeans-3.2.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\hibernate-3.2.6-patched.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jbpm-jpdl-3.3.1.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jbp
m-identity-3.3.1.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\springmodules-jbpm31.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\spring-2.0.6.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-core.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\lucene-analyzers-2.1.0.jar;
C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\liblucene-snowball-2.1.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-core.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jibx-run.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\xpp3-1.1.3_8.jar;C:\Alfresco\tomcat\webapps\alfresco
\WEB-INF\lib\commons-logging-1.1.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\ehcache-1.4.1-patched.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\dom4j-1.6.1.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\acegi-security-0.8.2_patched.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\
lib\hibernate-3.2.6-patched.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\quartz-1.6.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\pdfbox-0.7.3.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\poi-3.1.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jooconverter-2.1.0.jar;C:\Alfr
esco\tomcat\webapps\alfresco\WEB-INF\lib\jid3lib-0.5.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\freemarker-2.3.13.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\log4j-1.2.15.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\cryptix-jce-provider.jar;C:\Alfresco\tomcat\webapps\alfresco
\WEB-INF\lib\commons-codec-1.3.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-dbcp-1.2.3.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-pool-1.4.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jta.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\mail.jar;C:\Alfresco\
tomcat\webapps\alfresco\WEB-INF\lib\activation.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jug-lgpl-2.0.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-deployment-3.2.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-collections-3.1.jar;C:\Alfresco\tomcat\webapps\alf
resco\WEB-INF\lib\cgC:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib-nodep-2.2_beta1.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\antlr-2.7.5H3.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\tm-extractors-1.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-io-1.1.jar;  C:\Alfr
esco\OpenOffice.org\URE\java\juh.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-beanutils-1.7.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jut.jar; C:\Alfresco\OpenOffice.org\Basis\program\classes\sandbox.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jut.jar;C:\Alfresco\t
omcat\webapps\alfresco\WEB-INF\lib\lucene-core-2.4.1.jar;C:\Alfresco\tomcat\C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\mysql-connector-java-5.1.7-bin.jar;C:\Alfresco\tomcat\C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\servlet-api.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\bsh-1.3.0.
jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\saxpath.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jaxen-1.1-beta-8.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\json.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\bcprov-jdk15-137.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-I
NF\lib\derby.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\ibatis-2.3.4.726-patched.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\truezip.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\ant.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\truelicense-1_29.jar;C:\Alfresco\tomcat\we
bapps\alfresco\WEB-INF\lib\truexml-1_29.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\tm-extractors-1.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\joda-time-1.2.1.jar  org.alfresco.tools.export -user admin -pwd admin -s user://alfrescoUserStore -path /sys:system/sysSmiley Tongueeople -verbose al
frescoUserStore-people
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Alfresco\OpenOffice/org\URE\java\juh/jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-beanutils-1/7/0/jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jut/jar;
Caused by: java.lang.ClassNotFoundException: C:\Alfresco\OpenOffice.org\URE\java\juh.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-beanutils-1.7.0.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jut.jar;
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

why am i getting this error.. i have configured the jar files according to alfresco version 3.2