Accueil

Execution application hors Eclipse

Vous êtes ici

4 contributions / 0 nouveau(x)
Dernière contribution
Execution application hors Eclipse

Bonjour,

J'ai réalisé, sous un environnement Windows XP, une application qui interagit avec Alfresco (création de dossiers, copies de fichiers). Cette application est codée depuis Eclipse et utilise le SDK (les projets SDK AlfrescoEmbedded et SDK AlfrescoRemote(bien que je doute que ce dernier soit utile à mon application)). Cette application fonctionne sans problème quand elle est lancée sous Eclipse.

Or, je veux lancer cette application depuis la ligne de commande.
Je l'ai légèrement modifiée pour enlever la méthode public static void main qui exécutait l'application. J'ai fait un jar de ce projet. Puis j'ai fait une classe qui reprend le contenu de la méthode public static void main d'origine.

En revanche, lorsque je lance l'exécution depuis la ligne de commande, j'obtiens des exceptions :

Exception in thread "main" org.alfresco.error.AlfrescoRuntimeException: 08300002
File server configuration error, 08300001 Failed to initialize desktop action
at org.alfresco.filesys.AbstractServerConfigurationBean.init(AbstractSer
verConfigurationBean.java:459)
at org.alfresco.filesys.AbstractServerConfigurationBean.onApplicationEve
nt(AbstractServerConfigurationBean.java:819)
at org.springframework.context.event.SimpleApplicationEventMulticaster.m
ulticastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publis
hEvent(AbstractApplicationContext.java:294)
at org.springframework.context.support.AbstractApplicationContext.finish
Refresh(AbstractApplicationContext.java:858)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:419)
at org.alfresco.repo.management.subsystems.ChildApplicationContextFactor
y$ApplicationContextState.start(ChildApplicationContextFactory.java:624)
at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.st
art(AbstractPropertyBackedBean.java:458)
at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.on
ApplicationEvent(AbstractPropertyBackedBean.java:386)
at org.springframework.context.event.SimpleApplicationEventMulticaster.m
ulticastEvent(SimpleApplicationEventMulticaster.java:97)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicas
tEvent(SafeApplicationEventMulticaster.java:78)
at org.springframework.context.support.AbstractApplicationContext.publis
hEvent(AbstractApplicationContext.java:294)
at org.springframework.context.support.AbstractApplicationContext.finish
Refresh(AbstractApplicationContext.java:858)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:419)
at org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:83)
at org.alfresco.sample.GestionAlfresco.<init>(GestionAlfresco.java:51)
at org.alfresco.sample.Injection.init(Injection.java:85)
at InjectionAlfresco.main(InjectionAlfresco.java:13)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 08300001 Failed to initi
alize desktop action
at org.alfresco.filesys.alfresco.AlfrescoContext.initialize(AlfrescoCont
ext.java:126)
at org.alfresco.filesys.repo.ContentContext.initialize(ContentContext.ja
va:170)
at org.alfresco.filesys.alfresco.AlfrescoDiskDriver.registerContext(Alfr
escoDiskDriver.java:405)
at org.alfresco.filesys.repo.ContentDiskDriver.registerContext(ContentDi
skDriver.java:583)
at org.alfresco.filesys.config.ServerConfigurationBean.processFilesystem
sConfig(ServerConfigurationBean.java:1663)
at org.alfresco.filesys.AbstractServerConfigurationBean.init(AbstractSer
verConfigurationBean.java:454)
... 18 more
Caused by: org.alfresco.filesys.alfresco.DesktopActionException: Unable to resol
ve drag and drop application as a file, class path resource [alfresco/desktop/Al
fresco.exe]
at org.alfresco.filesys.alfresco.DesktopAction.initializeAction(DesktopA
ction.java:425)
at org.alfresco.filesys.alfresco.AlfrescoContext.initialize(AlfrescoCont
ext.java:122)
... 23 more

J'ai un fichier de log qui me donne les résultats suivants :
Ces logs sont générés à partir de l'exécution des lignes suivantes :

	    context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
repository = (Repository)context.getBean("JCR.Repository");
try{
// login to workspace (here we rely on the default workspace defined by JCR.Repository bean)
session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
}

Extrait des logs :
[30/09/2011 10:33:53] - DEV - INFO  - Injection                      - Initialisation Injection Alfresco : fichier de log initialisé
[30/09/2011 10:33:53] - DEV - INFO - Injection - Initialisation Injection Alfresco : Chargement des properties
[30/09/2011 10:33:53] - DEV - INFO - Injection - Initialisation Injection Alfresco : properties chargées
[30/09/2011 10:33:53] - DEV - INFO - Injection - Initialisation Injection Alfresco : creation classe gestion Alfresco
[30/09/2011 10:33:53] - DEV - INFO - GestionAlfresco - Debut connexion Alfresco : recup du context
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from class path resource [alfresco/repository.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from class path resource [alfresco/domain/transaction.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [jar:file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/activites/mission29_BillabongAlfresco/tests/oliveSolution/InjectionFacturesRemote.jar!/alfresco/module/test/alfresco-global.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [jar:file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/activites/mission29_BillabongAlfresco/tests/oliveSolution/InjectionFacturesRemote.jar!/alfresco-global.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/activites/mission29_BillabongAlfresco/tests/oliveSolution/alfresco-global.properties]
[30/09/2011 10:34:05] - DEV - WARN - RuntimeSystemPropertiesSetter - Could not find alfresco-jmxrmi.password on classpath
[30/09/2011 10:34:05] - DEV - INFO - iPropertyPlaceholderConfigurer - Loading properties file from class path resource [alfresco/alfresco-shared.properties]
[30/09/2011 10:34:05] - DEV - INFO - dPropertyPlaceholderConfigurer - Loading properties file from class path resource [alfresco/version.properties]
[30/09/2011 10:34:05] - DEV - INFO - dPropertyPlaceholderConfigurer - Loading properties file from class path resource [alfresco/domain/cache-strategies.properties]
[30/09/2011 10:34:09] - DEV - INFO - UpdateChecker - New update(s) found: 2.4.5 [http://www.terracotta.org/confluence/display/release/Release+Notes+Ehcache+Core+2.4]. Please check http://ehcache.org for the latest version.
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract java.util.List org.alfresco.service.cmr.repository.NodeService.getStores()] with attributes [[ACL_ALLOW, AFTER_ACL_NODE.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract void org.alfresco.service.cmr.repository.NodeService.setChildAssociationIndex(org.alfresco.service.cmr.repository.ChildAssociationRef,int) throws org.alfresco.service.cmr.repository.InvalidChildAssociationRefException] with attributes [[ACL_PARENT.0.sys:base.WriteProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.AssociationRef org.alfresco.service.cmr.repository.NodeService.getAssoc(java.lang.Long)] with attributes [[ACL_ALLOW]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.AssociationRef org.alfresco.service.cmr.repository.NodeService.createAssociation(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) throws org.alfresco.service.cmr.repository.InvalidNodeRefException,org.alfresco.service.cmr.repository.AssociationExistsException] with attributes [[ACL_ALLOW]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.ChildAssociationRef org.alfresco.service.cmr.repository.NodeService.createNode(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName) throws org.alfresco.service.cmr.repository.InvalidNodeRefException,org.alfresco.service.cmr.dictionary.InvalidTypeException] with attributes [[ACL_NODE.0.sys:base.CreateChildren]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.ChildAssociationRef org.alfresco.service.cmr.repository.NodeService.createNode(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName,java.util.Map) throws org.alfresco.service.cmr.repository.InvalidNodeRefException,org.alfresco.service.cmr.dictionary.InvalidTypeException] with attributes [[ACL_NODE.0.sys:base.CreateChildren]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract void org.alfresco.service.cmr.repository.NodeService.addProperties(org.alfresco.service.cmr.repository.NodeRef,java.util.Map) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.WriteProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.NodeRef$Status org.alfresco.service.cmr.repository.NodeService.getNodeStatus(org.alfresco.service.cmr.repository.NodeRef)] with attributes [[ACL_NODE.0.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract java.io.Serializable org.alfresco.service.cmr.repository.NodeService.getProperty(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract java.util.List org.alfresco.service.cmr.repository.NodeService.getChildAssocs(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QNamePattern,org.alfresco.service.namespace.QNamePattern) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.ReadChildren, AFTER_ACL_NODE.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract java.util.List org.alfresco.service.cmr.repository.NodeService.getChildAssocs(org.alfresco.service.cmr.repository.NodeRef) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.ReadChildren, AFTER_ACL_NODE.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract java.util.List org.alfresco.service.cmr.repository.NodeService.getChildAssocs(org.alfresco.service.cmr.repository.NodeRef,java.util.Set)] with attributes [[ACL_NODE.0.sys:base.ReadChildren, AFTER_ACL_NODE.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract java.util.List org.alfresco.service.cmr.repository.NodeService.getChildAssocs(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QNamePattern,org.alfresco.service.namespace.QNamePattern,boolean) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.ReadChildren, AFTER_ACL_NODE.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.StoreRef org.alfresco.service.cmr.repository.NodeService.createStore(java.lang.String,java.lang.String) throws org.alfresco.service.cmr.repository.StoreExistsException] with attributes [[ACL_METHOD.ROLE_ADMINISTRATOR]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.NodeRef org.alfresco.service.cmr.repository.NodeService.restoreNode(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName)] with attributes [[ACL_NODE.0.sys:base.DeleteNode, ACL_NODE.1.sys:base.CreateChildren]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract void org.alfresco.service.cmr.repository.NodeService.setProperties(org.alfresco.service.cmr.repository.NodeRef,java.util.Map) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.WriteProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.Path org.alfresco.service.cmr.repository.NodeService.getPath(org.alfresco.service.cmr.repository.NodeRef) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract void org.alfresco.service.cmr.repository.NodeService.deleteNode(org.alfresco.service.cmr.repository.NodeRef) throws org.alfresco.service.cmr.repository.InvalidNodeRefException] with attributes [[ACL_NODE.0.sys:base.DeleteNode]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract org.alfresco.service.cmr.repository.NodeRef org.alfresco.service.cmr.repository.NodeService.getChildByName(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName,java.lang.String)] with attributes [[ACL_NODE.0.sys:base.ReadChildren, AFTER_ACL_NODE.sys:base.ReadProperties]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract boolean org.alfresco.service.cmr.repository.NodeService.exists(org.alfresco.service.cmr.repository.StoreRef)] with attributes [[ACL_ALLOW]]
[30/09/2011 10:34:27] - DEV - INFO - MethodDefinitionMap - Adding secure method [public abstract boolean org.alfresco.service.cmr.repository.NodeService.exists(org.alfresco.service.cmr.repository.NodeRef)] with attributes [[ACL_ALLOW]]

J'avoue que je suis perdu...
Je peux vous dire que le fichier de log qui est généré quand l'application est lancée en ligne de commande est différent de celui qui est généré lorsque l'application est lancée à partir d'eclipse.
Par exemple : lorsque l'application est lancée depuis eclipse, j'ai des lignes XmlBeanDefinitionReader avant les lignes JndiPropertiesFactoryBean. Ci-dessous, je vous quelques différences qui me semblent utiles, mais je pourrais vous en fournir d'autres s'il le faut.
Depuis la ligne de commande

[30/09/2011 10:34:05] - DEV - INFO  - JndiPropertiesFactoryBean      - Loading properties file from class path resource [alfresco/repository.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from class path resource [alfresco/domain/transaction.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [jar:file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/activites/mission29_BillabongAlfresco/tests/oliveSolution/InjectionFacturesRemote.jar!/alfresco/module/test/alfresco-global.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [jar:file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/activites/mission29_BillabongAlfresco/tests/oliveSolution/InjectionFacturesRemote.jar!/alfresco-global.properties]
[30/09/2011 10:34:05] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/activites/mission29_BillabongAlfresco/tests/oliveSolution/alfresco-global.properties]
[30/09/2011 10:34:05] - DEV - WARN - RuntimeSystemPropertiesSetter - Could not find alfresco-jmxrmi.password on classpath

Depuis Eclipse

[30/09/2011 10:49:13] - DEV - INFO  - JndiPropertiesFactoryBean      - Loading properties file from class path resource [alfresco/repository.properties]
[30/09/2011 10:49:13] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from class path resource [alfresco/domain/transaction.properties]
[30/09/2011 10:49:13] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from file [C:\AlfrescoSDK\lib\server\config\alfresco\module\test\alfresco-global.properties]
[30/09/2011 10:49:13] - DEV - INFO - JndiPropertiesFactoryBean - Loading properties file from URL [file:/C:/Documents%20and%20Settings/bmide/Bureau/stageMike/workspace/GSM_Alfresco_injectionFactures/InjectionFactures/bin/alfresco-global.properties]
[30/09/2011 10:49:13] - DEV - INFO - DefaultListableBeanFactory - Overriding bean definition for bean 'repository-properties': replacing [Generic bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [alfresco/core-services-context.xml]] with [Generic bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [alfresco/core-services-context.xml]]

Re: Execution application hors Eclipse

Petite précision, je viens de voir qu'il y a une ligne dans les logs générés lorsque l'application est lancée depuis Eclipse qui n'est pas dans les logs générés depuis la ligne de commande :

[30/09/2011 10:49:02] - DEV - INFO  - ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1cde100: startup date [Fri Sep 30 10:49:02 CEST 2011]; root of context hierarchy

Merci de bien vouloir m'aiguiller pour la résolution de ce problème, afin que mon application puisse se lancer sans problème depuis la ligne de commande.

Re: Execution application hors Eclipse

J'ai investigué, et j'ai pu régler le problème en copiant toute l'arborescence lib\server\config\alfresco\* du SDK dans mon répertoire d'exécution en alfresco\*

comme mon classpath d'exécution java fait référence à mon répertoire d'exécution. Les fichiers requis sont trouvés.

En revanche, cette solution ne me satisfait qu'à moitié car cela multiplie les doublons de fichiers, n'y a-t-il pas la possibilité de faire pointer directement vers le répertoire alfresc\* du SDK ?

Re: Execution application hors Eclipse

Bonjour,

Je reviens vers vous car je suis passé à la version 3.4.e d'alfresco et du SDK.
Et la méthode que j'avais utilisé dans le message précédent ne marche plus.

Je dois dire que je désespère de trouver comment lancer mon application en dehors d'éclipse en ligne de commande.

Je fais appel à vous pour me sortir de cette impasse :cry: