Tomcat as an Enterpise server - java

It seems that tomcat is a web application server and EAR cannot be deployed in it. Can it be updated to deploy EAR files. If not what could be the alternate server which is easy to configure and deploy?

In Short - NO. Tomcat is not a Java EE compliant server, but just a web server.
Use JBoss/GlassFish/Geronimo, there are a lot more, just google for it :)

Best alternative is Glassfish Application Server, alongwith Netbeans which will be best for practice purpose. Although there are a long list of such server and also that Apache also have one such server.
....

I don't know about Glassfish, but JBoss uses an embedded Tomcat so you might get comfortable with it somewhat easier.

Related

Is it possible to consume a web service deployed in glassfish by an application on client side using apache tomcat?

this may be two questions in one, so...Sorry, please correct me if I'm wrong.
I have to deploy a web service developed with JPA, JSP and Glassfish 3.1.2, in a machine which only has apache Tomcat 7 as server installed on Windows 7.
I don't really know how apache can connect to the database externally, or if that is really possible if you don't use TomEE.
I know in Glassfish you can have a connection pool and a jdbc resource, and if you're using JPA, that's how the connection to database works(kindof), so you can deploy the .war file. But, if you only have a Tomcat and the app is using JPA, so it does not connect itself to the database(It does not have a class with a connection credentials), How can I achieve this?
Or, Can I deploy the .war of the web service on Glassfish and then be consumed by an application that only works with apache Tomcat on client side? Am I mixing concepts which should not be mixed?
Any enlightenment is highly appreciated.
You can use Tomcat with JPA, you can even use it in a standalone java application. Define a persistence unit name in persistence.xml, make sure the transaction type is RESOURCE_LOCAL (you can't use JTA in Tomcat, make sure to check this), and get a reference to the EM using the following
EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistenceUnitName");
em = emf.createEntityManager();
Finally, add the jpa provider jars to Tomcat, there are examples for that (I've never done it, but I'm sure some Tomcat expert could lend a hand)
The other option could also work, that is consume your webservice using a client deployed on another server
Good luck!
If your application uses advanced Java EE functionality (JTA, CDI), it won't work on Tomcat. If it uses JSTL, you will have to add a JSTL library to the tomcat installation. Read the docs, it should be stated somewhere, but I would not simply deploy the war to a tomcat.
If you just want to develop a relay webapp that consumes a webservice and displays the results, it will run on tomcat independantly of where the webservice runs.

glassfish, tomcat and jersey

If I use Glassfish and only need jersey for jax-rs and grizzly for servlet/jsp, will glassfish load all other Java EE components I don't need and take more up more resources than just running jersey/tomcat or will glassfish just load jersey/grizzly and will use almost the same resources? I have tried running starting default glassfish and default tomcat, glassfish takes much more ram.
Is there any reason not to run jersey with tomcat? maybe because the integration is done better by Glassfish?
There are lots of people who use Jersey with Tomcat. Tomcat is a servlet container only but will not interfere with other Java EE technologies that you choose to support through other means (e.g. Jersey). You may have to manage some of the initialization of the frameworks, etc. that other full-J2EE containers like Glassfish already provide, but it shouldn't be too painful.
You can use the 'web profile' to help minimize the download, initial memory and start-up time.
The most recent web profile is http://dlc.sun.com.edgesuite.net/glassfish/3.1.2.2/release/glassfish-3.1.2.2-web.zip
The start-up time is between Tomcat and the GlassFish 'full' profile.
The web profile includes an integrated implementation of Jersey.

Deploy War File in Microsoft IIS 7

I would like to ask how can I deploy a war file to Microsoft IIS 7?
Thanks in advance.
You can't. You need a Java EE Web Container such as Tomcat or JBoss in order to do so. IIS can just act as a front facing proxy for the stuff hosted through the WAR file.
What you probably need is a way to connect IIS and Tomcat together so that requests for any dynamic resources such as JSPs and Servlets can be delegated to Tomcat.
The following link explains how to do so in detail.
http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
Please read this article: Deploying Java Servlet applications on Windows with IIS The Java is running on Jetty and IIS is used as a proxy, but in this solution all components are fit together to make it look and feel like it is built-in IIS feature of running WAR files.

Tomcat or JBoss server for a Java EE application?

This might be duplicate of this and this question.
I have a java application in which i am using JAX-WS (WEB SERVICES). and many other features in it like apache-commons utils.
My application is swing application, that connects to my server code
and uploads and downloads, and sync files with the server. my
database is mysql.
I have compiled my server code and created a .WAR file. i deployed
that .WAR (containing all the required libraries for my server
side application) file on a JBoss server and its working fine.
Now my Management says me to why use JBoss instead of Tomcat, which
easy to manage and setup on a linux server. actualy they have a
linux server which supports tomcat, but not JBoss. so they said to
me to deploy on Tomcat on Linux Server. I installed and configured
tomcat on my windows and deployed a .WAR file. and also created
virtual directory for my resources its working fine[but not tested
completely]
My Application does not have EJB so I think that Tomcat is good enough.
Please suggest me is it fine to use Tomcat instead of JBoss server,
I am worried if it may get problems in the future, or it might not
support features of my application in future or after complete testing.
JBoss uses Tomcat under the hood to host war applications anyway.
Using Tomcat for you war application instead of JBoss should be perfectly fine.
Any commons-jars that you are using can be downloaded from http://commons.apache.org/. Put them in your lib directory and you should be good to go. Most apache commons libraries should allready be included with Tomcat though, you'll have to check.
PS:
JAX-WS is standard in the latest JDK6 updates. If your using a earlier version of the JDK then just download the JAX-WS jars. The standard reference implementation from Oracle/Sun can be downloaded from here http://jax-ws.java.net/
Do you have EJB? JBoss comes with its implementation of the EJB JSR specification.
For Tomcat, you require plugins like openEJB.
Many application servers use Tomcat internally as its Servlet container. But for compliance to JavaEE standards, most would choose a JBoss application server over Tomcat anyday.
Note that JBoss 7 Application Server Web Profile is certified.
Tomcat functions well as a plain vanilla Servlet container. Many enterprises when using Tomcat, couple it with Proxy and HTTPD servers for security and load balancing reasons.

What are the differences when deploying on Tomcat vs. Websphere?

If I were to deploy an application on Tomcat vs. Websphere, what are things that I need to consider?
Do I have to develop my Java code differently if developing in one app server vs another?
Edit:
I will be funneling people from a website into a web app that does credit card processing and e-signatures (cc processing and e-sigs are through separate services). That is its sole job
You cannot use EJBs on Tomcat (unless you add OpenEJB). If your WebSphere deployment uses EJBs, you'll have to remove them to deploy on Tomcat.
If you use any Java EE features beyond servlet/JSP engine and JNDI naming service you'll have to eliminate them from your app.
Tomcat accepts WAR packages. If you package your app into an EAR on WebSphere, you'll have to change it to WAR for Tomcat.
Both use JNDI for data sources. There might be some nagging differences in naming conventions, but if you stick to the standard they should be portable.
If you use any WebSphere specific code in your app, you'll have to remove it to deploy on Tomcat.
If your app is servlets, JSPs, and JDBC you can deploy on either one without any problems.
You can think as Tomcat as a subset of Websphere, so theoretically everything that works on Tomcat will work in Websphere.
But...Deploying in Websphere, in my humble opinion, is a terrible pain, while deploying in Tomcat just works. (And if fails, just delete temporary folders)
Without knowing the technologies you are using, that's all I can say.
Depends, what are you trying to deploy?
Tomcat isn't a full EE server--are you trying to deploy an EE app?
If you're just deploying a web app, it's more important to consider which version of the servlet spec/etc. each server implements.

Categories