maven项目报错Encountered "-", but was expecting: "="]

同一个项目组的,别人的项目就可以启动并且正常运行。真的不知道到底是哪里出了问题。开发工具,换了好几个版本。用了me6.5,2017.都是报这个错
别的tomcat 。maven版本。jdk。都是一样的。
唯一的不同。。和他们操作系统不一样,,千万不要跟我说让我重新装个win7.。。那我会崩溃的。。
在网上搜索同样的问题,别人说是什么编码的关系。我已经把所有我能改的编码都改成了UTF-8,还是不可以。
求大神解救

Servlet.service() for servlet [springmvc] in context with path [/shopPlat] threw exception [Request processing failed; nested exception is org.springframework.context.ApplicationContextException: Failed to parse FreeMarker template for URL [swms/swmssys/system/unit.html]; nested exception is freemarker.core.ParseException: Parsing error in template "swms/swmssys/system/unit.html" in line 1, column 41:
Encountered "-", but was expecting:
"="] with root cause
freemarker.core.ParseException: Parsing error in template "swms/swmssys/system/unit.html" in line 1, column 41:
Encountered "-", but was expecting:
"="
at freemarker.core.FMParser.generateParseException(FMParser.java:4672)
at freemarker.core.FMParser.jj_consume_token(FMParser.java:4543)
at freemarker.core.FMParser.Include(FMParser.java:1681)
at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2361)
at freemarker.core.FMParser.Content(FMParser.java:2593)
at freemarker.core.FMParser.OptionalBlock(FMParser.java:2761)
at freemarker.core.FMParser.Root(FMParser.java:2933)
at freemarker.template.Template.(Template.java:193)
at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:419)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:330)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:205)
at freemarker.template.Configuration.getTemplate(Configuration.java:740)
at freemarker.template.Configuration.getTemplate(Configuration.java:673)
at org.springframework.web.servlet.view.freemarker.FreeMarkerView.getTemplate(FreeMarkerView.java:351)
at org.

4个回答

freemarker解析过程中有无,检查哈“-”标识符是否用错了。http://xiaolaohudebaba-126-com.iteye.com/blog/772470

qq_14853517
qq_14853517 没有用那个标识符呀也。。。
2 年多之前 回复

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

<bean id="freemarkerViewResolver" class="com.sgcctd.common.springmvc.RichFreeMarkerViewResolver">
    <property name="prefix" value=""/>
    <property name="suffix" value=".html"/>
    <property name="contentType" value="text/html; charset=UTF-8"/>
    <property name="exposeRequestAttributes" value="false"/>
    <property name="exposeSessionAttributes" value="false"/>
    <property name="exposeSpringMacroHelpers" value="true"/>
    <property name="order" value="1"/>
</bean>
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
    <property name="templateLoaderPath" value=""/>
    <property name="freemarkerVariables" value="#{propertyUtils.getTemplateDirectivesMap()}"/>
    <property name="preferFileSystemAccess" value="false"></property>
    <property name="freemarkerSettings">
        <props>
            <prop key="tag_syntax">auto_detect</prop>
            <prop key="template_update_delay">0</prop>
            <prop key="defaultEncoding">UTF-8</prop>
            <prop key="url_escaping_charset">UTF-8</prop>
            <prop key="locale">zh_CN</prop>
            <prop key="boolean_format">true,false</prop>
            <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
            <prop key="date_format">yyyy-MM-dd</prop>
            <prop key="time_format">HH:mm:ss</prop>
            <prop key="number_format">0.######</prop>
            <prop key="whitespace_stripping">true</prop>
            <prop key="auto_import">/WEB-INF/ftl/pony/index.ftl as p,/WEB-INF/ftl/spring.ftl as s</prop>
        </props>
    </property>
</bean>

以上是freemaker 的配置文件

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

<!-- 扫描注解配置-->
<context:component-scan base-package="com.sgcctd">
    <!-- 扫描除了Controller之外的注解Bean,Controller层扫描由springmvc来中配置,这里仅做其他类型注解扫描 -->
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" /> 
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository" />
</context:component-scan>
<!-- 扫描注解中的@Resource、@Required、@PreDestroy等-->
<context:annotation-config />

<!-- 定义文件上传处理器 -->  
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>

<!-- json支持更改为fastjson -->
<!-- 启用默认配置 -->
<mvc:annotation-driven>
    <mvc:message-converters register-defaults="true">
        <!--先进行string转换-->
        <bean class="org.springframework.http.converter.StringHttpMessageConverter" >
            <property name="supportedMediaTypes">
                <list>
                    <bean class="org.springframework.http.MediaType">
                        <constructor-arg value="text" />
                        <constructor-arg value="plain" />
                        <constructor-arg value="UTF-8" />
                    </bean>
                </list>
            </property>
        </bean>
        <!-- 配置Fastjson支持 -->
        <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
            <property name="supportedMediaTypes">
                <list>
                    <value>application/json</value>
                </list>
            </property>
            <property name="features">
                <list>
                    <value>WriteMapNullValue</value>
                    <value>QuoteFieldNames</value>
                </list>
            </property>
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>

<mvc:interceptors> 
     <mvc:interceptor>  
        <mvc:mapping path="/**" />
        <mvc:exclude-mapping path="/app/**" />
        <bean id="cloudContextInterceptor" class="com.sgcctd.common.interceptor.CloudContextInterceptor">
            <property name="nofindPage" value="/nosite.html"></property>
        </bean>
     </mvc:interceptor>
     <mvc:interceptor>  
        <mvc:mapping path="/admin/**" />
        <bean id="adminInterceptor" class="com.sgcctd.common.interceptor.AdminHandlerInterceptorAdapter">
            <property name="loginPage" value="/index.jhtml"></property>
        </bean>
    </mvc:interceptor>
</mvc:interceptors>

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
    <property name="cookieName" value="clientlanguage"/>
    <property name="cookieMaxAge" value="-1"/>
</bean>

<!-- 异常统一处理 -->
<bean id="exceptionresolver"
    class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
    <property name="defaultErrorView">
        <value>/common/error/error</value>
    </property>
    <property name="exceptionAttribute" value="ex"></property>  
    <property name="exceptionMappings">
        <props>
            <prop key="com.sgcctd.base.exception.BusinessException">/common/error/errorB</prop>
            <prop key="java.sql.SQLException">/error/errorDB</prop>
        </props>
    </property>
</bean>

以上是springMVC的配置文件

https://my.oschina.net/u/2302435/blog/1527081
我的问题是解决了,你的看造化吧。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!