• Post Reply Bookmark Topic Watch Topic
  • New Topic

Eclipse: Developing Tomcat Application in Docker Container  RSS feed

 
John Stephens
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

From my experience with other apps and services, my dev process is create a container and mount my dev folder into that container. Not sure if that's the right thing to do but I'm trying to do the same thing with Tomcat. The problem starts when I want to create a project in Eclipse. I follow articles and create a Dynamic Web Project but it requires local Tomcat installation which I want to avoid.

Am I doing something wrong here?

Thanks
 
salvin francis
Bartender
Posts: 1664
37
Eclipse IDE Google Web Toolkit Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what you need exactly.
For a Dynamic web project, Eclipse does not always need you define the server. You can select "Target runtime" as "<None>" and it will create a project for you without bothering you about the server choice. You can later add servers in the Project Facets UI.
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't use "dynamic web project". I loathe and despise the built-in Tomcat support for JEE Eclipse and use the sysdeo/mongrel plugin, instead.

I usually provide a mountpoint in the container under "/opt" and softlink that to a link under TOMCAT_HOME/webapps. For example: /usr/local/tomcat/webapps/mywebapp -> /opt/mywebapp. Then I direct the build unto the external directory location that mounts in Docker as /opt/mywebapp.
 
John Stephens
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for response.

Tim, I've tried mongrel but it didn't work in Neon and Oxygen version of Eclipse. I've tried similar Eclipse Tomcat Plugin which is derived from sysdeo. When I start Tomcat it wants me to set up preferences. And then I trapped again. I need to install tomcat locally to be able to update preferences. Or maybe I didn't get you right? Sorry.

Salvin, I'll try to make it work without server by just deploying on container. Tomcat 9 doesn't require server restart and it reloads war files automatically.
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid that I'm not actively doing Tomcat development at the moment, since the people who employed me to do that are seriously in arrears regarding payment, but the story is that if you search the Eclipse Marketplace (In the Eclipse Help menu) and look for "Eclipse Tomcat Plugin 9.1.0" you'll find something equivalent.

WTP is an abomination that seriously mangles Tomcat's internal operations, which is why I avoid it even though it comes pre-installed. The sysdeo/mongrel plugin did require you to install a stand-alone copy of Tomcat (actually, so does WTP, IIRC), but you then configure and maintain Tomcat directly, just like you would on an IDE-free production server. WTP makes imperfect copies of configuration information and uses that, which is why I despise it so much.

You've always been able to hot-deploy (and re-deploy) webapps in Tomcat. The problems came from 2 sources: 1) versions of the JVM that used PermGen storage wouldn't release old PermGen space (which was a major issue for apps using Hibernate, for example). And static classes tended not to re-initialize when then new version of the app loaded.

PermGen went away with Java 8, but I don't know what, if any progress has been made on ensuring that the new app load acts totally clean in static resources.
 
John Stephens
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim, sorry for replying late. This is my side learning project. And unfortunately with Java there are many unknowns so it's tough to learn on practise. I'll try to start with maven as my project generator. I want to develop auth-server and will start with simple maven-archetype-webapp. And I'll try to deploy my war file automatically using Jenkins (have very little experience. Hope it's possible).

I'll not be concerned about PermGen for now, because I'm still on dev environment. Anyways if you feel I'm on wrong direction please let me know
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!