Coder Social home page Coder Social logo

Comments (4)

zhouit avatar zhouit commented on September 3, 2024 1

堆栈信息里面:java.lang.NoClassDefFoundError: Could not initialize class com.zblog.service.freemarker.FreeMarkerUtils 看一下你的是什么情况吧

from zblog.

zsw12013 avatar zsw12013 commented on September 3, 2024

@dongfangshangren 不知道,找了好几天了,在本地上是没有错误的,
我在tomcat 的server.xml 文件中 中配置如下
<Context docBase="zblog" path="/" debug="0"/>

from zblog.

zhouit avatar zhouit commented on September 3, 2024

明显你部署的时候 FreeMarkerUtils .class文件不在你的WEB-INF/classes,导致类找不到

from zblog.

zsw12013 avatar zsw12013 commented on September 3, 2024

@dongfangshangren 不对,maven 打包时,没有吧ftl和它下面的html文件没带上,到时初始化FreeMarkerUtils 时报错,出错的代码地方如下

URL uri = FreeMarkerUtils.class.getResource("ftl");
  config.setDirectoryForTemplateLoading(new File(uri.toURI()));

只需在pom.xml 添加一下配置,就可以吧html文件打包带上

 <resources>  
            <resource>  
                <directory>src/main/java</directory>  
                <includes>  
                    <include>**/*.html</include>  
                 </includes>  
                <!-- 是否替换资源中的属性-->  
                <filtering>false</filtering>  
            </resource>  
    </resources>

from zblog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.