I understand enabling JMX in jetty, we can fetch some information about deployed webapps.
Can Jetty also provide enough information to indicate that a given webapp is up and running, or some metrics that can be considered to identify the state of deployed webapps?
Perform a Jetty Server Dump.
https://www.eclipse.org/jetty/documentation/current/jetty-dump-tool.html
This will output the state of all relevant components within Jetty.
This can be accessed via the various "dump" methods on Server (choose the one that you want).
You can trigger this Jetty Server Dump within JMX as well.
Alternatively, you can ask each of the deployed webapps their running state.
Use the org.eclipse.jetty.util.component.LifeCycle interface, and the .isRunning() method.
The LifeCycle interface is available on all deployed webapps, even if they are an instance of WebAppContext (for war files), or ServletContextHandler for manually created webapps, or even ContextHandler for "bare metal" handling of requests.
Related
i have a multiple domains on my centos vps (domains running on apache http server via virtual host configurations). and also same vps, i want to add my new domain but that domain will route my spring boot application (application is a jar file also inside embedded tomcat ). i couldn't find any configuration for embedded tomcat specific domains and ports.
standalone Tomcat i can make configuration via server.xml file like this image
also this short tutorial shows configuration for stadalone tomcat Tomcat Virtual Host Configuration
But how can i do that configuration for embedded Tomcat ? Any suggestion ?
With Spring Boot embedded Tomcat, you are hosting only one application per servlet container. So I don't believe that Tomcat's concept of Virtual Hosts make sense at all.
If you have to host your app on shared Tomcat instance, just build WAR without embedded container.
It depends. 2 ways to deploy your project.jar as you want to :
First way : You can use the "apache web server" and his own "mod_proxy" in order to serve as many Spring webapps you want to, each on a specific port configured with "php-fpm" and with a proxy defined to route requests from/to your namebased VirtualHost configuration.
Nowadays, with Spring Boot 2.5, all you have to do is to set the property server.port in your application.properties file, and use it accordingly with mod_proxy directives.
If you are using profile, you can either set one port to dev or prod or test or whatever properties file you need.
Another way to proceed : you can use the apache web server "mod_jk" bridge module to configure multiple load-balancers for your Virtualhosts too.
Choose your path, young Jedi ;)
This response is certainly not for the OP, 7 years later, but for other people whom are using any web search engine like Google. They will come here and see "something is impossible". It is not true.
This is my scenario:
Wildfly 8.2.0
ejb-jar with 2-webservices deployed in ear-packaging
several web-war each with one-webservice deployed as standalone wars
My problem is that the webservices calls hit my servlet filters, which contains very complex logic, and does some permanent and temporary redirects.
Currently, i cannot ascertain how this will affect external services that depend on these webservices, but on my development and test environment, the redirect dont affect much, but i would like to avoid hitting my main application logic from the webservice calls.
What have i tried?
wildfly webservice subsystem:
<subsystem xmlns="urn:jboss:domain:webservices:1.2">
<modify-wsdl-address>true</modify-wsdl-address>
<!-- tried <wsdl-host>subdomain.mydomain.com</wsdl-host> -->
<wsdl-host>jbossws.undefined.host</wsdl-host>
<wsld-port>http-port</wsld-port>
<wsld-secure-port>https-port</wsdl-secure-port>
</subsytem>
Even i setup the ports as in the above configurations, i am unable to access the webservices anymore. specifying the wsdl-host manually does not help either.
Could it be possible, that within the same deployed module, i can
specify a different port for my webservices?
And if a specify a different port, would these go through a different
lifecycle without hitting my main webapplication filter chains?
I just packaged my maven web application into a war file, upload it to remote server which has installed the tomcat environment. After I unpacked my war file and put all files in the /webapps/ROOT directory, I run bin/startup.sh to fire up the tomcat.
This just works fine, but when I intend to change my web application and redeploy it on the server, I don't know how to do that seamlessly, that is to say, not letting the users who is using my website lose any request.
Could anyone give me some idea? Thanks a lot!
You can always use manager app coming with tomcat to deploy a war without bringing the website down, even from a remote machine using browser.
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely
You may use reverse proxy as door of you site. After deploying your "second" war into Tomcat, you can change the configuration of reverse proxy and reload it. The reloading of reverse proxy is very speedy, so that it likes "seamless" re-deployment of Java web application. After the reloading of reverse proxy, you could un-deploy "first" war of application safely.
This way to re-deploy is especially useful if the application needs time for initialization(for example: including ORM, Spring Framework...).
There are few concerns about using multiple-war-at-the-same-time:
1) There will be two applications(although, temporary) running on your Tomcat concurrently, make sure there is nothing hazard about concurrent executing. For example: scheduled jobs
2) You need to confirm that there is enough memory on Tomcat to live with two web applications, or Tomcat may hang.
3) Be meticulous about Java.lang.OutOfMemory: PermGen Space problem
My system is divided to 2 or 3 servers architecture, and only one server has a webApp
Since we use javaMelody to monitor the webApp server, is there a way to use on a regular, no-
webApp JVM, and if so, how can we access the data
I would say include your application into a webapp (a war file for example) then deploy it in a server like Tomcat or Jetty. By the way, Tomcat or Jetty can be embedded.
Otherwise, there is currently no way to do this.
Using jboss-esb 5.1.0.GA
I have a web service that an EJB that I have makes calls on when it is started. This EJB may be installed in the same JBoss instance as the web service. If I start JBoss, let it come up completely, then deploy my EJB into the same instance, all is well. However, if I leave it deployed and restart JBoss, when the EJB gets to the point where it makes a call on the web service, the Application Server start-up process hangs. Now the WebService was deployed prior to the EJB according to the logs. It acts like the web server that is serving the WS calls is not yet up either. I can try to access the WSDL via a web browser and that fails until the JBoss instance is fully started. i can see if I have my dependencies wrong and it would error out on deployment, but I get no error, it just hangs indefinitely. Any ideas where to go from here. Any more information you need?
Thanks,
-Rob
You can ensure the order of deployment if you bundle your webservice war and ejb jar into one single ear file. In this case the ejb jar is always deployed first.
Appears there is a bug in the version of JBoss that we are using. We were required to register for an event to notify us when JBoss was up, then we made our WS calls and things work fine now.