cancel
Showing results for 
Search instead for 
Did you mean: 

Export in 3.0

loftux
Star Contributor
Star Contributor
The complete repository export has been disabled in 3.0. This feature has been useful for migrating from one db to another, not having to do any complex database migrations, instead bootstrapping the content.
So I thought that I instead use the export/import features. To list all the needed jars can be quite some work, so I made a script that outputs another script. Put this in a file in your Alfresco home folder, call it something like createexport.sh and make it executable.

#!/bin/sh
# Create Alfresco export script
# Peter Löfgren, Redpill Linpro

SCRIPTNAME="export.sh"
ALF_HOME=.
cd "$ALF_HOME"
APPSERVER="${ALF_HOME}/tomcat"

# Add the basics
echo "#!/bin/sh" > $SCRIPTNAME

# make the export dir
echo "if [ ! -d ./export ]; then" >> $SCRIPTNAME
echo "mkdir export" >> $SCRIPTNAME
echo "fi" >> $SCRIPTNAME

# Add Java options to script
echo "export JAVA_HOME=/usr/lib/jvm/java-6-sun" >> $SCRIPTNAME
#echo "export JAVA_OPTS='-Xms128m -Xmx1024m -XX:MaxPermSize=128m -server'" >> $SCRIPTNAME

# Add classpath to the script
echo -n "java -classpath $APPSERVER/webapps/alfresco/WEB-INF/classes/alfresco/module:"  >> $SCRIPTNAME
echo -n "$APPSERVER/shared/classes:"  >> $SCRIPTNAME
echo -n "$APPSERVER/webapps/alfresco/WEB-INF/classes:"  >> $SCRIPTNAME

# List all libs
for FILE in $APPSERVER/webapps/alfresco/WEB-INF/lib/*
do
    echo -n $FILE: >> $SCRIPTNAME
done
# This is to get your db jar, you may hav to include other locations
for FILE in $APPSERVER/lib/*
do
    echo -n $FILE: >> $SCRIPTNAME
done

# Add the final export commands
echo -n -e " org.alfresco.tools.Export -user admin -pwd admin -zip -dir export -verbose -store \0044\0061 \0044\0062"  >> $SCRIPTNAME
The created script is the used calling it with 2 parameters, the store to export and the export file name
./export.sh workspace://SpacesStore spacesstore.acp
The created export package is saved in a subfolder called export.
Edit the resulting script to meet your needs. My script probably adds more jars than needed, but this was easier than manually figuring out what jars to use.
To create an import script, just change to org.alfresco.tools.Import instead in a copy of your script, and tweak the import options (untested at this time).

Now some questions
The complete repository export also exported export_systeminfo.xml and export_models.acp, this does not map to any content stores as far as i can see. Are they necessary to achieve a migration from one db to another, i.e do a bootstrap?
Is it supported to export/import avm://sitestore? I've been able to export, I've not had time to test an import. I can see that it at least can not be part of a bootstrap job.

Regards
Peter Löfgren
5 REPLIES 5

mcmagnus
Champ in-the-making
Champ in-the-making
Hi

Thanks for the script Peter, but do you know why the complete export was removed? I see it's on its way back in again for Labs 3e.

I also see the function is there in Labs 3c, but importing it back again into the same version fails. Perhaps this is why it was removed in the first place?

ganesh_boil
Champ in-the-making
Champ in-the-making
Hi Loftux ,
thanks for ur script.
But i'm just getting confusion with it. Can you provide the details to execute this script on windows machine.
My environment is :

Alfresco labs 3.0 with inbuilt DB (derby)
OS: Windows

Please provide the steps to execute this script in windows machine. So that it will be more helpful than this.

Thanks for your support.

loftux
Star Contributor
Star Contributor
Unfortunately I do not have access to a Windows environment to create an equivalent windows script.
So the one I created only runs on linux.

mjdinsmore
Champ in-the-making
Champ in-the-making
Thanks for the script.  Should this standalone script/tool work better than the built-in export tool that's in Alfresco 2.1?  By that, I mean does it work more reliably than the web interface tool (<i>I know it uses the same codebase</i>)?  If I run the tool on a small space it works fine, but if I run it on a larger one, it will just quit on me (I haven't profiled it yet to see if it's memory constraints or some other problem).  I suppose the standalone tool might be easier to debug when problems arise


In the meantime, I'll try to figure out why it fails to run for me – it's giving me a RMI port already bound exception.  Should this be run on a different machine than the Alfresco server?


8:07am dinsmore@foobar # ./export.sh workspace://myspace myspace.acp
Alfresco Repository Exporter
log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
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]
org.springframework.beans.factory.BeanCreationException: 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]
Caused by: 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]
   at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:804)
   at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:417)
   at org.springframework.jmx.support.ConnectorServerFactoryBean.afterPropertiesSet(ConnectorServerFactoryBean.java:168)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1118)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:270)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
   at org.alfresco.util.ApplicationContextHelper.getApplicationContext(ApplicationContextHelper.java:55)
   at org.alfresco.tools.Tool.initialiseRepository(Tool.java:246)
   at org.alfresco.tools.Tool.start(Tool.java:212)
   at org.alfresco.tools.Export.main(Export.java:65)
Caused by: javax.naming.NameAlreadyBoundException: alfresco/jmxrmi [Root exception is java.rmi.AlreadyBoundException: alfresco/jmxrmi]
   at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:122)
   at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:208)
   at javax.naming.InitialContext.bind(InitialContext.java:400)
   at javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:625)
   at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:412)
   … 16 more
Caused by: java.rmi.AlreadyBoundException: alfresco/jmxrmi
   at sun.rmi.registry.RegistryImpl.bind(RegistryImpl.java:123)
   at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
   at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386)
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
   at sun.rmi.transport.Transport$1.run(Transport.java:159)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
   at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)
   at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
   at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
   at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
   at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
   at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:120)
   … 20 more

27.507u 0.937s 0:17.08 166.4%   0+0k 0+0io 38pf+0w

loftux
Star Contributor
Star Contributor
I know I ran this locally (on the same server), so it should work. But its been a while since.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.