Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish v3 servlet container

Tags:

glassfish

I'm wondering what is the servlet container in Glassfish. In some sources I saw that Glassfish uses something like Grizzly, but Grizzly is a web framework:

The Grizzly NIO and Web framework has been designed to help developers to take advantage of the Java™ NIO API. Grizzly's goal is to help developers to build scalable and robust servers using NIO and we are also offering extended framework components: Web Framework (HTTP/S), Bayeux Protocol, Servlet, HttpService OSGi and Comet.

What does it mean? Does Glassfish use Grizzly as web container. Or maybe Tomcat, and Grizzly as an extension?

like image 812
bontade Avatar asked Jun 02 '12 18:06

bontade


People also ask

Does GlassFish support servlet?

GlassFish Server supports the Java Servlet Specification version 3.0. Note - Servlet API version 3.0 is fully backward compatible with versions 2.3, 2.4, and 2.5, so all existing servlets should work without modification or recompilation.

What is GlassFish container?

GlassFish is the reference implementation of Java EE and as such supports Enterprise JavaBeans, JPA, JavaServer Faces, JMS, RMI, JavaServer Pages, servlets, etc. This allows developers to create enterprise applications that are portable and scalable, and that integrate with legacy technologies.

What is servlet and servlet container?

What Are Servlets and Their Containers. Servlets are a component of the JEE framework used for web development. They are basically Java programs that run inside the boundaries of a container. On the whole, they are responsible for accepting a request, processing it, and sending a response back.

What is servlet container with example?

An application server that provides the facilities for running Java servlets. Also called a "servlet engine" and "servlet womb," examples of servlet containers are JServ and Tomcat from the Apache Jakarta Project. Today, servlet containers also support JavaServer Pages (JSPs) by converting them to servlets.


1 Answers

Grizzly is the HTTP connector. Glassfish uses a fork of Tomcat's engine (Catalina) as servlet container. An easy evidence is checking the stacktrace when some exception occurs in your business code. You'll see org.apache.catalina.* deep down in the trace, between the com.sun.grizzly.* lines and the lines of your own business code. It typically look like this:

...
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:680)

Glassfish is not the only which uses Catalina by the way, JBoss AS and IBM WebSphere also use it.

like image 200
BalusC Avatar answered Oct 18 '22 03:10

BalusC