java-module

Java 9 modules and classpath hell: conflicting class names

ぃ、小莉子 提交于 2019-12-10 03:42:01
问题 It is said that java 9 modules will solve classpath hell. However, I am thinking about the following situation: Module A uses modules B and C. Both modules will export a class with same name and package. How will the classloading issue be solved here? 回答1: This situation is forbidden in the Java 9 module system. If two modules in the same layer have the same package, Java 9 will fail at startup with an error: java.lang.LayerInstantiationException: Package <package_name> in both module

fatal error compiling invalid flag --module-path

柔情痞子 提交于 2019-12-09 15:54:29
问题 I have a project. Originally it was a single module project with structure like this java-cloud-sample\ src\ main\ java pom.xml I decided to make it into a multi-module structure - I use java 9 anyway. So I separated it like this java-cloud-sample\ java-cloud-rest-api\ src\ pom.xml pom.xml Where root pom.xml looks like this <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/

Limit modules added by javapackager

人走茶凉 提交于 2019-12-09 10:37:17
问题 I am trying to reduce the size of my application by limiting the modules that it includes. I already did this for my runtime using jlink . However, when I run javapackager using the --add-modules and --limit-modules options with a comma-separated list of the same small set of modules I used for the runtime, it insists on adding all of the modules anyway. It doesn't seem to want to honor the option I'm giving it. How can I get the tool to limit the modules it adds to my app bundle? "Adding

Why is exporting the entire module not allowed?

你说的曾经没有我的故事 提交于 2019-12-09 02:27:06
问题 In Java 9's module declaration there are 2 constructs: exports com.foo; And opens com.foo; Where exports grants compile-time access, while opens allows runtime access, as reflection and resources. opens has one leniency over exports that you can define the whole module as open, resulting the same as explicitly opening every package: open module com.mod { But there's no similar construct exported module com.mod { My Question : Why is it so; what decisions has been made to allow opening the

Proper way to use Spring JAXB Marshaller with Java 9 without defining additional modules

跟風遠走 提交于 2019-12-09 01:44:27
问题 To illustrate my issue, I created a small spring boot sample application. The purpose of the application is to create a Jaxb2Marshaller bean. @SpringBootApplication public class App implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(App.class, args); } @Bean public Jaxb2Marshaller jaxb2Marshaller() { Jaxb2Marshaller bean = new Jaxb2Marshaller(); bean.setContextPath("ch.sahits.game.helloworld"); return bean; } @Override public void run(String... args)

Java 11 Unable to derive module descriptor

柔情痞子 提交于 2019-12-08 21:15:43
问题 I am getting this error message when I try to compile my new modularized Java 11 application: Error occurred during initialization of boot layer java.lang.module.FindException: Unable to derive module descriptor for C:\Users\inter\.m2\repository\xalan\xalan\2.7.2\xalan-2.7.2.jar Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module This appears to be an issue from a dependency of a dependency. I can't even find which module is

How to get a Module by its name in Java 9?

强颜欢笑 提交于 2019-12-08 11:48:13
问题 How to get java.lang.Module by string name in Java 9? For example, we have String name = "some.module"; Module module = //how to get here it? 回答1: One way to get your module from the boot layer which consists at least java.base after its initialization is: String moduleName = "my.module"; Module m = ModuleLayer.boot().findModule(moduleName).orElse(null); though preferably a safe way IMO, would be to get a module would be using the Configuration and the system ClassLoader to get the

Trying to run executable jar of JavaFX app - Error: JavaFX runtime components are missing

六月ゝ 毕业季﹏ 提交于 2019-12-08 10:06:56
问题 I've created a JavaFX 11 app that is ready to be deployed. I use Gradle 5.0 as my build tool and this command to compile the jar: jar { manifest { attributes( 'Main-Class': 'checkmydigitalfootprint.MainApp' ) } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } } Then on command line I've tried different commands to run the jar file: java -jar CheckMyDigitalFootprint.jar java -jar CheckMyDigitalFootprint.jar --module-path="/users/joseph/eclipse-workspace

How to replace --add-modules java.xml.ws

风流意气都作罢 提交于 2019-12-08 08:05:51
问题 I did migrate my Maven based project to SpringBoot 2.0 and Java 9. In the process, I had to add some dependencies to get rid of Java 9 warnings regarding modules (that still can be added with --add-modules). However I am unable to get rid off --add-modules java.xml.ws . As suggested in JEP 320, adding dependencies: <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId

An illegal reflective access operation has occurred while executing automated tests using Selenium and Java 9

拈花ヽ惹草 提交于 2019-12-08 04:36:18
问题 I having a strange issue with my selenium test When I am opening my chrome browser im receiving 2 errors: [1569419754.430][WARNING]: Timed out connecting to Chrome, retrying... [1569419759.899][WARNING]: Timed out connecting to Chrome, retrying... Before the browser actually opens. I also noticed at the end of the test there are numerous warnings: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.openqa.selenium.os.ProcessUtils WARNING: