cancel
Showing results for 
Search instead for 
Did you mean: 

change to shared/classes/alfresco/web-extension/share-config-custom.xml does not do anything

eltorio
Champ in-the-making
Champ in-the-making
Hi,
I'm new to Alfresco, I've installed Alfresco Community 4.2c on linux under Tomcat7
I changed tomcat/conf/catalina.properties for having shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
When I change aspect visibility in ${catalina.base}/shared/classes/alfresco/web-extension/share-config-custom.xml with:

      <aspects>
         <!– Aspects that a user can see –>
         <visible>
        <!–   
            <aspect name="cm:generalclassifiable" />
            <aspect name="cm:complianceable" />
            <aspect name="cm:dublincore" />
            <aspect name="cm:effectivity" />
            <aspect name="cm:summarizable" />
            <aspect name="cm:versionable" />
            <aspect name="cm:templatable" />
            <aspect name="cm:emailed" />
–>
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
            <aspect name="gd:googleEditable" />
            <aspect name="cm:geographic" />
            <aspect name="exif:exif" />
         </visible>

I still have all the aspect in the share UI, in fact my real problem is that I cannot add my custom test aspect <aspect name="customSmiley Very HappyocumentComptable" /> developped with the 2 ex sample files:
${catalina.base}/shared/classes/alfresco/extension/custom-model-context.xml
${catalina.base}/shared/classes/alfresco/extension/customModel.xml

for testing if my new xml files are read I made a intentional mistake in the xml doc, and it works I got an error on tomcat starting.
I also force adding ${catalina.base}/shared/classes in tomcat classpath by adding a setenv.sh,
my classpass reported by tomcat is


Using CATALINA_BASE:   /java/tomcat
Using CATALINA_HOME:   /java/tomcat
Using CATALINA_TMPDIR: /java/tomcat/temp
Using JRE_HOME:        /java/jdk1.7.0_11/jre
Using CLASSPATH:       /java/tomcat/shared/classes/:/java/tomcat/bin/bootstrap.jar:/java/tomcat/bin/tomcat-juli.jar


wich is correct for my installation

Thanks everyone for your help
15 REPLIES 15

rjohnson
Star Contributor
Star Contributor
I don't get this. I have this any number of times and it simply works. The only thing you have done that I never did was to alter the shared loader location but I cannot see how that would matter and your test suggests that it is being recognised.

This only leaves me with the idea that share-config-custom.xml is not being read and the onlt test I can suggest for that is to deliberately make it mal formed. If you get an error its being read, if not, it isn't. The other thing I would suggest is putting Alfresco in debug mode by settingthe appropriate items for the repository and share in log4j.properties.

I wish I could be of more help, but this just works for me.

eltorio
Champ in-the-making
Champ in-the-making
I made the basic test to make an error in share-config-custom.xml and it makes an obvious error:

2013-12-06 09:47:58,017  ERROR [extensions.config.BaseConfigService] [localhost-startStop-1] Input stream invalid - skipped for source: classpath:alfresco/web-extension/share-config-custom.xml'
org.springframework.extensions.config.ConfigException: 11060000 Failed to parse config stream
        at org.springframework.extensions.config.xml.XMLConfigService.parse(XMLConfigService.java:224)
        at org.springframework.extensions.config.BaseConfigService.appendConfig(BaseConfigService.java:268)
        at org.springframework.extensions.config.BaseConfigService.parse(BaseConfigService.java:298)
        at org.springframework.extensions.config.xml.XMLConfigService.initConfig(XMLConfigService.java:132)
        at org.springframework.extensions.config.BaseConfigService.init(BaseConfigService.java:95)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)

Caused by: org.dom4j.DocumentException: Error on line 64 of document  : La balise de fin pour le type d'élément "removeable" doit se terminer par un délimiteur '>'. Nested exception: La balise de fin pour le type d'élément "removeable" doit se terminer par un délimiteur '>'.
        at org.dom4j.io.SAXReader.read(SAXReader.java:482)
        at org.dom4j.io.SAXReader.read(SAXReader.java:343)
        at org.springframework.extensions.config.xml.XMLConfigService.parse(XMLConfigService.java:212)
        … 37 more

Next I remove the shared loader from tomcat (but let {$catalina_base}/shared/classes in the classpath and I got the same not visible aspect
Finally I remove shared/classes from my classpath but now Alfresco is not working I get in the web interface:

A problem has occurred.
This page could not be rendered:
document-details
Please notify your system administrator.


the shared.loader modification I made is automatically done on windows with the official installer, I checked the line is exactly the same in the tomcat7 bundled in the windows installer, I'll try to make a virtual machine under windows with my custom aspect and my share-config-custom.xml under windows for seeing what happens.
On linux I must make a manual installation. But tomcat is tomcat and java is java so it can run!

running in DEBUG mode lin log4j is a good idea but I don't know wich items I need, there is a lot of items and putting all in debug will result in a unreadable log

sujaypillai
Confirmed Champ
Confirmed Champ
With everything back in proper place (after removing all changes from share-config-custom.xml ) try placing your aspect directly in tomcat\webapps\share\WEB-INF\classes\alfresco\share-documentlibrary-config.xml and try to check whether it reflects in UI.

Also try applying the aspect by Javascript:

doc.addAspect("custom:DocumentComptable");
doc.save();

and let us know what happens.

rjohnson
Star Contributor
Star Contributor
The good news is that I have cut & pasted your model and context into files on my test VM (I did remove the blank lines) and they work perfectly. The attached screen grab shows your new aspect (you would need to add a desscription for it in a message bundle).

But I guess this is also the bad news because if it works for me it should work for you. The XML is as below.. but its the same as yours

DocumentComptable-model-context.xml


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <!– Registration of new models –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/DocumentComptable-model.xml</value>
            </list>
        </property>
    </bean>
</beans>


DocumentComptable-model.xml


<?xml version="1.0" encoding="UTF-8"?>
<model name="custom:DocumentComptableModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <!– Optional meta-data about the model –>
   <description>Modele comptable</description>
   <author>Ronan</author>
   <version>1.0</version>
   <imports>
          <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <namespaces>
      <namespace uri="http://documentum.sudagri-jatropha.com/model/content/1.0" prefix="custom"/>
   </namespaces>
        <constraints>
                <constraint name="custom:listTypesPieceComptable" type="LIST">
                        <parameter name="allowedValues">
                                <list>
                                    <value>Facture achat</value>
                                    <value>Facture vente</value>
                                    <value>Cheque</value>
                                    <value>Masse salariale</value>
                                </list>
                        </parameter>
                </constraint>
        </constraints>
        <aspects>
                <aspect name="custom:DocumentComptable">
                <title>Document Comptable</title>
                        <properties>
                                <property name="custom:CodePieceComptable">
                                        <title>Numero piece comptable</title>
                                        <type>d:text</type>
                                        <protected>false</protected>
                                        <mandatory>true</mandatory>
                                        <multiple>false</multiple>
                                </property>
                                <property name="custom:TypePieceComptable">
                                        <title>Type de piece comptable</title>
                                        <type>d:text</type>
                                        <protected>false</protected>
                                        <mandatory>true</mandatory>
                                        <multiple>false</multiple>
                                        <constraints>
                                                <constraint ref="custom:listTypesPieceComptable" />
                                        </constraints>
                                </property>
                                <property name="custom:Echeance">
                                        <title>Echance piece</title>
                                        <type>d:text</type>
                                        <protected>false</protected>
                                        <mandatory>false</mandatory>
                                        <multiple>false</multiple>
                                </property>
                                <property name="custom:Montant">
                                        <title>Montant total piece</title>
                                        <type>d:text</type>
                                        <protected>false</protected>
                                        <mandatory>false</mandatory>
                                        <multiple>false</multiple>
                                </property>
                        </properties>
                </aspect>
        </aspects>
</model>


and the section from my share-config-custom.xml looks like:-


   <config evaluator="string-compare" condition="DocumentLibrary">
         <!–
         Used by the "Manage Aspects" action

         For custom aspects, remember to also add the relevant i18n string(s)
            cm_myaspect=My Aspect
      –>
      <aspects>
         <!– Aspects that a user can see –>
         <visible>
            <aspect name="fgpt:onHold"/>
            <aspect name="fgpt:cancelled"/>
            <aspect name="fgpt:printaspect"/>
            <aspect name="fgic:assigned"/>
            <aspect name="custom:DocumentComptable" />
         </visible>
         <!– Aspects that a user can add. Same as "visible" if left empty –>
         <addable>
         </addable>
         <!– Aspects that a user can remove. Same as "visible" if left empty –>
         <removeable>
         </removeable>
      </aspects>
</config>


So, what you have written works.



eltorio
Champ in-the-making
Champ in-the-making
Thanks everyone;
rjohnson: thanks now I'm looking for a tomcat misconfiguration
sujaypillai: putting the aspect in the first line in tomcat\webapps\share\WEB-INF\classes\alfresco\share-documentlibrary-config.xml does not work, also commenting all the aspect in tomcat\webapps\share\WEB-INF\classes\alfresco\share-documentlibrary-config.xml does not change the UI, all aspects are still there!!!!

eltorio
Champ in-the-making
Champ in-the-making
I cannot explain why, but in a virtual machine with the same linux distrib I install the linux installer. Next I deleted tomcat/webapps/alfresco and tomcat/webapps/share , After that I replace alfresco.war and share.war from my VM , started tomcat and…

IT APPEARS in UI without any other change…

Now it does not work:
first I change my namespace to sudagri
1- string is not displayed (ie shown as apect.sudagri_DocumentComptable and not as "Document Comptable")
2- I can add by pressing the + but there is no x for removing it (<removeable> is empty in the config)
3- If I add and save I have no new properties in the document…

Again and again thanks a lot because I only progress with your help