请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

HTTP Status 500 – Internal Server Error

老师你好,项目已部署到服务器上,访问页面出现500错误,具体报错如下

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)

spring-dao.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!--配置整合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>

cataline.out信息:

图片描述
图片描述

打包的项目jar包:

图片描述

本地JDK版本:

图片描述

服务器JDK版本:

图片描述

正在回答 回答被采纳积分+3

1回答

翔仔 2020-05-10 23:20:33

同学好,请先确保本地没有问题,如果本地没有问题的话,我感觉应该是线上服务器jar包缺失或者冲突导致的,同学可以把war包解压出来,将它里面的jar包和线下的做下对比。

或者直接试试这个,https://blog.csdn.net/tensorzhl/article/details/52893236

如果不行的话,因为这个异常确实没见到过,所以还是需要对比一下jar包,估计跟  spring-webmvc jar 这个jar有关


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信