启动 jasperserver 失败:org.springframework.beans.factory.BeanCreationException

Failed starting jasperserver: org.springframework.beans.factory.BeanCreationException


我第一次尝试启动 Jasperserver,正如您此时可能想的那样,它并没有很好地结束。

我做了什么:

  1. 安装Tomcat v7.0.32
  2. 安装 Jasperreport v7.1.0

注:

我在做什么:

错误:

tomcat7-stdout.2018-06-14:

    2018-06-14 10:16:46 Commons Daemon procrun stdout initialized
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000074b5c75a, pid=4528, tid=11980
#
# JRE version: Java(TM) SE Runtime Environment (7.0_80-b15) (build 1.7.0_80-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V  [jvm.dll+0x1cc75a]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Program Files\Apache Software Foundation\Tomcat 7.0\hs_err_pid4528.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
virtualDataSourceQueryService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teiidVirtualQueryService' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source-query-service.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1105)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1664)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'virtualDataSourceHandler' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source.xml]: Cannot resolve reference to bean 'teiidVirtualQueryService' while setting bean property 'virtualDataSourceQueryService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teiidVirtualQueryService' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source-query-service.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 28 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teiidVirtualQueryService' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source-query-service.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 38 more
Caused by: java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2908)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.startServer(TeiidVirtualDataSourceQueryServiceImpl.java:525)
    at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.init(TeiidVirtualDataSourceQueryServiceImpl.java:519)
    at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.afterPropertiesSet(TeiidVirtualDataSourceQueryServiceImpl.java:768)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
    ... 45 more
2018-06-14 10:18:25,475 ERROR JNDIResourceProvider,localhost-startStop-1:75 - error closing context
javax.naming.OperationNotSupportedException: Context is read only
    at org.apache.naming.NamingContext.checkWritable(NamingContext.java:962)
    at org.apache.naming.NamingContext.close(NamingContext.java:762)
    at com.tonbeller.tbutils.res.JNDIResourceProvider.close(JNDIResourceProvider.java:72)
    at com.tonbeller.tbutils.res.CompositeResourceProvider.close(CompositeResourceProvider.java:56)
    at com.tonbeller.tbutils.res.ResourcesFactory.initialize(ResourcesFactory.java:163)
    at com.tonbeller.tbutils.res.ResourcesFactory.<init>(ResourcesFactory.java:92)
    at com.tonbeller.tbutils.res.ResourcesFactory.<clinit>(ResourcesFactory.java:89)
    at com.tonbeller.tbutils.res.ResourcesFactoryContextListener.contextInitialized(ResourcesFactoryContextListener.java:23)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1105)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1664)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

localhost.2018-06-14:

INFORMAZIONI: Initializing Spring root WebApplicationContext
giu 14, 2018 10:18:25 AM org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customJDBCReportDataSourceServiceFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'virtualDataSourceHandler' while setting bean property 'virtualDataSourceHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'virtualDataSourceHandler' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source.xml]: Cannot resolve reference to bean 'teiidVirtualQueryService' while setting bean property 'virtualDataSourceQueryService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teiidVirtualQueryService' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source-query-service.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1105)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1664)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'virtualDataSourceHandler' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source.xml]: Cannot resolve reference to bean 'teiidVirtualQueryService' while setting bean property 'virtualDataSourceQueryService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teiidVirtualQueryService' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source-query-service.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 28 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teiidVirtualQueryService' defined in ServletContext resource [/WEB-INF/applicationContext-virtual-data-source-query-service.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    ... 38 more
Caused by: java.lang.UnsupportedClassVersionError: org/infinispan/manager/EmbeddedCacheManager : Unsupported major.minor version 52.0 (unable to load class org.infinispan.manager.EmbeddedCacheManager)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2908)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.startServer(TeiidVirtualDataSourceQueryServiceImpl.java:525)
    at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.init(TeiidVirtualDataSourceQueryServiceImpl.java:519)
    at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.afterPropertiesSet(TeiidVirtualDataSourceQueryServiceImpl.java:768)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
    ... 45 more

结论:

我真的不知道该怎么办了!我已经尝试 google 它,但一切都是旧的,与我得到的错误无关。希望你能帮助我!

编辑 18/06/2018

编辑 22/06/2018

不支持 major.minor 版本 52.0 意味着 Java 版本不匹配,切换到 Java 8

似乎即使您安装了 Tomcat 指向的 JRE 1.7,您的系统也有 JRE 1.8,它实际上是 运行ning。另外,您没有安装 JDK。需要编译 Java 类.

尝试以下操作:

  1. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 下载 JDK 1.8 for Windows。您必须先接受许可协议。

  2. 运行 安装程序。除了安装路径之外,应该没有太多可供您配置的选项。记住这个路径以备后用

  3. 安装程序完成后,搜索 "environment variables"。在那里,寻找 PATH 变量和 CLASSPATH。如果它们不存在,您可以通过添加新变量来创建它们。

  4. 编辑PATH变量,添加“;path\in\step\bin\”。如果你不记得了,通常是C:\Program Files\Java\jdk1.8.0_131\bin\PATH 变量给出了可执行文件的位置,如 javac、java 等...

  5. 创建 JAVA_HOME 变量并将其设置为 "path/to/jdk"。应该是 C:\Program Files\Java\jdk1.6.0_25

  6. 创建 JRE_HOME 变量并将其设置为 "path/to/jre"。它应该看起来像 JRE_HOME=C:\Program Files\Java\jdk1.6.0_32\jre

  7. 创建CATALINA_HOME 变量并将其设置为安装Tomcat 4.1 的目录路径。它应该看起来 C:\Program Files\Apache\tomcat\bin\startup

  8. 创建 CLASSPATH 变量并将其设置为 "path\common\lib\servlet-api.jar"。它应该看起来像 C:\apache-tomcat-6.0.14\lib\servlet-api.jar.

  9. 通过在 cmd 上回显来检查这些设置是否正确。只需在 cmd 中输入 %PATH%%JAVA_HOME%%JRE_HOME% 等。它们应该产生与前面步骤中设置的值相同的值。

  10. 最后,在 cmd 中输入 javac 并按回车键检查 Java 是否安装正确。如果你得到类似 "Usage: javac ...." 的输出,那么它已经正确安装。

  11. 运行 你的项目。

PATH是操作系统使用的环境变量(Windows,MacOSX,Linux)会在其中寻找native 运行 的可执行程序。 JAVA_HOMEJRE_HOME 不被 Java 本身使用。 Apache Tomcat 期望将这些环境变量之一设置为 JDK 或 JRE 的安装目录。 CLASSPATH 被像 tomcat 这样的第 3 方应用程序用来将 CLASSPATH 中设置的任何内容注入到您创建的每个 java 应用程序中。CATALINA_HOME 指向安装 tomcat,启动时可能需要。 .

可能是你没有设置变量导致的错误