joy460154849 2018-01-11 02:30 采纳率: 0%
浏览 968
已结题

war包centos6.5上运行,freemarker运行报错,本地运行正常

maven项目通过package打包在centos6.5上运行,freemarker运行报错,本地运行正常
报错内容:HTTP Status 500 - Could not resolve view with name 'views/weatherlog' in servlet with name 'springMVC'

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<context:component-scan base-package="mongodb.*" />

<!-- MVC配置 代替 映射器和解析器 -->
<mvc:annotation-driven validator="validator" />

<!-- 校验器 -->
<!-- 以下 validator ConversionService 在使用 mvc:annotation-driven 会 自动注册 -->
<bean id="validator"
    class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
    <property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
    <!-- 如果不加默认到 使用classpath下的 ValidationMessages.properties -->
    <property name="validationMessageSource" ref="messageSource" />
</bean>
<bean id="messageSource"
    class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="classpath:messages" />
    <property name="fileEncodings" value="utf-8" />
    <property name="cacheSeconds" value="120" />
</bean>

<!-- 解析器注册 -->
<bean
    class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
    <property name="messageConverters">
        <list>
            <ref bean="stringHttpMessageConverter" />
        </list>
    </property>
</bean>
<!-- String类型解析器,允许直接返回String类型的消息 -->
<bean id="stringHttpMessageConverter"
    class="org.springframework.http.converter.StringHttpMessageConverter" />

<bean
    class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
    <property name="prefix" value="/" />
    <property name="suffix" value=".ftl" />
    <property name="contentType" value="text/html; charset=utf-8" />
</bean>

<bean id="freemakerCongfig"
    class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"
    p:templateLoaderPath="/">
    <property name="freemarkerSettings">
        <props>
            <!-- 默认编码 -->
            <prop key="defaultEncoding">UTF-8</prop>
            <!-- 去掉数字格式化 -->
            <prop key="number_format">#.##</prop>
            <!-- 导入自定义内容 -->
            <prop key="auto_import">/ftl/index.ftl as f</prop>
            <!-- 处理空值为空字符串 -->
            <prop key="classic_compatible">true</prop>
        </props>
    </property>
    <property name="freemarkerVariables">
        <map>
            <entry key="left">
                <bean class="com.jdog.frameworks.freemarker.directive.FreeMarkerLeft" />
            </entry>
            <entry key="block">
                <bean
                    class="com.jdog.frameworks.freemarker.directive.FreeMarkerBlockDirective" />
            </entry>
        </map>
    </property>
</bean>

  • 写回答

6条回答 默认 最新

  • kanliyong87 2018-01-11 03:40
    关注

    请详细贴出错误日志,方便排查

    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛