main函数创建Configuration() 没有问题,在controller上执行就报错

具体错误代码如下

    2018-12-05 17:25:39,486 DEBUG [servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] - Resolving exception from handler [public java.lang.String com.chinagdn.base.web.ss.SweepCompanyController.uploadReport(com.chinagdn.base.vo.ReportWordVo)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
2018-12-05 17:25:39,486 DEBUG [web.servlet.mvc.annotation.ResponseStatusExceptionResolver] - Resolving exception from handler [public java.lang.String com.chinagdn.base.web.ss.SweepCompanyController.uploadReport(com.chinagdn.base.vo.ReportWordVo)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
2018-12-05 17:25:39,498 DEBUG [web.servlet.mvc.support.DefaultHandlerExceptionResolver] - Resolving exception from handler [public java.lang.String com.chinagdn.base.web.ss.SweepCompanyController.uploadReport(com.chinagdn.base.vo.ReportWordVo)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
2018-12-05 17:25:39,499 DEBUG [springframework.web.servlet.handler.SimpleMappingExceptionResolver] - Resolving exception from handler [public java.lang.String com.chinagdn.base.web.ss.SweepCompanyController.uploadReport(com.chinagdn.base.vo.ReportWordVo)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
2018-12-05 17:25:39,500 DEBUG [springframework.web.servlet.handler.SimpleMappingExceptionResolver] - Resolving to view 'error/500' for exception of type [org.springframework.web.util.NestedServletException], based on exception mapping [java.lang.Throwable]
2018-12-05 17:25:39,500 DEBUG [springframework.web.servlet.handler.SimpleMappingExceptionResolver] - Exposing Exception as model attribute 'exception'
2018-12-05 17:25:39,500 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'error/500'; model is {exception=org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration}
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: freemarker/template/Configuration
    at com.chinagdn.base.web.ss.SweepCompanyController.uploadReport(SweepCompanyController.java:128)
    at com.chinagdn.base.web.ss.SweepCompanyController$$FastClassBySpringCGLIB$$9b19d86b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor$1.proceed(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:82)
    at org.apache.shiro.authz.aop.AuthorizingMethodInterceptor.invoke(AuthorizingMethodInterceptor.java:39)
    at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor.invoke(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:115)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.chinagdn.base.web.ss.SweepCompanyController$$EnhancerBySpringCGLIB$$84209520.uploadReport(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    ... 47 more
2018-12-05 17:25:39,509 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Rendering view [org.springframework.web.servlet.view.JstlView: name 'error/500'; URL [/WEB-INF/views/error/500.jsp]] in DispatcherServlet with name 'springMvc'
2018-12-05 17:25:39,509 DEBUG [springframework.web.servlet.view.JstlView] - Added model object 'exception' of type [org.springframework.web.util.NestedServletException] to request in view with name 'error/500'
2018-12-05 17:25:39,509 DEBUG [springframework.web.servlet.view.JstlView] - Forwarding to resource [/WEB-INF/views/error/500.jsp] in InternalResourceView 'error/500'
2018-12-05 17:25:39,514 ERROR [500.jsp] - Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: freemarker/template/Configuration
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: freemarker/template/Configuration
    at com.chinagdn.base.web.ss.SweepCompanyController.uploadReport(SweepCompanyController.java:128)
    at com.chinagdn.base.web.ss.SweepCompanyController$$FastClassBySpringCGLIB$$9b19d86b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor$1.proceed(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:82)
    at org.apache.shiro.authz.aop.AuthorizingMethodInterceptor.invoke(AuthorizingMethodInterceptor.java:39)
    at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor.invoke(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:115)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.chinagdn.base.web.ss.SweepCompanyController$$EnhancerBySpringCGLIB$$84209520.uploadReport(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    ... 47 more
2018-12-05 17:25:39,537 DEBUG [springframework.web.multipart.commons.CommonsMultipartResolver] - Cleaning up multipart file [list[0].file] with original filename [], stored in memory
2018-12-05 17:25:39,537 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request
2018-12-05 17:25:39,575 DEBUG [apache.shiro.web.servlet.SimpleCookie] - Found 'jeesite.session.id' cookie value [8085a300-c84d-470f-a511-132f708a97f9]
2018-12-05 17:25:39,575 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'springMvc' processing GET request for [/css/common.css]
2018-12-05 17:25:39,575 DEBUG [servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Looking up handler method for path /css/common.css
2018-12-05 17:25:39,595 DEBUG [servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Did not find handler method for [/css/common.css]
2018-12-05 17:25:39,596 DEBUG [springframework.web.servlet.handler.SimpleUrlHandlerMapping] - Matching patterns for request [/css/common.css] are [/css/**]
2018-12-05 17:25:39,597 DEBUG [springframework.web.servlet.handler.SimpleUrlHandlerMapping] - URI Template variables for request [/css/common.css] are {}
2018-12-05 17:25:39,597 DEBUG [springframework.web.servlet.handler.SimpleUrlHandlerMapping] - Mapping [/css/common.css] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/css/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@4219e435]]] and 1 interceptor
2018-12-05 17:25:39,597 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Last-Modified value for [/css/common.css] is: -1
2018-12-05 17:25:39,600 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Null ModelAndView returned to DispatcherServlet with name 'springMvc': assuming HandlerAdapter completed request handling
2018-12-05 17:25:39,600 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request
2018-12-05 17:26:50,014 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Executing session validation...
2018-12-05 17:26:50,014 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Validating all active sessions...
2018-12-05 17:26:50,014 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Finished session validation.  No sessions were stopped.
2018-12-05 17:26:50,014 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Session validation completed successfully in 0 milliseconds.
2018-12-05 17:28:50,021 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Executing session validation...
2018-12-05 17:28:50,021 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Validating all active sessions...
2018-12-05 17:28:50,022 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Finished session validation.  No sessions were stopped.
2018-12-05 17:28:50,022 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Session validation completed successfully in 1 milliseconds.
2018-12-05 17:30:50,017 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Executing session validation...
2018-12-05 17:30:50,017 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Validating all active sessions...
2018-12-05 17:30:50,017 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Finished session validation.  No sessions were stopped.
2018-12-05 17:30:50,017 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Session validation completed successfully in 0 milliseconds.
2018-12-05 17:32:50,015 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Executing session validation...
2018-12-05 17:32:50,015 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Validating all active sessions...
2018-12-05 17:32:50,015 INFO  [apache.shiro.session.mgt.AbstractValidatingSessionManager] - Finished session validation.  No sessions were stopped.
2018-12-05 17:32:50,015 DEBUG [apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler] - Session validation completed successfully in 0 milliseconds.

  • maven依赖如下

    • <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.20</version> </dependency>
  • 创建的一个类,在自己的main函数下可以正常运行
package com.chinagdn.base.common.utils;
import freemarker.template.Configuration;

public class DocumentHandler {
    private Configuration configuration = null;

    public DocumentHandler() {

        // Configuration对象在main函数下创建没有问题,
        // 在controller创建就会报错
        configuration = new Configuration();
        configuration.setDefaultEncoding("utf-8");
}

public static void main(String[] args) {
    //此处可以创建实例,不会报错
    DocumentHandler d = new DocumentHandler();
    try {
        ....
    } catch (IOException e) {
        e.printStackTrace();
    }
}
  • 如果在 controller 层创建此对象则会报错
@RequiresPermissions("ss:sweep:buploadReport")
@RequestMapping(value = "/uploadReport/save", method = RequestMethod.POST)
public String uploadReport(ReportWordVo ReportWordVo){

    //创建这个对象的时候就会报错,实际是他的构造函数中创建的对象有问题
    DocumentHandler documentHandler = new DocumentHandler();

    return null;
}

尝试过的方式

  • 百度说是没有引用依赖 (尝试过 2.3.20/2.3.23 版本)

  • Configuration对象在main函数下跑的时候没有问题,在controller下面跑就报错

图片

  • 图片说明
  • 图片说明

2个回答

看看工程下有没freemaker jar 有的话,估计很大几率是jar冲突,建议仔细排查,仅供参考!

问题及解决,原因是再maven中添加新的依赖后,项目构建的时候lib下没有 freemaker jar,需要将所有的jar重新引用一次

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

相似问题

2
关于函数作参数的问题,请大佬指教
2
我想用spark-submit提交个springboot的jar包,指定运行main函数是遇到了问题
8
函数局部变量在函数退出后释放
4
学到函数了。遇到两个问题。为什么实参必须初始化?为什么变量m进过函数后,没有被赋新值
4
两个数组作为实际参数传给被调用函数的时候,没有敲长度,但可以正常运行
4
python中有子程序吗?如果没有,如何在函数中优雅地修改传递进来的参数?
2
java web 连接hive问题
9
把外部变量局部于main函数内遇到了问题
7
Java虚拟机在什么时候启动的?运行main方法的时候?一个main对应一个虚拟机吗
4
OpenCV函数返回的简单问题
4
关于复制构造函数问题
5
springboot创建mapper有问题
4
idea在创建父子项目时,子项目的main包下java包和resources没有自动加载包权限
2
定义一个矩形(Rectangle)类,该类代表了一个矩形。可以定义不同的矩形,并对矩形 进行如下运算:
5
程序没有main函数,会出现什么
2
C语言新手,想请教大佬们一个关于在函数内(不是主函数)分配内存的问题
1
MyBatis自己写的Function调用Mapper,如何在Controller调用Function?
2
Java项目调用jni接口报NoClassDefFoundError,直接执行main方法就可以,但是从controller调就报错
1
【C语言】结构体数组作为函数参数的排序问题
0
[Fork/Join]在main方法中写Fork/Join测试,main线程结束,ForkJoinPool中的线程为什么也结束了?