Error occurred during initialization of boot layerjava.lang.module.ResolutionException:

So I tried to use one java project I have as a library for another project. I built the project into a .jar file and put it in as a library in the other project. In the module-info.java for the project I am trying to import as a library I have a dependency for fastjson. Here are the contents of module-info.java:
module java.downloader{
requires fastjson;
exports com.help.downloader;

}
module java.downloader{
requires fastjson;
exports com.help.downloader;

}
here is the module-info.java for the module I am trying to import in:
module com.example.attempt {
requires javafx.controls;
requires javafx.fxml;
requires javafx.media;
requires java.downloader;


opens com.example.attempt to javafx.fxml;
exports com.example.attempt;

}
module com.example.attempt {
requires javafx.controls;
requires javafx.fxml;
requires javafx.media;
requires java.downloader;


opens com.example.attempt to javafx.fxml;
exports com.example.attempt;

}
when I try to run it I get this: Error occurred during initialization of boot layer java.lang.module.ResolutionException: Module java.downloader contains package com.alibaba.fastjson.util, module fastjson exports package com.alibaba.fastjson.util to java.downloader
46 Replies
JavaBot
JavaBot2y ago
This post has been reserved for your question.
Hey @nikcho-kouhai! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
stechy1
stechy12y ago
Hi, can you show us at least file structure of both modules?
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
this is what its actually called by the way
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
before it was java-youtube-downloader I renamed them in a bit of a desperate attempt it did not work though. just keep in mind that's what they are called now and the problem ain't there
stechy1
stechy12y ago
Well, from my experience of working with modules, I would recommend you to name modules same as your package. It will prevent a lot of unexpected issues.
nikcho-kouhai
nikcho-kouhaiOP2y ago
I had to afk for a bit but now I'm back I'll revert the name of the package to how it was before and rename the module to match the name of the package and see if that helps same crap
stechy1
stechy12y ago
Still same error?
nikcho-kouhai
nikcho-kouhaiOP2y ago
okay so I fixed it by just importing the project as a module instead of using the .jar file I still cannot understand what the problem was but now I have another issue
stechy1
stechy12y ago
Ok, what is the problem now?
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
my other module which was called "attempt" is ....is just missing bro what has java been smoking weird shit has been hapenning the past 3 days my source folder turned into a normal folder 2-3 times and now one of my modules is just gone the weirdest things is that I can still use the classes that were in that module but I cannot see the module itself
stechy1
stechy12y ago
And is is gone from the file system or only IntelliJ do not see it?
nikcho-kouhai
nikcho-kouhaiOP2y ago
they aren't gone from the file system I can run them just fine I have them open as tabs on my IDE
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
the class "VideoPlayer" for example is from that other module
stechy1
stechy12y ago
Have you tried to update Maven project in IntelliJ? In Maven tab, there is a refresh button Sometimes it helps
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
I have 2 god damn pom files 💀
stechy1
stechy12y ago
If not, Maven can not read the structure properly and that is causing issues Now I understand Show each of them You messed it up
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
uh the other one be tool ong sec
stechy1
stechy12y ago
Just the beginning
nikcho-kouhai
nikcho-kouhaiOP2y ago
<?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://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.github.ikiulian</groupId> <artifactId>java-youtube-downloader</artifactId> <version>3.2.2</version> <packaging>pom</packaging> <name>Java youtube video downloader</name> <description>Java parser for retrieving youtube video meta info</description> <licenses> <license> <name>The Unlicense</name> <url>http://unlicense.org/</url> <distribution>repo</distribution> </license> </licenses> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>17</source> <target>17</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.0</version> </plugin> </plugins> </build> I like how one uses java 19 and the other one 17
stechy1
stechy12y ago
It is so confusing. Please start from scratch. Create two new Maven projects and copy code into new ones. The current setup doesn't make sense.
nikcho-kouhai
nikcho-kouhaiOP2y ago
okay I look into this folder and its completely unrelated, I have got no idea why its here its about as useful as me so I'm just gonna delete it
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
it also holds the other pom.xml file yeah that's what I've been telling myself to do for a while I'll try that now I suppose
stechy1
stechy12y ago
Than do it
nikcho-kouhai
nikcho-kouhaiOP2y ago
okay I did it and now
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
I do have two modules which is nice but uh yeah I still have an issue
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
bro how can u not find it IF THERE'S LITERALLY 3 OF IT
stechy1
stechy12y ago
Is it a Maven project? Have you added a dependency? Did IntelliJ recognized this dependency?
nikcho-kouhai
nikcho-kouhaiOP2y ago
I don't think I can understate the low amounts of idea I have about what the hell is going on, its like atomic levels of "I have literally 0 idea"
nikcho-kouhai
nikcho-kouhaiOP2y ago
No description
nikcho-kouhai
nikcho-kouhaiOP2y ago
its literally right there
stechy1
stechy12y ago
Okay, than check which module does it exports
nikcho-kouhai
nikcho-kouhaiOP2y ago
wait I deleted the requires fastjson; line re-wrote it and now it works
stechy1
stechy12y ago
See 😀
nikcho-kouhai
nikcho-kouhaiOP2y ago
it WORKS dude I can't even thank you
JavaBot
JavaBot2y ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
nikcho-kouhai
nikcho-kouhaiOP2y ago
just . thanks I don't know how it got to this point in the first place but hopefully nothing blows up in my face again
stechy1
stechy12y ago
You are welcome 🤗
nikcho-kouhai
nikcho-kouhaiOP2y ago
:thumbsupcat:
JavaBot
JavaBot2y ago
Post Closed
This post has been closed by <@359755548973072397>.
Want results from more Discord servers?
Add your server