老师你好,项目已部署到服务器上,访问页面出现500错误,具体报错如下
HTTP Status 500 – Internal Server Error
Type 异常报告
消息 Servlet.init() for servlet [spring-dispatcher] threw exception
描述 服务器遇到一个意外的情况,阻止它完成请求。
Exception
javax.servlet.ServletException: Servlet.init() for servlet [spring-dispatcher] threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
org.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:818)org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:818)
org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:818)org.apache.tomcat.util.net.NioEndpointSocketProcessor.doRun(NioEndpoint.java:1623)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
Root Cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in file [/apache-tomcat-8.5.53/webapps/SchoolShopO2O/WEB-INF/classes/spring/spring-dao.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/servlet/view/groovy/GroovyMarkupConfigurer
Root Cause
java.lang.NoClassDefFoundError: org/springframework/web/servlet/view/groovy/GroovyMarkupConfigurer
java.lang.Class.getEnclosingMethod0(Native Method)
java.lang.Class.getEnclosingMethodInfo(Class.java:1072)
java.lang.Class.getEnclosingClass(Class.java:1272)
java.lang.Class.getSimpleBinaryName(Class.java:1443)
java.lang.Class.getSimpleName(Class.java:1309)
java.lang.Class.isAnonymousClass(Class.java:1411)
org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:135)
org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:125)
org.apache.ibatis.builder.xml.XMLConfigBuilder.typeAliasesElement(XMLConfigBuilder.java:164)
org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:109)
org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:98)
org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:508)
org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:424)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
<!--配置整合mybatis-->
<!--1.配置数据库相关参数properties-->
<context:property-placeholder location="classpath:db.properties"/>
<!--2.数据库连接池-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${db.driver}"/>
<property name="jdbcUrl" value="${db.slave.url}"/>
<property name="user" value="${db.username}"/>
<property name="password" value="${db.password}"/>
<!--c3p0连接池的私有属性-->
<property name="maxPoolSize" value="30"/>
<property name="minPoolSize" value="10"/>
<!--关闭连接不自动commit-->
<property name="autoCommitOnClose" value="false"/>
<!--获取连接超时时间-->
<property name="checkoutTimeout" value="10000"/>
<!--当获取连接失败重试次数-->
<property name="acquireRetryAttempts" value="2"/>
</bean>
<!--3.配置sqlSessionFactory对象-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!--注入数据库连接池-->
<property name="dataSource" ref="dataSource"/>
<!--配置mybatis全局配置文件-->
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<!--扫描entity包 使用别名-->
<property name="typeAliasesPackage" value="com.lzr.entity"/>
<!--扫描sql配置文件:mapper需要的xml文件-->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
</bean>
<!--4.配置扫描Dao接口包 动态实现Dao接口 注入spring容器中-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--注入sqlSessionFactory-->
<property name="SqlSessionFactoryBeanName" value="sqlSessionFactory"/>
<!--给出需要扫描Dao层的接口包-->
<property name="basePackage" value="com.lzr.dao"/>
</bean>
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程