在操作跟数据库相关的逻辑时控制台可能会报类似如下的错误
Caused by: com.justep.exception.BusinessException: 编码: JUSTEP150055; 提示: 在模块"/XXX/data"下获取数据库连接出错 at com.justep.exception.BusinessException.create(Unknown Source) at com.justep.system.data.Transaction.getConnection(Unknown Source) at com.justep.system.data.Transaction.getConnection(Unknown Source) at com.justep.model.ModelUtils.getConnection(Unknown Source) ... 32 more Caused by: javax.naming.NameNotFoundException: Name XX is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:770) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152) at javax.naming.InitialContext.lookup(InitialContext.java:417) at com.justep.system.data.Transaction.getConnectionWithJndi(Unknown Source)
这个错误是指没有找到名字为XX的数据源,可以到apache-tomcat\conf\context.xml中确认是否有name为XX的数据源配置信息
如果没有需要添加这个数据源配置可以直接在这个文件中添加或者可以通过studio的“窗口——首选项——Studio配置——数据源”中添加,需要注意的是配置了数据源后要重新启动tomcat服务
评一波