Andrea Girardi
Andrea Girardi

Reputation: 4427

Print Alfresco exception

I've some problem printing the exception stack trace for Alfresco Exception.

On debug mode, step by step under Eclipse IDE I'm able to see the message when the exception is raised inspecting the Exception object but, when I send the error message to console output it's always null.

The exception is raised by this instruction:

try {
    UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
}
catch (Exception ex) {
    System.out.println(" " + ex.getStackTrace());           
    System.out.println("ERROR - createContent : " + ex.getMessage());
}

(in that case I tryed to write on a folder that not exists on repository) and inspecting the ex object on eclipse I can see the message:

java.lang.IllegalStateException: Failed to resolve to a single NodeRef with parameters (store=workspace:SpacesStore uuid=null path=/app:company_home/cm:UploadFromJava), found 0 nodes.

but ex.getMessage() returns null

Anyone could help me?

thanks, Andrea

Upvotes: 0

Views: 718

Answers (2)

Andrea Girardi
Andrea Girardi

Reputation: 4427

Implementing a method in this way:

NamedValue setNameProperty(String name) throws AlfrescoRuntimeException
{
    try {
        return Utils.createNamedValue(Constants.PROP_NAME, name);
    }
    catch (Exception ex) {
        throw new AlfrescoRuntimeException(ex.getMessage());
    }
}

The message is correclty printed with e.printStackTrace();

Upvotes: 1

Mohammed Amr
Mohammed Amr

Reputation: 317

Try to replace your package in the log4j.properties from debug to error

Upvotes: 0

Related Questions