程序使用jetty作为服务器是正常的,但是打包成war 部署到tomcat9报错ERROR,疑似com.jfinal.proxy.ProxyClassLoader.loadProxyClass(ProxyClassLoader.java:51) 问题。
一jetty部署正常情况。
Starting JFinal 4.8
Starting scanner at interval of 5 seconds
Starting Jetty Server 9.4.12.v20180830 on port: 6255
Sql: select role_id from `72crm_admin_role` where label = 1
Sql: select role_id from `72crm_admin_role` where label = 2
Sql: select role_id from `72crm_admin_role` where label = 3
Starting Complete. Welcome To The JFinal World (^_^)
二、tomcat部署报错日志。
13-Jan-2020 11:59:06.935 严重 [main] org.apache.catalina.core.StandardContext.filterStart 启动过滤器异常
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.kakarote.crm9.erp.work.service.WorkService$$EnhancerByJFinal
at com.jfinal.proxy.ProxyClassLoader.loadProxyClass(ProxyClassLoader.java:51)
at com.jfinal.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:70)
at com.jfinal.proxy.ProxyFactory.get(ProxyFactory.java:41)
at com.jfinal.proxy.Proxy.get(Proxy.java:32)
at com.jfinal.aop.AopFactory.createObject(AopFactory.java:181)
at com.jfinal.aop.AopFactory.doGetSingleton(AopFactory.java:91)
at com.jfinal.aop.AopFactory.doGet(AopFactory.java:65)
at com.jfinal.aop.AopFactory.get(AopFactory.java:48)
at com.jfinal.aop.Aop.get(Aop.java:101)
at com.kakarote.crm9.common.config.JfinalConfig.onStart(JfinalConfig.java:153)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:72)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:102)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4533)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5172)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
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:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: java.lang.ClassNotFoundException: com.kakarote.crm9.erp.work.service.WorkService$$EnhancerByJFinal
at java.lang.ClassLoader.findClass(ClassLoader.java:523)
at com.jfinal.proxy.ProxyClassLoader.findClass(ProxyClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at com.jfinal.proxy.ProxyClassLoader.loadProxyClass(ProxyClassLoader.java:49)
... 54 more
13-Jan-2020 11:59:07.263 信息 [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
13-Jan-2020 11:59:07.263 信息 [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
13-Jan-2020 11:59:07.264 信息 [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@63088bbd')
说明:业务类已经没有抛出异常代码,但是还报错,在使用数据库连接池后异常JFianl和tomcat不兼容。
WorkService代码如下:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
com.kakarote.crm9.erp.work.service; java.util.Date; cn.hutool.core.collection.CollectionUtil; cn.hutool.core.util.ObjectUtil; cn.hutool.core.util.StrUtil; com.alibaba.fastjson.JSONArray; com.alibaba.fastjson.JSONObject; com.kakarote.crm9.common.config.paragetter.BasePageRequest; com.kakarote.crm9.common.constant.BaseConstant; com.kakarote.crm9.erp.admin.entity.AdminMenu; com.kakarote.crm9.erp.admin.entity.AdminUser; com.kakarote.crm9.erp.admin.service.AdminFileService; com.kakarote.crm9.erp.admin.service.AdminMenuService; com.kakarote.crm9.erp.work.entity.*; com.kakarote.crm9.utils.AuthUtil; com.kakarote.crm9.utils.BaseUtil; com.kakarote.crm9.utils.R; com.jfinal.aop.; com.jfinal.aop.; com.jfinal.kit.Kv; com.jfinal.plugin.activerecord.Db; com.jfinal.plugin.activerecord.Page; com.jfinal.plugin.activerecord.Record; com.jfinal.plugin.activerecord.tx.Tx; com.kakarote.crm9.utils.TagUtil; java.util.*; java.util.concurrent.CopyOnWriteArrayList; java.util.concurrent.atomic.AtomicReference; java.util.stream.Collectors; WorkService{ AdminFileService ; WorkbenchService ; AdminMenuService ; (Tx.) R setWork(Work work){ (Arrays.(work._getAttrNames()).contains()&&StrUtil.(work.getName())){ R.(); } Long userId = BaseUtil.().getUserId(); bol; (work.getWorkId() == ){ Set<Long> ownerUserIds = HashSet<>(); ownerUserIds.add(userId); (work.getOwnerUserId() != ){ ownerUserIds.addAll(TagUtil.(work.getOwnerUserId())); } (work.getIsOpen() == ){ ownerUserIds.clear(); } work.setOwnerUserId(TagUtil.(ownerUserIds)); work.setCreateUserId(userId); work.setCreateTime(Date()); bol = work.save(); WorkTaskClass workTaskClass = WorkTaskClass(); workTaskClass.setClassId(); workTaskClass.setName(); workTaskClass.setCreateTime(Date()); workTaskClass.setCreateUserId(userId); workTaskClass.setWorkId(work.getWorkId()); workTaskClass.setOrderNum(); workTaskClass.save(); workTaskClass.setName(); workTaskClass.setOrderNum(); workTaskClass.save(); workTaskClass.setName(); workTaskClass.setOrderNum(); workTaskClass.save(); ownerUserIds.forEach(ownerUserId -> { WorkUser workUser = WorkUser(); workUser.setWorkId(.getWorkId()); workUser.setUserId(ownerUserId); (ownerUserId.equals()){ workUser.setRoleId(BaseConstant.); workUser.save(); }{ workUser.setRoleId(BaseConstant.); workUser.save(); } }); }{ (! AuthUtil.(work.getWorkId().toString(), )){ R.(); } Integer workId = work.getWorkId(); Map<String,Object> columns = work.toRecord().getColumns(); (columns.containsKey()){ (! ObjectUtil.(columns.get())){ Work oldWork = Work().findById(workId); work.setOwnerUserId(TagUtil.(work.getOwnerUserId())); Set<Long> oldOwnerUserIds = TagUtil.(oldWork.getOwnerUserId()); Set<Long> ownerUserIds = TagUtil.(work.getOwnerUserId()); Collection<Long> intersection = CollectionUtil.(oldOwnerUserIds, ownerUserIds); oldOwnerUserIds.removeAll(intersection); ownerUserIds.removeAll(intersection); (Long next : oldOwnerUserIds){ leave(work.getWorkId().toString(), next); Db.(, workId, next); } (Long ownerUserId : ownerUserIds){ WorkUser workUser = WorkUser(); workUser.setWorkId(work.getWorkId()); workUser.setUserId(ownerUserId); workUser.setRoleId(BaseConstant.); workUser.save(); } }{ Db.(, workId); work.setOwnerUserId(+ userId + ); WorkUser workUser = WorkUser(); workUser.setWorkId(work.getWorkId()); workUser.setUserId(userId); workUser.setRoleId(BaseConstant.); workUser.save(); } } (work.getIsOpen() != ){ (work.getIsOpen() == ){ work.setOwnerUserId(); Db.(, workId); }(work.getIsOpen() == ){ List<Long> userList = Db.(); userList.remove(Long.(userId)); List<WorkUser> workUserList = ArrayList<>(); WorkUser nowWorkUser = WorkUser(); nowWorkUser.setWorkId(work.getWorkId()); nowWorkUser.setUserId(userId); nowWorkUser.setRoleId(BaseConstant.); workUserList.add(nowWorkUser); userList.forEach(id -> { WorkUser workUser = WorkUser(); workUser.setWorkId(.getWorkId()); workUser.setUserId(id); workUser.setRoleId(BaseConstant.); .add(workUser); }); Db.(workUserList, ); userList.add(Long.(userId)); work.setOwnerUserId(TagUtil.(userList.stream().map(Long::intValue).collect(Collectors.()))); } } (work.getStatus() != && work.getStatus() == ){ work.setArchiveTime(Date()); } bol = work.update(); } bol ? queryOwnerRoleList(work.getWorkId()).put(, work) : R.(); } R deleteWork(String workId){ Db.(, workId); Db.(, workId); Db.(, workId); update = Db.(, workId); update > ? R.() : R.(); } R queryWorkNameList(){ List<Record> recordList; (AuthUtil.()){ recordList = Db.(Db.()); }{ recordList = Db.(Db.(, Kv.(, BaseUtil.().getUserId()))); } R.().put(, recordList); } R queryTaskByWorkId(JSONObject jsonObject){ Integer workId = jsonObject.getInteger(); List<Record> classList = Db.(, workId); LinkedList<Record> linkedList = LinkedList<>(classList); Record item = Record(); item.set(, ); item.set(, - ); linkedList.addFirst(item); List<Record> finalClassList = CopyOnWriteArrayList<>(linkedList); finalClassList.forEach(workClass -> { List<Record> recordList = Db.(Db.(, Kv.(, ).set(, .getInteger()).set(, .getJSONArray()).set(, .getJSONArray()).set(, workClass.getInt()))); workClass.set(, recordList.size()); (recordList.size() == ){ (workClass.getInt() != - ){ workClass.set(, ArrayList<>()); }{ .remove(workClass); } }{ .taskListTransfer(recordList); recordList.sort(Comparator.(a -> a.getInt())); workClass.set(, recordList); } }); R.().put(, finalClassList); } R queryTaskFileByWorkId(BasePageRequest<JSONObject> data){ Page<Record> workFile = Db.(data.getPage(), data.getLimit(), Db.(, Kv.(, data.getData().getInteger()))); R.().put(, workFile); } R queryArchiveWorkList(BasePageRequest request){ Page<Record> recordPage = Db.(request.getPage(), request.getLimit(), , ); R.().put(, recordPage); } R workStatistics(String workId){ Long userId1 = BaseUtil.(); (.equals(workId)){ Record taskStatistics = Record(); List<Record> memberTaskStatistics = ArrayList<>(); (AuthUtil.()){ taskStatistics = Db.(Db.()); memberTaskStatistics = Db.(); memberTaskStatistics.forEach(record -> { Record first = Db.(Db.(, Kv.(, record.getInt()))); record.setColumns(first); }); }{ List<Record> recordList = Db.(Db.(, Kv.(, userId1))); List<Integer> workIds = recordList.stream().map(record -> record.getInt()).collect(Collectors.()); (workIds.size() == ){ taskStatistics.set(, ).set(, ).set(, ).set(, ).set(, ).set(, ); }{ taskStatistics = Db.(Db.(, Kv.(, CollectionUtil.(workIds, )))); memberTaskStatistics = Db.(Db.(), CollectionUtil.(workIds, )); memberTaskStatistics.forEach(record -> { Record first = Db.(Db.(, Kv.(, record.getInt()).set(, CollectionUtil.(, )))); record.setColumns(first); }); } } R.().put(, Kv.(, taskStatistics).set(, memberTaskStatistics)); } Record taskStatistics = Db.(Db.(, Kv.(, workId))); String ownerUserId = Db.(, workId); List<Record> ownerList = ArrayList<>(); (Integer userId : TagUtil.(ownerUserId)){ Record ownerUser = Db.(, workId, userId, BaseConstant.); (ownerUser != ){ ownerList.add(ownerUser); } } List<Record> userList = ArrayList<>(); (Integer userId : TagUtil.(ownerUserId)){ userList.add(Db.(, userId)); } List<Record> classStatistics = ArrayList<>(); List<Record> labelStatistics = ArrayList<>(); List<Record> recordList = Db.(, workId); Map<String,Object> classMap = HashMap<>(); recordList.forEach(record -> .put(record.getStr(), record.getStr())); classMap.forEach((classId, name) -> { Record first = Db.(, classId, ); first.set(, .get(classId)); .add(first); }); List<Record> labelList = Db.(, workId); List<String> labelIdList = labelList.stream().map(record -> record.getStr()).collect(Collectors.()); Set<Integer> labelIdSet = HashSet<>(toList(labelIdList)); Map<Integer,Record> labelMap = HashMap<>(); labelIdSet.forEach(id -> { Record record = Db.(, id); .put(record.getInt(), record); }); labelMap.forEach((id, record) -> { AtomicReference<Integer> complete = AtomicReference<>(); AtomicReference<Integer> undone = AtomicReference<>(); .forEach(label -> { (label.getStr().contains(.toString())){ (label.getInt() == ){ .getAndSet(.get() + ); }(label.getInt() == ){ .getAndSet(.get() + ); } } }); record.set(, complete.get()); record.set(, undone.get()); .add(record); }); List<Record> memberTaskStatistics = memberTaskStatistics(workId); Kv result = Kv.(, taskStatistics).set(, classStatistics).set(, labelStatistics).set(, memberTaskStatistics).set(, userList).set(, ownerList); R.().put(, result); } List<Integer> toList(List<String> labelList){ List<Integer> list = ArrayList<>(); (labelList == || labelList.size() == ){ list; } labelList.forEach(ids -> { (StrUtil.(ids)){ (String id : ids.split()){ (StrUtil.(id)){ .add(Integer.(id)); } } } }); list; } List<Record> memberTaskStatistics(String workId){ List<Record> list = ArrayList<>(); Work work = Work().findById(workId); (work.getIsOpen() == ){ list = Db.(Db.(), workId); list.forEach(record -> { Record first = Db.(Db.(, Kv.(, record.getInt()).set(, ))); record.setColumns(first); }); }{ String ownerUserIds = Db.(, workId); (StrUtil.(ownerUserIds)){ list; } (String userId : ownerUserIds.split()){ (StrUtil.(userId)){ ; } Record user = Db.(, userId); Record first = Db.(Db.(, Kv.(, workId).set(, userId))); user.setColumns(first); list.add(user); } } list; } R queryWorkOwnerList(String workId){ String ownerUserId = Db.(, workId); List<Record> userList = ArrayList<>(); (Integer userId : TagUtil.(ownerUserId)){ userList.add(Db.(, userId)); } R.().put(, userList); } R updateOrder(JSONObject jsonObject){ String updateSql = ; (jsonObject.containsKey()){ JSONArray tolist = jsonObject.getJSONArray(); Integer toId = jsonObject.getInteger(); (i = ; i <= tolist.size(); i++){ Db.(updateSql, toId, i, tolist.get(i - )); } } (jsonObject.containsKey()){ JSONArray fromList = jsonObject.getJSONArray(); Integer fromId = jsonObject.getInteger(); (i = ; i <= fromList.size(); i++){ Db.(updateSql, fromId, i, fromList.get(i - )); } } R.(); } R leave(String workId, Long userId){ Work work = Work().findById(workId); (work.getCreateUserId().equals(userId)){ R.(); } Db.(Db.(, Kv.(, workId).set(, userId))); Db.(Db.(, Kv.(, workId).set(, userId))); Set<Long> ownerUserIds = TagUtil.(work.getOwnerUserId()); ownerUserIds.remove(userId); work.setOwnerUserId(TagUtil.(ownerUserIds)); update = work.update(); Db.(, workId, userId); update ? R.() : R.(); } R getWorkById(String workId){ Work work = Work().findById(workId); (work == ){ R.(); } isUpdate = ; (AuthUtil.() || BaseUtil.().getRoles().contains(BaseConstant.)){ isUpdate = ; } AdminUser user = BaseUtil.(); Long userId = BaseUtil.(); Integer roleId = Db.(, workId, userId); JSONObject root = JSONObject(); List<Record> menuRecords = Db.(Db.(), roleId); Integer workMenuId = Db.(); List<AdminMenu> adminMenus = .queryMenuByParentId(workMenuId); JSONObject object = JSONObject(); adminMenus.forEach(menu -> { JSONObject authObject = JSONObject(); List<AdminMenu> chlidMenus = .queryMenuByParentId(menu.getMenuId()); ((!= && .equals(BaseConstant.)) || .equals(BaseConstant.) || .getRoles().contains(BaseConstant.) || .getRoles().contains(BaseConstant.)){ chlidMenus.forEach(child -> { .put(child.getRealm(), ); }); }{ (.getIsOpen() == ){ chlidMenus.forEach(child -> { (.equals(child.getRealm()) && ! .getCreateUserId().equals()){ ; } .put(child.getRealm(), ); }); }{ .forEach(record -> { (.getMenuId().equals(record.getInt())){ .put(record.getStr(), ); } }); } } (! authObject.isEmpty()){ .put(menu.getRealm(), authObject); } }); (! object.isEmpty()){ root.put(, object); } work.put(, Kv.(, isUpdate)).put(, root); R.().put(, work); } R queryRoleList(){ R.().put(, Db.(Db.())); } R queryOwnerRoleList(Integer workId){ Integer isOpen = Db.(, workId); (workId == || isOpen == ){ R.().put(, Db.(+ )); } R.().put(, Db.(Db.(), workId)); } (Tx.) R setOwnerRole(JSONObject jsonObject){ List<WorkUser> workUserList = jsonObject.getJSONArray().toJavaList(WorkUser.); Integer workId = jsonObject.getInteger(); workUserList.forEach(workUser -> workUser.setWorkId()); Db.(, workId); Db.(workUserList, ); List<Record> recordList = Db.(Db.(), workId); R.().put(, recordList); } (Tx.) R deleteTaskList(String workId, String classId){ Db.(, classId, workId); delete = WorkTaskClass().deleteById(classId); delete ? R.() : R.(); } R archiveTask(String classId){ Integer count = Db.(, classId); (count == ){ R.(); } update = Db.(, classId); update > ? R.() : R.(); } R archList(String workId){ List<Record> recordList = Db.(Db.(), workId); .taskListTransfer(recordList); R.().put(, recordList); } R remove(Integer userId, Integer workId){ Integer roleId = Db.(, workId, userId); (roleId.equals(BaseConstant.)){ R.(); } Work work = Work().findById(workId); Set<Integer> userIds = TagUtil.(work.getOwnerUserId()); userIds.remove(userId); work.setOwnerUserId(TagUtil.(userIds)); update = work.update(); Db.(, workId, userId); update ? R.() : R.(); } R updateClassOrder(JSONObject jsonObject){ String sql = ; Integer workId = jsonObject.getInteger(); JSONArray classIds = jsonObject.getJSONArray(); (i = ; i < classIds.size(); i++){ Db.(sql, i, workId, classIds.get(i)); } R.(); } R activation(Integer taskId){ Task task = Task().findById(taskId); Integer count = Db.(, task.getClassId()); update; (count>){ update = Db.(, taskId); }{ update = Db.(, taskId); } update > ? R.() : R.(); } initialization(){ BaseConstant.= Db.(); BaseConstant.= Db.(); BaseConstant.= Db.(); } R queryProjectUser(){ List<Record> recordList = Db.(Db.(),); R.().put(,recordList); } }
---------------------------------------------------------------------------
求助!!