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.203 Replies
⌛
This post has been reserved for your question.
Hey @nomoney4u! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
So you installed Eclipse IDE for Enterprise Java and Web Developers?
I have installed the correct Eclipse and have loaded my project. I have also added the Tomcat server.
Is your project a Maven project?
Yes it is
So one of your modules has
<packaging>war</packaging>
?yup
you should have a servers view like that
Can you see that?
Yup
right click on it and select "Add or Remove..."
Can you show the modal that pops up?
I see this error
in that project, it seems like Eclipse has detected some errors
Can you open the "Problems" view?
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 presentfirst error is on line 1 of the /war/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
oh, I see
Does one of the errors consist of multiple lines?
Can you compile that project from the command-line (
mvn verify
)?2nd error has to do with a plugin in /app/pom.xml
yeah I think you can configure Eclipse to skip that execution
I've been running
mvn clean install -Pdev
just fine without EclipseI think you should have this in your Window>Preferences
you can probably change "Default mojo execution action to "ignore"
ok so you want to activate the
dev
profileto 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"
It's already selected here
oh ok
good
then you don't need that part
Have you done that?
I did just ran
validate
on the parent under Project Explorer and got a different set of errors under Problemsyup, and that resolves the previous errors but
validate
gave me new errors https://discord.com/channels/648956210850299986/1326967094960459807/1326970487015997484I did just ran
validate
on the parent under Project Explorer and got a different set of errors under Problemsyou can probably ignore the XML schema problems
the
execution
is still there after I set it to ignoreIn that modal, can you click "Open workspace lifecycle mappings metadata"?
yes, it took me to a blank .xml file
ok
What Java version are you using for the project?
1.8.0_301
In the preferences, there should be an "Installed JREs" option
Can you show the content of that?
it looks like cleaning the project fixed that but now it has a different error (ignoring xml schema problem)
Does your project have a "JRE System Library" thing anywhere?
Can you right-click on the error, select "Copy" and paste it here in Discord?
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?
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)
yup, I have 1 in the /war folder
Can you show that one?
was using 2.4, updated to 3.4.0 and it solved that Maven config problem
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
ok good
except maybe that it tries to use JDK 22 but we can fix that later
Try the thing with "Add and Remove..." again
I see this error
Can you right click the war module and open Properties > Project Facets?
What's shown there?
Try changing the version next to "Dynamic Web Module" to 5.0
and try that again
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
change the facet to 1.8.0_301What? but yeah that looks good you should be able to start tomcat ideally start it in debug mode
sorry,
java
in the facetah 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
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
How did you add it?
What Tomcat version do you have installed locally?
What are the errors?
I assume you selected Tomcat v7.0 server there?
yup
Is that application supposed to be run on Tomcat 7?
yes, that is what I'm currently using when manually building out the .war and dropping it in the webapps directory
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
yes, looks right
So you are using Java EE 7 or earlier?
Not sure what that means, the current combination that I was asked to use was 1.8.0_301 + Tomcat 7
Well, Java EE 8 was released in 2017
but ok
and Java EE 7 is from 2013
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
What are you doing after that?
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
Same errors when trying to start Tomcat in debug mode in Eclipse after selecting jdk1.8.0_301
There's more (it's pretty long) but here's a portion of the error
oh that's more useful
Can you show the full output?
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.
Can you try removing your deployment in Eclipse and restart the server?
Do you get the same error?
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?
that
remove your application from that and try starting tomcat without your application
ah, yup, Tomcat runs fine at 8080 without the resource
And you started it from Eclipse?
yup
Can you show what it looks like in the servers view?
Can you add the project using the "Add and Remove" while the server is running?
What happens when doing that?
looks like nothing changed and it's wanting me to restart the server (upon restart, I get the error above)
anything happening in the console?
oh ok
nothing changes in the console when I add the resource, same error above if I have to resource when restarting Tomcat
Try opening the pom.xml of the war module
you should have an "Effective POM" tab in Eclipse
open that and search for maven-compiler-plugin using Ctrl+F
Is there maybe something like that? If yes, what number does it show?
I also noticed that it now have 100 errors in Problems
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?
Weird part is why do I need to fix them if they're working with
mvn clean install
and IJU?or is this an Eclipse issue of not being able to find the right paths?
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
It rebuilt, dropped errors down to 4, refreshed itself, and then back to 100 of 3646 items
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?
yes
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"?
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.I think A2 is supposed to be generated
try undoing that and see what happens
(and reloading the project again)
reloading = clean?
reloading = that
clean just means "delete the
target
folder"no luck, still 3000+ errors
so you changed it to "execute" again?
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?
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?yup
Does Eclipse show any errors in the other module?
Are these classes available in Eclipse?
should I be doing this on the parent module? or the war module?
parent
then it builds all modules
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
ok
Can you show the exact error?
you could also copy it in the problems view as before
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
Can you copy the whole thing here?
press F2 for focusing
and then you should be able to copy it
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.
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.resolveInternalit tries to use JDK 22 you can try going to Window>Preferences>Installed JREs and remove the 22 one
k lol, moving it to 1.8.0_301 increased the errors
Any errors in any of the pom.xml files?
you could try reloading the project (all modules) in Eclipse (without the "clean" option)
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
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?
looks like I can do this, is /app supposed to be in here somehow for it to find the class?
the error definitely tells me there are questionable things going on in the project and that it's very dependent on JDK 8 lol
nope, all pom.xml are good
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?
nothing shows up
Do you also get that error in one of the imports?
What's in "Projects"?
there not being anything (apart from the JDK) is a bit weird
yup, this A2 class is one of the ones that can't be resolved in the 3000+ errors in the Problems view
"resolved + Problems" triggering the bot lol
Can't say I'm innocent about that
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?yup
in its pom.xml
yup
Can you show these?
Is there any dependency between modules?
Can you show what the WAR project looks like expanded?
especially the parts in my image
like
mvn verify
on the root projectwoops, should've named it .txt sorry
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.
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
Do all modules of your project use version
1.2-SNAPSHOT
?
What if you don't clean it after mvn verify
?yup, those have been left untouched since the beginning of time
then it stays like this
In the console, select Open Console>Maven Console
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?
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.
1/9/25, 3:08:44 PM EST: [WARN] [1;33mParameter '[0;1;33museCache[0;1;33m' is unknown for plugin '[0;1;33mmaven-war-plugin[0;1;33m:[0;1;33m3.4.0[0;1;33m:[0;1;33mwar[0;1;33m ([0;1;33mdefault-war[0;1;33m)[0;1;33m'[m
YES there is
in all 3 (parent/war/app) modules
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 beforeit looks like it's used in the war/pom.xml:
<useCache>true</useCache>
I think that option was removed from that plugin
so you could maybe try removing that from your pom.xm las well
new errors after running
mvn eclipse:eclipse
but it has a lot more in the Java Resources for the /war module nowDo these files exist?
yup
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?
yup and yup
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💤
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.
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💤
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.
💤
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.
which files are the errors occuring in?
💤
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.
The same file in the .m2 repo. I have cleared out that folder and got Maven to redownload as well as ran a verification on the .jar
I'm not sure if that's even a problem since Tomcat started ok with the resource added.
I can go to localhost:8080 and see a 404 error. At this point, maybe I just need to somehow point Tomcat to the location where the "exploded war" would be? I'm know IntelliJ Ultimate use that terminology, not sure what that would be in Eclipse world.
normally you tell Eclipse the project you want to deploy on the server in the servers tab
and then it automatically deploys it
but that one sounds like issues in your pom.xml
you have dependencies A using B using A
you should be able to expand/copy the errors and maybe get more information
I followed directions found on google to change that error to "ignore" but it looks like more errors shows up about "source not found" and the existing cycle error is still there. I would love to get on a screenshare if it makes this process easier.
the cycle errors are probably in your pom.xml files
you should be able to copy the error in the problems view and paste it (e.g. here) to see what exactly happens
This is what I'm seeing when going into detail for the cycle error:
check the pom.xml files of app and war
when opening them in Eclipse, there should be an "Effective POM" tab
It looks like app has a dependency on war and war has a dependency on app
at least that's what the error is saying
got it, it looks like I was able to resolve most of the issue that prevented Tomcat to start, now that I can "debug" the war project on the server, it creates this folder (see screenshot). Is it possible to modify the "context" (not sure what the terminology here would be for Eclipse) so I can go to /dev instead of /proj-war ?
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.
What do you mean with context?
The context path/the path where the application is deployed?
out of interest: How did you resolve it?
yup, in IntelliJ, I was able to mark "/dev" and the endpoint would be
http://localhost:8080/dev
yeah you can configure that for the deployment
I think in the servers tab
what's shown there?
I cleaned/rebuild it multiple time and it somehow fixed it (even though errors are still in the Problems tab, Tomcat as able to start with the resource attached) 🤷♂️
also the errors about cycles?
if so, you might really want to check that
The cycles error might be hidden somewhere in the 2k+ errors now, most of them are like the screenshot and they're in the
jpa
project. However, it builds just fine with mvn clean install -Pdev
so I'm not sure what's going on hereI guess the rebuilding things resolved the cycle errors and that fixing it
I think that the types like
Address_
are generated so Eclipse doesn't run the things generating that
or doesn't properly include them in the classpathit shows
(dev)
which I was assuming it knowsWhat happens when double-clicking the deployment? What's shown when right-clicking it?
this part?
no, in that menu
properties
actually that window you have there - are there multiple tabs?
There's the "Modules" tab and this is what it shows
ok yeah then it's deployed on /dev
💤
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.