NutzCN Logo
问答 关于插入数据不能自动生成uuid的问题
发布于 2610天前 作者 qq_e864bdda 3050 次浏览 复制 上一个帖子 下一个帖子
标签:
@Name
	// 字符主键
	@Prev(els = @EL("uuid"))//(uuid()也测试了不行)
	@Comment("uuid主键唯一")
	// 字段注释
	@ColDefine(type = ColType.VARCHAR, width = 32)
	// 字段类型
	private String uuid;

报错信息

十月 30, 2017 8:07:04 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.mvc.LoadingException$FC$9a86caf9ff5d3b587784fcdf555a4a7d.invoke(LoadingException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:200)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:115)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
	at org.nutz.dao.impl.NutDao.insert(NutDao.java:148)
	at com.naxxm.MainSetup.init(MainSetup.java:37)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	... 29 more
Caused by: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.el.opt.object.MethodOpt.fetchMethod(MethodOpt.java:61)
	at org.nutz.el.opt.object.MethodOpt.calculate(MethodOpt.java:48)
	at org.nutz.el.opt.object.InvokeMethodOpt.calculate(InvokeMethodOpt.java:22)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:33)
	at org.nutz.dao.impl.entity.macro.ElFieldMacro.onAfter(ElFieldMacro.java:42)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:64)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
	... 40 more
24 回复

你自定义过EL的配置文件?

没有配置过啦,这才刚开始~都是按照教程来的~,这个要怎么解决呢?

是不是有老的nutz.jar存在?

首先说明是同一个人,问题出在下面这种情况,有两个

@Prev(els = { @EL("uuid(16)") })
@Table("t_sys_employee")
public class SysEmployee {
	@Name//字符主键
	@Prev(els = { @EL("uuid(16)") })
	@Comment("uuid主键唯一")//字段注释
	@ColDefine(type = ColType.VARCHAR,width = 32)//字段类型
	private String uuid;
	
//	room  = fetch(cnd); 
//	room.setUsed("Yes");
//	room.setVersion(room.getVersion+1); 不要动version!!!!
//	dao().updateWithVersion(root);
//
//	@Column(version=true)
//	private Long version;

	
	
	@Comment("版本")
	//@Column(version=true)
	private Integer  version;
	
	//@Name//字符主键
	@Prev(els = { @EL("uuid(16)") })
	@Comment("员工编号")//字段注释
	@ColDefine(type = ColType.VARCHAR,width = 16)//字段类型
	private String bm;

问题一:是不是只能用一次下面代码?

@Prev(els = { @EL("uuid(16)") })

问题二:业务需要有两个字段都需要设置字符主键,这样是不是没法操作,我看只能用一个@Name呢?

16是进制,不是长度. 你定义的字段长度才16字节,放不下的.

改成32也是不行的,可上面报错一样,只能写一个,什么情况呢?还有能解决问题二的方法吗?

具体报什么错误

这是写两个@el报的错,长度也修改成width = 32了,问个题外话,你们头像是怎么上传的,研究了半天,没有入口呢,哈哈~

十月 31, 2017 4:25:22 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.mvc.LoadingException$FC$9a86caf9ff5d3b587784fcdf555a4a7d.invoke(LoadingException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:200)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:115)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
	at org.nutz.dao.impl.NutDao.insert(NutDao.java:148)
	at com.naxxm.MainSetup.init(MainSetup.java:37)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	... 29 more
Caused by: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.el.opt.object.MethodOpt.fetchMethod(MethodOpt.java:61)
	at org.nutz.el.opt.object.MethodOpt.calculate(MethodOpt.java:48)
	at org.nutz.el.opt.object.InvokeMethodOpt.calculate(InvokeMethodOpt.java:22)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:33)
	at org.nutz.dao.impl.entity.macro.ElFieldMacro.onAfter(ElFieldMacro.java:42)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:64)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
	... 40 more

你在项目里面找个类,写个main方法,执行一下这个语句

El.eval("uuid()");

看看是否报错

只写一个运行项目代码,并在其中加入是可以的:

El.eval("uuid()");
2017-10-31 17:01:01 mytest:77b7326bca8e4ed6aaacc1aad45aef1b

在你当前报错的这个项目里面试

PS: 点自己的头像,进个人主页, 然后再点自己的头像,就可以修改了

这是启动tomcat后所有的控制台信息~
配置bean:
@Table("t_sys_employee")
public class SysEmployee {
	private static final Log Log = Logs.get();
	
	@Name//字符主键
	@Prev(els = { @EL("uuid()") })
	@Comment("uuid主键唯一")//字段注释
	@ColDefine(type = ColType.VARCHAR,width = 32)//字段类型
	private String uuid;
	
//	room  = fetch(cnd); 
//	room.setUsed("Yes");
//	room.setVersion(room.getVersion+1); 不要动version!!!!
//	dao().updateWithVersion(root);
//
//	@Column(version=true)
//	private Long version;
	
	@Comment("版本")
	//@Column(version=true)
	private Integer  version;
	
	//@Name//字符主键
	@Prev(els = { @EL("uuid()") })
	@Comment("员工编号")//字段注释
	@ColDefine(type = ColType.VARCHAR,width = 32)//字段类型
	private String bm;
	
	@Comment("公司编号")
	@ColDefine(type = ColType.VARCHAR,width = 16)
	private String gs_bm;
	
	@Comment("所属分店")
	@ColDefine(type = ColType.VARCHAR,width = 16)
	private String md_bm;
	
	@Comment("员工姓名")
	@ColDefine(type = ColType.VARCHAR,width = 20)
	private String name;
	
	@Comment("登录密码")
	@ColDefine(type = ColType.VARCHAR,width = 16)
	private String password;
	
	@Comment("操作角色")
	@ColDefine(type = ColType.VARCHAR,width = 30)
	private String role;
	
	@Comment("性别")
	@ColDefine(type = ColType.VARCHAR,width = 2)
	private String sex;
	
	@Comment("手机号")
	@ColDefine(type = ColType.INT,width = 30)
	private String mobile;
	
	@Comment("基本工资")
	@ColDefine(type = ColType.FLOAT,width = 8,precision = 2)
	private String wage;
	
	@Comment("岗位")
	@ColDefine(type = ColType.VARCHAR,width = 20)
	private String position;
	
	@Comment("入职日期")
	@ColDefine(type = ColType.VARCHAR,width = 20)
	private String entryDate;
	
	@Comment("参与销售")
	@ColDefine(type = ColType.VARCHAR,width = 20)
	private String sales;
	
	@Comment("是否在职")
	@ColDefine(type = ColType.VARCHAR,width = 20)
	private String state;

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public String getBm() {
		return bm;
	}

	public void setBm(String bm) {
		this.bm = bm;
	}

	public String getGs_bm() {
		return gs_bm;
	}

	public void setGs_bm(String gs_bm) {
		this.gs_bm = gs_bm;
	}

	public String getMd_bm() {
		return md_bm;
	}

	public void setMd_bm(String md_bm) {
		this.md_bm = md_bm;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
		
		System.out.println("-----------------------");
		Log.debug("mytest:" + El.eval("uuid()"));
		System.out.println("-----------------------");
		System.out.println("-----------------------");
		Log.debug("mytest:" + El.eval("uuid()"));
		System.out.println("-----------------------");
		
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getWage() {
		return wage;
	}

	public void setWage(String wage) {
		this.wage = wage;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public String getEntryDate() {
		return entryDate;
	}

	public void setEntryDate(String entryDate) {
		this.entryDate = entryDate;
	}

	public String getSales() {
		return sales;
	}

	public void setSales(String sales) {
		this.sales = sales;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}
	
}




十月 31, 2017 5:27:30 下午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\WeX5_V3.7\java\jre1.8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/WeX5_V3.7/studio//../java/jre1.8/bin/client;D:/WeX5_V3.7/studio//../java/jre1.8/bin;D:/WeX5_V3.7/studio//../java/jre1.8/lib/i386;C:\Windows;C:\Windows\System32;E:\Oracle\product\12.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Users\liuyc\AppData\Local\Microsoft\WindowsApps;;D:\WeX5_V3.7\studio;;.
十月 31, 2017 5:27:30 下午 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
十月 31, 2017 5:27:30 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 303 ms
十月 31, 2017 5:27:30 下午 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
十月 31, 2017 5:27:30 下午 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.41
十月 31, 2017 5:27:30 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor baas.xml
十月 31, 2017 5:27:30 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\WeX5_V3.7\apache-tomcat\webapps\..\..\runtime\BaasServer\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:ERROR Could not find value for key log4j.appender.INFO
log4j:ERROR Could not instantiate appender named "INFO".
2017-10-31 17:27:31 NutFilter[nutz] starting ...
2017-10-31 17:27:31 Locations count=4 time use 11ms
2017-10-31 17:27:31 Locations count=59 time use 22ms
2017-10-31 17:27:31 Using 95 castor for Castors
2017-10-31 17:27:31 Loading by class org.nutz.mvc.impl.NutLoading
2017-10-31 17:27:31 Nutz Version : 1.r.62 
2017-10-31 17:27:31 Nutz.Mvc[nutz] is initializing ...
2017-10-31 17:27:31 Web Container Information:
2017-10-31 17:27:31  - Default Charset : GBK
2017-10-31 17:27:31  - Current . path  : D:\WeX5_V3.7\studio\.
2017-10-31 17:27:31  - Java Version    : 1.8.0_73
2017-10-31 17:27:31  - File separator  : \
2017-10-31 17:27:31  - Timezone        : Asia/Shanghai
2017-10-31 17:27:31  - OS              : Windows 10 x86
2017-10-31 17:27:31  - ServerInfo      : Apache Tomcat/6.0.41
2017-10-31 17:27:31  - Servlet API     : 2.5
2017-10-31 17:27:31  - ContextPath     : /baas
2017-10-31 17:27:31  - context.tempdir : D:\WeX5_V3.7\apache-tomcat\work\Catalina\localhost\baas
2017-10-31 17:27:31  - MainModule      : com.naxxm.MainModule
2017-10-31 17:27:31 >> app.root = D:/WeX5_V3.7/apache-tomcat/webapps/../../runtime/BaasServer
2017-10-31 17:27:31 @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "ioc/", "*async", "*tx", "*anno", "com.naxxm"],init=[])
2017-10-31 17:27:31 Found 2 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
2017-10-31 17:27:31 loading [conf.js]
2017-10-31 17:27:31 loading [dao.js]
2017-10-31 17:27:31 Loaded 3 bean define from path=[ioc/] --> [dataSource, conf, dao]
2017-10-31 17:27:31 Load AopConfigure for anno=org.nutz.aop.interceptor.async.Async by type=org.nutz.aop.interceptor.async.AsyncAopIocLoader
2017-10-31 17:27:31 Loaded 5 bean define from reader --
[txREPEATABLE_READ, txSERIALIZABLE, txNONE, txREAD_UNCOMMITTED, txREAD_COMMITTED]
2017-10-31 17:27:31 Found 19 resource by src( com/naxxm/ ) , regex( ^.+[.]class$ )
2017-10-31 17:27:31 Found @IocBean : class com.naxxm.action.FoodAction
2017-10-31 17:27:31 Found @IocBean : class com.naxxm.action.OrderAction
2017-10-31 17:27:31 Found @IocBean : class com.naxxm.modules.login.LoginAction
2017-10-31 17:27:31 Found @IocBean : class com.naxxm.service.FoodService
2017-10-31 17:27:31 Found 4 classes in 1 base-packages!
beans = ["foodAction", "foodService", "loginAction", "orderAction"]
2017-10-31 17:27:31 NutIoc init begin ...
2017-10-31 17:27:31 ... NutIoc init complete
2017-10-31 17:27:31 Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2017-10-31 17:27:31 @Views(DefaultViewMaker.class)
2017-10-31 17:27:31 @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2017-10-31 17:27:31  > scan 'com.naxxm'
2017-10-31 17:27:31 Found 19 resource by src( com/naxxm/ ) , regex( ^.+[.]class$ )
2017-10-31 17:27:31    >> add 'com.naxxm.action.FoodAction'
2017-10-31 17:27:31    >> add 'com.naxxm.action.OrderAction'
2017-10-31 17:27:31    >> add 'com.naxxm.modules.login.LoginAction'
2017-10-31 17:27:31 module class location 'file:/D:/WeX5_V3.7/runtime/BaasServer/WEB-INF/classes/com/naxxm/MainModule.class'
2017-10-31 17:27:31  > scan 'com.naxxm'
2017-10-31 17:27:31 Found 19 resource by src( com/naxxm/ ) , regex( ^.+[.]class$ )
2017-10-31 17:27:31    >> add 'com.naxxm.action.FoodAction'
2017-10-31 17:27:31    >> add 'com.naxxm.action.OrderAction'
2017-10-31 17:27:31    >> add 'com.naxxm.modules.login.LoginAction'
2017-10-31 17:27:31 Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
2017-10-31 17:27:31 Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
2017-10-31 17:27:31    '/ecoolper/food/queryAction' >> (FoodAction.java:35).query            : JSONObject | @Ok(json ) @Fail(raw  ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-10-31 17:27:31    '/ecoolper/food/save'       >> (FoodAction.java:65).saveAction       : void       | @Ok(json ) @Fail(raw  ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-10-31 17:27:31    '/ecoolper/order/queryAction' >> (OrderAction.java:38).query           : JSONObject | @Ok(json ) @Fail(raw  ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-10-31 17:27:31    '/ecoolper/order/saveAction' >> (OrderAction.java:71).saveAction      : void       | @Ok(raw  ) @Fail(raw  ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-10-31 17:27:31    '/naxxm/login/loginAction'  >> (LoginAction.java:35).login           : JSONObject | @Ok(json ) @Fail(raw  ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-10-31 17:27:31 Found 5 module methods
2017-10-31 17:27:31 @Localization not define
2017-10-31 17:27:31 Setup application...
2017-10-31 17:27:31 Get 'dao'<interface org.nutz.dao.Dao>
2017-10-31 17:27:31 Get '$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2017-10-31 17:27:31 	 >> Load definition name=$aop_async
2017-10-31 17:27:31 Found IocObject($aop_async) in AsyncAopIocLoader@20550960
2017-10-31 17:27:31 	 >> Make...'$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2017-10-31 17:27:31 Save object '$aop_async' to [app] 
2017-10-31 17:27:31 Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
2017-10-31 17:27:31 	 >> Load definition name=dao
2017-10-31 17:27:31 Loading define for name=dao
2017-10-31 17:27:31 Found IocObject(dao) in JsonLoader(paths=[ioc/])
2017-10-31 17:27:31 	 >> Make...'dao'<interface org.nutz.dao.Dao>
2017-10-31 17:27:31 Load class org.nutz.dao.impl.NutDao without AOP
2017-10-31 17:27:31 Save object 'dao' to [app] 
2017-10-31 17:27:31 Get 'dataSource'<>
2017-10-31 17:27:31 	 >> Load definition name=dataSource
2017-10-31 17:27:31 Loading define for name=dataSource
2017-10-31 17:27:31 Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2017-10-31 17:27:31 	 >> Make...'dataSource'<>
2017-10-31 17:27:31 Load class com.alibaba.druid.pool.DruidDataSource without AOP
2017-10-31 17:27:31 Save object 'dataSource' to [app] 
2017-10-31 17:27:31 {dataSource-1} inited
2017-10-31 17:27:31 Get 'dataSource'<>
2017-10-31 17:27:31 Jdbcs init complete
2017-10-31 17:27:31 Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-10-31 17:27:31 select expert : org.nutz.dao.impl.jdbc.sqlserver2005.Sqlserver2005JdbcExpert
2017-10-31 17:27:31 JDBC Driver --> 1.2
2017-10-31 17:27:31 JDBC Name   --> jTDS Type 4 JDBC Driver for MS SQL Server and Sybase
2017-10-31 17:27:31 JDBC URL    --> jdbc:jtds:sqlserver://127.0.0.1:1433/testdb_sys
2017-10-31 17:27:31 Database info --> SQLSERVER:[Microsoft SQL Server - 09.00.5000]
2017-10-31 17:27:31 Found 19 resource by src( com/naxxm/ ) , regex( ^.+[.]class$ )
2017-10-31 17:27:32 SELECT COUNT(*) FROM t_sys_employee 
-----------------------
2017-10-31 17:27:32 Found 1 resource by src( org/nutz/conf/NutzDefaultConfig.js ) , regex( \.(js|json)$ )
2017-10-31 17:27:32 mytest:649d85551ddc4e63863eca7f263e8dd4
-----------------------
-----------------------
2017-10-31 17:27:32 mytest:48bd28becda24d3da5cc31ee056ec276
-----------------------
2017-10-31 17:27:32 // NOT SQL // ElFieldMacro=uuid()
2017-10-31 17:27:32 // NOT SQL // ElFieldMacro=uuid()
2017-10-31 17:27:32 Error happend during start serivce!
org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:115)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
	at org.nutz.dao.impl.NutDao.insert(NutDao.java:148)
	at com.naxxm.MainSetup.init(MainSetup.java:37)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.el.opt.object.MethodOpt.fetchMethod(MethodOpt.java:61)
	at org.nutz.el.opt.object.MethodOpt.calculate(MethodOpt.java:48)
	at org.nutz.el.opt.object.InvokeMethodOpt.calculate(InvokeMethodOpt.java:22)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:33)
	at org.nutz.dao.impl.entity.macro.ElFieldMacro.onAfter(ElFieldMacro.java:42)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:64)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
	... 40 more
2017-10-31 17:27:32 try to depose ioc
2017-10-31 17:27:32 org.nutz.ioc.impl.NutIoc@31040115 is closing. startup date [17-10-31 17:27:31.306]
2017-10-31 17:27:32 Depose object 'dao' ...
2017-10-31 17:27:32 Depose object '$aop_async' ...
2017-10-31 17:27:32 Depose object 'dataSource' ...
2017-10-31 17:27:32 {dataSource-1} closed
2017-10-31 17:27:32 org.nutz.ioc.impl.NutIoc@31040115 is deposed. startup date [17-10-31 17:27:31.306]
十月 31, 2017 5:27:32 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.mvc.LoadingException$FC$9a86caf9ff5d3b587784fcdf555a4a7d.invoke(LoadingException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:200)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.nutz.dao.DaoException: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:115)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
	at org.nutz.dao.impl.NutDao.insert(NutDao.java:148)
	at com.naxxm.MainSetup.init(MainSetup.java:37)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	... 29 more
Caused by: org.nutz.el.ElException: must be Method or RunMethod, key=uuid
	at org.nutz.el.opt.object.MethodOpt.fetchMethod(MethodOpt.java:61)
	at org.nutz.el.opt.object.MethodOpt.calculate(MethodOpt.java:48)
	at org.nutz.el.opt.object.InvokeMethodOpt.calculate(InvokeMethodOpt.java:22)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:33)
	at org.nutz.dao.impl.entity.macro.ElFieldMacro.onAfter(ElFieldMacro.java:42)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:64)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
	... 40 more

十月 31, 2017 5:27:32 下午 org.apache.catalina.core.StandardContext start
严重: Error filterStart
十月 31, 2017 5:27:32 下午 org.apache.catalina.core.StandardContext start
严重: Context [/baas] startup failed due to previous errors
十月 31, 2017 5:27:32 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/baas] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
十月 31, 2017 5:27:32 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
十月 31, 2017 5:27:32 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
十月 31, 2017 5:27:32 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor PushServer.xml
2017-10-31 17:27:32 PushServer stop
十月 31, 2017 5:27:32 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor x5.xml
[JUSTEP_HOME in UIServer]: D:\WeX5_V3.7
十月 31, 2017 5:27:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory app-template
十月 31, 2017 5:27:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
十月 31, 2017 5:27:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
十月 31, 2017 5:27:33 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
十月 31, 2017 5:27:33 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
十月 31, 2017 5:27:33 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
十月 31, 2017 5:27:33 下午 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
十月 31, 2017 5:27:33 下午 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
十月 31, 2017 5:27:33 下午 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/11  config=null
十月 31, 2017 5:27:33 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 2456 ms

不是这样试。

例如在这个pojo类里面加个main方法,然后里面写el.eval,跑这个main方法,看看出什么。

我总觉得有老的nutz.jar存在

main

@Table("t_sys_employee")
public class SysEmployee {
	private static final Log Log = Logs.get();
	public static void main(String[] args) {
		System.out.println(El.eval("uuid()"));
	}
	
	
	
	
	
	
	
	@Name//字符主键
	@Prev(els = { @EL("uuid()") })
	@Comment("uuid主键唯一")//字段注释
	@ColDefine(type = ColType.VARCHAR,width = 32)//字段类型
	private String uuid;

日志:

log4j:ERROR Could not find value for key log4j.appender.INFO
log4j:ERROR Could not instantiate appender named "INFO".
2017-10-31 17:52:52 Locations count=51 time use 45ms
2017-10-31 17:52:52 Found 1 resource by src( org/nutz/conf/NutzDefaultConfig.js ) , regex( \.(js|json)$ )
2017-10-31 17:52:52 Using 95 castor for Castors
c1963e2ef6004c68abc35a336321db30

是這樣嗎,沒什麽錯~
我是單獨運行的這個類~

啊啊啊啊啊啊啊啊啊啊啊啊啊

我终于看出问题了。。。

属性的名字也叫uuid,所以冲突了。。。

换个有意义点的名字吧

是这样,这个万门解决,还有个问题,就是version = true时,船舰表的时候后面的字段就不创建了

public class SysEmployee {
	@Name//字符主键
	@Prev(els = { @EL("uuid()") })
	@Comment("uuid主键唯一")//字段注释
	@ColDefine(type = ColType.VARCHAR,width = 32)//字段类型
	private String id;
	
//	room  = fetch(cnd); 
//	room.setUsed("Yes");
//	room.setVersion(room.getVersion+1); 不要动version!!!!
//	dao().updateWithVersion(root);
//
//	@Column(version=true)
//	private Long version;
	
	@Comment("版本")
	@Column(version=true)
	private Integer  version0;

只创建到version,也就是只有uuid和version0两个字段,后面的就不在创建了,也没有报错信息~

创建语句就出来这么多~

2017-10-31 18:12:45 CREATE TABLE t_sys_employee(
id VARCHAR(32),
version0 NUMERIC(8),
PRIMARY KEY (id)
)

我是按照这个帖子设置的,但是设置后,字段生成就有问题

https://nutz.cn/yvr/t/54315s2gouhnfpa0p3ip93g8ij

其他属性通通加@Column

是的,完美解决~非常感谢~么么哒,回复太效率了~

version建议:

version的默认值如果设置了version = true应该创建的时候自动设置为0比较合理吧,否则的话就是null + 1了,导致dao.updateWithVersion(sysEmployee);不起作用
@Comment("版本")
	@Column(version=true)
	@Default("0")
	private Long version;

一般是long,而非Long吧

是的,是我的问题,写错了,已经有这个功能了~谢谢

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