JFinal-BBS 运行就报错,请帮忙解决一下

蓝帅 发布于 2014/11/12 11:08
阅读 796
收藏 1

@JFinal 你好,想跟你请教个问题:都有些不好意思问这么简单的问题了,主要还是基础不够

在改动jfinalbbs时一运行就报这些错,找不到原因,主要是对jfinal还不够熟悉,网上说导包我也导了,可一运行还是报错

警告: FAILED Jfinal: java.lang.IllegalStateException: class cn.zeny.bss.BSSConfig is not a javax.servlet.Filter
java.lang.IllegalStateException: class cn.zeny.bss.BSSConfig is not a javax.servlet.Filter
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:98)
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:117)
at com.jfinal.server.JettyServer.start(JettyServer.java:64)
at com.jfinal.core.JFinal.start(JFinal.java:165)
at cn.zeny.bss.BSSConfig.main(BSSConfig.java:87)


十一月 12, 2014 11:01:15 上午 org.eclipse.jetty.webapp.WebAppContext doStart
警告: Failed startup of context o.e.j.w.WebAppContext{/,file:/F:/eclipse/bss/WebRoot/}
java.lang.IllegalStateException: class cn.zeny.bss.BSSConfig is not a javax.servlet.Filter
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:98)
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:117)
at com.jfinal.server.JettyServer.start(JettyServer.java:64)
at com.jfinal.core.JFinal.start(JFinal.java:165)
at cn.zeny.bss.BSSConfig.main(BSSConfig.java:87)


十一月 12, 2014 11:01:15 上午 org.eclipse.jetty.server.AbstractConnector doStart
信息: Started SelectChannelConnector@0.0.0.0:80
Starting Complete. Welcome To The JFinal World :)


加载中
0
iginx
iginx
检查 web.xml文件
1
iginx
iginx

cn.zeny.bss.BSSConfig is not a javax.servlet.Filter

已经很明显了,把非Filter当成Filter配置了

1
紫电清霜
紫电清霜

才看到,sorry。

遇上问题的时候不要急,把关键错误信息google一下就行了~

0
蓝帅
蓝帅

引用来自“iginx”的评论

cn.zeny.bss.BSSConfig is not a javax.servlet.Filter

已经很明显了,把非Filter当成Filter配置了

package cn.zeny.bss;


import org.bee.tl.core.GroupTemplate;
import org.bee.tl.ext.jfinal.BeetlRenderFactory;


import cn.zeny.controller.IndexController;
import cn.zeny.controller.UserController;
import cn.zeny.demo.User;
import cn.zeny.interceptor.GlobalInterceptor;
import com.jfinal.core.JFinal;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.JFinalConfig;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.ext.interceptor.SessionInViewInterceptor;
import com.jfinal.kit.StringKit;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.druid.DruidPlugin;


public class BSSConfig extends JFinalConfig{
private String json = java.lang.System.getenv("VCAP_SERVICES");
    private boolean isLocal = StringKit.isBlank(json);
@Override
public void configConstant(Constants me) {
loadPropertyFile("classes/config.txt");
if (isLocal) {
me.setDevMode(true);
}
me.setError404View("/common/404.html");
        me.setError500View("/common/500.html");
        me.setMainRenderFactory(new BeetlRenderFactory());
        GroupTemplate gt = BeetlRenderFactory.groupTemplate;
        gt.setStatementStart("@");
        gt.setStatementEnd(null);
}
/**
 * 设置路由
 */
@Override
public void configRoute(Routes me) {
me.add("/",IndexController.class);
me.add("/user",UserController.class);
}
/**
 * 配置插件
 */
@Override
public void configPlugin(Plugins me) {
String jdbcUrl, username, password, driver;
        driver = getProperty("driverClass");
        if (isLocal) {
            jdbcUrl = getProperty("jdbcUrl");     username = getProperty("username");   password = getProperty("password");
        } else {
            JSONObject json = JSONObject.parseObject(this.json).getJSONArray("mysql-5.6").getJSONObject(0).getJSONObject("credentials");
            username = json.getString("username");      password = json.getString("password");
            jdbcUrl = "jdbc:mysql://" + json.getString("host") + ":" + json.getString("port") + "/" + json.getString("name");
        }
        DruidPlugin druidPlugin = new DruidPlugin(jdbcUrl, username, password, driver);
        druidPlugin.setInitialSize(3).setMaxActive(10);
        me.add(druidPlugin);
        // 配置ActiveRecord插件
        ActiveRecordPlugin arp = new ActiveRecordPlugin(druidPlugin);
        if (isLocal){
            arp.setShowSql(true);
        }
        arp.addMapping("user", User.class);
        me.add(arp);
}
/**
* 配置拦截器
*/
@Override
public void configInterceptor(Interceptors me) {
me.add(new SessionInViewInterceptor());
me.add(new GlobalInterceptor());
}


@Override
public void configHandler(Handlers me) {

}
public static void main(String[] args) throws Exception{
JFinal.start("WebRoot", 80, "/", 5);
}
}
我把类发你看,你给我解决下吧,谢谢
0
蓝帅
蓝帅

引用来自“iginx”的评论

检查 web.xml文件
谢谢,原来是WEB.xml文件的问题
0
蓝帅
蓝帅

引用来自“紫电清霜”的评论

才看到,sorry。

遇上问题的时候不要急,把关键错误信息google一下就行了~

没事,解决了
返回顶部
顶部