I am using alfresco 2.1 community edition and having my Alfresco SDK in 1 of the machine and alfresco server+database in the other machine. Now I am trying to execute a very simple program from Alfresco SDK and want the content to be stored in Alfresco/alf_data directory + alfresco database which is in another machine. But I am unable to do the same
Below is my custom repository.prop config and sample prog + error after executing this sample program. Will be kind if somebody can tell me what I miss out.
###########################################################3 Custom repo: ——————— # # Sample custom content and index data location #
dir.root=//10.116.10.50/Alfresco/alf_data
db.username=alfresco db.password=alfresco
# # MySQL connection (This is default and requires mysql-connector-java-3.1.12-bin.jar, which ships with the Alfresco server) # db.driver=org.gjt.mm.mysql.Driver db.url=jdbc:mysql://10.116.10.50:3306/alfresco
# # Oracle connection (requires ojdbc14_g.jar or equivalent jar in shared libraries location) # #db.driver=oracle.jdbc.OracleDriver #db.url=jdbcracle:thin:@localhost:1521:alfresco
# # Sybase connection (requires jconn2d.jar or equivalent jar in shared libraries location) # #db.driver=com.sybase.jdbc2.jdbc.SybDriver #db.url=jdbc:sybase:Tds:localhost:2638/alfresco
// login to workspace (here we rely on the default workspace defined by JCR.Repository bean) Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
try { // first, access the company home Node rootNode = session.getRootNode(); Node companyHome = rootNode.getNode("app:company_home");
// create the content node String name = "Amit31"; Node content = companyHome.addNode("cm:" + name, "cm:content");
} ############################################### Error after executing sample prog: ——————————————— 17:51:26,845 WARN [remoting.rmi.RmiRegistryFactoryBean] Could not detect RMI registry - creating new one Caught exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dictionaryRepositoryBootstrap' defined in class path resource [alfresco/core-services-context.xml]: Invocation of init method failed; nested exception is org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap$1@239f6 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dictionaryRepositoryBootstrap' defined in class path resource [alfresco/core-services-context.xml]: Invocation of init method failed; nested exception is org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap$1@239f6 Caused by: org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap$1@239f6 at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:281) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:155) at org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap.bootstrap(DictionaryRepositoryBootstrap.java:134) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1122) 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:273) 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.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68) at org.alfresco.sample.FirstJCRClient.main(FirstJCRClient.java:28) Caused by: java.lang.IllegalStateException: No user transaction is active at org.alfresco.util.transaction.SpringAwareUserTransaction.rollback(SpringAwareUserTransaction.java:479) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:276) … 20 more ###########################################################333
FirstJCRClient is an example of running against a local instance of Alfresco.
What you probably want to do is to run a program against a remote instance of alfresco. Which will have to use one of Alfresco's remote interfaces rather than the embedded JCR client.
Do you have any sample program using Alfresco's remote interfaces? Will you please share? Will be very kind of you!
1 more thing is I able to execute the above program and can store content & metadata in alf_data & DB which is at the remote machine. I was getting error b'coz I was not having proper permissions in remote machine where I was trying to dump my contents & metadata.