paddy3k
paddy3k

Reputation: 149

CrystalEnterprise.getSessionMgr() modifies java system.out stream

I have a JBoss EAP 6.4.8 and a statless EJB which does nothing more than getting an ISessionMgr instance.

public boolean changePassword(String user, String oldPw, String newPw, String cmsName, String authType)
{
    boolean success = false;
    try
    {
        System.out.println("BEFORE");
        ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
        System.out.println("AFTER");

        // commented out
        // IEnterpriseSession session = sessionMgr.logon(user, oldPw, cmsName, authType);
        // session.getUserInfo().setPassword(oldPw, newPw);
    }
    catch(Exception e)
    {
        System.out.println("EXCEPTION");
        LOG.error("Error changing password for BO-CMS and user '" + user + "'", e);
    }
    return success;
}

The original task of this EJB was to change a user password which works perfectly fine. However, I noticed that after calling CrystalEnterprise.getSessionMgr() each System.out (and each log4j Logger as well) produces no output anymore. The code above prints only 'BEFORE' and no "AFTER" or "EXCEPTION" But my debugger proves that System.out.println("AFTER") gets invoked.

By the way: calling, calling this piece of code directly from within a java main method works as expected. I get an "BEFORE" and "AFTER" output.

Does anybody know what happens here?

Upvotes: 1

Views: 359

Answers (1)

Travis Bruce
Travis Bruce

Reputation: 65

I ran into this same issue on WildFly 26. The issue appears to happen because after CrystalEnterprise.getSessionMgr(); runs, the logger level has become null. I don't think it is actually modifying System.out.

You can work-around the problem by running logger.setLevel(Level.INFO) on your respective logger instance after CrystalEnterprise.getSessionMgr(); runs.

Upvotes: 0

Related Questions