cancel
Showing results for 
Search instead for 
Did you mean: 

FirstFoundation explanations

chapeaurouge
Champ in-the-making
Champ in-the-making
Hi all,

Starting on extending a bit alfresco to fit our needs, We will create several thousands specific financial documents in batch, getting metadata from one place, and the actual doc from another, for easier archiving and searching.

Got a couple basic questions. I am using the Java Foundation API, tomcat v 6.0.16 on a gentoo 64bits machine, java 1.6 64 bits. Alfresco is 2.9B (683), schema 116. I am testing remotely using Eclipse.

- In the comment of the sample FirstFoundationClient.java in the SDK, it says: "Note: the web client will need to be re-started after executing this sample to see the changes in effect."
–> Does this mean I need to actually restart tomcat to see the changes? How else could I do it?

- Also, when restarting tomcat, I do have an error:
SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.alfresco.web.ui.common.component.UIListItem
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.alfresco.web.ui.common.component.UIListItem
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
   at java.util.ArrayList.readObject(ArrayList.java:593)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       …….

The node then appears, but there is nothing in the document. I get this when trying to get to the document.

The node's content is missing: 
   node: workspace://SpacesStore/162cf781-5a4d-11dd-b732-114ffaf1c7ce
   reader: ContentAccessor[ contentUrl=store://2008/7/25/15/25/163d2424-5a4d-11dd-b732-114ffaf1c7ce.bin, mimetype=text/plain, size=0, encoding=UTF-8, locale=en_US] 
Please contact your system administrator.

I am currently looking mainly at the javadoc, going through the samples, but my java is rusty. Do you guys know of good tutorials? (Found one on ecmarchitect, quite good to get me started Smiley Happy)

Thanks all.

fred
13 REPLIES 13

pmonks
Star Contributor
Star Contributor
The Foundation Services API is an in-process API, in other words it's intended for developing code that will run inside the Alfresco web app.  For out-of-process code that has to interact with a remote Alfresco server, you'll need to use one of the remote APIs (listed in order of preference):
  1. Web Scripts - http://wiki.alfresco.com/wiki/Web_Scripts

  2. SOAP Web Services - http://wiki.alfresco.com/wiki/Alfresco_Content_Management_Web_Services

  3. URL Accessible Operations - http://wiki.alfresco.com/wiki/URL_Addressability

  4. JCR-RMI - http://wiki.alfresco.com/wiki/JCR-RMI_Extension (not recommended)
The reason the Web Client needs to be restarted after running the FirstFoundationClient is that you're running two copies of Alfresco (the Web Client and FirstFoundationClient) against a single persistent repository (alf_data directory / database).  This is effectively a two-node Alfresco cluster, however neither the vanilla Web Client nor the FirstFoundationClient example are configured as a cluster by default, so content modification events do not get broadcast between the two "nodes" in the cluster (which is why restarting fixes things - that clears out the various in-memory caches).  Note that it's entirely possible to configure the Web Client and FirstFoundationClient as a cluster - they're simply not configured that way by default.

Without diving into the code I'm not sure what the first error is caused by, but the second is often a symptom of either not writing the content of a node correctly or not committing the transaction the write operation is within properly.

As for tutorials, the various SDK examples (including FirstFoundationClient) are one of the better places to start - they demonstrate various different techniques, including a SOAP Web Service client (which is one of the ways I'd suggest handling your bulk load requirement via an external application).

Cheers,
Peter

chapeaurouge
Champ in-the-making
Champ in-the-making
Hi Peter,

Thanks for the explanations.

So I guess I will have the same issues with the JCR API? I have read, however, that JSR-170 (and upcoming) is a good way to be standard compliant, and that multitude of CMS/DMS uses it. I'd love to leverage that. What do you think?

I will take a more in-depth look at the Web Scripts and SOAP services. I am not familiar with these terms too much, so it kind of scared me off at first (that's why I usually prefer the most "desktop" oriented approach Smiley Wink)

Thanks for your time. Cheers,

fred

pmonks
Star Contributor
Star Contributor
So I guess I will have the same issues with the JCR API?
If you wish to use JCR to access an Alfresco server out-of-process (ie. remotely) you could use the JCR-RMI extension (http://wiki.alfresco.com/wiki/JCR-RMI_Extension).  There are several problems with using JCR-RMI however, the most glaring of which (imvho) is that JCR was never really intended to be a remote API (see for example http://research.sun.com/technical-reports/1994/abstract-29.html for a discussion of why this matters).

I have read, however, that JSR-170 (and upcoming) is a good way to be standard compliant, and that multitude of CMS/DMS uses it. I'd love to leverage that. What do you think?
In my experience very few CMSes support JCR (at least in it's JSR-170 incarnation - perhaps JSR-283 will get more traction), which, amongst other things, makes me wonder if it really is a good abstraction of a CMS.  Add to that it's unnecessary Java centricity and (imvho) it's value is even more questionable.

I'd encourage you to investigate Web Scripts (REST) as a basis for communicating with Alfresco (or any other system for that matter) - it really is very approachable and the fact that it's so "light" (from a dependency perspective) makes it pretty compelling.

Cheers,
Peter

chapeaurouge
Champ in-the-making
Champ in-the-making
Thanks for your valuable feedback Peter!

Cheers,
fred

vibhutewary
Champ in-the-making
Champ in-the-making
Hello,
I'm trying to run FirstFoundationClient.java

I am getting this error :

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'luceneFullTextSearchIndexer' defined in class path resource [alfresco/core-services-context.xml]: Cannot resolve reference to bean 'indexerAndSearcherFactory' while setting bean property 'indexerAndSearcherFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexerAndSearcherFactory' defined in class path resource [alfresco/core-services-context.xml]: Cannot resolve reference to bean 'admLuceneIndexerAndSearcherFactory' while setting bean property 'defaultBinding'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'admLuceneIndexerAndSearcherFactory' defined in class path resource [alfresco/core-services-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLIndexAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
PropertyAccessException 2: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLSearchAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexerAndSearcherFactory' defined in class path resource [alfresco/core-services-context.xml]: Cannot resolve reference to bean 'admLuceneIndexerAndSearcherFactory' while setting bean property 'defaultBinding'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'admLuceneIndexerAndSearcherFactory' defined in class path resource [alfresco/core-services-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLIndexAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
PropertyAccessException 2: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLSearchAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'admLuceneIndexerAndSearcherFactory' defined in class path resource [alfresco/core-services-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLIndexAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
PropertyAccessException 2: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLSearchAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (2) are:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLIndexAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
Caused by: java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
   at sun.beans.editors.EnumEditor.setValue(EnumEditor.java:72)
   at sun.beans.editors.EnumEditor.setAsText(EnumEditor.java:102)
   at org.springframework.beans.TypeConverterDelegate.convertValue(TypeConverterDelegate.java:268)
   at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:189)
   at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:139)
   at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:772)
   at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:606)
   at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java:49)
   at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:74)
   at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
   at org.springframework.beans.factory.support.AbstractBeanFactory.applyPropertyValues(AbstractBeanFactory.java:840)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1026)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:245)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1019)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:245)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1019)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:642)
   at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:419)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:328)
   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.sample.FirstFoundationClient.main(FirstFoundationClient.java:69)
PropertyAccessException 2:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.alfresco.repo.search.MLAnalysisMode] for property 'defaultMLSearchAnalysisMode'; nested exception is java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
Caused by: java.lang.IllegalArgumentException: Unsupported value: EXACT_LANGUAGE_AND_ALL
   at sun.beans.editors.EnumEditor.setValue(EnumEditor.java:72)
   at sun.beans.editors.EnumEditor.setAsText(EnumEditor.java:102)
   at org.springframework.beans.TypeConverterDelegate.convertValue(TypeConverterDelegate.java:268)
   at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:189)
   at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:139)
   at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:772)
   at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:606)
   at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java:49)
   at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:74)
   at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
   at org.springframework.beans.factory.support.AbstractBeanFactory.applyPropertyValues(AbstractBeanFactory.java:840)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1026)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:245)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1019)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:245)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1019)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:642)
   at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:419)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:328)
   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.sample.FirstFoundationClient.main(FirstFoundationClient.java:69)

What is the possible reason behind this error? I have a database called alfresco with grant options as described in the sdk wiki.

custom-repository.properties file looks like this:

#
# Sample custom content and index data location
#

dir.root=./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://localhost/alfresco

#
# Oracle connection (requires ojdbc14_g.jar or equivalent jar in shared libraries location)
#
#db.driver=oracle.jdbc.OracleDriver
#db.url=jdbcSmiley Surprisedracle: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
since i have uncommented the mysql section and the username and password one as well. My db username is root and has no password.

I had also issued the command as described in wiki:
mysqladmin -u root -p create alfresco
mysql -u root -p -e "grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;"
mysql -u root -p -e "grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;"
I do not have Alfresco running since i believe it is not required for this example.

I have followed the http://wiki.alfresco.com/wiki/Alfresco_SDK#Downloading_and_Installing_the_SDK

However, the line "Check the database connection details are correct and then it's simply a case of running or debugging the FirstFoundationClient.java application within Eclipse." is not clear, which file do i have to change the database connection details in if not custom-repository.properties where i have already uncommented the username and password line?

Please help,
Best Regards,
Vibhu.

major_king
Champ in-the-making
Champ in-the-making
Hi Vibhu,

i have the same error during the last few builds. My last test was today with the 1-october-builds :cry:

Is this a bug, so anybody has this problem or is this an individual error, perhaps false configuration???

I use eclipse ganymedem and the 1-october-builds. The only changes in the Alfresco-Configuration is the MySQL-Repository.

Regards,
christian

ajay7
Champ in-the-making
Champ in-the-making
Hi,
i am facing the same above problem, r u able to solve it?

vibhutewary
Champ in-the-making
Champ in-the-making
Hello, please make sure that your hosts file is correctly set.

i modified my to look like this.

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1   localhost localhost   localhost

Thanks and Regards,
Vibhu.

major_king
Champ in-the-making
Champ in-the-making
Hi Vibhu,

what's your "hosts file"? In the FFC-files i can't find this.

Regards,
christian