Make love, not war files.

So kids and germs, lets talk about something unexciting and uninspiring. J2EE. You see when a programmer loves a business very much and wants to show that it cares to solve its problems... Ok no seriously J2EE. Lets rippof Wikipedia's first sentence for convenience.
Java Platform, Enterprise Edition or Java EE is Oracle's enterprise java computing platform. The platform provides an API and runtime environment for developing and running enterprise software, including network and web services, and other large-scale, multi-tiered, scalable, reliable, and secure network applications.
Quite the mouthful. All this means is that Java has a software stack with libraries and other neat toys to facilitate the development of applications that solve business problems. Like managing payroll, processing financial transactions and other back-end necessary work that keeps the world spinning. Before your elitist nubbin starts throbbing please understand that I'm oversimplifying things. It goes so deep on many levels that a puny little blog post can't even begin to encompass the world that enterprise Java has become.

Now the meat of the matter. WebLogic is one of the products that enables the serving and consumption of Java Web Based Applications. These applications adhere to a standard structure in the way the files are organized. WebLogic likes to do things a little bit different. When you want to install your developed and ready application to facilitate the transfer and deployment you usually package it in a format that encompasses all the files that make your application in a single file. This is called a Web Archive File or simply WAR file. You give this war file to WebLogic and he should proceed to install your application on the server and make it available to your eager users. This is where it gets interesting. On your application file/folder structure you have a couple of folders called WEB-INF and classes bellow it. Now its usually the case that when a Web Application Server (Weblogic, Tomcat, Jboss, Glassfish, WebSphere) receives an app it does something called exploding the war. Is not what it sounds like. All it does it takes the packaged files in your war file and unpack them in a navigable file folder structure. WebLogic decides that when exploding the war he is going to unpack all the files except for the ones in WEB-INF/classes which he would like to keep compressed and packed nicely elsewhere. Now this is transparent to your application because WebLogic will make sure to reference your application to where he has decided to keep the class files. And this is ok. For the most part anyways. I have the sour luck of maintaining a web app that uses a framework that has LITERAL STATIC references to the WEB-INF/classes folder structure in which it expects to find stuff for it to function. The whole WebLogic model for war exploding structure falls apart the minute he decides to keep some files elsewhere.

Unfortunately I have yet to find a switch I can flip or a setting I can configure to force WebLogic in to exploding the war file with the classes folder as well. Yes I tried the <prefer-web-inf-classes>true</prefer-web-inf-classes> in the weblogic.xml. While I keep looking I found a workaround. If you install your application without packing it in to a war file first, WebLogic will not insist upon itself and use your preferred application structure. Now this is fine but it messes up my deployment pipeline. Packing apps in war files is convenient for many reasons like transferring over a network to multiple servers and such.  I'll leave this one to the google spiders in hopes that this gets indexed and an answer can be found.

Comments