开发者

Print Alfresco exception

开发者 https://www.devze.com 2023-04-09 09:30 出处:网络
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 i

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


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();


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

0

精彩评论

暂无评论...
验证码 换一张
取 消