Strange error on Mainframe when running JAR with JZOS batch



Support for Java SE, EE & ME, JVM, JNI, JDBC, EJB, JFC, JPDA, JAAS,JCE, JAXP, XML and Java API.

Strange error on Mainframe when running JAR with JZOS batch

Postby dphickey » Tue Jun 14, 2016 1:40 am

I'm new to JAVA on the mainframe and my boss has asked me to create some batch programs using JAVA. My teammate and I have created 2 programs using JZOS running JAVA on the Unix side of the mainframe from MVS JCL. His program however runs very slow so I was tasked with examining it and possibly improving it. I created a working version that runs much faster and it runs just fine on my PC in Eclipse and runs fine on the command line by running the jar with the JAVA command. However the problem occurs when I promote this to the mainframe. The program runs and errors off when one object calls another object passing any kind of parameter or variable.
For example. I have an environment object that contains data for connecting to DB2 and some other security applications. I can create the environment object fine from main but when I pass any data from that object or the object itself I get an error saying item cannot be found. If it's the entire object it says it cannot find the environment object. If I pass a string is will tell me it cannot find the String object.

The error looks like this:
Exception in thread "main" java.lang.NoSuchMethodError: org/dao/service/DataSourceUser.setEnvData(Lcom/test/copybooks/EnvPropertyRecord;)V                                                    
:at com.test.source.TestProgram.main(TestProgram.java:33)


Any help would be appreciated.

Coded for you. Please learn to do it yourself next time
dphickey
 
Posts: 2
Joined: Tue Jun 14, 2016 1:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Strange error on Mainframe when running JAR with JZOS batch

 

Re: Strange error on Mainframe when running JAR with JZOS ba

Postby Robert Sample » Tue Jun 14, 2016 3:10 am

Your post is not clear about how you are executing the Java code -- from a Unix OMVS prompt or via a batch job? If a batch job, does //STDENV have the correct information for your site? You need to get with your site support group and confirm the values, particularly for PATH and LIBPATH. While Java will be installed by default into a particular Unix System Services location, sites do have the option to override that location and place it somewhere else. Only someone working at your site can confirm what the PATH and LIBPATH environment variables need to be set to. There are other environment variables needed, but the particular error message you are getting would tend to point to LIBPATH or maybe PATH as being the issue.
Robert Sample
Global moderator
 
Posts: 3181
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 194 times

Re: Strange error on Mainframe when running JAR with JZOS ba

Postby dphickey » Tue Jun 14, 2016 6:24 pm

As stated in the original post this is a batch MVS job running a JAVA jar using the JZOS batch procedure. The JCL is on MVS the jar is on the UNIX side. I don't think this is a lib path or path issue as I can point to the original program in the same library and it runs fine. I have requested assistance from a system programmer but have not yet heard back. I'm exploring all options at this time.
dphickey
 
Posts: 2
Joined: Tue Jun 14, 2016 1:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Strange error on Mainframe when running JAR with JZOS ba

Postby Robert Sample » Tue Jun 14, 2016 6:40 pm

I don't think this is a lib path or path issue as I can point to the original program in the same library and it runs fine.
I don't think you understand z/OS -- a batch job runs in a separate address space and hence shares NOTHING of what you are doing when you point to the original program. The batch JCL must define the environment (including the PATH and LIBPATH), either explicitly through the //STDENV DD statement or program statements, and/or implicitly by the /etc/profile and .profile of the batch job's user id. If the JCL for the original program and your program are EXACTLY the same (other than the program name), and you're using the same user id for both, then this becomes a site issue and ONLY your site support group (such as your systems programmer) could possibly help you.
Robert Sample
Global moderator
 
Posts: 3181
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 194 times


Return to Mainframe Java

 


  • Related topics
    Replies
    Views
    Last post