一切福田,不離方寸,從心而覓,感無不通。

com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor和oracle不识别

出现的错误一:

  1. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource
  2.     [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:
  3.     Failed to parse config resource: class path resource [mybatis-config.xml];
  4.     nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.ClassCastException:
  5.     com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  6.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
  7.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
  8.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
  9.     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  10.     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  11.     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  12.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  13.     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
  14.     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
  15.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
  16.     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
  17.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
  18.     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
  19.     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
  20.     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
  21.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  22.     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  23.     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  24.     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
  25.     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
  26.     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
  27.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  28.     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  29.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  30.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  31.     at java.lang.Thread.run(Thread.java:745)
  32. Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
  33. Cause: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  34.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:500)
  35.     at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
  36.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
  37.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
  38.     … 25 more
  39. Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  40.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
  41.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
  42.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:494)
  43.     … 28 more
  44. Caused by: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  45.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.pluginElement(XMLConfigBuilder.java:183)
  46.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:110)
  47.     … 30 more
  48. 十月 09, 2017 10:25:39 上午 org.apache.catalina.core.StandardContext listenerStart
  49. 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  50. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is
  51. org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause:
  52. java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  53.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
  54.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
  55.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
  56.     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  57.     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  58.     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  59.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  60.     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
  61.     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
  62.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
  63.     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
  64.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
  65.     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
  66.     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
  67.     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
  68.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  69.     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  70.     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  71.     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
  72.     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
  73.     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
  74.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  75.     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  76.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  77.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  78.     at java.lang.Thread.run(Thread.java:745)
  79. Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
  80. Cause: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  81.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:500)
  82.     at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
  83.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
  84.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
  85.     … 25 more
  86. Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  87.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
  88.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
  89.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:494)
  90.     … 28 more
  91. Caused by: java.lang.ClassCastException: com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
  92.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.pluginElement(XMLConfigBuilder.java:183)
  93.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:110)
  94.     … 30 more

主要是这句:com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor

再来看看我的配置:

  1. <plugins>
  2.         <plugin interceptor="com.github.pagehelper.PageHelper">
  3.             <!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库-->
  4.             <property name="dialect" value="Oracle"/>
  5.         </plugin>
  6.     </plugins>

配置中实现的是com.github.pagehelper.PageHelper这个接口,而错误报的是这个借口在强转成org.apache.ibatis.plugin.Interceptor这个借口的时候报错了,而我使用的是pageheper5.1.2版本,上网一查,自4.0.0版本以后就不再实现这个接口了,转而实现这个接口:org.apache.ibatis.plugin.Interceptor,因此,修改配置如下:

  1. <!-- 配置分页插件 -->
  2.     <plugins>
  3.         <plugin interceptor="com.github.pagehelper.PageInterceptor">
  4.             <!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库-->
  5.             <property name="dialect" value="Oracle"/>
  6.         </plugin>
  7.     </plugins>

出现的错误二:

修改完配置之后接着又出现了这样的错误:

  1. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]:
  2.     Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:
  3.     Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException:
  4.     Error parsing SQL Mapper Configuration. Cause: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  5.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
  6.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
  7.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
  8.     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  9.     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  10.     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  11.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  12.     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
  13.     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
  14.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
  15.     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
  16.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
  17.     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
  18.     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
  19.     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
  20.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  21.     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  22.     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  23.     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
  24.     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
  25.     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
  26.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  27.     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  28.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  29.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  30.     at java.lang.Thread.run(Thread.java:745)
  31. Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
  32. Cause: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  33.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:500)
  34.     at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
  35.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
  36.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
  37.     … 25 more
  38. Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  39.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
  40.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
  41.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:494)
  42.     … 28 more
  43. Caused by: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  44.     at com.github.pagehelper.PageInterceptor.setProperties(PageInterceptor.java:242)
  45.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.pluginElement(XMLConfigBuilder.java:184)
  46.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:110)
  47.     … 30 more
  48. Caused by: java.lang.ClassNotFoundException: Oracle
  49.     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
  50.     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
  51.     at java.lang.Class.forName0(Native Method)
  52.     at java.lang.Class.forName(Class.java:191)
  53.     at com.github.pagehelper.PageInterceptor.setProperties(PageInterceptor.java:239)
  54.     … 32 more
  55. 十月 09, 2017 10:36:08 上午 org.apache.catalina.core.StandardContext listenerStart
  56. 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  57. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is
  58. org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause:
  59. com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  60.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
  61.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
  62.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
  63.     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  64.     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  65.     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  66.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  67.     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
  68.     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
  69.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
  70.     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
  71.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
  72.     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
  73.     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
  74.     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
  75.     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  76.     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  77.     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  78.     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
  79.     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
  80.     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
  81.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  82.     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  83.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  84.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  85.     at java.lang.Thread.run(Thread.java:745)
  86. Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
  87. Cause: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  88.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:500)
  89.     at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
  90.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
  91.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
  92.     … 25 more
  93. Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  94.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
  95.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
  96.     at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:494)
  97.     … 28 more
  98. Caused by: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: Oracle
  99.     at com.github.pagehelper.PageInterceptor.setProperties(PageInterceptor.java:242)
  100.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.pluginElement(XMLConfigBuilder.java:184)
  101.     at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:110)
  102.     … 30 more
  103. Caused by: java.lang.ClassNotFoundException: Oracle
  104.     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
  105.     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
  106.     at java.lang.Class.forName0(Native Method)
  107.     at java.lang.Class.forName(Class.java:191)
  108.     at com.github.pagehelper.PageInterceptor.setProperties(PageInterceptor.java:239)
  109.     … 32 more

错误的信息很明显,oracle类不识别,最终原因还是因为版本的问题,自4.0.0以后的版本已经可以自动识别数据库了,所以不需要我们再去指定数据库,所以,修改配置:

  1. <plugins>
  2.         <plugin interceptor="com.github.pagehelper.PageInterceptor">
  3.             <!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库, 4.0.0以后版本支持自动识别数据库-->
  4.             <!-- <property name="dialect" value="Oracle"/>-->
  5.         </plugin>
  6.     </plugins>

我这里把配置数据库的一行代码给注释掉了,修改完毕之后,启动正常。

 

from:https://blog.csdn.net/maxiao1204/article/details/79937012