Configuring Eclipse to use explode war with Tomcat for debugging

I'm a bit new to the Java world and am trying to configure my local environment for a new job. I was able to load my project into IntelliJ Ultimate (IJU) and am trying to replicate the same configuration but in Eclipse because it seems that the Web module/plugin for IJU is not available for IJ CE. Can anyone or @dan1st | Daniel help me configure my Eclipse for this project? Goal: Able to add breakpoint and/or hot-reload Java codes for debugging and development without having to constantly compile and deploy the war file. Thank you in advance.
175 Replies
JavaBot
JavaBot2w ago
This post has been reserved for your question.
Hey @nomoney4u! 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 marked as dormant 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.
dan1st
dan1st2w ago
So you installed Eclipse IDE for Enterprise Java and Web Developers?
nomoney4u
nomoney4uOP2w ago
I have installed the correct Eclipse and have loaded my project. I have also added the Tomcat server.
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
Is your project a Maven project?
nomoney4u
nomoney4uOP2w ago
Yes it is
dan1st
dan1st2w ago
So one of your modules has <packaging>war</packaging>?
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
you should have a servers view like that
No description
dan1st
dan1st2w ago
Can you see that?
nomoney4u
nomoney4uOP2w ago
Yup
dan1st
dan1st2w ago
right click on it and select "Add or Remove..."
No description
dan1st
dan1st2w ago
Can you show the modal that pops up?
nomoney4u
nomoney4uOP2w ago
I see this error
No description
dan1st
dan1st2w ago
in that project, it seems like Eclipse has detected some errors Can you open the "Problems" view?
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
Can you expand the module with the <packaging>war</packaging> in the project explorer and show its content (you can redact the text containing the project name but I specifically want to see the icons and (including the project icons) and whether these things are present
No description
nomoney4u
nomoney4uOP2w ago
first error is on line 1 of the /war/pom.xml <?xml version="1.0" encoding="UTF-8"?>
dan1st
dan1st2w ago
oh, I see Does one of the errors consist of multiple lines? Can you compile that project from the command-line (mvn verify)?
nomoney4u
nomoney4uOP2w ago
2nd error has to do with a plugin in /app/pom.xml
No description
dan1st
dan1st2w ago
yeah I think you can configure Eclipse to skip that execution
nomoney4u
nomoney4uOP2w ago
I've been running mvn clean install -Pdev just fine without Eclipse
dan1st
dan1st2w ago
I think you should have this in your Window>Preferences
No description
dan1st
dan1st2w ago
you can probably change "Default mojo execution action to "ignore" ok so you want to activate the dev profile
dan1st
dan1st2w ago
to do that, you can right-click on the project and select "Properties". Then, under "Maven", you should be able to add "dev" to "Active Maven Profiles"
No description
No description
nomoney4u
nomoney4uOP2w ago
It's already selected here
No description
dan1st
dan1st2w ago
oh ok good then you don't need that part Have you done that?
nomoney4u
nomoney4uOP2w ago
I did just ran validate on the parent under Project Explorer and got a different set of errors under Problems
No description
nomoney4u
nomoney4uOP2w ago
yup, and that resolves the previous errors but validate gave me new errors https://discord.com/channels/648956210850299986/1326967094960459807/1326970487015997484
dan1st | Daniel
I did just ran validate on the parent under Project Explorer and got a different set of errors under Problems
No description
dan1st
dan1st2w ago
you can probably ignore the XML schema problems
nomoney4u
nomoney4uOP2w ago
the execution is still there after I set it to ignore
dan1st
dan1st2w ago
In that modal, can you click "Open workspace lifecycle mappings metadata"?
nomoney4u
nomoney4uOP2w ago
yes, it took me to a blank .xml file
No description
dan1st
dan1st2w ago
ok What Java version are you using for the project?
nomoney4u
nomoney4uOP2w ago
1.8.0_301
dan1st
dan1st2w ago
In the preferences, there should be an "Installed JREs" option
No description
dan1st
dan1st2w ago
Can you show the content of that?
nomoney4u
nomoney4uOP2w ago
No description
nomoney4u
nomoney4uOP2w ago
it looks like cleaning the project fixed that but now it has a different error (ignoring xml schema problem)
No description
dan1st
dan1st2w ago
Does your project have a "JRE System Library" thing anywhere?
No description
dan1st
dan1st2w ago
Can you right-click on the error, select "Copy" and paste it here in Discord?
nomoney4u
nomoney4uOP2w ago
Description Resource Path Location Type Exception java.lang.ExceptionInInitializerError [in thread "Worker-45: Building"] pom.xml /war line 1 Maven Configuration Problem not sure, where can I find this?
dan1st
dan1st2w ago
expand the project in the project explorer In the pom.xml this occurs in, is there any mention of a "maven-war-plugin"? If yes, try changing the version of that to 3.3.2 or 3.4.0 (because of https://stackoverflow.com/q/72837802/10871900)
nomoney4u
nomoney4uOP2w ago
yup, I have 1 in the /war folder
dan1st
dan1st2w ago
Can you show that one?
nomoney4u
nomoney4uOP2w ago
was using 2.4, updated to 3.4.0 and it solved that Maven config problem
No description
dan1st
dan1st2w ago
Now can you show that part of the war project? These errors here are validations/Eclipse detecting invalid things in other files but these shouldn't stop you from deploying stuff
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
ok good except maybe that it tries to use JDK 22 but we can fix that later
dan1st
dan1st2w ago
Try the thing with "Add and Remove..." again
No description
dan1st | Daniel
I see this error
No description
dan1st
dan1st2w ago
Can you right click the war module and open Properties > Project Facets? What's shown there?
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
Try changing the version next to "Dynamic Web Module" to 5.0 and try that again
nomoney4u
nomoney4uOP2w ago
ok, I have gone ahead and: 1. change the facet to 1.8.0_301 2. recreate the Tomcat server 3. add the resource into the Tomcat server
No description
dan1st
dan1st2w ago
change the facet to 1.8.0_301
What? but yeah that looks good you should be able to start tomcat ideally start it in debug mode
nomoney4u
nomoney4uOP2w ago
sorry, java in the facet
No description
dan1st
dan1st2w ago
ah ok I wouldn't change that there but ok Note that this configuration may be overridden at any point when reloading the project normally you'd configure these differently
nomoney4u
nomoney4uOP2w ago
so it looks like the tomcat that Eclipse is trying to start is not the same as my default installed Tomcat and it failed to start with a lot of errors
dan1st
dan1st2w ago
How did you add it? What Tomcat version do you have installed locally? What are the errors?
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
I assume you selected Tomcat v7.0 server there?
No description
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
Is that application supposed to be run on Tomcat 7?
nomoney4u
nomoney4uOP2w ago
yes, that is what I'm currently using when manually building out the .war and dropping it in the webapps directory
No description
dan1st
dan1st2w ago
ok so the server is currently not running? THat's good Can you remove it from Eclipse and add it again? and show me the steps you are taking
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
yes, looks right So you are using Java EE 7 or earlier?
nomoney4u
nomoney4uOP2w ago
Not sure what that means, the current combination that I was asked to use was 1.8.0_301 + Tomcat 7
dan1st
dan1st2w ago
Well, Java EE 8 was released in 2017 but ok and Java EE 7 is from 2013
nomoney4u
nomoney4uOP2w ago
The project has been there for a long time and we're looking to upgrade it soon but in order to do that, I need to have it running locally first
dan1st
dan1st2w ago
What are you doing after that?
nomoney4u
nomoney4uOP2w ago
No description
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
Change "Workspace default JRE" to your Java 8 installation if you are starting Tomcat 7 with JDK 22 or whatever else you have, it won't work
nomoney4u
nomoney4uOP2w ago
Same errors when trying to start Tomcat in debug mode in Eclipse after selecting jdk1.8.0_301
No description
nomoney4u
nomoney4uOP2w ago
There's more (it's pretty long) but here's a portion of the error
dan1st
dan1st2w ago
oh that's more useful
nomoney4u
nomoney4uOP2w ago
Jan 09, 2025 1:40:17 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.109
Jan 09, 2025 1:40:17 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jan 09, 2025 1:40:17 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [340] milliseconds.
Jan 09, 2025 1:40:18 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/dev]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1227)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:804)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1689)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1679)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Jan 09, 2025 1:40:17 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.109
Jan 09, 2025 1:40:17 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jan 09, 2025 1:40:17 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [340] milliseconds.
Jan 09, 2025 1:40:18 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/dev]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1227)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:804)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1689)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1679)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
dan1st
dan1st2w ago
Can you show the full output?
nomoney4u
nomoney4uOP2w ago
Here's the full output https://pastebin.com/G4vLyu9t
Pastebin
Jan 09, 2025 1:40:17 PM org.apache.catalina.startup.VersionLoggerLi...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
dan1st
dan1st2w ago
Can you try removing your deployment in Eclipse and restart the server? Do you get the same error?
nomoney4u
nomoney4uOP2w ago
Not sure what this mean. Are you saying to remove the newly added Tomcat server and manually move the .war file to the original Tomcat's webapps folder and manually start the Tomcat server?
dan1st
dan1st2w ago
that
No description
dan1st
dan1st2w ago
remove your application from that and try starting tomcat without your application
nomoney4u
nomoney4uOP2w ago
ah, yup, Tomcat runs fine at 8080 without the resource
dan1st
dan1st2w ago
And you started it from Eclipse?
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
Can you show what it looks like in the servers view?
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
Can you add the project using the "Add and Remove" while the server is running? What happens when doing that?
nomoney4u
nomoney4uOP2w ago
No description
nomoney4u
nomoney4uOP2w ago
looks like nothing changed and it's wanting me to restart the server (upon restart, I get the error above)
dan1st
dan1st2w ago
anything happening in the console? oh ok
nomoney4u
nomoney4uOP2w ago
nothing changes in the console when I add the resource, same error above if I have to resource when restarting Tomcat
dan1st
dan1st2w ago
Try opening the pom.xml of the war module
dan1st
dan1st2w ago
you should have an "Effective POM" tab in Eclipse
No description
dan1st
dan1st2w ago
open that and search for maven-compiler-plugin using Ctrl+F
dan1st
dan1st2w ago
Is there maybe something like that? If yes, what number does it show?
No description
nomoney4u
nomoney4uOP2w ago
I also noticed that it now have 100 errors in Problems
No description
dan1st
dan1st2w ago
oh yeah you'd probably need to fix that right-click on the module and select Maven > Update Maven project Can you show me the modal that appears?
nomoney4u
nomoney4uOP2w ago
Weird part is why do I need to fix them if they're working with mvn clean install and IJU?
No description
nomoney4u
nomoney4uOP2w ago
or is this an Eclipse issue of not being able to find the right paths?
dan1st
dan1st2w ago
select all the modules and press ok - what happens? it seems like these errors come from resources which should normally not have any Java files
nomoney4u
nomoney4uOP2w ago
It rebuilt, dropped errors down to 4, refreshed itself, and then back to 100 of 3646 items
dan1st
dan1st2w ago
You redacted parts of the "Path" - I assume that shows your project name? Does it show other things as well? Are the errors in generated code?
nomoney4u
nomoney4uOP2w ago
yes
dan1st
dan1st2w ago
or do these files maybe reference generated code? You remember when I asked you to change the part about lifecycle mappings from "execute" to "ignore"?
nomoney4u
nomoney4uOP2w ago
it seems that there is a class used in /war/.java that is calling from /app/.java return new URI(A2.getNewServer() + "blah"); In this case A2 cannot be resolved.
dan1st
dan1st2w ago
I think A2 is supposed to be generated try undoing that and see what happens (and reloading the project again)
nomoney4u
nomoney4uOP2w ago
reloading = clean?
dan1st
dan1st2w ago
reloading = that clean just means "delete the target folder"
nomoney4u
nomoney4uOP2w ago
no luck, still 3000+ errors
dan1st
dan1st2w ago
so you changed it to "execute" again?
nomoney4u
nomoney4uOP2w ago
yup opening the same project in IJ, it shows that these classes are from /app/ folder and not /war/ so maybe IJ was able to find it while Eclipse is having problem deriving the path?
dan1st
dan1st2w ago
ok then idk what Maven is generating that doesn't generate it with Eclipse When you run mvn verify, it works, right? i.e. the errors are gone so from the other module?
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
Does Eclipse show any errors in the other module? Are these classes available in Eclipse?
nomoney4u
nomoney4uOP2w ago
should I be doing this on the parent module? or the war module?
dan1st
dan1st2w ago
parent then it builds all modules
nomoney4u
nomoney4uOP2w ago
I noticed that the "execution" error is on the /app module. I feel like because the /app module is having problems that these classes can't be imported to the /war module
dan1st
dan1st2w ago
ok Can you show the exact error? you could also copy it in the problems view as before
nomoney4u
nomoney4uOP2w ago
this seems to be the only error in the pom.xml for the /app module note: I can't find it in the problems view since it only shows 100/3000
No description
dan1st
dan1st2w ago
Can you copy the whole thing here? press F2 for focusing and then you should be able to copy it
nomoney4u
nomoney4uOP2w ago
Here's the full error https://pastebin.com/eNE8Bthh
Pastebin
[Marker [on: /-app/pom.xml, id: 135598, type: org.eclipse.m2e.core....
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
dan1st
dan1st2w ago
Could not find artifact com.sun🛠️jar:22.0.2 at specified path C:\Program Files\Java\openlogic-openjdk-22.0.2+9-windows- x64/../lib/tools.jar at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal
it tries to use JDK 22 you can try going to Window>Preferences>Installed JREs and remove the 22 one
nomoney4u
nomoney4uOP2w ago
k lol, moving it to 1.8.0_301 increased the errors
No description
dan1st
dan1st2w ago
Any errors in any of the pom.xml files? you could try reloading the project (all modules) in Eclipse (without the "clean" option)
nomoney4u
nomoney4uOP2w ago
nope, that fixed the /app module, all good in the /app and /jpa I deleted the errors and reload the project, it's back to 3646 errors, all in /war this time
dan1st
dan1st2w ago
oh ok Do these missing classes exist in /app? or any of the other modules? you can press Ctrl+Shift+T and enter the class name Ctrl+Shift+T Is there any error in any pom.xml?
nomoney4u
nomoney4uOP2w ago
looks like I can do this, is /app supposed to be in here somehow for it to find the class?
No description
No description
dan1st
dan1st2w ago
the error definitely tells me there are questionable things going on in the project and that it's very dependent on JDK 8 lol
nomoney4u
nomoney4uOP2w ago
nope, all pom.xml are good
dan1st
dan1st2w ago
I would want you to check the "Libraries" tab there anyway afterwards but if you use Ctrl+Shift+T and enter the clas name (A2) in the modal, what happens?
nomoney4u
nomoney4uOP2w ago
nothing shows up
dan1st
dan1st2w ago
Do you also get that error in one of the imports?
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
What's in "Projects"? there not being anything (apart from the JDK) is a bit weird
nomoney4u
nomoney4uOP2w ago
yup, this A2 class is one of the ones that can't be resolved in the 3000+ errors in the Problems view
dan1st
dan1st2w ago
"resolved + Problems" triggering the bot lol Can't say I'm innocent about that
nomoney4u
nomoney4uOP2w ago
No description
dan1st
dan1st2w ago
you could try the thing with compiling from the command-line again and the errors happen in the war project? Does the war project have any <dependency>s?
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
in its pom.xml
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
Can you show these? Is there any dependency between modules?
dan1st
dan1st2w ago
Can you show what the WAR project looks like expanded?
No description
dan1st
dan1st2w ago
especially the parts in my image like mvn verify on the root project
nomoney4u
nomoney4uOP2w ago
woops, should've named it .txt sorry
nomoney4u
nomoney4uOP2w ago
https://pastebin.com/zs14aUK5 here's a pastebin of the same list of dependencies
Pastebin
- Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
nomoney4u
nomoney4uOP2w ago
No description
nomoney4u
nomoney4uOP2w ago
No description
nomoney4u
nomoney4uOP2w ago
for a split second before it switch to 3000+ errors (when I clean the project at the parent level), I see this something tells me there's something in Eclipse that is not reading the pom.xml correctly and can't find the /app module vs how IJ (both U and CE) can read the dependencies just fine
No description
dan1st
dan1st2w ago
Do all modules of your project use version 1.2-SNAPSHOT? What if you don't clean it after mvn verify?
nomoney4u
nomoney4uOP2w ago
yup, those have been left untouched since the beginning of time then it stays like this
dan1st
dan1st2w ago
In the console, select Open Console>Maven Console
No description
dan1st
dan1st2w ago
and then reload the projects that should show you a lot of stuff Can you show that? I have the suspicion that Eclipse resolves dependencies using the Java version you are using for running Eclipse (which is Java 17, 21 or 22) and that causing the issue specifically whatever happens when reloading the project - including errors and warnings occuring during that btw is there anything mentioning "eclipse" or "m2e" in any of the pom files?
nomoney4u
nomoney4uOP2w ago
Pastebin
1/9/25, 3:08:36 PM EST: [INFO] Update started1/9/25, 3:08:37 PM EST...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
dan1st
dan1st2w ago
1/9/25, 3:08:44 PM EST: [WARN] Parameter 'useCache' is unknown for plugin 'maven-war-plugin:3.4.0:war (default-war)'
nomoney4u
nomoney4uOP2w ago
YES there is in all 3 (parent/war/app) modules
dan1st
dan1st2w ago
Do you have a <useCache> in the maven-war-plugin config? you could also try running mvn eclipse:eclipse in the root Module that might set up the Eclipse project for you but make a backup of the project before
nomoney4u
nomoney4uOP2w ago
it looks like it's used in the war/pom.xml: <useCache>true</useCache>
dan1st
dan1st2w ago
I think that option was removed from that plugin so you could maybe try removing that from your pom.xm las well
nomoney4u
nomoney4uOP2w ago
new errors after running mvn eclipse:eclipse but it has a lot more in the Java Resources for the /war module now
No description
dan1st
dan1st2w ago
Do these files exist?
nomoney4u
nomoney4uOP2w ago
yup
dan1st
dan1st2w ago
Can you rename it/change the file extension so that the file ends with .zip instead of .jar? After doing that, is it a valid zip file?
nomoney4u
nomoney4uOP2w ago
yup and yup
dan1st
dan1st2w ago
Can you run mvn verify or a similar command again? after you renamed/removed the file that should redownload the file Can you show the icon of the project in the project explorer in Eclipse? and also expand it and show what's there project icons actually contain quite a bit of information about what Eclipse thinks about the project if the icons of different modules look differently, I'd be interested in all variants you are seeing
JavaBot
JavaBot2w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
nomoney4u
nomoney4uOP2w ago
Sorry, had to take a break from this earlier. It seems that this error is the current culprit. I deleted the whole .m2/repository directory and used mvn verify to rebuild it but this error keeps coming back when I load Eclipse again. https://discord.com/channels/648956210850299986/1326967094960459807/1327009757747347497
JavaBot
JavaBot2w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?