NullPointer in log during first connection to database

前端 未结 2 827
北海茫月
北海茫月 2020-12-11 05:09

I get a NullPointerException on the console of my tomcat at my first connection to the database with createEntityManager(). I am using:

    <
2条回答
  •  北海茫月
    2020-12-11 05:23

    This exception is not about database platform but about application server platform. It's not fatal. SessionManager#init() method does following:

        String platformClass
                = ServerPlatformUtils.detectServerPlatform(null);
        try {
            detectedPlatform
                    = ServerPlatformUtils.createServerPlatform(
                    null, platformClass,
                    SessionManager.class.getClassLoader());
        } catch (NullPointerException npe) {
            //some platforms may not be handling 'null' session well,
            //so be defensive here and only log throwable here
            detectedPlatform = null;
            LOG.logThrowable(SessionLog.WARNING,
                    AbstractSessionLog.CONNECTION, npe);
        }
    

    So null is used as detected server platform and EclipseLink will consider that current application server platform does not have multitenancy support (which Apache Tomcat does not have). This code in SessionManager is related to new WebLogic feature and you may simply ignore it. 2.7.0 throws ServerPlatformException instead of NPE but this change was not bacported to 2.6.1.

    If you guys would like to add Apache Tomcat platform detection, please open enhancement request on Eclipselink Bugzilla and vote for it to give it a priority.

提交回复
热议问题