如何修复“错误:无法创建Java虚拟机”?

时间:2019-04-08 14:11:46

标签: java tomee

我想用tomee创建一个JEE Web API。

我有一个实用的示例,但是当我尝试使用此代码启动它时

mvn clean package tomee:run

它返回此:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building books 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ books ---
[INFO] Deleting /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ books ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ books ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/classes
[WARNING] /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/src/main/java/car/tp4/entity/BookBean.java: /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/src/main/java/car/tp4/entity/BookBean.java uses unchecked or unsafe operations.
[WARNING] /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/src/main/java/car/tp4/entity/BookBean.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- openjpa-maven-plugin:2.3.0:enhance (enhancer) @ books ---
65  book-pu  INFO   [main] openjpa.Tool - Enhancer running on type "class car.tp4.entity.Book".
142  book-pu  WARN   [main] openjpa.Enhance - The type "car.tp4.entity.Book" must have a no-args constructor. Adding a public no-args constructor.
184  book-pu  INFO   [main] openjpa.Tool - Enhancer running on type "class car.tp4.entity.BookBean".
195  book-pu  INFO   [main] openjpa.Tool - No metadata was found for 1 classes; they have been enhanced as persistence-aware. If you intended for any of these classes to be persistence-capable, then this means that OpenJPA could not find any metadata for those classes. This can happen if the directory containing your metadata is not in your CLASSPATH, or if your metadata files are not named properly. See the documentation on metadata placement for more information. Persistence-aware classes: [class car.tp4.entity.BookBean]
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ books ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ books ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ books ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.4:war (default-war) @ books ---
[INFO] Packaging webapp
[INFO] Assembling webapp [books] in [/home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/books-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/src/main/webapp]
[INFO] Webapp assembled in [43 msecs]
[INFO] Building war: /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/books-1.0-SNAPSHOT.war
[INFO] 
[INFO] --- tomee-maven-plugin:1.7.1:run (default-cli) @ books ---
[INFO] TomEE was unzipped in '/home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/apache-tomee'
[INFO] Removed not mandatory default webapps
[INFO] Installed '/home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/books-1.0-SNAPSHOT.war' in /home/gautier/Bureau/M1/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/apache-tomee/webapps/ROOT.war
[INFO] Starting synchronizer with an update interval of 5000
[INFO] Running 'org.apache.openejb.maven.plugin.run'. Configured TomEE in plugin is localhost:8080 (plugin shutdown port is 8005 and https port is 8443)
-Djava.endorsed.dirs=/home/gautier/Bureau/M1Started server process on port: 8080
/S2/CAR/car-tp4-drincqbier-sparrow/car-tp4/car-tp4/target/apache-tomee/endorsed is not supportedError: Cou.ld not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
 Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.

我试图更改Java的版本(我有9,并尝试了8,但问题相同)

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

我使用Ubuntu 16.04

我读到它可能是分配的内存太低。但我不知道如何解决...

如果您有任何想法?

0 个答案:

没有答案