wangziming 发表于 2021-5-28 22:06:14

自定义war部署问题

我用自定义的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 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));      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");

wangziming 发表于 2021-5-28 22:07:27

版本5.3.0

论坛管理员 发表于 2021-5-31 11:03:46

您这个错误是否不够完善!
ClassNotFoundException是找不到类。
应该还有一个提醒找不到什么类,但是您的错误没有提供。
请检查一下是否缺少类!
页: [1]
查看完整版本: 自定义war部署问题