Tomcat or JBoss server for a Java EE application? - java

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.

Related

Migrating from tomcat to websphere

At the moment, I'm developing a java web application locally(localhost) on Windows, using Tomcat 8.5 .
Unofortunately, I have no developing enviroment, so I have to do everything locally and then deploy to production via .WAR .
The issue is that the production application server (Linux RedHat) is running on websphere, if I generate the .WAR on tomcat, Will I have any problems to run it on WebSphere? Should I change anything in my code or web xml?
My system does nothing fancy, no hibernate, no spring, just a very classic mvc web application.
Thanks in advance
In general you shouldn't have to make any changes, but there are some differences between the two environments that could cause issues.
IBM provides a tool that will analyze your application and suggest changes that may need to be made. You can find more information here: https://www.ibm.com/developerworks/library/mw-1701-was-migration/index.html

Java Spring MVC deploy .war on GlassFish

At first i want to say that i'm a beginner in java servers and never deploy an java .war app on server other than localhost in my intellij.
I have a simple only REST app Which work fine in localhost, i also created war file and deploy it by command "asadmin deploy --port 4849 war_name", but when i go into url http://stachurskipiotr4.usermd.net/cookbook-1.0-SNAPSHOT there is an server error.
I completely don't know what it is, i will be grateful for any help.
Access the domain port for that case. Default is 8080 if you haven't configured.
http://stachurskipiotr4.usermd.net:8080/cookbook-1.0-SNAPSHOT
Also, please use or log in your admin console to see the apps if it's deployed. You can also access it directly from there.
Glassfish already provides the Jackson libraries and the version conflicts with the one Spring depends on. Glassfish is an enterprise container, is there a specific need for the enterprise container? Try a regular servlet container like Tomcat instead. If you do want enterprise, maybe you shouldn't need using Spring
EDIT:
Removing jackson jars from your project won't help you; Spring code wants the version it wants. You can try to find out which version Glassfish provides and then see which version of Spring depends on that and use that version of Spring. This is a wrong thing to try as this will be just the tip of the iceberg. Do not try to deploy Spring code in an enterprise container, these are competing specs.
Your options are
1) figure out why is Tomcat not working. Tomcat is a battle-tested servlet container with thousands of production deployments.
2) Try a different servlet container such as Jetty.
3) Rewrite your code to the JEE specification and deploy to an enterprise container such as Glassfish or Wildfly (there are others).
4) Use Spring Boot to embed the container and package your app as an executable jar.
EDIT2:
If you chose Spring Boot, your artifact will be an executable jar, you do not deploy it into a container since the container is embedded. You start the jar via a java command. You remove the container from your deployment entirely. I don't know your deployment environment, but you do not use Glassfish at all at this point, you have to run the java command to start the server.
If Glassfish is a requirement, you have to rewrite your code

Java JVM versus Glassfish

I'm really new to Java and I have a basic question. I'm getting ready to deploy a Java web service that I have created in Netbeans/Glassfish. I used Netbeans because of the development GUI and tools. Of course I also deployed to Netbean's built in GF server because of easy and simplicity. I have a Windows 8 server with IIS that I now need to deploy this to. I was thinking that since Java 1.7 EE was already on my IIS server, than I wouldn't need a "container server" like GF but that doesn't appear to be the case. So, I'm confused. What's the difference between the server that Glassfish creates and the JVM that Java EE creates when it is installed? If I have to install Glassfish on my IIS server, am I going to have competing web services and port conflicts to resolve?
Thank you.
The Java Virtual Machine (JVM) is used to execute any Java program. However, all it does is execute the byte code in a Java binary, for example a Java archive (.jar) file. It does not include implementations of many of the Java EE libraries.
A web application, typically deployed as a web archive (.war) file, usually requires libraries not provided by the JVM. In addition, the standard Java web application architecture means that the entry point for the application is not in the .war file - it is in the web application server, which then calls into the code provided in the .war file.
The web application server, which includes full J2EE containers like Glassfish and also more limited web servers like Tomcat and Jetty, acts as an intermediate layer, running on a JVM and executing the web application provided in the .war file.
Probably the best way to run your application on an IIS server is to set up the IIS server as the front end - so the client facing ports would be under IIS control - and set up the web server as a back end to which IIS forwards the relevant requests. The answers at the following question provide some links that may be useful:
Deploy War File in Microsoft IIS 7

Tomcat as an Enterpise server

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.

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