严重:错误manager.start()java.lang.NullPointerException

时间:2019-05-12 09:27:26

标签: java spring session tomcat

我在带有JDBC存储的tomcat服务器上使用Persistent Manager实现,该存储将会话数据存储在DB表中,而不是存储在tomcat中。我为Oracle数据库配置了如下所示的context.xml文件。

<Valve className="org.apache.catalina.valves.PersistentValve" />

        <Resource name="jdbc/mydb" type="javax.sql.DataSource"
        maxActive="50" maxIdle="20" maxWait="5000" validationQuery="select 1 from dual"
        removeAbandoned="true" logAbandoned="true" driverClassName="oracle.jdbc.driver.OracleDriver"
        username="myusername" password="mypassword"
        url="jdbc:oracle:thin:@192.168.1.63:1521/orcl" />

    <Manager className="org.apache.catalina.session.PersistentManager"
        distributable="true"  processExpiresFrequency="3" maxIdleBackup="1" saveOnRestart='false'>
        <Store className="org.apache.catalina.session.JDBCStore"
            dataSourceName="jdbc/mydb"
            sessionAppCol="app_name" sessionDataCol="session_data" sessionIdCol="session_id"
            sessionLastAccessedCol="last_access" sessionMaxInactiveCol="max_inactive"
            sessionTable="tomcat_sessions" sessionValidCol="valid_session" />
    </Manager>

会话数据例外存储在DB表中。但是现在我想对我的MySQL数据库执行相同的操作,并且我以与对Oracle DB相同的方式进行配置。如下所示,仅对Resource中的MySQL进行了必要的更改。但是它抛出了NullPointerException

<Resource name="jdbc/mydb" type="javax.sql.DataSource"
                        maxActive="150" maxIdle="100" maxWait="5000" validationQuery="select 1"
                        removeAbandoned="true" logAbandoned="true" driverClassName="com.mysql.jdbc.Driver"
                        username="myusername" password="mypassword"
                        url="jdbc:mysql://192.168.1.205:2222/mydbname" />   

堆栈跟踪:

 SEVERE: Error manager.start()
    java.lang.NullPointerException
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:195)
            at org.apache.catalina.session.JDBCStore.open(JDBCStore.java:861)
            at org.apache.catalina.session.JDBCStore.getConnection(JDBCStore.java:833)
            at org.apache.catalina.session.JDBCStore.start(JDBCStore.java:968)
            at org.apache.catalina.session.PersistentManagerBase.start(PersistentManagerBase.java:995)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4714)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
            at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
            at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
            at org.apache.catalina.core.StandardService.start(StandardService.java:525)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

    May 12, 2019 2:32:07 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context [] startup failed due to previous errors
    May 12, 2019 2:32:07 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8090
    May 12, 2019 2:32:07 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8011
    May 12, 2019 2:32:07 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/22  config=null
    May 12, 2019 2:32:07 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 262912 ms
    Exception in thread "Quartz Scheduler [SCHEDULERS]" May 12, 2019 2:33:58 PM org.apache.catalina.loader.WebappClassLoader loadClass
    INFO: Illegal access: this web application instance has been stopped already.  Could not load org.quartz.utils.ExceptionHelper.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    java.lang.IllegalStateException
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
            at org.quartz.SchedulerException.getUnderlyingException(SchedulerException.java:169)
            at org.quartz.SchedulerException.toString(SchedulerException.java:265)
            at java.lang.String.valueOf(String.java:2849)
            at java.lang.StringBuilder.append(StringBuilder.java:128)
            at org.springframework.core.NestedExceptionUtils.buildMessage(NestedExceptionUtils.java:47)
            at org.springframework.core.NestedRuntimeException.getMessage(NestedRuntimeException.java:74)
            at java.lang.Throwable.getLocalizedMessage(Throwable.java:391)
            at java.lang.Throwable.toString(Throwable.java:480)
            at java.lang.String.valueOf(String.java:2849)
            at java.io.PrintStream.println(PrintStream.java:821)
            at org.apache.tomcat.util.log.SystemLogHandler.println(SystemLogHandler.java:242)
            at java.lang.Throwable$WrappedPrintStream.println(Throwable.java:748)
            at java.lang.Throwable.printStackTrace(Throwable.java:655)
            at java.lang.Throwable.printStackTrace(Throwable.java:643)
            at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
            at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
            at java.lang.Thread.dispatchUncaughtException(Thread.java:1986)


    Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "Quartz Scheduler [SCHEDULERS]"
    Exception in thread "Quartz Scheduler [SCHEDULERS]"
    Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "Quartz Scheduler [SCHEDULERS]"

0 个答案:

没有答案