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
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法