779 questions
Advice
1
vote
4
replies
68
views
Attempting to add a module-info.java to spark.core.2.13 of Apache Spark: how to make scala accepting module delaration and gather its classes?
I'm willing to progress into the subject of introducing java modules into Apache Spark. They are needed for:
sorting and avoiding conflicts between dependencies.
allow Spark modules to be integrated ...
Best practices
1
vote
4
replies
124
views
Java Module System Breaking Serialization of Standard Library Classes - Is there a better solution than --add-opens?
Problem
When serializing Java standard library classes (like java.awt.Rectangle, Point, Dimension, etc.) using frameworks like XStream, Jackson, or Gson, I'm forced to use --add-opens flags:
--add-...
2
votes
0
answers
82
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 ...
3
votes
2
answers
275
views
Java, using nested modules
Question looks easy, and probably has an easy solution, but I didn't find one.
Given module A that needs module B, which in turn needs module C.
Module A should not need to know about module C. I well ...
2
votes
1
answer
202
views
Mockito and module-info with Version 5.16.0+: Mockito cannot mock this class
I'm using the Java Module System since some years now and until Mockito 5.15.2 this was no Problem. But with Version 5.16.0+ I now got the following error:
Mockito cannot mock this class: class javax....
3
votes
1
answer
107
views
How to include the SPI "uses" and/or "provides" section for a module with Javadoc?
If you look at a module's documentation from the standard library, such as java.base, you'll see it has a section that lists which services it uses and which services it provides.
Based on the ...
0
votes
1
answer
58
views
Does adding a module dependency enable component scanning?
I have a project which has 2 modules A and B.
Module A depends on module B. (Maven compile and test dependency).
Module A and module B have the same package structure and names i.e
module A/src/main/...
0
votes
1
answer
73
views
How to add to modulepath?
Surefire has a parameter called additionalClasspathElements for adding elements to the test classpath.
Is there a way to add elements to the test modulepath instead?
0
votes
3
answers
359
views
Problems with jlinking javafx modules to make stand alone aplication
You can checkout my whole project on github. I currently don't use any dependency managers in my projects and I would like to keep it that way. I am using a library that I made in java and I am using ...
0
votes
1
answer
197
views
Package exists in another module - java.transaction.xa - JAVA 17
I am working on java 17 migration from java 8.
While upgrading the code I'm getting stuck on below error. Unable to proceed forward due to this issue.
Error:
[exec] ./src/javax/transaction/xa/Xid....
3
votes
1
answer
180
views
Resource Loading with SpringBoot @Value and JavaFX requires files to be in resources/static with java 9 modules. Why?
As the title says. To load a xml file (and any other file for that matter) via spring boots value annotation, the file has to sit in resources/static/path-to-file when using a module-info file. not ...
2
votes
1
answer
125
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. ...
2
votes
0
answers
93
views
Running a modular Java application built by Gradle from IntelliJ IDEA
How to run a Java class with a main method from Idea in project managed by Gradle in a modular way?
For class like
package org.example.moduledemo;
public class Main {
public static void main(...
0
votes
0
answers
47
views
javac --patch-module doesn't work as expected at compile time
I want to compile my program with the use of the internal API of a modular java library which in addition is package-private. In the future I also want to fine-tune the package access at runtime to ...
0
votes
0
answers
130
views
java 9 modules causing errors
Recently we have started migrating to java 17 from 8. We found some jaxb exceptions (shown below) which got resolved after adding --add-opens=java.base/java.lang=ALL-UNNAMED. I am not sure if this is ...
0
votes
0
answers
131
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 ...
0
votes
1
answer
244
views
Unable to use module com.azure.identity in modular java project
I am trying to use Microsoft's azure-identity module) in a Gradle app.
However .\gradlew run fails with this stack trace:
> Task :run
java.lang.module.FindException: Module msal4j.persistence....
2
votes
1
answer
253
views
Can't run Hibernate in a module environment
The problem
I'm having trouble trying to make Hibernate run in a project that have modules. I am trying to modernize an old tool that uses and old version of Hibernate with javax-based JPA and I am ...
0
votes
1
answer
570
views
Java: Need to read jackson.databind module, but it does not exist
I have a class MyClass inside java module com.example.mymodule, which needs to use com.fasterxml.jackson.databind.ObjectMapper.
When trying to run the app, I get the following error:
java.lang....
2
votes
1
answer
703
views
How to compile Java module by using --module-source-path?
I'm trying to compile a Java module that is located in a separate directory from my project's source root. Here's my project structure:
Foundation-Test-1:
│ .gitignore
│ Foundation-Test-1.iml
│
├──...
0
votes
2
answers
281
views
How to run a JavaFX app in Eclipse with Gradle dependencies?
If I try to run a JavaFX app with a classic classpath inside Eclipse then I get follow warning:
WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @7b58231a'
That I ...
2
votes
1
answer
623
views
Whats the reason for: module not found: org.jspecify
After doing some dependency updates on my project (Java 17 with modules) I got the following error message during compilation:
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ energy-...
0
votes
1
answer
190
views
A method to open jdk.compile from the lombok source
I referenced lombok.'s method of opening jdk.compile in jdk21,which opens jdk.complie at the initialization stage of the annotation processor
private static void addOpensForLombok() {
...
0
votes
0
answers
375
views
cannot access class com.sun.tools.javac.api.JavacTrees (in module jdk.compiler)
I have customized an annotation handler using java21. The pom file of the project where the annotation processor is located is shown below:
<project xmlns="http://maven.apache.org/POM/4.0.0&...
-1
votes
1
answer
163
views
Why am I getting java.lang.NoClassDefFoundError: java/sql/Driver when using a custom class loader?
This works with Java 8:
public class Test {
public static void main(String[] args) throws Exception {
URLClassLoader loader = new URLClassLoader(new URL[0], null);
System.out.println("&...
2
votes
1
answer
213
views
Automatic Module present but not found
In my Java 21 project, I'm trying to use the package io.jsonwebtoken.Jwts in the library jjwt-api.
This dependency has no module-info.java and no Automatic-Module-Name-entry inside of the MANIFEST.MF.
...
2
votes
1
answer
454
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
0
answers
390
views
how using jdbc driver with java modules
I am programming a database application in Java and would like to use java modules.
The following code crashes with an error:
package dm;
import java.sql.Connection;
import java.sql.DriverManager;
...
2
votes
0
answers
68
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
101
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 ...
4
votes
1
answer
564
views
How to add module 'java.smartcardio' in a non-modular JavaFX application?
I'm working on a JavaFX application which is currently non-modular. If I would make my application modular then I would need to make many changes in other projects that are not fully under my command.
...
2
votes
2
answers
245
views
Can I exclude maven resource folder from a Java module?
I created two Maven projects 'javafx' and 'commonfx' to reproduce an error.
module commonfx {
exports commonfx.calculator;
}
module javafx {
requires javafx.controls;
requires javafx....
1
vote
1
answer
994
views
How to reduce the size of my executable made via `jpackage`
I have a jpackage build script that takes one of my projects (all have the exact same structure) and creates an executable. This script works and produces an installer, which I can run to create my ...
5
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
149
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
1
answer
287
views
What is causing this error? "Module main contains package javafx.fxml, module javafx.fxml exports package javafx.fxml to main"
From what I understand and read already the problem is that the module is imported twice somewhere, but I don't understand where. This is my module-info.java file:
module main {
requires org....
2
votes
2
answers
995
views
JavaFX 21 modular application, how to add automatics modules (H2 and Hibernate) to classpath after jlink has linked modules required for the runtime
How to in a JavaFX 21 modular application using JLink (in order to package as a native executable),
put the automatic modules H2 and Hibernate, in the class path, as explained in this video,
do you ...
-1
votes
1
answer
751
views
java Caused by: javax.net.ssl.SSLProtocolException: Cannot decode named group: x25519
I need some help.
I writing a JavaFX app which uses java kubernetes client https://github.com/kubernetes-client/java which in turn uses bouncyCastle.
When I run the app from Intellij everything works. ...
0
votes
0
answers
30
views
Getting InaccessibleObjectException when using app dynamics agent [duplicate]
My application is currently using Java 8 and we are using docker image which runs on jre 8.
Due to some compliance reason we need to immediately upgrade docker image which runs on jre 11.
But our code ...
1
vote
1
answer
155
views
How to set the location that JavaCompiler executes from?
I am working with javax.tools.JavaCompiler, using it to programmatically compile Java code from my running Java application. Everything is working great, except that I don't how to execute the ...
0
votes
1
answer
3k
views
Why Java modules usage is not visible/explicit in majority of Maven projects? How does a Maven Projects know which modules to depend on?
As most of you know, Java Modules (Platform Module System) have been introduced in Java 9. Although, I personally never had a chance to explicitly use modules since then. And at the same time, every ...
0
votes
1
answer
115
views
How to add non-modular JARs with split packages to a modular JavaFX project in Intellij idea?
My project uses Mapsforge library for displaying maps, and JavaFX for GUI.
There is a way to compile JavaFX with javafx-maven-plugin and stay in the unmodular paradigm, but it seems against the best ...
2
votes
0
answers
75
views
What is the mechanism for solving multiple Java modules containing the same package(s)?
I have a new Java application that is module based. I need to pull in two dependencies (one module based - sqlite - and one that is not - commonutilities) but both contain transient dependencies to ...
-1
votes
1
answer
96
views
Java modules ResolutionException happening only when unit testing with JUnit5 and IntelliJ
I have a desktop JavaFX application using Java 9 modules system, Gradle and IntelliJ. The application builds and runs perfectly with Gradle run task. I am using it without any issue.
Now I am ...
1
vote
1
answer
1k
views
Error "module not found: jakarta.cdi" when using module-info.java in a Spring boot 3 project
I got the following error when I add the dependency jakarta.transaction to the module-info.java file, as suggested by IntelliJ:
module not found: jakarta.cdi
The module-info.java file dependency is ...
0
votes
1
answer
905
views
Java 9 Modules & IntelliJ: how to configure multiple modules
I am trying to create a very simple java modules project in IntelliJ with multiple modules.
Accordingly documentation in https://openjdk.org/projects/jigsaw/quick-start#multimodulecompile inside src ...
1
vote
1
answer
142
views
Problem reading classes from JPMS module in Spring 6
I have a JPMS application with layer tree. On Layer C I need to create Spring context while Spring framework is located on Layer B:
boot layer
|- Layer B with Spring framework.
|- Layer C ...
0
votes
2
answers
490
views
package com.google.gson.internal.bind.util is declared in module com.google.gson, which does not export it
I got this error message when compiling code generated from the OpenAPI generator:
package com.google.gson.internal.bind.util is declared in module com.google.gson, which does not export it
In my ...
3
votes
1
answer
1k
views
module reads package javax.annotation from both jsr305 and java.annotation
I go the error message:
module reads package javax.annotation from both jsr305 and java.annotation
In my build.gradle I used these dependencies:`
implementation "javax.annotation:jsr305:1.0"...
0
votes
0
answers
199
views
Export com.sun.imageio.plugins.jpeg module in java module application
info look like :
module ir.mehritco.megnatis.faststonecapture {
requires javafx.controls;
requires javafx.fxml;
requires org.controlsfx.controls;
requires org.kordamp.bootstrapfx.core;...