cancel
Showing results for 
Search instead for 
Did you mean: 

Command line org.alfresco.tools.Import failed to work

panco
Champ in-the-making
Champ in-the-making
I installed the Alfresco 2.1 into a Tomcat 5.5 + Mysql 5.0 server, I tried to import the user data from a xml file (as shown below). I write a batch and put it together with the xml in the C:\xampp\tomcat\webapps\alfresco\WEB-INF directory. I change directory to C:\xampp\tomcat\webapps\alfresco\WEB-INF and run the batch file, it throws out the java.io.IOException: Cannot bind to URL [rmi://localhost:50500/alfresco/jmxrmi].

Does anyone know how to fix this issue? please help!

Alfresco Repository Importer
The following error has occurred:
Error creating bean with name 'serverConnector' defined in class path resource [alfresco/core-services-context.xml]: Invocation of init method failed; nested exception is java.io.IOException: Cannot bind to URL [rmi://localhost:50500/alfresco/jmxrmi]: javax.naming.NameAlreadyBoundException: alfresco/jmxrmi [Root exception is java.rmi.AlreadyBoundException: alfresco/jmxrmi]


The classpath includes:
  1. all the jar files in the lib directory
  2. tomcat\common\lib\mysql-connector-java-5.0.7-bin.jar;
  3. tomcat\common\endorsed\serializer.jar;
      tomcat\common\endorsed\xalan.jar;
  4. current directory

import.bat
java -classpath classes;lib\acegi-security-0.8.2_patched.jar;lib\activation.jar;lib\addressing-1.0.jar;lib\alfresco-core.jar;lib\alfresco-deployment.jar;lib\alfresco-linkvalidation.jar;lib\alfresco-mbeans.jar;lib\alfresco-remote-api.jar;lib\alfresco-repository.jar;lib\alfresco-web-client.jar;lib\ant.jar;lib\antlr-2.7.5H3.jar;lib\aopalliance.jar;lib\avalon-framework-4.2.0.jar;lib\axis.jar;lib\bcel.jar;lib\bcprov-jdk15-129.jar;lib\bsf-2.4.0.jar;lib\bsh-1.3.0.jar;lib\catalina.jar;lib\cglib-nodep-2.2_beta1.jar;lib\chiba-1.3.0.jar;lib\commons-beanutils-1.7.0.jar;lib\commons-codec-1.3.jar;lib\commons-collections-3.1.jar;lib\commons-dbcp-1.2.1.jar;lib\commons-digester-1.6.jar;lib\commons-discovery-0.2.jar;lib\commons-el.jar;lib\commons-fileupload-1.1.1.jar;lib\commons-httpclient-3.0.jar;lib\commons-io-1.1.jar;lib\commons-jxpath-1.2.jar;lib\commons-lang-2.1.jar;lib\commons-logging-1.0.4.jar;lib\commons-modeler.jar;lib\commons-pool-1.3.jar;lib\commons-validator.jar;lib\cpool.jar;lib\cryptix-jce-provider.jar;lib\dom4j-1.6.1.jar;lib\ehcache-1.3.0.jar;lib\fontbox-0.1.0.jar;lib\fop-0.92beta.jar;lib\freemarker.jar;lib\guessencoding-1.0.jar;lib\hibernate-3.2.1.jar;lib\hrtlib.jar;lib\hsqldb.jar;lib\htmlparser-1.6.jar;lib\icu4j_3_6_1.jar;lib\jakarta-oro-2.0.8.jar;lib\jaxen-1.1-beta-8.jar;lib\jaxrpc.jar;lib\jbpm-identity-3.2.jar;lib\jbpm-jpdl-3.2-patched.jar;lib\jcr-1.0.jar;lib\jgroups-2.2.8.jar;lib\jibx-bind.jar;lib\jibx-run.jar;lib\jid3lib-0.5.jar;lib\JMagick.jar;lib\joda-time-1.2.1.jar;lib\jooconverter-2.1.0.jar;lib\json.jar;lib\jstl-1.1.0.jar;lib\jta.jar;lib\jug.jar;lib\jut.jar;lib\list.txt;lib\log4j-1.2.8.jar;lib\lucene-analyzers-2.1.0.jar;lib\lucene-core-2.1.0.jar;lib\lucene-snowball-2.1.0.jar;lib\mail.jar;lib\myfaces-api-1.1.5.jar;lib\myfaces-impl-1.1.5.jar;lib\naming-factory.jar;lib\naming-resources.jar;lib\odf_utils.jar;lib\odmg-3.0.jar;lib\openoffice-juh-2.0.3.jar;lib\openoffice-jurt-2.0.3.jar;lib\openoffice-ridl-2.0.3.jar;lib\openoffice-sandbox-2.0.3.jar;lib\openoffice-unoil-2.0.3.jar;lib\opensaml-1.0.1.jar;lib\pdfbox-0.7.3.jar;lib\poi-2.5.1_patched.jar;lib\portlet-api-lib.jar;lib\quartz-1.6.0.jar;lib\resolver.jar;lib\rhino-js-1.6R4.jar;lib\saaj.jar;lib\saxpath.jar;lib\spring-2.0.2.jar;lib\springmodules-jbpm31.jar;lib\standard.jar;lib\tlc124.jar;lib\tm-extractors-0.4_patched.jar;lib\tomcat-coyote.jar;lib\tomcat-util.jar;lib\truezip.jar;lib\wsdl4j-1.5.1.jar;lib\wss4j.jar;lib\xercesImpl-2.8.0.jar;lib\xml-apis.jar;lib\xmlgraphics-commons-1.0.jar;lib\xmlsec-1.4.0.jar;lib\xpp3-1.1.3_8.jar;lib\xstream-1.1.3.jar;C:\xampp\tomcat\common\lib\mysql-connector-java-5.0.7-bin.jar;C:\xampp\tomcat\common\endorsed\serializer.jar;C:\xampp\tomcat\common\endorsed\xalan.jar;. org.alfresco.tools.Import -user admin -pwd admin -store workspace://SpacesStore -path \sys:system\sys:people person.xml 

person.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>fredb</cm:userName>
    <cm:firstName>Fred</cm:firstName>
    <cm:lastName>Bloggs</cm:lastName>
    <cm:middleName></cm:middleName>
    <cm:email>fredb@alfresco.org</cm:email>
</cm:person>
<cm:person view:childName="cm:person">
    <cm:userName>sues</cm:userName>
    <cm:firstName>Sue</cm:firstName>
    <cm:lastName>Sanderson</cm:lastName>
    <cm:middleName></cm:middleName>
    <cm:email>sues@alfresco.org</cm:email>
</cm:person>
</view:view>
23 REPLIES 23

rrb
Champ in-the-making
Champ in-the-making
I've come to the conclusion that the whole "bulk load users via import" exercise has a lot of issues that undermine it being viable unless you have a desire to live in a world of hurt..

As an exercise I created a brand new Alfresco system ( moved alfdata, and created the tables again from scratch like a first time install) then did a full repository export.

Next I added exactly one new user, and assigned a space for them. then did another export of the full repository and then started to compare the xml files that the exports generated.

When a full repository export is done it creates  the following files
export_spaces.acp
export_spaces_archive.acp
export_system.acp
export_systeminfo.xml
export_users.acp
export_versions.acp

( I entered "export" as the name when prompted. all of these acp files are zip files, and in turn contain repository conent, and further xml files).

After unzipping , and looking at a comparing the xml in the *users.acp files shows the contents that pretty much align with what is doc'd elsewhere above on user creation.  Basically insertion of xml like:
  <usr:user view:childName="usr:user">               
    <view:aspects>                        
      <sys:referenceable></sys:referenceable>               
    </view:aspects>                        
    <viewSmiley Tongueroperties>                        
      <usr:accountExpires>false</usr:accountExpires>            
      <usr:credentialsExpire>false</usr:credentialsExpire>         
      <usrSmiley Tongueassword>9715b1505310fad03dd3bd3222c8</usrSmiley Tongueassword>      
      <usr:accountLocked>false</usr:accountLocked>      
    <sys:node-uuid>d98b5ff7-a4e8-11dc-bb17-81e939738fa3</sys:node-uuid>   
      <sys:node-dbid>446</sys:node-dbid>               
      <usr:username>testusername</usr:username>               
      <usr:salt>                        
        <view:value view:isNull="true"></view:value>            
      </usr:salt>                        
      <sys:store-protocol>user</sys:store-protocol>            
      <cm:name>d98b5ff7-a4e8-11dc-bb17-81e939738fa3</cm:name>         
      <usr:enabled>true</usr:enabled>                  
      <sys:store-identifier>alfrescoUserStore</sys:store-identifier>      
    </viewSmiley Tongueroperties>                     
    <view:associations></view:associations>               
  </usr:user>                                                                

There are several issues here for a "bulkload" that are not obvious on how to address::
        1: generating your own encrypted passwords
        2: generating your own node-uuid's
        3) generating your own node-dbids

as prior posts show this does not lead to the user "home" space creation.

Diff'ing the "*spaces.acp" file ( not the spaces_archive.acp) shows the need to create a _lot_ of xml. To begin with it is important to recognize that the result from diffing the "*_users.xml" files in the two acp files has 8463 lines of in it. Of which about 125 lines differed. Of these about 80 seemed (i'm guessing) to be about declaring / creating the user space, and security ace / acls tags, and then repeating properties from the *user.xml file above. The rest of the 125 lines make reference to the *acp files that existed at the time of the creation of the _users.acp file ( all because I gen'd into alfresco space - as suggested in the WIKI)

The short version of this is in the final analysis without using xslt and some (probably) java ( and having a good xpath tool at hand during debugging)  to manipulate the insertions this is going to be an error prone exercise.  IMHO, if one is going to go to that trouble it would be better to get all the sources from subversion, change the "create user dialog" to optionally ask for a file ( perhaps xml) to do the load, in a loop read fromthe file all the fields the  runtime dialog has and then complete the process as the dialog does…  basically  be sure of setting things up as intended by the inhabitants of the "planet alfresco".

This is not the place for a rant about the insanity that XML has brought to the software world ( but if it was i'd suggest begin by comparing what a linux passwd file looks like for root and one user ( 2 lines), with the above xml fragments scattered across two xml trees).

My view is that "bulk loading users and their spaces" is administratively opaque, and not well served by the suggestion implied in the PACKT book  and the WIKI, and this forum that it is  reasonably possible as an admin task from outside Alfresco. 

I am willing to entertain the idea that I've grossly misunderstood some aspect of the software, and I can see how the export/import from inside an alfresco instance has great value for moving/sharing document "libraries" between alfresco instances ( but not necessarily different releases), but until shown otherwise my view is bulkloading users is a perilous task if you are thinking "just create an xml file and load it up".

…rrb

rrb
Champ in-the-making
Champ in-the-making
My brief rant reminded me of a quip that used to be on a machine we had:

Sort in IBM JCL compared with unix sh:

IBM JCL:
//* This JCL member will show basic functions of JCL.
//*
//* STEP0010 uses the IEBGENER utility program to create a file.
//* STEP0020 uses the SORT utility to copy the file on positions 1-3.
//* STEP0030 uses the SORT utility to sort the file on positions 1-3.
//* STEP0040 uses the SORT utility to sort the file on positions 5-7.
//* STEP0050 uses the SORT utility to sort the file on positions 5-7.
//*          This step uses an alternate collating table to sort with
//*          case insensitivity.
//*
//* CAUTION! Since the ALTSEQ is defined at the binary (or hexadecimal)
//*          level this step will only work for EBCDIC-encoded files.
//*
//* *******************************************************************
//* This step does the housekeeping to delete files created by a
//* previous run of this job.
//*
//BLOWAWAY EXEC PGM=IEFBR14,COND=(0,LT)
//DD1      DD  DSN=SIMOTIME.DATA.JCLSCAN1,
//             UNIT=SYSDA,SPACE=(TRK,0),DISP=(MOD,DELETE,DELETE),
//             DCB=(RECFM=FB,LRECL=80)
//DD2      DD  DSN=SIMOTIME.DATA.JCLSCAN2,
//             UNIT=SYSDA,SPACE=(TRK,0),DISP=(MOD,DELETE,DELETE),
//             DCB=(RECFM=FB,LRECL=80)
//DD3      DD  DSN=SIMOTIME.DATA.JCLSCAN3,
//             UNIT=SYSDA,SPACE=(TRK,0),DISP=(MOD,DELETE,DELETE),
//             DCB=(RECFM=FB,LRECL=80)
//DD4      DD  DSN=SIMOTIME.DATA.JCLSCAN4,
//             UNIT=SYSDA,SPACE=(TRK,0),DISP=(MOD,DELETE,DELETE),
//             DCB=(RECFM=FB,LRECL=80)
//DD5      DD  DSN=SIMOTIME.DATA.JCLSCAN5,
//             UNIT=SYSDA,SPACE=(TRK,0),DISP=(MOD,DELETE,DELETE),
//             DCB=(RECFM=FB,LRECL=80)
//*
//* *******************************************************************
//* This step uses IEBGENER to copy a sequential file. SYSIN is DD *
//* with thirty-six (36) records.
//*
//STEP0010 EXEC PGM=IEBGENER,COND=(0,LT)
//SYSPRINT DD  SYSOUT=*



Unix sh:
sort foo > sortedfoo;

In alfresco, defining a single user  and homespace via xml import bears remarkable similarity.

in sh an approximation is:

echo "smithj:x:561:561:Joe Smith:/home/smithj:/bin/bash" >> /etc/passwd;

In alfresco: the short version involves a close reading of this forum thread…

..rrb

skwong
Champ in-the-making
Champ in-the-making
Hi,

Try to add the following line in your xml file. It should create user's folder in User Homes space instead of Company Home. The folder will be named according to username

<cm:homeFolderProvider>userHomesHomeFolderProvider</cm:homeFolderProvider>

slothrop
Champ in-the-making
Champ in-the-making
Try to add the following line in your xml file. It should create user's folder in User Homes space instead of Company Home. The folder will be named according to username

<cm:homeFolderProvider>userHomesHomeFolderProvider</cm:homeFolderProvider>

I tried every variation on this that I could think of, with no success.