查看: 5082|回复: 2

自定义war部署问题

升级   0.18%

4

主题

2

回帖

18

积分

注册会员

Rank: 2

积分
18
发表于 2021-5-28 22:06:14 | 显示全部楼层 |阅读模式
我用自定义的war部署报错,,参考文档https://www.yuque.com/o2oa/course/hpx0it
(该war完全和o2无关,只是个普通javaweb项目)
O2OA的war和常规war遵守的协议是否完全一致?
报错如下:
java.lang.ClassNotFoundException:
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at com.x.server.console.NodeAgent.customWarPublish(NodeAgent.java:581)
        at com.x.server.console.NodeAgent.customWar(NodeAgent.java:567)
        at com.x.server.console.NodeAgent.redeploy(NodeAgent.java:398)
        at com.x.server.console.NodeAgent.run(NodeAgent.java:183)
2021-05-28 20:51:12.160 INFO [Thread-4] com.x.server.console.NodeAgent - 部署:

对应代码
   File war = new File(Config.dir_custom(), name + ".war");    File dir = new File(Config.dir_servers_applicationServer_work(), name);    if (war.exists()) {      modified(war, dir);      String className = contextParamProject(dir);      URLClassLoader classLoader = new URLClassLoader(new URL[] { (new File(dir, "WEB-INF/classes")).toURI().toURL() });      Class<?> cls = classLoader.loadClass(className);      QuickStartWebApp webApp = new QuickStartWebApp();      webApp.setAutoPreconfigure(false);      webApp.setDisplayName(name);      webApp.setContextPath("/" + name);      webApp.setResourceBase(dir.getAbsolutePath());      webApp.setDescriptor(dir + "/WEB-INF/web.xml");      webApp.setExtraClasspath(calculateExtraClassPath(cls, new Path[0]));      webApp.getInitParams().put("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");      webApp.getInitParams().put("org.eclipse.jetty.jsp.precompiled", "true");      webApp.getInitParams().put("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
回复

使用道具 举报

升级   0.18%

4

主题

2

回帖

18

积分

注册会员

Rank: 2

积分
18
发表于 2021-5-28 22:07:27 | 显示全部楼层
版本5.3.0
回复

使用道具 举报

升级   100%

139

主题

1万

回帖

4万

积分

超级版主

Rank: 8Rank: 8

积分
41458
发表于 2021-5-31 11:03:46 | 显示全部楼层
您这个错误是否不够完善!
ClassNotFoundException  是找不到类。
应该还有一个提醒找不到什么类,但是您的错误没有提供。
请检查一下  是否缺少类!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread