I have a web application developed in pure JSP and Servlet. Application can be deployed local servers and run. Now we have a requirement where we will get a notification as soon as someone deployed the application in their server. The application will send us the IP address of the machine which the application is deployed.
We wrote a ServletContextListener and added the code into it, so it will execute only once in the apps life time.
Now for the above thing, internet connection is must, that is OK. But the issue is the application should not give access to the web pages/ servlets if the notification is not sent to us.
I know this kind of thing can be done in desktop applications, but how to do this in web applications?
Related
I am trying to use Bluemix monitoring and analytics service bounded to a java application running on Liberty runtime. But the service always shows application as unavailable (even though I can see and verify its working). And none of the stats on CPU/memory utilization & response/throughput times work. The application is started by calling the Main class and its NOT web application. Is there specific entry in manifest.yml for M&A to start working with the application. I have used M&A with node.js application and it worked well.
I thought I will just get an answer by simple google search but alas not able to find anything on this. Appreciate the help
The Monitoring & Analytics service generally assumes a web application. The availability tab is based on doing an http GET of your application's route as defined in Bluemix. Since yours is not a web application it presumably either doesn't have a route or doesn't respond to the one that it has if it does have one; this will cause M&A to report it as down.
Likewise for Liberty apps the performance data is gathered via Websphere application server JMX MBeans. If your app is not a web app, it is likely that it is invisible to these interfaces.
There was a temporary outtage due to network issues, but things should be resolved now. Restage your app and try again...
What I have ?
Two web applications which inter-communicates using sendRedirect
What I want ?
To deploy those web apps on AWS
Problems
1) When I am deploying one web application to AWS , I dont have url of second web application because it is not deployed yet. I must need to specify url of second web app so first web app can communicate with second web app.
2) I can not deploy second web app initially because it also redirects to first web app (inter-communication ) i.e. If i deploy second web app initially problem continues because I don't have url of first web application
Straight Solution
1) Deploy first web app with dummy url of second web app. (Here I wll get actual url of first web app)
2) Deploy second web app with actual url of first web app (Here I will get actual url of second web app)
3) Update first web app with actual url of second web app and redeploy the first web app
Above solution is time consuming and needs rework.
Is there any efficient way by which I can dynamically update the url
used in web app , and no need to redeploy app
Don't know the knitty gritty details on how it can/should be implemented exactly but I would look for a kind of publish/subscribe mechanism in which both Web servers are initially booted and listening for each other. The web server remains pending until it receives a notification the other is ready to receive messages. When one of the web servers is ready to receive messages it will publish a notification. Once the other web server is ready it will receive the notification (containing the URL at which it can be received) and publish also a notification that it is ready to receive messages.
Another possibility would be create load ballancers for both web servers at a fixed address. When the web server is started it will be added to the load ballancer hiding where the server exactly is deployed.
Hope this makes sense to you.
I know for a Java Program to run on another Computer it needs JRE(Java Runtime Environment). But for a J2EE application (Serlvet-JSP) or Struts2 framework application or Hibernate framework application or any Framework application of Java what are need to Run it Successfully on another computer where it is not developed....
I know JRE is required for both type of Application. and JDK is for developing an application.
I also know that for Mobile application to run on device it needs an Emulator that supports the particular OS (Android, iOS, etc). Just like an Standalone Java Application.
But for running J2EE application is there any other requirements than JRE??
For Example:- I have made a site called SocialMash.com I want to have a working prototype to deliver to user (User meaning like we all use Stackoverflow and other sites). What will I require to configure the site.
I know I will require a server like Tomcat/JBOSS/GlassFish but that all will be on my side (server side/ development side) but Do the Users to use the site will require anything among JDK, JRE, Server, or anything to use SocialMash.com or just URL will be enough?????
You need to have a JavaEE application server. It runs on top of JRE. You can check this open-source reference implementation (full-profile, my favourite):
https://glassfish.java.net/
or if you want to have only web-profile:
http://tomcat.apache.org/download-80.cgi
Web profile is different from full profile in that web profile supports only Servlet-JSP, but not JPA (or hibernate as stated in your question).
Users will not require anything except for the browser in case you write a web application (Servlets+JSP, Struts, JSF, etc. - just give them a web reference). But you can go further than that. You can write a Java SE desktop client for EJB, or SOAP service (they will be placed in full-profile server like Glassfish), and distribute for your customers. In this way they will not require any browser, but your custom desktop program.
Some of the libraries require to be added to your application server and configured manually. Like Struts. In this case you first need to decide which framework/library you would like to use, then go to their web site, and follow the tutorial on its installation.
To host an J2EE application, a webserver is required that has servlet container. servers included in XAMPP/LAMP/WAMPP will do for php based application. But for J2EE application servlet container is rquired which is there in TOMCAT/GLASSFISH/JBOSS.
On the user side, the user sees pure HTML with additional js/css. He does not see the jsp scriplets/servlet code written in your J2EE application. so no java technology is required on the user system. He only needs a browser.
A J2EE project intends to create a web service. In order to run this project on your computer, you need a local server.
Any IDE can provide you a local server like Tomcat or Glassfish, you just need to try to run this project to get these options.
If you don't need to access the code on the other computer, two options:
You compile your project to get a .war file, which you can deploy on your Tomcat server, or any else.
You put this on a server of yours, and share the url.
Assuming that you are in charge of the app hosting:
If that the app is running on your own remote server, you just need to share the app url and your user can access it with his browser (nothing more is needed).
If you run it in your own computer, as localhost, he won't be able to access it, and I recommand the usage of a host like Openshift to make it accessible (that's a free solution).
I'm working in a lab where they typically deploy apps to Geronimo. I have an existing stand-alone server based app written in Java. Can any Java application be hosted in Geronimo? If so, is there a good reference to take an existing app and host it in Geronimo? Is there a benefit to hosting something in Geronimo or are there times when something is best left as a stand-alone app?
When you work on an Application Server, there is specific way a program should be written for it to be qualified for deployment on app server. A program can be a Servlet, EJB, JSP etc. If your existing stand-alone server based app is any of these, then it can surely be deployed on Geronimo.
looking for someone to verify whether this approach is good or not . let say i have web app A run on tomcat. By deploying one webcache web app on the same tomcat. will that minimum the likelyhood that my web app crash due to overload by web visitors? if yes, what webcache should i used to implement this technique? or should i forget about webcache deploy this way and user service like akamai instead..? low cost is my main priority. looking forward to hear from you all
By duplicating on the same server/machine you gain nothing. When many users rush to the website, you would need more system resources to serve them and since these are shared by all web apps the second installation will be in as bad situation as the first one.
To properly cluster a web application you need more servers. You install Tomcat and your web application in each one and then use a load balancer to share the traffic. This is usually implemented with Apache Web Server and mod_proxy or mod_jk. Of course you need to pay for the extra server. One solution would be to deploy your app in a cloud environment (like Amazon EC2) and start the second server only when needed.
Another solution is to scale up, that is use a more powerful machine.