AnsweredAssumed Answered

Unable to store content in remote machine DB & alf_data dir!

Question asked by amit_wmw@yahoo.com on Mar 5, 2009
Hello

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=jdbc:oracle: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

#####################################################3#

Sample prog:
——————–

public class FirstJCRClient
{
   
   private static final String String = null;
  
   public static void main(String[] args)      
   {
   
      try{
         
         
         
          ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
      
          Repository repository = (Repository)context.getBean("JCR.Repository");
         
          // 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");
            
              content.setProperty("cm:name", name);
              content.addMixin("cm:versionable");
             
              content.setProperty("cm:title", name);
              content.setProperty("cm:description", name);
              content.setProperty("cm:content", "Success");
                           
              //Amit Versioning
              content.checkin();
              session.save();
             
             
            
          }   
          catch (Exception exp ){
             System.out.println (" error while creating nodes " + exp);
             exp.printStackTrace();
          }
          finally
          {
              session.logout();
              System.exit(0);
          }
         
      }catch (Exception exp ){
         System.out.println (" Caught exception " + exp);
         exp.printStackTrace();
      }
      
   }
   
      

}
###############################################
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

Thanks
Amit.

Outcomes