Deploy ETP Projects as .war files?

Deploy ETP projects to Tomcat, Jetty and other servlet container platforms as you would deploy to Java EE platforms such as Weblogic, WebSphere, JBOSS and Geronimo.  Use the ETP Deploy Wizard but specify a destination file that ends in .war instead of .ear.  The relevant portions of your ETP Project's Java EE folder will be packaged, namely the war subdirectory.

However, Tomcat and other servlet container environments are much more limited than full Java EE environments.  In addition to limiting the capabilities of what your ETP environment can do (distributed program link under transaction control is disallowed) the environments need additional resources to conduct basic ETP operations.  For that reason, two or more additional libraries must be included in the Java Build Path for the COBOL projects associated with the ETP project.  When you created your COBOL project using the New COBOL Project wizard you probably selected Elastic Transaction Platform Template under the Compatibility selection in the wizard.  To automatically add the additional Java EE jars that are required for war deployment, select the Elastic Transaction Platform WAR Template at the outset. 

If you already have a COBOL project that you want to use and convert to .war deployment, open up the .classpath file in the project's home directory with an ordinary text editor (the Eclipse Java Build Path property sheet can display but not update these class entries).  Duplicate the lines you see containing ELASTIC_COBOL_CORE and update two of them to read:

<classpathentry kind="var" path="ELASTIC_COBOL_CORE/elastic_cobol/lib/javaee-api-7.0.jar"/>
<classpathentry kind="var" path="ELASTIC_COBOL_CORE/elastic_cobol/lib/openejb-client-4.7.4.jar"/>

Other libraries may be required, such as the log4j library used for certain CICS Journal settings that you wish to direct to the Java log4j system.

Note:  Tomcat 7 Bug.  A Tomcat version 7 bug prevents loading javax classes from the JavaEE library because they are overridden by Tomcat classes that report:

java.lang.NoClassDefFoundError: javax/transaction/NotSupportedException

Upgrade to Tomcat version 8 or "explode" the contents of javaee-api-7.0.jar into the classes directory of the WEB-INF directory and repackage the war.  On Linux systems this is accomplished with the following script in the directory containing your .war file:

mkdir xx
cd xx
jar xf ../*.war
cd WEB-INF/classes
jar xf ../lib/javaee-api-7.0.jar
rm ../lib/javaee-api-7.0.jar
cd ../..
jar cfm ../*.war META-INF/MANIFEST.MF *
cd ..
rm -rf xx


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk