• 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

Static file - Chicken and egg

 
Greenhorn
Posts: 29
  • Number of slices to send:
    Optional 'thank-you' note:
Tomcat 9

One of my (vendor) applications needs to read a static file over http to setup some internal configuration related to relying party registry as part of SAML authentication. I put this XML file in the webapps/ROOT folder so it can be accessed over https://server/filename.xml

When Tomcat starts up, catalina.out shows that the vendor app is unable to read the static file during its startup because, presumably, Catalina is not yet up (even though I can see that the ROOT webapp is deployed) - Eventually the app times out and then I see the Catalina server online message. At this point, the static file can be accessed. But that's too late for the app because it needs the file as part of its startup.

How is this sort of thing handled?

Thanks
 
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:
Well, to start with, you shouldn't be sticking your files into other people's webapps. By default, TOMCAT_HOME/webapps/ROOT contains Tomcat's administrative web application. Which is a secured application in addition to belonging to Tomcat.

Tomcat is NOT a file server. A Web Server of any kind is not a file server, but JEE servers especially are not. Don't be fooled by the fact that URLs resemble filesystem paths. They are not filesystem paths, they are resource paths, and while in certain cases, a resource path can be translated fo a "file path" within a WAR, there are very specific rules about that.

I used quotes, because officially a WAR is a ZIP file and its contents are not considered as files by the OS. Tomcat "exploded" those WARs by default, and the exploded WAR is a directory/file structure, but that's beside the point.

Truthfully, if I needed to serve up a simple file via HTTP, I'd either set up a resource path in a standard (non-JEE) webapp server like Apache, Nginx or IIS or I'd knock out a NodeJS dedicated server. Setting up a JEE webapp just to serve one file os more trouble than it's worth.
 
Bartender
Posts: 2436
13
  • Number of slices to send:
    Optional 'thank-you' note:
I am not sure if I should add more discussion to this thread.
Nowadays, with Spring Boot, people use embedded Tomcat server instead of deploying WAR to an external Tomcat.
Also, one of the Spring Framework advocate, Josh Long has a quote "make jar , not war". So, that means we can package
Spring Boot applications in jar files, instead of using war files.
 
Saloon Keeper
Posts: 15621
366
  • Number of slices to send:
    Optional 'thank-you' note:
It sounds like you're trying to host the SAML metadata file. This is usually the responsibility of the identity provider service.

Presumably, your metadata file also contains the address of the identity provider that the vendor application authenticates against. Does the service at this address not host its own copy of the metadata?

I also find it very strange that the vendor app must retrieve the file through HTTP. Most applications that use SAML authentication are also able to read a metadata file that is bundled with the application. Maybe you can hack around it by configurating the location of the metadata file using the file protocol, rather than the http protocol.

Anyway, if you're stuck with having to host the metadata file yourself, then I recommend hosting it in a separate web server. You can do it in a second Tomcat instance, or as Tim has pointed out, you can also do it with another web server.

Himai Minh wrote:Nowadays, with Spring Boot, people use embedded Tomcat server instead of deploying WAR to an external Tomcat.


That assumes that you write your application using Spring. The Java web application development ecosystem consists of more than just Spring.

Also, one of the Spring Framework advocate, Josh Long has a quote "make jar , not war". So, that means we can package Spring Boot applications in jar files, instead of using war files.


This might be a nice maxim for small to medium size development houses, but many larger developers have a very mature infrastructure of finely tuned application servers, and require you to deploy your application into them as a WAR. Bundling an embedded application server with every application is nice if you want to quickly deploy a simple web application at your customers, but for more complex enterprise software it is not only pointless, it's wasteful as well.
 
Tim Holloway
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:

Stephan van Hulst wrote:
This might be a nice maxim for small to medium size development houses, but many larger developers have a very mature infrastructure of finely tuned application servers, and require you to deploy your application into them as a WAR. Bundling an embedded application server with every application is nice if you want to quickly deploy a simple web application at your customers, but for more complex enterprise software it is not only pointless, it's wasteful as well.


Well, I'm glad we have Spring Boot, and it does have its place even in complex enterprises,, as it is well-suited to containerized deployment. But that doesn't mean that it's the best solution for every JEE webapp deployment.

More to the point, as I said earlier, it's simply too much time and resources to create a JEE webapp just to serve up a single file. That's even more true for Spring Boot which combines webapp + server.
 
Himai Minh
Bartender
Posts: 2436
13
  • Number of slices to send:
    Optional 'thank-you' note:
I think nowadays, people are migrating from a monolith to microservices using Spring Boot.
That says, a project is now divided into smaller independent/autonomous projects using Spring Boot. Each Spring Boot project has its own embedded Tomcat server.
That explains why Josh Long advocates "make jar, not war".


 
Stephan van Hulst
Saloon Keeper
Posts: 15621
366
  • Number of slices to send:
    Optional 'thank-you' note:
You are implying that a microservice architecture necessarily requires a separate application server per service. That just isn't the case. Microservices packaged as a plain old WAR without an embedded application server are still microservices.

Himai Minh wrote: I think nowadays, people are migrating from a monolith to microservices using Spring Boot.

That says, a project is now divided into smaller independent/autonomous projects using Spring Boot.


The point of Spring Boot is not the development of microservices. You CAN develop microservices with Spring Boot, but you can just as easily develop them without Spring Boot.

That explains why Josh Long advocates "make jar, not war".


The point that Josh Long makes is that it's easier to set up an application that uses an embedded application server that is tailored to the application, than it is to configure a single application server to host a wide array of applications. That is absolutely true.

However, if I already have an application server in place, and I'm willing to adapt my application to the platform it is running on (instead of the other way around), then I'd go as far as to say that it's at least as easy and quick to develop a WAR that targets it, as it is to develop a standalone application with an embedded application server.

The point is that blindly following a mantra like "Make JAR not WAR" is just naïve. You always need to consider the circumstances you're in, and in some circumstances it simply doesn't make sense to bundle your application with an embedded server.
 
Tim Holloway
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:
If you have 47 Spring Boot applications deployed on 1 machine, you effectively have 47 Tomcat instances, each of which has to be configured with its own unique port number because no modern OS allows multiple applications to share a single TCP/IP port.

In such a case, having the overhead of only 1 (or a few) Tomcat instance(s) with concomitant resource sharing can be very attractive. Easier to manage as a complete macro-system, less overall resource usage. And actually, I'm not sure that every tunable Tomcat option can be easily set in Spring Boot.

Spring Boot is a very useful tool, but remember the adage about the small child with the hammer.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic
vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |