cancel
Showing results for 
Search instead for 
Did you mean: 

Failed load audit model, please help

aique
Champ in-the-making
Champ in-the-making
Hi!.

I'm developing a J2EE app with the Alfresco SDK and the JCR API.

The versions are 3.3 in both.

I have a form to log in using the next code into a servlet:

ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
Session session = repository.login(new SimpleCredentials(usuario, password.toCharArray()));

When I complete the form and submit it I get this error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'copyService' defined in class path resource [alfresco/core-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Cannot resolve reference to bean 'auditModel.modelRegistry' while setting bean property 'auditModelRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Audit' defined in class path resource [alfresco/bootstrap-context.xml]: Invocation of init method failed; nested exception is org.alfresco.repo.audit.model.AuditModelException: 03150001 Failed to load audit model: file:/C:/TFM/entorno/tomcat/webapps/wdi/WEB-INF/classes/alfresco/audit/alfresco-audit-cmis.xml

I have open the file in the path C:/TFM/entorno/tomcat/webapps/wdi/WEB-INF/classes/alfresco/audit/alfresco-audit-cmis.xml and this is the content:

<?xml version="1.0" encoding="UTF-8"?>

<Audit xmlns="http://www.alfresco.org/repo/audit/model/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.alfresco.org/repo/audit/model/3.2 alfresco-audit-3.2.xsd">

<DataExtractors>
<DataExtractor name="simpleValue" registeredName="auditModel.extractor.simpleValue"/>
<DataExtractor name="nullValue" registeredName="auditModel.extractor.nullValue"/>
<DataExtractor name="changeLog" registeredName="CMISChangeLogDataExtractor"/>
</DataExtractors>

<PathMappings>
<PathMap source="/CMISChangeLog" target="/CMISChangeLog" />
<PathMap source="/alfresco-api/post/FileFolderService/create" target="/CMISChangeLog/CREATED" />
<PathMap source="/alfresco-api/post/NodeService/setProperties" target="/CMISChangeLog/UPDATED" />
<PathMap source="/alfresco-api/post/NodeService/addProperties" target="/CMISChangeLog/UPDATED" />
<PathMap source="/alfresco-api/post/NodeService/setProperty" target="/CMISChangeLog/UPDATED" />
<PathMap source="/alfresco-api/post/NodeService/removeProperty" target="/CMISChangeLog/UPDATED" />
<PathMap source="/alfresco-node/beforeDeleteNode" target="/CMISChangeLog/DELETED" />
<PathMap source="/alfresco-api/post/PermissionService/setPermission" target="/CMISChangeLog/SECURITY" />
<PathMap source="/alfresco-api/post/PermissionService/setInheritParentPermissions" target="/CMISChangeLog/SECURITY" />
<PathMap source="/alfresco-api/post/PermissionService/clearPermission" target="/CMISChangeLog/SECURITY" />
<PathMap source="/alfresco-api/post/PermissionService/deletePermission" target="/CMISChangeLog/SECURITY" />
</PathMappings>

<Application name="CMISChangeLog" key="CMISChangeLog">
<AuditPath key="CREATED">
<AuditPath key="result">
<RecordValue key="value" dataExtractor="changeLog" />
</AuditPath>
<AuditPath key="error">
<RecordValue key="value" dataExtractor="nullValue" />
</AuditPath>
</AuditPath>

<AuditPath key="UPDATED">
<AuditPath key="args">
<AuditPath key="nodeRef">
<RecordValue key="value" dataExtractor="changeLog" />
</AuditPath>
</AuditPath>
<AuditPath key="error">
<RecordValue key="value" dataExtractor="nullValue" />
</AuditPath>
</AuditPath>

<AuditPath key="DELETED">
<AuditPath key="node">
<RecordValue key="value" dataExtractor="changeLog" />
</AuditPath>
</AuditPath>

<AuditPath key="SECURITY">
<AuditPath key="args">
<AuditPath key="nodeRef">
<RecordValue key="value" dataExtractor="changeLog" />
</AuditPath>
</AuditPath>
<AuditPath key="error">
<RecordValue key="value" dataExtractor="nullValue" />
</AuditPath>
</AuditPath>
</Application>

</Audit>

Any one knows what's happen?.

Thanks for your help, I'm really stuck.
3 REPLIES 3

aique
Champ in-the-making
Champ in-the-making
I have found the Java code where the exception is thrown:

public void registerModel(URL auditModelUrl)
        {
            try
            {
                if (auditModels.containsKey(auditModelUrl))
                {
                    logger.warn("An audit model has already been registered at URL " + auditModelUrl);
                }
                Audit audit = AuditModelRegistryImpl.unmarshallModel(auditModelUrl);

                // Store the model itself
                auditModels.put(auditModelUrl, audit);

                // Cache property enabling each application by default
                List<Application> applications = audit.getApplication();
                for (Application application : applications)
                {
                    properties.put(getEnabledProperty(application.getKey()), true);
                }
            }
            catch (Throwable e)
            {
                throw new AuditModelException("Failed to load audit model: " + auditModelUrl, e);
            }
        }

Uses the application tag and his attribute key. Both are in the file, into the line:

<Application name="CMISChangeLog" key="CMISChangeLog">

¿Maybe I have to get the application CMISChangeLog from somewhere?.

Any ideas help.

Thanks!.

aique
Champ in-the-making
Champ in-the-making
I solved the problem. I didn't add the .xsd files to the WEB-INF directory.

anik
Champ in-the-making
Champ in-the-making
Hi,
I am also getting the same error when i add a custom audit file in extension folder. can u please tell me which .xsd files am I supposed to add and also the location of the files?
Thanks.