539 questions
1
vote
0
answers
59
views
Split Package problem in hbase-client module in apache hbase
I am working on creating module-info.java file for hbase-client module in apache hbase project. Now, hbase-client has direct incoming dependency on hbase-common module.
In apache hbase project, most ...
4
votes
3
answers
329
views
How to combine multiple Java modules into one JAR?
The goal:
to combine multiple JARs and the modules in them into a single JAR
allow consumers to include a single package dependency in their maven/gradle/... files
make all of the modules available ...
0
votes
0
answers
41
views
Java 17 - ClassNotFoundException - java/sql/SQLException velocity template .vm file
I have been facing below issue during the ANT build of my older project with JAVA 17.
The build.xml is created using .vm(Velocity Template file).
Error:
[exec] Error: java.lang.NoClassDefFoundError: ...
1
vote
2
answers
109
views
What are the real-world use cases for java.lang.Module#addOpens(String, Module)?
I am familiar with the Java Platform Module System.
The javadoc for Module#addOpens sketches out a use case that I cannot translate into the real world:
This method can be used for cases where a ...
2
votes
2
answers
122
views
ClassCastException across modules with org.eclipse.persistence.oxm.XMLBinder
I am trying to read a docx file and replace the author names with a constant string.
This is the code in my main function.
import jakarta.xml.bind.JAXBException;
import org.docx4j.openpackaging....
2
votes
1
answer
96
views
What arrows to use in component diagrams to show relations between JPMS layers?
JPMS supports multiple layers. For example boot layer and its two child layers.
And I need to show these layers on UML diagram. For this I selected component diagram where every layer is a component. ...
-3
votes
1
answer
899
views
Can we set Java environment variables at run time in Java 17
I'm trying to set environment variables at run time using reflection in a Java application that's being migrated from Java 8 to Java 17. I'm changing the environment variable for my unit testing. ...
0
votes
0
answers
119
views
Transform simple FO file to PDF using fop 2.10 and JPMS
I did an example that you may clone by
git clone https://github.com/rolfschumacher/chFop.git
Importing it to Eclipse as an existing Maven project and let it run leads to
Unable to derive module ...
4
votes
1
answer
271
views
Access jdk.unsupported from JUnit doesn't need module require
I'm trying to figure out why JUnit behaves differently from a 'regular' Java program with respect to the jdk.unsupported module. And yes, I know I shouldn't be using this. I'm just trying (and failing)...
1
vote
0
answers
54
views
compiler:testCompile puts all transitive dependencies on module path
I added a module.info to my src/main/java and then also to my src/test/java, as per the example here. Compiling my main code is no problem. I see the compiler:compile goal adds only my direct (non-...
0
votes
0
answers
95
views
How to Migrate from Java 11 to 17 for a plugin with jars in classpath and packages are exported
We have a plugin named mockito and it has cglib-nodep-2.2.2.jar, hamcrest-core-1.3.jar, mockito-core-1.10.19.jar, objenesis-2.4.jar, jmockit-1.49.jar in it's bundle-classpath and have exported all the ...
2
votes
1
answer
398
views
How to fix java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine in java 21
I've a clojure project with deps.edn which uses the library clj-async-profiler
My main function in the project contains the below code -
(ns com.myns.cli
(:gen-class)
(:require
[clj-async-...
0
votes
1
answer
105
views
State of JPMS in Android
What is the current state of JPMS support in Android?
If I define a module, does Android honor the public/internal separation or does Android just ignore module-info?
0
votes
0
answers
42
views
Why does a module has to provide the imports for required static references?
I am migrating my Web project into java modules (JigSaw) with Java 17 and eclipse. One of my projects (ProjectA) defines Lombok as a required static resource ("requires static lombok;") in ...
2
votes
0
answers
63
views
Is there a way to detect reflectively how a Java module has been patched?
In an implementation of the Java Platform Module System, as implemented by most OpenJDK implementations, you can patch a module with classes from other artifacts. (Maven does this during Surefire runs,...
1
vote
0
answers
168
views
spring jpms module exited
anyone can explain to me why my spring jpms module exited ?
my code is too simple :
package ir.moke.module.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot....
1
vote
0
answers
50
views
Micronaut programmatically add controller
I working on Java 21 JPMS module .
is there any way to dynamically register/unregister to micronaut a class annotated by @Controller ?
Actually i want to implement modular api .
Note: Each api has own ...
0
votes
2
answers
133
views
Tomcat JPMS error jakarta.security.auth.message
I try to build jpms embedded tomcat server .
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</...
1
vote
0
answers
83
views
Making JPMS ServiceLoader non-recursive or avoid duplicate services
I am trying to load modules dynamically from a folder.
Suppose I have a "Module A" that has its own set of dependencies and "Module B" that has its own set of dependencies + it ...
0
votes
1
answer
462
views
Cannot Export/Open Package from Module jdk.compiler to Run/Pass Tests in Maven
Settings
I'm using JDK 22:
openjdk version "22" 2024-03-19
OpenJDK Runtime Environment (build 22+36-2370)
OpenJDK 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)
I'm also using ...
4
votes
1
answer
2k
views
class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x13d73fa) cannot access class sun.nio.ch.DirectBuffer
I tried execute spark program in my springboot framework(mvn) project in IDEA, but I found the question below:
INFO
org.apache.spark.storage.BlockManagerMasterEndpoint -- Using org.apache.spark....
2
votes
1
answer
134
views
Java cannot find class in modular jar file, yet javap can
I have a simple hello world that I'm trying to build into a modular jar to test running jlink. I can neither run the jar file nor can I create an image for it with jlink.
I an on Windows, and using ...
0
votes
0
answers
69
views
Why ServiceLoader.load(...) runs ok, but fails my tests?
I have a Spring Boot project with 2 jigsaw modules (java 21).
Inner module with only one public package with interfaces and DTOs; also it provides an implementation for UseCase service:
module com....
1
vote
0
answers
131
views
Do I still need maven dependencies when using JPMS modules?
I don't fully understand the combination of JPMS and maven. In multiple places, the two claim to be independent and orthogonal to each other, yet both offer concepts for dependency and encapsulation.
...
0
votes
0
answers
48
views
JPMS; trying to use a class from a dependecy module as mainClass fails in maven build
I have a Java maven project that has dependencies to other libraries. One of these dependecies has a Main class that can be used as < mainClass > in my maven-jar-plugin so I don't have have to ...
2
votes
0
answers
134
views
Maven JPMS without test-scoped dependencies
Having a maven project "Test".
This is the pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...
3
votes
1
answer
272
views
When running mvn test why is build failing with java.lang.ClassNotFoundException: java.net.http.HttpResponse?
When running mvn test -e -X why is build failing with java.lang.ClassNotFoundException: java.net.http.HttpResponse?
I am using java 17
My stack trace is:
Running job testJava17ClientSamples ...
...
4
votes
0
answers
96
views
Are JPMS modifiers `static` and `transitive` incompatible?
The JPMS requires instruction can have two qualifiers static and transitive. For a module foo:
requires static bar;, makes resolution of the bar module optional at runtime,
requires transitive bar;, ...
0
votes
2
answers
519
views
Compilation failure on custom class with package java.util
I have a custom class, whose package is given as java.util. The code was compiling fine before java version 9, but when I have changed java version to 11, I am facing package exists in another module: ...
1
vote
1
answer
2k
views
ClassNotFoundException: org.apache.logging.log4j.Logger
In my Java 17 maven project I am using slf4j based on log4j2. It runs fine, when I start it from within Eclipse.
Maven places the main class in MANIFEST of the modules jar file and all dependent jar ...
1
vote
0
answers
153
views
surefire testng fails to launch due to JPMS error on jdk11
The diagnostics log basicaly says:
ResolutionException: Module org.seleniumhq.selenium.remote_driver
contains package com.tngtech.jgiven.impl, module
com.tngtech.jgiven.core exports package com....
0
votes
0
answers
199
views
how to set the compiler option --patch-modules in eclipse
I am using JDK 19 in a modular maven project.
My project compiles in the shell, but I get errors in Eclipse.
The package org.slf4j is accessible from more than one module: <unnamed>, org.slf4j
...
0
votes
0
answers
81
views
JPMS and foreign JAR files often lead to ResolutionException
This question has been asked here several times. But I did not find a usable answer so far (for years now). As I am doing small Java-17 programs using big jar files, I am wondering whether JPMS is the ...
0
votes
1
answer
393
views
DNSJava 2.1.8 as dependency invalidates JPMS (Java 9 Platform Module System) compatibility
There is a maven artifact called xxx:
Having this vanilla pom:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...
3
votes
1
answer
4k
views
Eclipse Java 17 setup issue related to (Java 9) Module System - The package * is accessible from more than one module: <unnamed>, java.xml
First of all I researched a lot about this issue already and it's is not a duplicate of the numerous and typical "The package * is accessible from more than one module: <unnamed>, java.xml&...
0
votes
0
answers
75
views
Java JPMS project : package (JAXB) is not visible
I am creating my first project using JPMS . Simply I have a Maven project and some simple classes that need JAXB classes.Then
created module-info.java
module mymodule{
requires jakarta.xml.bind;
...
0
votes
1
answer
540
views
fop pom and module-info example
I tried to locate an example of pom.xml and module-info.java to use fop in an embedded way with JPMS, namely Java-17, but could not find one.
E.g. my code:
FopFactoryBuilder builder = new ...
2
votes
1
answer
502
views
ModuleLayer can't find my resources when running my modular program, but it can for my modular jar
I have the following project structure.
ProjectName
|
|---src
|
|---main
|
|---java
| |
| |---ModuleName
| |
| |---module-info....
0
votes
1
answer
210
views
Modularizing a Java Project in Eclipse
I have four Java packages in Eclipse: augustus, caligula, julius, and nero. I want to place augustus and caligula in a module. I want to place julius and nero in another module. How do I go about ...
4
votes
1
answer
13k
views
Applying --add-opens Option to Dynamically Loaded Modules in Java 17
In the context of JEP 403's robust encapsulation in Java 17, I have a class (.jar) that is dynamically loaded during JVM execution.
This class utilizes Reflection to invoke private methods belonging ...
1
vote
0
answers
76
views
Enumeration of modules during resolution
In the Java Language Specification, paragraph 7.7, it states:
A 'dependency' is the observable module enumerated by resolution (as described in the java.lang.module package specification) for a given ...
1
vote
1
answer
215
views
Maven project: module not found even with correct dependencies
I'm trying to build a Java module with Maven but I keep getting the same error (module not found) with every dependency when I run mvn compile. Neither Intellij IDEA nor VSCode give me any error ...
0
votes
1
answer
227
views
How To Cache Java ServiceLoader.Provider Efficiently
I currently working on a JPMS project and would like to be able to cache the Providers retrieved on ServiceLoader.load() to be able to use their get() method later for a new set of service instances - ...
2
votes
1
answer
747
views
Error message mentions Java 9 even though I am using Java 11
I have a Java 11 Gradle project for work. I am using IntelliJ Idea. I have some test errors, so I'm trying to debug. The error message I'm asking about appears to be unrelated to the test errors, but ...
2
votes
1
answer
799
views
How to access files in /META-INF/resources when module-info.java is present?
When TestNG invokes Class.getResourceAsStream() on an external module, it is returning null.
Per Resources visibility with java9 modules when a user wants to access /resources/someResource.xml in a ...
0
votes
0
answers
75
views
source compilation errors for openliberty and JPMS
Does anybody else experience strange Source compilation had errors info messages when running an application with JPMS modules on openliberty. These are info messages I also see in my project:
...\src\...
2
votes
1
answer
86
views
Does --patch-module show up reflectively?
Suppose java is invoked with --patch-module. From within the running program, is there any way to discover that the patched module contains classes and packages in more than one location? I failed to ...
4
votes
0
answers
935
views
Usage Java module system for Kotlin project
In our purely Kotlin project we would like to use flexible Java 9 module system. Otherwise we have to use internal visibility modifier too often to hide internal Kotlin module functionality from other ...
4
votes
1
answer
724
views
How to run Spring Boot .jar with Java Modules?
I'm trying to create a simple Spring Boot application and run it with Java Modules on the latest Java version.
I have created a Main class:
package org.example;
import org.springframework.boot....
2
votes
1
answer
355
views
Do Java Modules (JPMS/Jigsaw) Solve the Problem that "Shading" Dependencies Solves?
A lot of Java projects shade their dependencies. I believe the main reason is illustrated by the answer on this SO question (What is the maven-shade-plugin used for, and why would you want to relocate ...