Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

servlet deployed outside of web app

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

we have a need to have a "global" servlet. we'd like to create a servlet and deploy a .jar file into say the jboss lib folder and have that servlet be accessable from any deployed war. the purpose of the servlet is to verify an application's health (lookup an applications jndi values and so forth). we'd like to be able to deploy this without having to deploy all of our applications into production. is there a way to inject this into all our web applications without touching the web.xml to define the servlet?

thanks!
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mark Lybarger:


we'd like to create a servlet and deploy a .jar file into say the jboss lib folder and have that servlet be accessable from any deployed war.



A servlet going to jboss's lib folder.I do not think its possible.Servlets can only live within a web application.

You have to write a servlet and pack it in web application structure (along with a web.xml ), deploy in server.All the other applications can make use of the servlet the usual way.

But what kind of monitoring you would be doing from that servlet ?
 
Mark Lybarger
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the servelet's purpose it to validate the health of a web application. it is to validate that a web application's declared resources (jndi lookups) are actually available. the servlet looks at a web.xml and all the defined resource ref's and tries to do a lookup on them. if found, good, if not, bad.

this servlet should be deployed to the container and not bundled with each and every application that is deployed. i don't want to have to touch the production applications to have them have this servlet available.

i've read there's some way to invoke a servlet using /servlet/class, but that this isn't supported directly by the j2ee specification. file systems aren't supported by the spec either, but everyone logs using a file logger.

any help would be most appreciated.

thanks
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mark Lybarger:


i've read there's some way to invoke a servlet using /servlet/class, but that this isn't supported directly by the j2ee specification.



Invoker servlet is a feature of Tomcat for quick test.I do not think its recommended for production use.As this is not part of the servlet specification so its not portable.


Mark Lybarger: it is to validate that a web application's declared resources (jndi lookups) are actually available. the servlet looks at a web.xml and all the defined resource ref's and tries to do a lookup on them



I think all vendors provide with these basic features to through administration console.
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic