1 2 Previous Next 17 Replies Latest reply on Sep 28, 2016 3:15 PM by cfang

    BatchRuntime.getJobOperator() call is prematurely terminating the program

    richardmoore

      I have the following code -

       

      System.out.println("Creating job operator.");

      JobOperator operator = BatchRuntime.getJobOperator();

      System.out.println("Job operator created.");

       

      I am getting the output -

      Creating job operator.

       

      And then nothing, the job ends no further messages and no exceptions. This is only happening on my linux server, the code works fine on my virtual desktop running under Eclipse.

      Is there a way to turn on debugging to see what is happening within the BatchRuntime.getJobOperator() down on my linux box? Any suggestions would be appreciated.

      I

        • 1. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
          jamezp

          The exceptions is likely be swallowed somewhere. Try doing something like:

          System.out.println("Creating job operator.");
          JobOperator operator;
          try {
              operator = BatchRuntime.getJobOperator();
          } catch (Exception e) {
              e.printStackTrace();
              throw e;
          }
          System.out.println("Job operator created.");
          

           

          --

          James R. Perkins

          • 2. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
            cfang

            can you give more details of the linux server where you had this problem (java version, OS version, etc)?  I suspect it could be some environment difference.

            • 3. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
              richardmoore

              Linux batapptest 3.10.0-327.36.1.el7.x86_64 #1 SMP Wed Aug 17 03:02:37 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

               

              openjdk version "1.8.0_102"

              OpenJDK Runtime Environment (build 1.8.0_102-b14)

              OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)

               

              I did some more tests last night, putting the try/catch as James suggested did not yield anything; but if I set the job-repository-type to in-memory instead of jdbc it works, the strange thing is, this is the same file I am using on my vdi/windows machine and it works.

              • 4. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                cfang

                can you check the system log files? 

                 

                Troubleshooting System Crashes - Troubleshooting Guide for Java SE 6 with HotSpot VM

                 

                JDK 1.8.0_102 is currently the latest update (released around July 19, 2016), and may not work with some drivers.

                • 5. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                  richardmoore

                  I will have to get an admin to get to the log. I should have mentioned that this all started when my DB2 database was switched from the name JAVAB to JAVABT1. Before that it worked fine on the linux box. I think I am going to ask the DBA's to rebuild JAVAB and try it again.

                  • 6. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                    richardmoore

                    The DBA's when rebuilding the tables in a new database called JAVABT1 they also set the schema to be DBO which was not the case before.

                     

                    When I was testing on the linux box I ran the following which failed because of the schema -

                    String jdbcClassName = "com.ibm.db2.jcc.DB2Driver"; // Add the two jars for DB2.

                    String host = "trhdb2";

                    String port = "60000";

                    String database = "javabt1";

                    String url = "jdbc:db2://" + host + ":" + port + "/" + database;

                    String user = "dvantage";

                    String password = "dvantage";

                     

                    But when I added the schema it worked -

                    String jdbcClassName = "com.ibm.db2.jcc.DB2Driver"; // Add the two jars for DB2.

                    String host = "trhdb2";

                    String port = "60000";

                    String database = "javabt1";

                    String schema = "DBO";

                    String url = "jdbc:db2://" + host + ":" + port + "/" + database + ":currentSchema=" + schema.toUpperCase() + ";";

                    String user = "dvantage";

                    String password = "dvantage";

                     

                    I put this same thing at the end of my jberet.properties url but it still isn't working, got any ideas -

                    job-repository-type = jdbc

                    db-url = jdbc:db2://trhdb2:60000/javabt1:currentSchema=DBO;

                    db-user = dvantage

                    db-password = dvantage

                    db-properties = driverClassName-com.ibm.db2.jcc.DB2Driver

                    • 7. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                      cfang

                      the last line:

                       

                      db-properties = driverClassName-com.ibm.db2.jcc.DB2Driver

                       

                      should be:

                       

                      db-properties = driverClassName=com.ibm.db2.jcc.DB2Driver

                       

                      Not sure which form you actually used, or is it just a paste error.

                      • 8. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                        jamezp

                        If the value in a properties file uses an = it should actually be escaped with a \. So db-properties=driverClassName\=com.ibm.db2.jcc.DB2Driver. The JavaDoc has more information on what characters need to be escaped.

                         

                        --

                        James R. Perkins

                        • 9. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                          richardmoore

                          Okay, I'm blind. I figured out what was going on. I had the DB2 jar name typo'd. I am not getting a message from the getJobOperator that is the problem. I even have a try/catch around it. Can you check on that part for me?

                          • 10. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                            cfang

                            if I misspell db2 jar name in classpath, I get the following error.  I'm running with latest JBeret 1.3.0.Beta4 snapshot build, but that part hasn't changed recently.

                               [testng] java.util.ServiceConfigurationError: javax.batch.operations.JobOperator: 
                            Provider org.jberet.operations.JobOperatorImpl could not be instantiated    [testng]      at java.util.ServiceLoader.fail(ServiceLoader.java:232)    [testng]      at java.util.ServiceLoader.access$100(ServiceLoader.java:185)    [testng]      at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)    [testng]      at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)    [testng]      at java.util.ServiceLoader$1.next(ServiceLoader.java:480)    [testng]      at javax.batch.runtime.BatchRuntime.getJobOperator(BatchRuntime.java:57)    [testng]      at com.ibm.jbatch.tck.utils.JobOperatorBridge.<init>(JobOperatorBridge.java:52)    [testng]      at com.ibm.jbatch.tck.tests.jslxml.ContextsGetIdTests.beforeTest(ContextsGetIdTests.java:140)    [testng]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    [testng]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    [testng]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    [testng]      at java.lang.reflect.Method.invoke(Method.java:498)    [testng]      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)    [testng]      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)    [testng]      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)    [testng]      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)    [testng]      at org.testng.TestRunner.beforeRun(TestRunner.java:641)    [testng]      at org.testng.TestRunner.run(TestRunner.java:609)    [testng]      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)    [testng]      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)    [testng]      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)    [testng]      at org.testng.SuiteRunner.run(SuiteRunner.java:240)    [testng]      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)    [testng]      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)    [testng]      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)    [testng]      at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)    [testng]      at org.testng.TestNG.run(TestNG.java:1031)    [testng]      at org.testng.TestNG.privateMain(TestNG.java:1338)    [testng]      at org.testng.TestNG.main(TestNG.java:1307)    [testng] Caused by: javax.batch.operations.BatchRuntimeException: JBERET000622:
                            Failed to obtain connection from jdbc:db2://a.b.c.d.e.redhat.com:50000/jbossqa:currentSchema=DBA;, {user=xxx, password=xxx, driverClassName=com.ibm.db2.jcc.DB2Driver}    [testng]      at org.jberet.repository.JdbcRepository.getConnection(JdbcRepository.java:979)    [testng]      at org.jberet.repository.JdbcRepository.createTables(JdbcRepository.java:235)    [testng]      at org.jberet.repository.JdbcRepository.<init>(JdbcRepository.java:158)    [testng]      at org.jberet.repository.JdbcRepository.create(JdbcRepository.java:108)    [testng]      at org.jberet.se.JobRepositoryFactory.getJobRepository(JobRepositoryFactory.java:52)    [testng]      at org.jberet.se.BatchSEEnvironment.getJobRepository(BatchSEEnvironment.java:133)    [testng]      at org.jberet.operations.JobOperatorImpl.<init>(JobOperatorImpl.java:94)    [testng]      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    [testng]      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)    [testng]      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)    [testng]      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)    [testng]      at java.lang.Class.newInstance(Class.java:442)    [testng]      at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)    [testng]      ... 26 more    [testng] Caused by: java.sql.SQLException:
                            No suitable driver found for jdbc:db2://a.b.d.d.e.redhat.com:50000/jbossqa:currentSchema=DBA;    [testng]      at java.sql.DriverManager.getConnection(DriverManager.java:689)    [testng]      at java.sql.DriverManager.getConnection(DriverManager.java:208)    [testng]      at org.jberet.repository.JdbcRepository.getConnection(JdbcRepository.java:977)    [testng]      ... 38 more
                            • 11. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                              richardmoore

                              That isn't what is happening for me. I originally had the following with no try/catch but either way it just hits the BatchRuntime.getJobOperator() statement and then ends, the catch never gets executed, there is no exception or stacktrace. This was caused by the jar having the path with uppercase in one of the sub-directory levels when it should have been lowercase. When I corrected it everything worked.

                               

                              // Beta3

                              try {

                                log.log(Level.INFO, "Creating job operator.");

                                operator = BatchRuntime.getJobOperator();

                                log.log(Level.INFO, "Job operator created.");

                                } catch(Exception e) {

                                log.log(Level.SEVERE, "Failed during creation of job operator.", e);

                                throw e;

                                }

                              • 12. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                                richardmoore

                                Where can I download the jars for the new Beta4?

                                • 13. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                                  cfang

                                  JBeret 1.3.0.Beta4 is working in progress, and its artifacts are not published yet.  But it is almost the same as Beta3, which was released on 2016-09-11 and available from either maven central or jboss.org nexus.

                                  • 14. Re: BatchRuntime.getJobOperator() call is prematurely terminating the program
                                    richardmoore

                                    I was actually using the Beta2 so I pulled down the Beta3 and it runs but I am now seeing this at the end of my log4j2 log -

                                     

                                    2016-09-28 10:37:29,303 Thread-1 WARN Unable to register Log4j shutdown hook because JVM is shutting down. Using SimpleLogger

                                    Weld SE container STATIC_INSTANCE shut down by shutdown hook

                                     

                                    What is causing this to show up and is there something I need to do to correct this?

                                    1 2 Previous Next