简体   繁体   中英

Can someone explain the details of this nullPointerException error to me?

So I'm trying to write a Java program using the SAP BO SDK. When I try to create a session, using a predefined class from the SDK, I get a nullPointerException. I copied my code 1 to 1 from an SDK tutorial. Here is my code:

public class Program {
    public static void main(String[] args) {
        try {
            ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
            ...
        }
    }
}

When I run that code (I commented everything else out for testing), I get the following error:

Exception in thread "main" java.lang.NullPointerException
at com.crystaldecisions.celib.classloader.ClassLoaderHelper$2.getResourceAsStream(ClassLoaderHelper.java:102)
at com.crystaldecisions.celib.classloader.ClassLoaderHelper.getResourceAsStream(ClassLoaderHelper.java:149)
at com.crystaldecisions.sdk.framework.internal.SessionMgr.initializeSystemProperties(SessionMgr.java:258)
at com.crystaldecisions.sdk.framework.internal.SessionMgr.<init>(SessionMgr.java:253)
at com.crystaldecisions.sdk.framework.internal.CEFactory.makeSessionMgr(CEFactory.java:94)
at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr_aroundBody0(CrystalEnterprise.java:121)
at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr_aroundBody1$advice(CrystalEnterprise.java:512)
at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr(CrystalEnterprise.java:1)
at myprogram.main(Program.java:18) <-- Line 4 in my code example above

Does this mean that there is an error in the libraries provided by the SDK? Or that I somehow imported those incorrectly? Is it possible to get any more information from this error code?

Thank you for any help or guidance you can provide.

EDIT: The tutorial used: http://bukhantsov.org/2011/08/getting-started-with-businessobjects-java-sdk/

The issue was that I was referencing JAR files directly from my Program Files. Copying the files to a local folder in my workspace, and referencing them from there fixed the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM