Compile error web module (war), cannot find symbol but the other class didn't show any error

No description
52 Replies
JavaBot
JavaBot9mo ago
This post has been reserved for your question.
Hey @Rag...JN 🌌 🦡 👽 💰! Please use /close or the Close Post button above when your problem is solved. 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.
Rag...JN 🌌 🦡 👽 💰 🐊
what could've been the issue?
Rag...JN 🌌 🦡 👽 💰 🐊
Here this is the one
No description
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
MoonSouhayl
MoonSouhayl9mo ago
that theme looks like VSCode, and i dont like that
Rag...JN 🌌 🦡 👽 💰 🐊
No It's intelli J Just tried and it didn't work
Rag...JN 🌌 🦡 👽 💰 🐊
This is the plug in the war module has
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
there's probably more information before that
@dan1st | Daniel
Rag...JN 🌌 🦡 👽 💰 🐊
This is where it started
dan1st
dan1st9mo ago
well here are the errors
No description
dan1st
dan1st9mo ago
literally Java compiler errors
Rag...JN 🌌 🦡 👽 💰 🐊
but it's already there
dan1st
dan1st9mo ago
is it imported correctly?
Rag...JN 🌌 🦡 👽 💰 🐊
yah I can even view the class by ctrl+click
No description
Rag...JN 🌌 🦡 👽 💰 🐊
This is the class
No description
Rag...JN 🌌 🦡 👽 💰 🐊
How do I check? it usually will show the compile error right? but it works perfectly fine even I can run the web app
dan1st
dan1st9mo ago
Did you run mvn install on the root project? I think maybe the web project doesn't find the other one
Rag...JN 🌌 🦡 👽 💰 🐊
no he can't find the symbol which is the ejb.impl.ClientSessionHandlerBean any advice on what to search for further google research? but also you can see in the other package (servlet) I imported another bean from the same package
Rag...JN 🌌 🦡 👽 💰 🐊
oh wait, so when I ctrl+click, it doesn't show me the code in the ejb package directly instead it shows the compiled class
dan1st
dan1st9mo ago
also in the mvn install command on the root project? Can you show the pom.xml of the project that fails (I think it's web, right?)
Rag...JN 🌌 🦡 👽 💰 🐊
<?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>
<parent>
<groupId>com.rag</groupId>
<artifactId>ee-app</artifactId>
<version>1.0</version>
</parent>

<artifactId>web</artifactId>
<packaging>war</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<?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>
<parent>
<groupId>com.rag</groupId>
<artifactId>ee-app</artifactId>
<version>1.0</version>
</parent>

<artifactId>web</artifactId>
<packaging>war</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.rag</groupId>
<artifactId>ejb</artifactId>
<version>1.0</version>
<type>ejb-client</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.rag</groupId>
<artifactId>core</artifactId>
<type>jar</type>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.0</version>
<scope>compile</scope>
</dependency>

</dependencies>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.rag</groupId>
<artifactId>ejb</artifactId>
<version>1.0</version>
<type>ejb-client</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.rag</groupId>
<artifactId>core</artifactId>
<type>jar</type>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.0</version>
<scope>compile</scope>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>

</plugins>
</build>

</project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>

</plugins>
</build>

</project>
dan1st
dan1st9mo ago
Which module contains ejb.impl?
Rag...JN 🌌 🦡 👽 💰 🐊
yah I tried this?
No description
dan1st
dan1st9mo ago
that's the root project, right? Can you show the pom.xml of that?
Rag...JN 🌌 🦡 👽 💰 🐊
yah ee-app
dan1st
dan1st9mo ago
also I don't know what <type>ejb-client</type> is supposed to do
Rag...JN 🌌 🦡 👽 💰 🐊
it's for client (remotes)
dan1st
dan1st9mo ago
And in the log of the mvn install on the root project, does it list all of your modules? Are you sure it is supposed to access implementation packages then?
Rag...JN 🌌 🦡 👽 💰 🐊
that's where it is useful I guess yah ok it's working after commenting out the type ejb client let me check one more time holly shit yah
dan1st
dan1st9mo ago
https://maven.apache.org/plugins/maven-ejb-plugin/examples/generating-ejb-client.html https://maven.apache.org/plugins/maven-ejb-plugin/examples/ejb-client-dependency.html it looks like ejb-client means you only have the stubs so no actual implementations since these are on the remote side oh and maybe if you do want <type>ejb-client</type>, you may need to add <generateClient>true</generateClient> to the <configuration> of the maven-ejb-plugin in the ejb module
Rag...JN 🌌 🦡 👽 💰 🐊
so ejb client removes everything that is ends with Bean in the end
dan1st
dan1st9mo ago
maybe
Rag...JN 🌌 🦡 👽 💰 🐊
this has to be it
dan1st
dan1st9mo ago
looks like it
No description
Rag...JN 🌌 🦡 👽 💰 🐊
Stubs means?
dan1st
dan1st9mo ago
essentially it means you just have the API, not the implementation and for the implementation, it might e.g. send it to a server which then processes it
Rag...JN 🌌 🦡 👽 💰 🐊
This means it would used the ejb's clean compiled packaged installed jar file?
No description
dan1st
dan1st9mo ago
When you have a dependency, it typically uses the version in your local repository (.m2/repository). This is created when doing mvn install. If none is found, it attempts to download it from a remote repository. and I guess with <type>ejb-client</type>, it looks for a -client.jar in there at the right location which is ~/.m2/repository/your/group/id/your-artifact-id/YOUR_VERSION/
Rag...JN 🌌 🦡 👽 💰 🐊
ok and it couldn't find?
dan1st
dan1st9mo ago
? I was just telling you where it looks for the JAR IntelliJ will probably directly use the other module so you don't have to do mvn install on every change maybe that's why you got different results for IntelliJ and Maven (CLI)
Rag...JN 🌌 🦡 👽 💰 🐊
oh ok mvn and intelij
dan1st
dan1st9mo ago
generally the Maven CLI is the source of thruth
Rag...JN 🌌 🦡 👽 💰 🐊
alright alright thank you so much
JavaBot
JavaBot9mo 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.
Rag...JN 🌌 🦡 👽 💰 🐊
Root cause for this problem was not undertanding the dependency configuration properly
JavaBot
JavaBot9mo ago
Post Closed
This post has been closed by <@910524060771971103>.
Want results from more Discord servers?
Add your server