• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deploying Microprofile on Tomcat?

 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone successfully managed to deploy a Microprofile application on Tomcat? I have read a lot of pages, and am still unclear what the easiest way to create an MP war file for Tomcat is, or if there even is a way. The MP Starter offers various runtimes, but not Tomcat, and even TomEE seems to support only a fairly old version of MP (2.1).

I'm also unclear if those "runtimes" are just a set of libraries that can be deployed to any JEE server, or if a Web Profile server like Tomcat will suffice, or if they're standalone servers.

Has anyone gone down this route and can shed some light on it?

(It doesn't help with building projects with a lot of dependencies that the Maven repo is rather unreliable this week, but that's a different topic.)
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Microprofile leverages heavily on Maven and there are no maven achetypes for Microprofile on Tomcat. Microprofile claims to be a JEE development and Tomcat only implements a minimal JEE stack. TomEE is Apache's attempt to make Tomcat more of a full-stack platform.

The difference is critical. To get full-stack JEE functions on vanilla Tomcat you have to include within your WAR libraries to supply the missing subsystems such as EJB/JPA, JMS, JavaMail and so forth. And, of course, stuff to handle things like JAX-TS and JSON. So a WAR build for Tomcat using advanced JEE functions is very different and much more complicated than a build for TomEE, Wildfly or WebSphere. So I wouldn't get too hopeful about seeing support there anytime soon.

It's likely that you could find some stuff in the advanced development source for Microprofile on TomEE for newer versions, but you'd probably have to fill in the missing parts yourself. Of course, if you're ambitious enough, you could probably join the team and promote the TomEE version yourself!
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, it bills itself as based on (parts of) JEE, but since it relies only on JAX-RS, CDI and JSON-B/P, I figured there should be a way to deploy it on Tomcat. But as you noted, not even TomEE seems to be a priority for them.
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:since it relies only on JAX-RS, CDI and JSON-B/P, I figured there should be a way to deploy it on Tomcat.



At the moment. I don't think they were guaranteeing that. But none of the above are built into Tomcat, unless CDI has been added since I last looked in detail. So you'd have to include the implementation jars in the Tomcat WAR and that means extra complications in the POM. Plus, while Microprofile itself doesn't need any other JEE features, I don't think it ruled out your using additional JEE resources in the Microprofile application itself. Such as JPA persistence.
 
Marshal
Posts: 4501
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:TomEE is Apache's attempt to make Tomcat more of a full-stack platform.


More than an attempt.  TomEE is Java EE 7 certified.

I have used version 7.1.0 for several projects using EJB/CDI/JSP/JMS/JPA/JTA/JAX-RS/JAX-B/JSON-P without issue.
 
Ron McLeod
Marshal
Posts: 4501
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't looked a the Java EE Micro Profiles, but you can exclude functionality that you don't need to reduce the deployment size.

For example - here I didn't need JPA, JSP, or XML processing:
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I haven't looked a the Java EE Micro Profiles, but you can exclude functionality that you don't need to reduce the deployment size.


Well, MicroProfile is not part of Java EE or Jakarta EE, it's just built on top of some of the specs. I've investigated some more, and apparently servers such as Tomcat or TomEE are not on the agenda for the MP community. In fact, they're seen by some as too heavyweight (even though Tomcat can start up just as fast as an MP server - no surprise, because an MP server would also have to support the Servlet and JAX-RS specs and all that comes with that). The favored deployment mechnism seems to be a single jar file that contains both the server and the application. That separation of the services runtime and the web frontend a server like Tomcat might serve is seen as an advantage not a drawback. I think I agree with that point of view if one is to completely separate the running of any micro services from higher level web services that might be seen by the outside world.

I've settled for OpenLiberty, an open source offshoot of WebSphere's Liberty profile. Builds quickly with Maven, and starts up fast.
 
Ron McLeod
Marshal
Posts: 4501
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't had the time to dig in to it myself (although I am very interested), but I thought that Tomitribe was working on creating MicroProfile based microservice deployables using existing TomEE/Apache technologies.
 
Ron McLeod
Marshal
Posts: 4501
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a test and learning exercise, I've ported a few smallish JEE projects over to Quarkus and was surprised at how easy the migrations were.  Some of the features of JEE such as EJBs doesn't existing in MicroProfile environments, but for what I needed, injection using CDI filled the gap.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic