Bonjour à tout le monde
je travaille sur Alfresco via CMIS et je veux générer un token pour empecher d' avoir un Popup à chaque fois que j' accéde à une ressource.
Voici en bas ma dependence Maven
Je n' arrive pas à loader le Context via application-context.xml car j' ai une exception pour ces fichiers
version.properties
alfresco-jmxrmi.password
J 'ai verifié dans le jar alfresco-repository mais ces fichier n' existent pas .
Est ce que ces fichier sont obligatoires ? est ce que je dois les créer?
// La dépendence de alfresco-repository
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>7.7</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
// Ma methode pour générer un ticket pour l' authentification
public String generateLoginTicket( String userName, String userPw )
{
String generatedTicketId = "";
try {
//-------------------------------------------------------------------
// Get a reference to the Alfresco Application Context and use it to
// get a handle to the Alfresco Service Registry so that we can look
// up the Alfresco Authentication Service:
// ApplicationContext appContext = ApplicationContextHelper.getApplicationContext();
//ServiceRegistry svcRegistry = (ServiceRegistry) appContext.getBean( ServiceRegistry.SERVICE_REGISTRY );
// Setup Spring and Transaction Service
// ok
//ServiceRegistry authenticationService=serviceRegistry.getAuthenticationService();
//
@SuppressWarnings("resource")
ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:alfresco/application-context.xml");
ServiceRegistry svcRegistry = (ServiceRegistry)context.getBean(ServiceRegistry.SERVICE_REGISTRY);
//ServiceRegistry svcRegistry=getServiceRegistry();
//-------------------------------------------------------------------
// Now, get a handle to the Alfresco Authentication Service, and ask
// it to authenticate us as a guest. Finally, ask it to generate an
// authentication ticket that we can use to get gues readable content
// contained in the repository on a future call:
AuthenticationService authenticationService = svcRegistry.getAuthenticationService();
authenticationService.authenticate( userName, userPw.toCharArray() );
generatedTicketId = authenticationService.getNewTicket();
} catch ( NoSuchBeanDefinitionException noBeanDef ) {
// thrown if there is no bean definition with the specified name
} catch ( BeansException beanEx ) {
// thrown if bean could not be obtained
} catch ( AuthenticationException authEx ) {
// log/handle error here
} catch ( Exception ex ) {
// handle generic exception / null pointer
}
return( generatedTicketId );
}
// Exception obtenue
WARN org.alfresco.util.RuntimeSystemPropertiesSetter - Could not find alfresco-jmxrmi.password on classpath
WARN org.springframework.context.support.ClassPathXmlApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [alfresco/version.properties] cannot be opened because it does not exist
Si vous pouvez m' aider s'il vous plaît