Problem when migrate storage to Amazon S3

Bug and problem reporting on Cyclos 4 version

Moderators: hugo, alexandre, rmvanarkel

Post Reply
trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Problem when migrate storage to Amazon S3

Post by trustpay »

Dear Cyclos Team,

I had problems when I follow the instructions below to migrate storage from database to Amazon S3.
https://documentation.cyclos.org/4.12/c ... tml#d0e733

Please help me check it!

Many thank!

Cyclos.properties
{\rtf1\ansi\ansicpg1252\cocoartf2511
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0 ## Database content manager configuration (default)\
cyclos.storedFileContentManager = db\
\
## File system content manager configuration\
# cyclos.storedFileContentManager = file\
# cyclos.storedFileContentManager.rootDir =\
# cyclos.storedFileContentManager.maxSubDirs = 100\
\
#Amazon Simple Storage Service (Amazon S3) content manager configuration.\
#cyclos.storedFileContentManager = s3\
cyclos.storedFileContentManager.bucketName = sandboxtrustbank\
cyclos.storedFileContentManager.regionName = ap-southeast-1\
cyclos.storedFileContentManager.accessKeyId = ** (hidden) ***\
cyclos.storedFileContentManager.secretAccessKey = *** (hidden) ***}

-----------------------
Bug migrate
{\rtf1\ansi\ansicpg1252\cocoartf2511
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0 root@sandbox:/var/lib/tomcat7/webapps# java -cp "WEB-INF/classes:../../lib/*:WEB-INF/lib/*:/var/lib/tomcat7" org.cyclos.impl.storage.utils.StoredFileContentMigrator s3\
Error: Could not find or load main class org.cyclos.impl.storage.utils.StoredFileContentMigrator\
root@sandbox:/var/lib/tomcat7/webapps# cd ROOT/\
root@sandbox:/var/lib/tomcat7/webapps/ROOT# java -cp "WEB-INF/classes:../../lib/*:WEB-INF/lib/*:/var/lib/tomcat7" org.cyclos.impl.storage.utils.StoredFileContentMigrator s3\
2020-02-21T12:29:09.076+07:00 WARN ClassPathXmlApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory': Unsatisfied dependency expressed through field 'cyclosProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cyclosProperties' defined in class path resource [spring/bootstrap.xml]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.cyclos.bootstrap.CyclosPropertiesFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@28c97a5]\
Error migrating file contents:\
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory': Unsatisfied dependency expressed through field 'cyclosProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cyclosProperties' defined in class path resource [spring/bootstrap.xml]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.cyclos.bootstrap.CyclosPropertiesFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@28c97a5]\
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)\
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)\
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411)\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)\
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)\
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)\
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)\
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)\
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)\
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)\
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:95)\
at org.cyclos.impl.storage.utils.StoredFileContentMigrator.initialize(StoredFileContentMigrator.java:400)\
at org.cyclos.impl.storage.utils.StoredFileContentMigrator.main(StoredFileContentMigrator.java:174)\
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cyclosProperties' defined in class path resource [spring/bootstrap.xml]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.cyclos.bootstrap.CyclosPropertiesFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@28c97a5]\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:570)\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)\
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)\
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)\
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)\
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1248)\
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1168)\
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)\
... 16 more\
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.cyclos.bootstrap.CyclosPropertiesFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@28c97a5]\
at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:760)\
at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:692)\
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:422)\
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:406)\
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333)\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1077)\
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:567)\
... 25 more\
Caused by: java.lang.NoClassDefFoundError: Ljavax/servlet/ServletContext;\
at java.lang.Class.getDeclaredFields0(Native Method)\
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)\
at java.lang.Class.getDeclaredFields(Class.java:1916)\
at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:755)\
... 31 more\
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext\
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)\
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)\
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)\
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)\
... 35 more}
Attachments
Bug and Cyclos Properties.zip
(2.32 KiB) Downloaded 45 times

luis
Posts: 192
Joined: Fri Feb 17, 2006 11:01 am

Re: Problem when migrate storage to Amazon S3

Post by luis »

The "ClassNotFoundException: javax.servlet.ServletContext" error indicates that the Tomcat jars haven't been included in your command.
The instruction page says this:

Code: Select all

java -cp "WEB-INF/classes:../../lib/*:WEB-INF/lib/*:/path-to-tomcat/lib" \
             org.cyclos.impl.storage.utils.StoredFileContentMigrator
Probably you're missing the /path-to-tomcat/lib to point to the correct tomcat lib location.
Luis Fernando Planella Gonzalez
Cyclos development team

Post Reply