Markus is a Developer Advocate at Red Hat and focuses on JBoss Middleware. He is working with Java EE servers from different vendors since more than 14 years and talks about his favorite topics around Java EE on conferences all over the world. He has been a principle consultant and worked with different customers on all kinds of Java EE related applications and solutions. Beside that he has always been a prolific blogger, writer and tech editor for different Java EE related books. He is the Java Community leader of the German DOAG e.V. and it's representative on the iJUG e.V. As a Java Champion and former ACE Director he is well known in the community. Markus is a DZone MVB and is not an employee of DZone and has posted 194 posts at DZone. You can read more from them at their website. View Full User Profile

Scaling up to WebLogic 12c Server from GlassFish 3.x

  • submit to reddit

One of the main goals of Oracle's strategy for GlassFish server was to "integrate with Fusion Middleware and Products" (source: Community Roadmap May, 2010). Back in this year you heard a lot of fears and rumors about the two servers becoming one. Seeing both products moving forward in terms of features and releases it gets clearer what that strategy could be. Beginning with GlassFish's support for a limited set of weblogic specific deployment descriptors, Oracle also moved on with WebLogic to do the same. Beginning with 10.3.6 WebLogic Server adds support for reading and using GlassFish's web deployment descriptors. These are glassfish-web.xml and sun-web.xml. This is useful for providing specific GlassFish behavioral settings and mappings for resources and security to WebLogic Server. The goal behind that obviously is to allow a GlassFish application to be deployed more easily to WebLogic Server and vice verse.

What WebLogic knows about GlassFish
WebLogic Server detects the presence of GlassFish web deployment descriptors in WAR files and parses them. Known entries are parsed into WebLogic server settings and applied at runtime via WebLogic MBeans (weblogic.j2ee.descriptor.wl.WeblogicWebAppBean).
WebLogic always will use an existing weblogic.xml instead of the GlassFish deployment descriptors if it is present and WebLogic applies the settings at runtime which means, that no weblogic.xml is actually generated.

glassfish-web.xml Element Name Weblogic Support (weblogic.xml)
context-root context-root

If you deploy a GlassFish web-application to WebLogic you get some log messages with INFO level and you can follow what is happening:

<Info> <HTTP> <BEA-101392>...
<Glassfish Descriptor element <glassfish-web-app> is not supported>
<Glassfish Descriptor element <context-root> was successfully parsed and applied>
<Glassfish Descriptor element <idempotent-url-pattern> is not supported>
<Glassfish Descriptor element <property> is not supported>
<Glassfish Descriptor element <reapIntervalSeconds> was successfully parsed and applied>
<Glassfish Descriptor element <res-ref-name> was successfully parsed and applied>
<Glassfish Descriptor element <jndi-name> was successfully parsed and applied>
<Glassfish Descriptor element <delegate> was successfully parsed and applied>
<Glassfish Descriptor element <keepgenerated> was successfully parsed and applied>

Compared to what GlassFish knows about WebLogic, this is still a very limited set of parameters. But it covers the most needed ones. And we are still looking forward to even less xml configuration with further Java EE versions. But let's look at the other side.

What GlassFish knows about WebLogic
GlassFish Server offers limited support for the weblogic-application.xml, weblogic.xml, and weblogic-webservices.xml deployment descriptor files. The only element in weblogic-application.xml that GlassFish Server supports is security. The equivalent element in the glassfish-application.xml file is security-role-mapping.

weblogic.xml Element Name GlassFish Server Support
role-name under security-role-assignment role-name under security-role-mapping glassfish-web.xml equivalent
principal-name under security-role-assignment principal-name under security-role-mapping glassfish-web.xml equivalent
resource-description resource-ref glassfish-web.xml equivalent, but resource-link not supported
resource-env-description resource-env-ref glassfish-web.xml equivalent, but resource-link not supported
ejb-reference-description ejb-ref glassfish-web.xml equivalent
service-reference-description service-ref glassfish-web.xml equivalent
timeout-secs under session-descriptor timeoutSeconds property of session-properties glassfish-web.xml equivalent
invalidation-interval-secs under session-descriptor reapIntervalSeconds property of manager-properties glassfish-web.xml equivalent
max-in-memory-sessions under session-descriptor maxSessions property of manager-properties glassfish-web.xml equivalent
persistent-store-dir under session-descriptor directory property of store-properties glassfish-web.xml equivalent
prefer-web-inf-classes under container-descriptor delegate attribute of class-loader glassfish-web.xml equivalent
context-root context-root glassfish-web.xml equivalent
cookies-enabled under session-descriptor Servlet 3.0
cookie-name under session-descriptor Servlet 3.0
cookie-path under session-descriptor Servlet 3.0
cookie-domain under session-descriptor Servlet 3.0
cookie-comment under session-descriptor Servlet 3.0
cookie-secure under session-descriptor Servlet 3.0
cookie-max-age-secs under session-descriptor Servlet 3.0
cookie-http-only under session-descriptor Servlet 3.0
url-rewriting-enabled under session-descriptor Servlet 3.0
persistent-store-cookie-name under session-descriptor Cookie-based persistence is supported
keepgenerated under jsp-descriptor keepgenerated init parameter of JspServlet
working-dir under jsp-descriptor scratchdir init parameter of JspServlet
compress-html-template under jsp-descriptor trimSpaces init parameter of JspServlet
index-directory-enabled under container-descriptor listings init parameter of DefaultServlet
index-directory-sort-by under container-descriptor sortedBy init parameter of DefaultServlet
save-sessions-enabled under container-descriptor Same as asadmin redeploy --keepstate=true or keep-state in glassfish-web.xml
run-as-principal-name under servlet-descriptor principal-name under servlet glassfish-web.xml equivalent

weblogic-webservices.xml Element Name GlassFish Server Support
webservice-type Possible values are JAXRPC or JAXWS. GlassFish Server does not support JAX-RPC web services with JSR 181 annotations. The use of this element is limited, because the container can find out if the type is JAX-WS or JAX-RPC based on presence of JSR 181 annotations.
wsdl-publish-file Same as wsdl-publish-location in glassfish-web.xml
service-endpoint-address Similar to endpoint-address-uri in glassfish-web.xml, except that webservice-contextpath and webservice-serviceuri are specified separately
j2ee:login-config Same as login-config in glassfish-web.xml
j2ee:transport-guarantee Same as transport-guarantee in glassfish-web.xml
exposed under wsdl Accepts true or false, defaults to true. Controls the publishing of WSDL to clients.
stream-attachments Accepts true or false, defaults to true. Only for JAX-WS web services. Configures the JAX-WS runtime to send attachments in streaming fashion.
validate-request Accepts true or false, defaults to false. Only for JAX-WS web services. Configures the JAX-WS runtime to validate that request messages are as the WSDL definitions specify.
http-response-buffersize Property of ReliabilityMessagingFeature configuration, similar to ReliableMessagingFeature.setDestinationBufferQuota()
reliability-config Partially supported. Subelements map to Metro's ReliabilityMessagingFeature.
inactivity-timeout under reliability-config Maps to ReliableMessagingFeature. getSequenceInactivityTimeout()
base-retransmission-interval under reliability-config Maps to ReliableMessagingFeature. getMessageRetransmissionInterval()
retransmission-exponential-backoff under reliability-config Maps to ReliableMessagingFeature. getRetransmissionBackoffAlgorithm(). Returns enum values, one of them is exponential.
acknowledgement-interval under reliability-config Maps to ReliableMessagingFeature. getAcknowledgementTransmissionInterval()
sequence-expiration under reliability-config Maps to ReliableMessagingFeature. getSequenceInactivityTimeout(). In WebLogic Server this value applies regardless of activity. In Metro it applies only to inactive sequences.
buffer-retry-count under reliability-config Maps to ReliableMessagingFeature. getMaxMessageRetransmissionCount()
buffer-retry-delay under reliability-config Maps to ReliableMessagingFeature. getMessageRetransmissionInterval()

But for what is all that good for?
Good question. There are some possible interpretations for what is happening.
1) GlassFish could be positioned as a certified, lightweight development platform for Oracle's FMW stack based on WebLogic server. If this would be the main goal, I wouldn't expect WebLogic to understand any of the GF DDs but GF knowing about all tweaks and settings of WLS.
2) Easy re-deployment of GF apps on WLS. This is what you find on the official launch slides. If you are running GF and you need to scale up to WLS you have a more easier migration path.
3) Both teams are trying to get hands on the concepts and switches of the other side. The GF roadmaps from the past highlight a "Common Server Platform" for WLS and GF. So knowing each other could be an easy and obvious first step for the teams.
As always, a bit of everything might be true. So there is nothing else left for now than simply to be happy about and watch how both excellent servers come closer together and to be open for future possibilities.



Published at DZone with permission of Markus Eisele, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Jonathan Fisher replied on Fri, 2011/12/16 - 11:40am

The entire article goes without comparing the benefits of weblogic over glassfish. Can you enumerate why the decision was made in the first place? I seriously doubt weblogic has a performance advantage over glasssfish, but it does contain a larger feature set.

Ed Randall replied on Wed, 2012/05/02 - 9:35am

Our application is intended to run on a number of different application servers and therefore contains  deployment descriptors for all of them. 

In some cases the presence of the Weblogic files is now interfering with Glassfish - is there any way to disable this feature?  So far we have done this by creating empty glassfish-specific DD files where necessary.  But the  weblogic-webservices.xml has no Glassfish equivalent whose presence will inhibit processing it.  Its XSD specifies legal values of webservice-type to be "JAXRPC" or "JAXWS".  Unfortunately Glassfish does not transform these to its own values properly, and complains:

[#|2012-05-02T14:24:44.787+0000|SEVERE|glassfish3.1.2||_ThreadID=19;_ThreadName=Thread-2;|WS00057: WebService  type is declared as JAXWS but should be either JAX-WS or JAX-RPC|#]

Changing the value to "JAX-WS" eliminates this error - but will be incorrect on Weblogic.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.