Deploy ear in embedded Jetty - java

Is it possible to deploy ear (Jersey and Metro) archive in embedded Jetty? Google shows articles and manuals only about Jetty + JBoss.

As far as I understand, Jetty shouldn't have such a functionality.
That's because jetty was designed to be a web container only for Servlets and JSPs.
You can see the jetty as an alternative to the Tomcat web server.
So Jetty is able to process only web based stuff (read WARs).
JBoss on the other hand is a full fledged Java EE container, so it can handle ears as well.
What you've seen is probably embedding the jetty inside the jboss.
I know that Jboss has used tomcat for dealing with servlets and jsps internally, so it might be possible to switch the underlying implementation from tomcat to jetty.
Hope this helps

I'll add that many people deploying into things like JBoss or other full Java EE stacks really don't need the full stack and can often get away with a servlet engine plus a handful of components. I know folks that have gone with aggregated solutions of things like jetty + open ejb to achieve a lightweight stack that does what they need without all the added Java EE bells and whistles. For example, if you intend to have an embedded scenario then you don't need to deploy an ear you can deploy the application bit by bit, handling servlets with jetty and ejb's with openejb or whatever *bean solution you like.
If you need the full Java EE container then by all means use one...but if you are using a minor subset of those Java EE features there are other ways to assemble your application.

Related

What is the reason that the tomcat is not an application server

I know that Tomcat is a web server but why it is not an application server?
Any server needs to follow some specification. What is that spec?
Is it possible for apache to make the tomcat application server?
Also I have read in a blog that the tomcat do not have some lib to act as an application server. What are those libs?
Thanks
I've heard once the following explanation I tend to agree with:
There is a spec of JEE (Java enterprise edition).
Formally you can think about it as a bunch of pdf-s describing the behavior of various technologies that comprise the JEE stack (for example: JMS, EJB, JPA, JPA, JSF, CDI and so on and so forth) as well as deployment models (EARs for example).
Implementors of Application servers have to implement all those technologies and offer interfaces that can be used by the application developers. So teams that stand behind WildFly (former JBoss), Geronimo, WebSphere, WebLogic and so on have read these specs and implemented everything in there.
Now, Tomcat didn't do that, they've only concentrated on (primarily) Servlets/JSPs. These are web technologies, so Tomcat can't be considered as an Application server that implements the whole JEE stack.
In general Tomcat (as well as Jetty, incidentally) should be more lightweight than full JEE compliant Application servers, it should start-up faster and it memory footprint should be smaller. So Tomcat/Jetty call themselves web servers.
I understand that this answer can be considered as speculation, but for me it makes a lot of sense.
Bellow is my perceive:
know that Tomcat is a web server but why it is not an application server?
Here, Application Server is specially for Java EE Server,Java EE is a huge specific collections for Enterprice Application Development,So Application Server should implement most specifics of these, while Tomcat(or Jetty) is only a Web Server(More accurately,Servlet Container),they only implements the specific about Web(such as Servlet Spec(JSR340), JSP(JSR245)). Therefore,Application Server is stronger than Web Server,but Web Server is more lightweight and enough to satisfy most web applications.
Any server needs to follow some specification. What is that spec?
Of course,it depends on that your Server want to provide what services(functions),these specifications can view here.
Is it possible for apache to make the tomcat application server?
I don't think apache will make tomcat to be an application server. Now, there are some popular Java EE Server: Jboss,WebLogic, etc. Not all enterprices need a heavyweight Application Server, on the contrary, most only need a lightweight Web Server。
Also I have read in a blog that the tomcat do not have some lib to act as an application server. What are those libs?
Tomcat only need care the specs about Web,and implements them.
Hope for your help.

Spring application deployment on Java-ee servers

Can I deploy a Spring java application on all (or at least most) of JavaEE servers ? like Weblogic, JBoss, Webshpere, Tomcat, Jettty etc.
And is there is preferred Java EE server for Spring ?
Yes you can. And no - there isn´t. Errata: you can take a look at the SpringSource dm Server. Be aware that spring is not a java EE implementation. Read this post here.
Yes, you can deploy it on any server, and you can use it on standalone applications and even on mobile applications. It is in no way restricted to web deployment. It is not even restricted to java, there is Spring.NET and even a Python version. However, java and web servers are a common if not the most common use for it.
Currently recommended web server by VMWare/Pivotal (current owner of Spring) is VFabric tcServer, which is a Tomcat fork containing some extra tools and functionality. But server in itself does not matter, Spring is container agnostic.
There is no preferred EE server. VFabric tcServer is a servlet container, not an EE server. It contains "enterprise capabilities" instead, but that's not the same thing. As said however, you can use whichever EE server you want.

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.

Running OSGi Container Inside Embedded Jetty Web Container. Possible?

Working on a project that runs an embedded Jetty web server withing its infrastructure. We are looking at addings a new web application that would benefit greatly from allowing views to be plugged in using OSGi. Vaadin is our web framework of choice.
There is a great tutorial on creating an OSGi pluggable Vaadin application in GlassFish where the web container and OSGi container are bridged. That is, the web container is not running in the OSGi container. Here is the tutorial: https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20Modular%20Vaadin%20Application%20with%20OSGi
My question is. Would it be possible to bridge an embedded Jetty web container and OSGi container in the same way as described in this tutorial.
Running jetty in an OSGi container is simply not an option for us as we have to work with existing deployment.
You should be able to embed any 4.2 compliant framework via the org.osgi.framework.launch.FrameworkFactory class. There's a few good examples if you google, two good ones are on the Felix site, and Neil Barlett's blog.
Configuring it will be far more work - you'll need to export all the Jetty and servlet packages via a system property org.osgi.framework.system.packages.extra and use something like Felix fileinstall or a console and pax-url to un/deploy bundles.
While your Vaadin app will be dynamic - nothing from Jetty or the embedding application will be (i.e. domain entities, services etc).
Could you embed a different container? Eclipse Virgo and JBoss AS are both OSGi and J2EE containers.
http://www.eclipse.org/virgo/
http://www.jboss.org/as7

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