Why do Java applications require application servers to get hosted? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
While Apache http web server is also used for web hosting, why do many Java applications require a Tomcat or JBoss or Glassfish sort of environment for getting hosted?
Please provide the information, applications developed on what Java technologies can be hosted in Apache http web server. And when should we opt for an application server for hosting Java applications?

If you are talking about Java web applications, then they need to run Java code on the web server. A static web server alone won't do that.
That is the same situation with all other server-side programming environments as well (although some of them work via a plugin that is directly embedded into the Apache web server, you still need that plugin).
applications developed on what java technologies can be hosted in Apache http web server
There is client-side Java (applets, Java web start). Probably not what you are talking about, but those run off a static web server.
For server-side Java, always use an application server or a standalone JVM (with an embedded server). Don't try to shove it into Apache (if that is even possible anymore these days). You may still want Apache (or nginx or something else) in addition as a front-end/load-balancer.

Apache Tomcat, otherwise known as “Tomcat” is a servlet container, developed and maintained by the Apache Software Foundation. It is a Java implementation that runs Java Servlets and JavaServer Pages, known as JSPs.
Apache as a web server can be configured in many different ways and with many extensions, but it does lack the ability to serve Java Servelets or JavaServer Pages (hereafter referred to as JSP). Tomcat can and does serve those, and often people who use or need JSP will believe that Tomcat needs to be used to serve these .
The big downside for Apache is the lack of functionality for Java Servlets or JavaServer Pages, which cannot be run with Apache’s web server. Tomcat was created to address this problem.
Have a look here Apache vs Tomcat also here

Related

Creation of a client-server desktop application [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've in the past created client-server web applications using Javascript, AJAX, Node, Express and MongoDB, but now I'm required to creare a client-server desktop application. It will therefore basically consists of a desktop program which will connect to a server program by doing requests. The server program will respond to the client program with the requested data which it can fetch from the database.
Since I'm really new to these kind of applications in Java, I have no idea how to create such an application in Java. Since the project will be large, we cannot hard-code all the server. We need probably a framework on the server side that listens for requests, but I've not found any for now. For example, Play Framework seems only to work for web applications. Which frameworks are useful for these purpose? Is this the right approach for this kind of applications? How would I connect client and server applications?
Please, do not suggest "use sockets". This will be quite a big "serious" project, and we need high level tools. We don't know how usually these kind of projects are created. Please, explain a little bit which patterns are usually used. Examples of concrete programs, maybe with open source code will be useful for us to understand. Also a list of the requirements that we need for these project would be very useful.
Note: I'm not asking for a exhaustive list of frameworks that we can use. I rather asking which kind of tools (with concrete examples) should we use and how to combine them. How to structure such a project.
You could write the server side application in Node JS or whatever other server side language you prefer - and implement that using REST services. Then in your Java desktop application, it would just communicate with the server using HTTP REST / SOAP etc.
That way if you were to then want to swap to use something like .NET to make your desktop application you would be free to do so without it changing anything on the server side. Also you would be able to implement a mobile application / tablet app / other web application and reuse all of the server side implementation easily without changing anything server side.
Another option is to use ServerSocket for the Java server side, and then connect to that from the client but you seem to know and dislike that option.
Another option to connect each side of the application would be to use some kind of pub / sub middleware messaging service - check out JMS as a framework - you will need some kind of implementation of JMS such as Active MQ, Websphere MQ or one of the many other free implementations. Check out : http://docs.oracle.com/javaee/6/tutorial/doc/bncdq.html
Difficult question to answer, but those are 3 high level options.
Use web technologies to connect client to server HTTP REST, or SOAP
Use ServerSockets and Socket connections and do everything manually
Use a messaging framework such as JMS

Some newbie questions about Java EE [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am totally new to Java EE. So pardon me if this is too naive a question.
There're so many concepts/jargon/specifictaion in the world of Java Web development. So I am bit lost. Below are my questions:
Do I must use Java EE SDK to develop web applications? Can Java SE SDK do that?
I just downloaded and extracted the Java EE SDK 7u1. There's only a single folder named glassfish4 after extraction. I heard that Java EE SDK is a superset of Java SE. So I am expecting some extra *.jar files containing some new APIs. But where are they?
What's the logical hierarchy Java web technology? It seems everything is based on Servlet.
Java EE is a set of specifications and APIs that define the standards which form Java EE. As such Java EE is not a superset of Java SE which defines the language and standard libraries, but just is built on top of it. Additionally, besides the APIs there is no SDK as such. Just choose an implementation (most people use an application server like Glassfish, JBoss/Wildfly, Websphere etc.) and use that.
If you just want to download the API jars, check the various respositories on the net, e.g. Maven Central etc. The most basic API jar would be javaee-api-7.0.jar. There are a couple of other jars but which you need to reference in your application depends on what you need and which Java EE implementation/provider you use.
You do not need the EE SDK for JavaEE development. It's just a glashfish server and some other tools provided by oracle to enable you to run EE applications.
Any other application server would work just as well.
Depending on your application server, you just package your class files into archives with a deployment descriptor and deploy them to your server, where the EE components are executed.
Since you seem to target web development: Take a look at Apache Tomcat!
It's a EE Web-Container implementation, which allows you to run Servlets and components built on top (JSF, JSPs).
You do not need a fully blown application server for web development. Glasfish seems to be a bit of an overkill for your use case, as you are not looking to run Enterprise Java Beans.
Refer to http://tomcat.apache.org/

JAVA EE web application and big traffic [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I choose java to make my web application with maven + hibernate + spring MVC + apache tomcat server (Java EE).
My web application will have many users and many visitors every day.
But my friend told me that web application with java don't support a lot of connections and it's made just for Intranet and business application with network within an organization.
So is it true apache tomcat can't handle all that traffic ?
i'm not looking for who is the best between java, php and .NET i want just know if web application with java can handle a big traffic ?
also explain me if there is some other negative points of using java and apache tomcat server.
The Java based technology stack you describe is extremely scalable, if you want it to be, and I would have no worries about using it for high traffic applications.
You may want to look at distributed hosting and load balancing, to make things more reliable. Lots of high traffic applications use Java and Spring stacks.
using plain old jsp/servlets are faster than spring and hibernate because spring or hibernate have a middle tier with classes which renders the page slowly and takes more memory at the server.
For production environs with huge scale applications you will end up writing plain jsp/servlets as they are a breeze to write and maintain.
Also i would like to add that struts library(jar file) had some security vulnerabilities in late 2013 only. Stay away from Struts and Spring.
People may be down voting but there is truth behind what i have actually experienced.

When is java used in a Dynamic Web Project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I loved the diversity of java ever since my first time using it. With that said I have tried to use it to its fullest. I am in the development of a computer game, android game, and website. Yay me. My problem is that I've been learning html, css, and a little bit of javascript for use in an eclipse dynamic web project. I don't see where or how java plays into the equation. To summarize I am asking for an explanation of where java would be used inside of a dynamic web project and maybe an example.
What I have now: http://192.168.43.194:8080/Pointlight_Productions/homepage.html
Dynamic web project is an Eclipse term, as far I know. When you create a Dynamic Web Project, you're typically telling Eclipse to manage your project as if it were intended as a web application to be deployed on a Servlet container. Eclipse will compile your source and resources and produce a .war file that you deploy in a Servlet container (Tomcat, Glassfish, etc.)
A Servlet container is written in Java. But this is provided. You write Java server code. In other words, you implement a number of Servlet classes that handle requests and generate responses.
For example, you might want to show a customized page for a user in an HTTP web application. Your Servlet would receive an HTTP request containing the name of the user. Your Servlet (or the services it depends on) would look up the name in some database, retrieve all the information for the corresponding user, and generate an HTTP response, possibly HTML, that would display that information.
Reading:
Our Servlet wiki page
How do servlets work? Instantiation, sessions, shared variables and multithreading
Java EE 7 Tutorials

Deploy and Serve a Thrift Service [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have built a service discovery layer on top of Zookeeper for finding Thrift services in a distributed environment. I'm looking for the best way to run those services in a production environment now.
Currently, it's done by packaging a war that gets deployed to Tomcat. During the servlet instantiation, the Spring ApplicationContext is created, which creates a TThreadPoolServer inside of Tomcat.
I don't like this for a couple of reasons:
It makes Tomcat sort of useless, and it feels like a hack to facilitate easy deployment
It avoids the Tomcat thread pooling and all of the logic that has gone into figuring out the best way to distribute requests
In the process of trying to find the best strategy to handle this, I have come up with a couple of alternatives:
Launch thrift services as a standalone JAR (I don't like this, mainly because I now need to reinvent the logic that app container developers have spent a lot of time working out
Host thrift over HTTP, thus utilizing the Tomcat thread pool and logic for service requests (iffy about this one due to the - albeit minor - performance hit this will incur)
Use a different type of application container for hosting these services
Does anyone have suggestions on how they may have handled hosting distributed servers before. Am I better off just using HTTP inside of Tomcat?
I've tried using Tomcat as a host for Thrift server and found out that it doesn't bring any additional value: all the features of servlet container (request routing, etc) aren't necessary in this scenario. On the other hand, Tomcat adds complexity and moving parts (i.e., it brings hard to resolve PermGen issues).
Using Thrift over HTTP causes significant performance impact, especially in high-load scenarios with a lot of client connections.
So I ended up with standalone Thrift services running under Supervisor Daemon (http://supervisord.org/). It makes management of distributed deployment really convenient. When it's necessary to expose Thrift API over HTTP (for example, for JS clients), we use thin async proxy implemented in vert.x (http://vertx.io/).

Categories

Resources