Main frame Execution from a JAR file

General discussion on the JZOS batch launcher and toolkit
Post Reply
LEOJ
Posts: 4
Joined: Mon Sep 15, 2008 10:58 am

Main frame Execution from a JAR file

Post by LEOJ »

Using IBM RAD 7.0.0.3, I installed the 'cook nook' sample application, and deployed it to USS, using the ANT functions. I added an additional class x.ckass. to the package for testing and tinkering.

The execute JCL is

//JAVA EXEC PROC=EXJZOSVM,VERSION='50',
// JAVACLS='-jar cookbook.jar'

with the STDENV set to

export JAVA_HOME=/usr/lpp/java/J5.0
#JZOS_HOME=<JZOS_HOME>
JZOS_HOME=/u/j4kboc/jzos/jzos

export PATH=/bin:"${JAVA_HOME}"/bin:

LIBPATH=/lib:/usr/lib:"${JAVA_HOME}"/bin
LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin/classic
LIBPATH="$LIBPATH":"${JZOS_HOME}"
export LIBPATH="$LIBPATH":

# Force the alphaWorks version of JZOS to run overriding the SDK
OPTS="-Djava.ext.dirs=${JZOS_HOME}:${JAVA_HOME}/lib/ext"
OPTS="$OPTS -Djzos.jdfsort.dir=${JZOS_HOME}"
OPTS="$OPTS -Djzos.script.path=${JZOS_HOME}/sample"
export JZOS_JVM_OPTIONS="$OPTS"

# Add the JZOS samples to the classpath
CLASSPATH="${JZOS_HOME}/jzos_sample.jar"


The job ends with a return code of 101
with this error message

JVMJZBL1001N JZOS batch Launcher Version: 2.3.0 Alphaworks 2008-05-12
JVMJZBL1002N Copyright (C) IBM Corp. 2005. All rights reserved.
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pmz31devifx-20071025 (
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 z/OS s390-31 j9vmmz3123-20071007 (
J9VM - 20071004_14218_bHdSMr
JIT - 20070820_1846ifx1_r8
GC - 200708_10)
JVMJZBL1052E Error reading jarfile "cookbook.jar" manifest - no Main-Class key
JVMJZBL1042E JZOS batch launcher failed, return code=101


There is a manifest file under my USS id, containing

Manifest-Version 1.0
Main-Class: com/ibm/jzos/cookbook/inventory/x


What am I doing wrong?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I had to stare at your manifest a little while, but I think that the problem is that the "Manifest-Version" key is missing a colon.

Here's a working example:

Code: Select all

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.4.2_16-b05 (Sun Microsystems Inc.)
Main-Class: com.ibm.jzos.test.helper.MainArgs
IMO, the easiest way to do this is with Ant. For example:

Code: Select all

    <target name="_build.jar" depends="init">
		<mkdir dir="dist"/>
        <jar destfile="dist/${jarfile}">
            <fileset dir="bin">
                <include name="**/*"/>
            	<!-- exclude .xml and .properties files at the top level, 
            	     since they are likely from resources/ and will be
            	     placed in the classpath individually -->
            	<exclude name="*.xml" />
            	<exclude name="*.properties" />
            </fileset>
           <manifest>
                <attribute name="Main-Class" value="full.path.Myclass"/>
            </manifest>		            
        </jar>
    </target>
LEOJ
Posts: 4
Joined: Mon Sep 15, 2008 10:58 am

Post by LEOJ »

I think I really need to get back to the basics. I'm not sure I;'ve coded all of the stuff the right way

Thi sis the path for the manifest /u/j4kboc/META-INF
caps ok?
This is the manifest MANIFEST.MF also caps, with your catch on the colon

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.4.2_16-b05 (Sun Microsystems Inc.)
Main-Class: com.ibm.jzos.cookbook.inventory.x

periods between nodes no / Right?

This is in the JCL
// JAVACLS='-jar cookbook.jar'


This is the LIB PATH


LIBPATH=/lib:/usr/lib:"${JAVA_HOME}"/bin
LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin/classic
LIBPATH="$LIBPATH":"${JZOS_HOME}"
export LIBPATH="$LIBPATH":


This is the CLASSPATH
export CLASSPATH="/u/j4kboc":

the jar is in
/u/j4kboc/cookbook.jar

Thankx
Leo


[/quote]
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

So, what error are you getting?
LEOJ
Posts: 4
Joined: Mon Sep 15, 2008 10:58 am

Post by LEOJ »

dovetail wrote:So, what error are you getting?
JVMJZBL1052E Error reading jarfile "cookbook.jar" manifest - no Main-Class key

I think the real problem is this: The JAR file is a zipped file containing the manifest file. I unzipped the cookbook.jar file. It split into lots of stuff
with a MANIFEST.MS file containing

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 2.3 (IBM Corporation)

but NO Main-Class: statement.

So, I''ll have to figure out a way of adding this, per your instructions to the RAD files.

/quote
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

If you are using the cookbook sample project, you can just modify the _build.jar ant task in build.xml to add your manifest (as shown above).
LEOJ
Posts: 4
Joined: Mon Sep 15, 2008 10:58 am

Post by LEOJ »

LEOJ wrote:I think I really need to get back to the basics. I'm not sure I;'ve coded all of the stuff the right way

Thi sis the path for the manifest /u/j4kboc/META-INF
caps ok?
This is the manifest MANIFEST.MF also caps, with your catch on the colon

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.4.2_16-b05 (Sun Microsystems Inc.)
Main-Class: com.ibm.jzos.cookbook.inventory.x

periods between nodes no / Right?

This is in the JCL
// JAVACLS='-jar cookbook.jar'


This is the LIB PATH


LIBPATH=/lib:/usr/lib:"${JAVA_HOME}"/bin
LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin/classic
LIBPATH="$LIBPATH":"${JZOS_HOME}"
export LIBPATH="$LIBPATH":


This is the CLASSPATH
export CLASSPATH="/u/j4kboc":

the jar is in
/u/j4kboc/cookbook.jar

Thankx
Leo

[/quote]
BINGO!
Edited the build recreated the JAR uploaded it (nice catch on those missing JAR files)
executes just fine.

Many Thankx
Post Reply