jfinal 加载beetl 出错

ly71669 发布于 2016/02/24 09:42
阅读 696
收藏 0

------------------------------------------beetl加载类------------------------------------------------

package common;
import org.beetl.ext.jfinal.BeetlRender;
import org.beetl.ext.jfinal.BeetlRenderFactory;

import com.jfinal.render.Render;

public class CustomBeetlRenderFactory extends BeetlRenderFactory{
    @Override
    public Render getRender(String view) {
        BeetlRender render=new BeetlRender(groupTemplate, view);
        return render;
    }
    @Override
    public String getViewExtension() {
        return ".html";
    }
}

----------------------------------------config配置文件-----------------------------------------------

public void configConstant(Constants me) {
        // 如果生产环境配置文件存在,则优先加载该配置,否则加载开发环境配置文件
        loadProp("config.properties", "config.properties");
        //配置beetl模板
        me.setMainRenderFactory(new CustomBeetlRenderFactory());
        //设置字符集
        //me.setEncoding("UTF-8");
        me.setDevMode(getPropertyToBoolean("devMode", false));
        //设置视图根目录
        me.setBaseViewPath("/page");
    }

---------------------------------控制台信息-------------------------------------------------------

Starting JFinal 2.2

log4j:WARN No appenders could be found for logger (org.eclipse.jetty.util.log).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Starting scanner at interval of 5 seconds.
Starting web server on port: 8081
Exception in thread "main" java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    common/CustomBeetlRenderFactory.getRender(Ljava/lang/String;)Lcom/jfinal/render/Render; @13: areturn
  Reason:
    Type 'org/beetl/ext/jfinal/BeetlRender' (current frame, stack[0]) is not assignable to 'com/jfinal/render/Render' (from method signature)
  Current Frame:
    bci: @13
    flags: { }
    locals: { 'common/CustomBeetlRenderFactory', 'java/lang/String', 'org/beetl/ext/jfinal/BeetlRender' }
    stack: { 'org/beetl/ext/jfinal/BeetlRender' }
  Bytecode:
    0x0000000: bb00 1059 b200 122b b700 164d 2cb0     

    at demo.Config.configConstant(Config.java:33)
    at com.jfinal.core.Config.configJFinal(Config.java:47)
    at com.jfinal.core.JFinal.init(JFinal.java:62)
    at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
    at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:277)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at com.jfinal.server.JettyServer.doStart(JettyServer.java:122)
    at com.jfinal.server.JettyServer.start(JettyServer.java:65)
    at com.jfinal.core.JFinal.start(JFinal.java:154)

    at demo.Config.main(Config.java:69)

----------------------------------------------------------------------------------------------------

加载中
0
闲大赋
闲大赋

这个怎么感觉跟java编译器有关,或者是平台或者是版本问题。没看出来怎么回事情

你先按照官网配置跑一下试试


0
iehyou
iehyou

应该是jar包版本不一致 冲突了吧 

查找下报错类的所在jar包实际加载路径

String path = Test.class.getProtectionDomain().getCodeSource().getLocation().getFile();

返回顶部
顶部