J'ai une erreur que je ne comprend pas, please help...

cancel
Showing results for 
Search instead for 
Did you mean: 
unknown-user
Active Member

J'ai une erreur que je ne comprend pas, please help...

J'ai une erreur que je ne comprend pas, please help me ?

Voici le code :

String paths[] = {"C:/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/application-context.xml"};
ApplicationContext ctx = new ClassPathXmlApplicationContext(paths);

Voici l'erreur :

28 sept. 2006 10:37:21 org.springframework.core.CollectionFactory <clinit>
INFO: JDK 1.4+ collections available
28 sept. 2006 10:37:21 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [C:/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/application-context.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [C:/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [C:/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/application-context.xml] cannot be opened because it does not exist
java.io.FileNotFoundException: class path resource [C:/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/application-context.xml] cannot be opened because it does not exist
   at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:137)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:167)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:129)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:145)
   at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
   at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
   at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:262)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
   at exemple.simpleExemple.main(simpleExemple.java:41)
2 Replies
thomasb
Member II

Re: J'ai une erreur que je ne comprend pas, please help...

FileSystemXmlApplicationContext serait probablement plus adapté…
unknown-user
Active Member

Re: J'ai une erreur que je ne comprend pas, please help...

Merci ThomasB, j'ai finalement réussi avec : ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
Mais j'ai encore une erreur, un peu plus loin pour la connexion a Alfresco !

Code :
              AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
              authenticationService.authenticate("admin", "admin".toCharArray());
        
Erreur :
           Exception in thread "main" org.alfresco.repo.security.authentication.AuthenticationException: Bad credentials presented
   at org.alfresco.repo.security.authentication.AuthenticationComponentImpl.authenticate(AuthenticationComponentImpl.java:69)
   at org.alfresco.repo.security.authentication.AuthenticationServiceImpl.authenticate(AuthenticationServiceImpl.java:104)
   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.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy22.authenticate(Unknown Source)
   at exemple.simpleExemple.doExample(simpleExemple.java:72)
   at exemple.simpleExemple.access$0(simpleExemple.java:62)
   at exemple.simpleExemple$1.doWork(simpleExemple.java:54)
   at org.alfresco.repo.transaction.TransactionUtil.executeInTransaction(TransactionUtil.java:168)
   at org.alfresco.repo.transaction.TransactionUtil.executeInUserTransaction(TransactionUtil.java:74)
   at exemple.simpleExemple.main(simpleExemple.java:58)
Caused by: net.sf.acegisecurity.BadCredentialsException: Bad credentials presented
   at net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider.getUserFromBackend(DaoAuthenticationProvider.java:393)
   at net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider.authenticate(DaoAuthenticationProvider.java:225)
   at net.sf.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:159)
   at net.sf.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49)
   at org.alfresco.repo.security.authentication.AuthenticationComponentImpl.authenticate(AuthenticationComponentImpl.java:63)
   … 24 more