resin-pro-4.0.53报错java.lang.Error: java.lang.ClassNotFoundException: com.caucho.loader.SystemClassLo

Posted 学习笔记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了resin-pro-4.0.53报错java.lang.Error: java.lang.ClassNotFoundException: com.caucho.loader.SystemClassLo相关的知识,希望对你有一定的参考价值。

最初并未发现,笔者的系统环境变量JAVA_HOME变量设置错误

D:\develop\Java\x64\jdk1.8.0_144 #最初使用了阉割版的JDK

改成完整安装的JDK就可以

D:\develop\Java\jdk1.8.0_144

另外还有设置RESIN_HOME环境变量

RESIN_HOME=D:\develop\resin-pro-4.0.53

设置环境变量

.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%RESIN_HOME%\lib\resin.jar;%RESIN_HOME%\lib\javamail-141.jar

网上说要把lib目录下所有jar加进去,即使JAVA_HOME设置正确,不加仍旧保持

缺少%RESIN_HOME%\lib\resin.jar;报错

Error occurred during initialization of VM
java.lang.Error: java.lang.ClassNotFoundException: com.caucho.loader.SystemClassLoader
        at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1469)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)
Caused by: java.lang.ClassNotFoundException: com.caucho.loader.SystemClassLoader

        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at java.lang.SystemClassLoaderAction.run(ClassLoader.java:2209)
        at java.lang.SystemClassLoaderAction.run(ClassLoader.java:2195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1456)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)

缺少%RESIN_HOME%\lib\javamail-141.jar报错:

file:/d:/develop/resin-pro-4.0.53/conf/health.xml:723: com.caucho.config.core.ResinIf.init(): java.lang.NoClassDefFoundError: javax/mail/Session

721:      - Automatic PDF reports
722:     -->
723:   <resin:if test="${pdf_summary}">
724:   <health:PdfReport>
725:     <path>${resin.root}/doc/admin/pdf-gen.php</path>

        at com.caucho.config.xml.XmlConfigContext.error(XmlConfigContext.java:1244)
        at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:471)
        at com.caucho.config.xml.XmlConfigContext.configureAttribute(XmlConfigContext.java:324)
        at com.caucho.config.program.NodeBuilderChildProgram.inject(NodeBuilderChildProgram.java:82)
        at com.caucho.config.program.ContainerProgram.inject(ContainerProgram.java:88)
        at com.caucho.config.program.ConfigProgram.configure(ConfigProgram.java:107)
        at com.caucho.config.core.ResinIf.init(ResinIf.java:71)
        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 com.caucho.config.j2ee.PostConstructProgram.inject(PostConstructProgram.java:140)
        at com.caucho.config.type.InlineBeanType.init(InlineBeanType.java:458)
        at com.caucho.config.xml.XmlConfigContext.configureChildBean(XmlConfigContext.java:705)
        at com.caucho.config.xml.XmlConfigContext.configureBeanProperties(XmlConfigContext.java:686)
        at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:464)
        at com.caucho.config.xml.XmlConfigContext.configureNode(XmlConfigContext.java:371)
        at com.caucho.config.xml.XmlConfigContext.configureBean(XmlConfigContext.java:285)
        at com.caucho.config.Config.configureBean(Config.java:376)
        at com.caucho.config.Config.configureBean(Config.java:342)
        at com.caucho.config.core.ResinImport.initImpl(ResinImport.java:176)
        at com.caucho.config.core.ResinImport.init(ResinImport.java:107)
        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 com.caucho.config.j2ee.PostConstructProgram.inject(PostConstructProgram.java:140)
        at com.caucho.config.type.InlineBeanType.init(InlineBeanType.java:458)
        at com.caucho.config.xml.XmlConfigContext.configureChildBean(XmlConfigContext.java:705)
        at com.caucho.config.xml.XmlConfigContext.configureBeanProperties(XmlConfigContext.java:686)
        at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:464)
        at com.caucho.config.xml.XmlConfigContext.configureNode(XmlConfigContext.java:371)
        at com.caucho.config.xml.XmlConfigContext.configureBean(XmlConfigContext.java:285)
        at com.caucho.config.xml.XmlConfigContext.configure(XmlConfigContext.java:243)
        at com.caucho.config.Config.configure(Config.java:324)
        at com.caucho.config.Config.configure(Config.java:254)
        at com.caucho.server.resin.BootConfig.configureFile(BootConfig.java:132)

        at com.caucho.server.resin.Resin.configureFile(Resin.java:1036)
        at com.caucho.server.resin.Resin.<init>(Resin.java:251)
        at com.caucho.server.resin.Resin.<init>(Resin.java:183)
        at com.caucho.server.resin.Resin.main(Resin.java:1465)
Caused by: com.caucho.config.ConfigException: com.caucho.config.core.ResinIf.init(): java.lang.NoClassDefFoundError: javax/mail/Session
        at com.caucho.config.ConfigException.create(ConfigException.java:102)
        at com.caucho.config.ConfigException.create(ConfigException.java:130)
        at com.caucho.config.j2ee.PostConstructProgram.inject(PostConstructProgram.java:142)
        at com.caucho.config.type.InlineBeanType.init(InlineBeanType.java:458)
        at com.caucho.config.xml.XmlConfigContext.configureChildBean(XmlConfigContext.java:705)
        at com.caucho.config.xml.XmlConfigContext.configureBeanProperties(XmlConfigContext.java:686)
        at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:464)
        ... 39 more
Caused by: java.lang.NoClassDefFoundError: javax/mail/Session
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.getDeclaredMethods(Class.java:1975)
        at com.caucho.config.reflect.ReflectionAnnotatedType.introspectMethods(ReflectionAnnotatedType.java:260)
        at com.caucho.config.reflect.ReflectionAnnotatedType.introspect(ReflectionAnnotatedType.java:212)
        at com.caucho.config.reflect.ReflectionAnnotatedType.introspect(ReflectionAnnotatedType.java:193)
        at com.caucho.config.reflect.ReflectionAnnotatedType.getMethods(ReflectionAnnotatedType.java:152)
        at com.caucho.config.reflect.AnnotatedTypeImpl.getMethods(AnnotatedTypeImpl.java:132)
        at com.caucho.config.xml.XmlBeanConfig.<init>(XmlBeanConfig.java:130)
        at com.caucho.config.xml.XmlBeanAttribute.create(XmlBeanAttribute.java:139)
        at com.caucho.config.xml.XmlConfigContext.configureBeanProperties(XmlConfigContext.java:677)
        at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:464)
        at com.caucho.config.xml.XmlConfigContext.configureAttribute(XmlConfigContext.java:324)
        at com.caucho.config.program.NodeBuilderChildProgram.inject(NodeBuilderChildProgram.java:82)
        at com.caucho.config.program.ContainerProgram.inject(ContainerProgram.java:88)
        at com.caucho.config.program.ConfigProgram.configure(ConfigProgram.java:107)
        at com.caucho.config.core.ResinIf.init(ResinIf.java:71)
        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 com.caucho.config.j2ee.PostConstructProgram.inject(PostConstructProgram.java:140)
        ... 43 more
Caused by: java.lang.ClassNotFoundException: javax.mail.Session
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 65 more
file:/d:/develop/resin-pro-4.0.53/conf/health.xml:723: com.caucho.config.core.ResinIf.init(): java.lang.NoClassDefFoundError: javax/mail/Session

721:      - Automatic PDF reports
722:     -->
723:   <resin:if test="${pdf_summary}">
724:   <health:PdfReport>
725:     <path>${resin.root}/doc/admin/pdf-gen.php</path>
 

当然如果你的resin启动还报错,请根据出错类所在包添加到%resin_home%\lib\目录

在linux下,专业版还有以下两种启动参数

IV) PDF Reports
---------------

  With Resin-Pro, you can get a PDF snapshot report of the server with the
  command-line:

    unix> bin/resin.sh pdf-report #生成pdf报告

  You can also get a watchdog restart report with the -watchdog option
  
    unix> bin/resin.sh pdf-report -watchdog

 

以上是关于resin-pro-4.0.53报错java.lang.Error: java.lang.ClassNotFoundException: com.caucho.loader.SystemClassLo的主要内容,如果未能解决你的问题,请参考以下文章

Java基本问题

Java注解Annotation

反射随笔:反射包的结构

java项目启动服务器出错

类型通配符 (?)

RecyclerView 中的捆绑问题