Setting up an application in weblogic server

Unofficial Content

In this article, we'll go over some basic concepts you need to take into account when deploying a web application to Weblogic server.

Unpack Wars disabled

One peculiarity of Weblogic server is that it does not support unpacking WAR files by default; the same happens with other servlet servers.

Due to the implementation of some features like Blob data type or QueryViewer control, you have to consider some aspects in order to make the application work as expected.

One possible solution is to do some configuration to unpack WAR files

If for any reason -possibly a security reason- the WAR file cannot be unpacked, the alternative is to configure the "Archived Real Path Enabled" in the Weblogic domain, under "Web Applications". 
By default this property is disabled; you should enable it and restart the Weblogic server.

i2015_04_10_20_48_442_png

i2015_04_10_20_44_071_png

Note: As from GeneXus Salto it's not necessary to activate the "Archived Real Path Enabled" property, although the unpackwar of the web server is set to False.

Using Blob data type in an application connected through JNDI

If the application connects using a JNDI datasource, it won't work for Blobs unless the Weblogic version is 10.3.5 or higher.

Therefore, installing Weblogic 10.3.5 or higher is required. In addition, the following has to be done:

Disable Weblogic wrapping

To disable wrapping of JDBC data type objects using the Administration Console:

  1. In the Domain Structure tree, expand Services and select Data Sources.
  2. In the Summary of the Data Sources page, click on the data source name.
  3. Select the Configuration: Connection Pool tab.
  4. Scroll down and click on Advanced to show the advanced connection pool options.
  5. In Wrap Data Types, clear the checkbox to disable wrapping.
  6. Click on Save.

i2015_04_13_13_19_373_png

Note: The Oracle documentation says that this change does not take effect immediately—it requires that the data source be redeployed or the server be restarted.

Setup weblogic.xml file with prefer-web-inf-classes option

The prefer-web-inf-classes element, if set to true, will cause classes located in the WEB-INF directory of a Web application to be loaded in preference to classes loaded in the application or system classloader.
So, create the weblogic.xml file with the following contents, and copy it at the same level of the web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
</weblogic-web-app>

Note: If the weblogic.xml file hasn't been set up with the above contents, an error is thrown which can be seen in the server logs: javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.commons.fileupload.DefaultFileItem.cleanup()

Do not forget

The JDBC driver should not be located under the lib directory of the webapp, because the server uses its own JDBC driver - SAC #29987

Additional Information

  • SAC #31118 Wrapper Oracle sobre Blob en weblogic 10.3.0 y 10.3.5 usando datasource.
  • SAC #21246 No funcionan búsquedas de cadena usando DataSource
  • SAC #23041 NullPointerException al subir blob
  • SAC #28768 Error 403 al llamar a prompts en Weblogic
  • SAC #33218 
    Consideraciones para aplicaciones java web que usan query viewer en servidores que no expanden la web application
  • SAC #29987 Consideraciones cuando se usa el pool de conexiones del server y blobs
  • SAC #35484 Se forma mal la url de las imagenes en servidores que no expanden la web application