NutzCN Logo
问答 关于项目的路径匹配的问题
发布于 2755天前 作者 wx_af00gmoo6aoo05upr4ph 2763 次浏览 复制 上一个帖子 下一个帖子
标签:

我的项目在启动时发现输出这样的信息
None module classes found!!!
但是我在登陆的时候,却发现后台无法匹配路径
org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:110) - Search mapping for [POST] path=/sys/author/baseuser/doLogin : NOT Action match
这是什么原因 造成的

22 回复

既然没有找到任何入口方法,那访问任意路径都是not found啦

@SetupBy(value=WendalSetup.class)
@IocBy(type=ComboIocProvider.class,args={"*js", "ioc/",
"*anno", "com.miracle.agile.framework","com.miracle.agile.business",
"*tx", // 锟斤拷锟斤拷锟斤拷锟斤拷 aop
"*async"})
@Modules(scanPackage=true)
public class MainModule {
}

这个就是我入口的方法

天啊, 你怎么发N个重复的问题

请问如何解决这个问题

MainModule的package是啥,入口类的package是啥,带@At方法的类就是入口类

这些我都配置了啊!为什么还是not found

我问的是: MainModule的package是啥,入口类的package是啥

package com.miracle.agile.framework;

import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.annotation.SetupBy;
import org.nutz.mvc.ioc.provider.ComboIocProvider;

@SetupBy(value=WendalSetup.class)
@IocBy(type=ComboIocProvider.class,args={"*js", "ioc/",
"*anno", "com.miracle.agile.framework","com.miracle.agile.business",
"*tx", // 锟斤拷锟斤拷锟斤拷锟斤拷 aop
"*async"})
@Modules(scanPackage=true)
public class MainModule {

}
这个是MainModule的package

入口类呢?

package com.miracle.agile.business.controllers.sys.author;

import com.miracle.agile.business.models.sys.author.BaseUser;
import com.miracle.agile.business.services.author.BaseUserService;
import com.miracle.agile.common.annotation.SLog;
import com.miracle.agile.common.base.Result;
import com.miracle.agile.common.filter.PrivateFilter;
import com.miracle.agile.common.page.DataTableColumn;
import com.miracle.agile.common.page.DataTableOrder;
import com.miracle.agile.framework.bean.UserBean;
import com.miracle.agile.framework.util.CommonUtils;

import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@IocBean
@At("/sys/author/baseuser")
@Filters({ @By(type = PrivateFilter.class)})
public class BaseUserController {
private static final Log log = Logs.get();
@Inject
BaseUserService baseUserService;

@At("")
@Ok("beetl:/sys/author/UserList.jsp")
@RequiresAuthentication
public void index() {

}
@At("/login")
@Ok("json")
@SLog(tag = "Login", msg = "登录")
public String  doLogin(@Param("username") String username, @Param("password") String password) {
    BaseUser user =baseUserService.VerificationUserInfo(username, password);
    if(CommonUtils.isEmpty(user)){
       return "10";
    }else{
       UserBean userBean=baseUserService.doLogin(user.getUserid());
       String string="";
    }
    return "00";
}

@At
@Ok("json")
@RequiresPermissions("platform.a.add")
@SLog(tag = "Add", msg = "Add:base_user")
public Object addDo(@Param("..") BaseUser base_user, HttpServletRequest req) {
    try {
       baseUserService.insert(base_user);
       return Result.success("system.success");
    } catch (Exception e) {
       return Result.error("system.error");
    }
}


@At("/edit/?")
@Ok("beetl:/platform/a/edit.html")
@RequiresAuthentication
public Object edit(String id) {
    return baseUserService.fetch(id);
}

@At
@Ok("json")
@RequiresPermissions("platform.a.edit")
@SLog(tag = "Edit", msg = "Edit:base_user")
public Object editDo(@Param("..") BaseUser base_user, HttpServletRequest req) {
    try {
       baseUserService.updateIgnoreNull(base_user);
       return Result.success("system.success");
    } catch (Exception e) {
       return Result.error("system.error");
    }
}

@At({"/delete","/delete/?"})
@Ok("json")
@RequiresPermissions("platform.a.delete")
@SLog(tag = "Delete", msg = "Delete:base_user")
public Object delete(String id,@Param("ids") String[] ids, HttpServletRequest req) {
    try {
       if(ids!=null&&ids.length>0){
         baseUserService.delete(ids);
       }else{
         baseUserService.delete(id);
       }
       return Result.success("system.success");
    } catch (Exception e) {
       return Result.error("system.error");
    }
}

@At
@Ok("json:full")
@RequiresAuthentication
public Object data(@Param("length") int length, @Param("start") int start, @Param("draw") int draw, @Param("::order") List<DataTableOrder> order, @Param("::columns") List<DataTableColumn> columns) {
    Cnd cnd = Cnd.NEW();
    return baseUserService.data(length, start, draw, order, columns, cnd, null);
}

}

改成

// 包含business这个package
@Modules(scanPackages=true, packages={"com.miracle.agile.business"})
// 或者直接指定顶层package
@Modules(scanPackages=true, packages={"com.miracle.agile"})

是让我改mainmodule这个类的配置吗,我的入口类可能会有多个包,那该怎么写呢

是改MainModule上的@Modules注解

// 直接指定顶层package
@Modules(scanPackages=true, packages={"com.miracle.agile"})

还是不行,还是那个urlmappingimpl的问题

我改成你说的那样报错
Caused by: java.lang.RuntimeException: Can not eval beetl:/platform/a/index.html("beetl:/platform/a/index.html") View for public void com.miracle.agile.business.controllers.sys.author.BaseModuleController.index()
at org.nutz.lang.Lang.makeThrow(Lang.java:132)
at org.nutz.mvc.view.ViewZone.makeView(ViewZone.java:90)
at org.nutz.mvc.impl.processor.ViewProcessor.evalView(ViewProcessor.java:89)
at org.nutz.mvc.impl.processor.ViewProcessor.init(ViewProcessor.java:31)
at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:38)
at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:54)
at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:201)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:108)
... 15 more

@Ok用了beetl但没有加载, 在MainModule加上

@Views({BeetlViewMaker.class})

2017-05-08 12:05:48,396 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:110) - Search mapping for [POST] path=/sys/author/baseuser/doLogin : NOT Action match
现在是这个问题

这个doLogin对应哪个入口方法

Object 'baseUserController' without define!现在报的是这个错误了

先告诉我你改了啥

把MainModule的iocby改一下,扫描ioc注解的路径全覆盖

@IocBy(type=ComboIocProvider.class,args={"*js", "ioc/",
"*anno", "com.miracle.agile",
"*tx",
"*async"})

添加回复
请先登陆
回到顶部