Action en javascript et evaluator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2008 09:18 AM
J'ai créé une action qui lance un javascript et qui marche très bien.
Voici le code du config-client
<config evaluator="node-type" condition="dev:_dev_UC"> <actions> <action-group id="document_browse_menu"> <action idref="valid_content" /> </action-group> </actions> </config> <config> <actions> <action id="valid_content"> <image>/images/icons/valide_content.gif</image> <label>Valid Content</label> <script>workspace://SpacesStore/scripts-valid-content</script> <params> <param name="noderef">#{actionContext.nodeRef}</param> </params> </action> </actions> </config>
Maintenant j'aimerai ajouter un evaluator personnalisé à mon action. (pour la faire apparaitre que dans certaines conditions).
J'ajoute donc les lignes suivantes :
<action id="valid_content">…<evaluator> org.newDevelopmentManagement.ValidContentEvaluator</evaluator>…</action>
et la class org.newDevelopmentManagement.ValidContentEvaluator qui implémente ActionEvaluator.
Lors que je construit mon AMP et que que l'intègre au WAR tout ce passe bien ; les fichiers sont aux bons endroits.
Mais dès que je lance Alfresco j'ai des erreurs qui surviennent:
org.alfresco.config.ConfigException: Unable to construct action 'valid_content' evaluator classname: org.newDevelopmentManagement.ValidContentEvaluator
J'ai testé en vain de changer le nom de mon package, ma fonction evaluator dans ma class ValidContentEvaluator est très simple et ne peut pas planter.
Je ne sais pourquoi Alfresco ne veux pas ce lancer.
J'ai peut être oublier de mettre quelque chose dans le config client!!
Merci pour vos réponses,
Fabien.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2008 09:44 AM
L'evaluateur java se trouve ou une fois que ton AMP est intégré dans le WAR?
Quel est le message complet d'erreur (le printStackTrace)
Michel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2008 10:13 AM
et voila le message d'erreur :
ERROR [org.springframework.web.context.ContextLoader] Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org_newDevelopmentManagement_configBootstrap' defined in file [C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\module\org.newDevelopmentManagement\module-context.xml]: Invocation of init method failed; nested exception is org.alfresco.config.ConfigException: Unable to construct action 'valid_content' evaluator classname: org.newDevelopmentManagement.ValidContentEvaluatorCaused by: org.alfresco.config.ConfigException: Unable to construct action 'valid_content' evaluator classname: org.newDevelopmentManagement.ValidContentEvaluator at org.alfresco.web.config.ActionsElementReader.parseActionDefinition(ActionsElementReader.java:222) at org.alfresco.web.config.ActionsElementReader.parse(ActionsElementReader.java:92) at org.alfresco.config.xml.XMLConfigService.parseConfigElement(XMLConfigService.java:258) at org.alfresco.config.xml.XMLConfigService.parse(XMLConfigService.java:114) at org.alfresco.config.BaseConfigService.appendConfig(BaseConfigService.java:204) at org.alfresco.web.config.WebClientConfigBootstrap.init(WebClientConfigBootstrap.java:72) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) 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.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2008 03:12 PM
<evaluator>org.newDevelopmentManagement.ValidContentEvaluator</evaluator>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2008 04:44 PM
Dans le fichier jar:
org.newDevelopmentManagement.jar
la classe java se trouve-t-elle bien dans une structure de répertoire comme celle-ci?org/newDevelopmentManagement/ValidContentEvaluator.class
pour info, un fichier jar est en réalité un fichier ZIP.
Pour pouvoir le lire avec un utilitaire de compression, renomme le en .zip
Si c'est bien le cas, peux-tu poster le code java?
Michel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2008 03:32 AM
J'ai déja regarder dans le jar le fichier est bien placé.
Voila mon code. On ne peut pas faire plus simple car ma première problématique est d'intégrer un évaluateur, je le configurerai après.
package org.newDevelopmentManagement;import org.alfresco.web.action.ActionEvaluator;import org.alfresco.web.bean.repository.Node;public class ValidContentEvaluator implements ActionEvaluator { @Override public boolean evaluate(Node node) { return true; }}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2008 04:32 AM
En regardant de plus près le web-client-config.xml,
j'ai remarqué une chose:
tu appels ton script via:
<script>workspace://SpacesStore/scripts-valid-content</script>
essaye de mettre le chemin d'acces à la place.
<script>/alfresco/dictionaire des Données/Scripts/nom_du_script.js</script>
(/alfresco étant le nom du company_home)pour pouvoir mettre ce code sur n'importe quel autre serveur…
Une possibilitée, c'est de vider le cache de tomcat (supprimer le répertoire work\Catalina\localhost\alfresco), mais je doute, normalement c'est lorsque l'on modifie ou développe des JSP…
Je continue à faire des recherches…
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2008 08:33 AM
Pour tester, j'ai mis un évaluateur existant à la place du mien.
<action id="valid_content">…<evaluator> org.alfresco.web.action.evaluator.CheckoutDocEvaluator</evaluator>…</action>
En faisant ça Alfresco ce lance bien et l'action réagi avec l'évaluateur.
J'ai ensuite mis le code de CheckoutDocEvaluator à la place du mien tout en gardant mon nom de classe et de package :
org.newDevelopmentManagement.ValidContentEvaluator
Et quand j'ai voulu lancer Alfresco la même erreur est apparue.
Je me demande si il ni a pas quelque chose à déclarer a Alfresco pour qu'il prenne en compte ma classe ValidContentEvaluator.
Bien cordialment,
Fabien.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2008 03:10 AM
Le problème vient surement du nom du fichier JAR….
renomme le en monEvaluateur.jar et surtout encore une fois qu'il ai la srtucture suivante:
monEvaluateur.jar|_org |_newDevelopmentManagement |_ValidContentEvaluator.class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2008 04:10 AM
Même en renommant le fichier JAR ça ne marche pas.
J'ai bien vérifié : le fichier .class est au bon endroit.
Le fichier monEvaluateur.jar n'est peut être pas pris en compte par Alfresco. (pourtant il est placé dans alfresco/WEB-INF/lib)
