-
1. Re: Running standalone - JBERET000601: Failed to get job xml file for job
cfang Aug 2, 2016 2:30 PM (in response to richardmoore)Once you've run this job at least once, the batch runtime will know your job. Can you try running it first, then query the job repository for job names?
-
2. Re: Running standalone - JBERET000601: Failed to get job xml file for job
richardmoore Aug 2, 2016 2:42 PM (in response to cfang)When I run it with the following I get the JBERET000601. How will it know about it?
long id = jo.start("myjob", null);
System.out.println("Job id: " + id);
-
3. Re: Running standalone - JBERET000601: Failed to get job xml file for job
cfang Aug 2, 2016 2:55 PM (in response to richardmoore)jberet standalone searches in your classpath for META-INF/batch-jobs/myjob.xml
Can you check if the above exists in your classpath?
-
5. Re: Running standalone - JBERET000601: Failed to get job xml file for job
jamezp Aug 2, 2016 4:20 PM (in response to richardmoore)Is there a stack trace with the message? Also does the message include the "myjob" name at the end?
--
James R. Perkins
-
6. Re: Running standalone - JBERET000601: Failed to get job xml file for job
cfang Aug 2, 2016 4:24 PM (in response to richardmoore)Can you check if META-INF/batch-jobs/myjob.xml is under your project compilation output directory? This is what is used as classpath at runtime in your current Eclipse project structure. I suspect since you added it as source, it may try to compile it (which does nothing), and it will not copy the resource files to output dir. As I understand it, Eclipse will not treat your source dir as classpath entry. If your project is maven project, then most of these is automatic.
-
7. Re: Running standalone - JBERET000601: Failed to get job xml file for job
richardmoore Aug 2, 2016 4:42 PM (in response to jamezp)Hey James,
Here is the output I get from running the code shown in the previous messages -
Aug 02, 2016 3:32:57 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.3.0 (Beta3)
Aug 02, 2016 3:32:57 PM org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory create
INFO: WELD-ENV-000020: Using jandex for bean discovery
Aug 02, 2016 3:32:57 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
None
Exception in thread "main" javax.batch.operations.JobStartException: JBERET000601: Failed to get job xml file for job myjob.xml
at org.jberet.creation.ArchiveXmlLoader.getJobXml(ArchiveXmlLoader.java:129)
at org.jberet.creation.ArchiveXmlLoader.loadJobXml(ArchiveXmlLoader.java:91)
at org.jberet.operations.JobOperatorImpl.start(JobOperatorImpl.java:102)
at com.awginc.jberet.examples.JBeretTest.main(JBeretTest.java:28)
Hey Cheng,
Here is the structure I have in bin which would be in the classpath -
-
8. Re: Running standalone - JBERET000601: Failed to get job xml file for job
jamezp Aug 2, 2016 5:30 PM (in response to richardmoore)The file should first be resolved on the class path and if not found there in the META-INF/batch-jobs directory. I don't know eclipse well, but it looks like when it's running the XML file isn't found on the class path. You might have to debug it to inspect the class path.
Or if you want to just print it to stdout something like this might work, but it could be pretty verbose.
package org.jboss.example; import java.io.File; import java.io.IOException; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystemNotFoundException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import java.util.stream.Stream; /** * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> */ public class Sample { public static void main(final String[] args) throws Exception { getResources().forEach(System.out::println); } private static Collection<Path> getResources() { final Collection<Path> resources = new ArrayList<>(); Stream.of(System.getProperty("java.class.path").split(Pattern.quote(File.pathSeparator))) .forEach((entry -> { try { resources.addAll(getResources(entry)); } catch (IOException e) { e.printStackTrace(); } })); return resources; } private static Collection<Path> getResources(final String entry) throws IOException { final FileSystem fs; if (entry.endsWith(".jar")) { fs = zipFs(Paths.get(entry)); } else { fs = FileSystems.getDefault(); } return listFiles(fs); } private static FileSystem zipFs(final Path path) throws IOException { final Map<String, String> env = new HashMap<>(); env.put("create", "true"); return zipFs(path, env); } private static FileSystem zipFs(final Path path, final Map<String, String> env) throws IOException { // locate file system by using the syntax // defined in java.net.JarURLConnection URI uri = URI.create("jar:" + path.toUri()); try { return FileSystems.getFileSystem(uri); } catch (FileSystemNotFoundException ignore) { } return FileSystems.newFileSystem(uri, env); } private static Collection<Path> listFiles(final FileSystem fs) throws IOException { final List<Path> files = new ArrayList<>(); for (Path root : fs.getRootDirectories()) { Files.walkFileTree(root, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { files.add(file); return FileVisitResult.CONTINUE; } }); } Collections.sort(files); return files; } }
-
9. Re: Running standalone - JBERET000601: Failed to get job xml file for job
richardmoore Aug 2, 2016 5:48 PM (in response to jamezp)Thanks James. We were able to work out the path issue, and it was because of Eclipse. The problem now is when we run our job with -
job-repository-type = jdbc
db-url = jdbc:mysql://localhost:3306/db2pdba
db-user = myId
db-password = myPswd
db-properties =
It is not locating the driver. How do we indicated that for standalone processing?
-
10. Re: Running standalone - JBERET000601: Failed to get job xml file for job
cfang Aug 2, 2016 6:18 PM (in response to richardmoore)do you have jdbc driver jar (e.g., mysql-connector-java-5.1.36-bin.jar) in your classpath, or added to your project runtime dependency?
Your jberet.properties should also be available in your classpath.
-
11. Re: Running standalone - JBERET000601: Failed to get job xml file for job
richardmoore Aug 2, 2016 6:43 PM (in response to cfang)I have the mysql jar and the jberet.properties in the path -
Here is what I get when I run it after changing the jberet.properties property job-repository-type = in-memory to be job-repository-type = jdbc
Aug 02, 2016 5:39:44 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.3.0 (Beta3)
Aug 02, 2016 5:39:44 PM org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory create
INFO: WELD-ENV-000020: Using jandex for bean discovery
Aug 02, 2016 5:39:45 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Exception in thread "main" java.util.ServiceConfigurationError: javax.batch.operations.JobOperator: Provider org.jberet.operations.JobOperatorImpl could not be instantiated
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$100(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at javax.batch.runtime.BatchRuntime$1.run(BatchRuntime.java:51)
at javax.batch.runtime.BatchRuntime$1.run(BatchRuntime.java:46)
at java.security.AccessController.doPrivileged(Native Method)
at javax.batch.runtime.BatchRuntime.getJobOperator(BatchRuntime.java:46)
at com.awginc.jberet.examples.JBeretTest.main(JBeretTest.java:14)
Caused by: javax.batch.operations.BatchRuntimeException: JBERET000622: Failed to obtain connection from jdbc:mysql://localhost:3306/db2pdba, {user=myUserId, password=myPswd}
at org.jberet.repository.JdbcRepository.getConnection(JdbcRepository.java:979)
at org.jberet.repository.JdbcRepository.createTables(JdbcRepository.java:235)
at org.jberet.repository.JdbcRepository.<init>(JdbcRepository.java:158)
at org.jberet.repository.JdbcRepository.create(JdbcRepository.java:108)
at org.jberet.se.JobRepositoryFactory.getJobRepository(JobRepositoryFactory.java:52)
at org.jberet.se.BatchSEEnvironment.getJobRepository(BatchSEEnvironment.java:133)
at org.jberet.operations.JobOperatorImpl.<init>(JobOperatorImpl.java:94)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 8 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/db2pdba
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.jberet.repository.JdbcRepository.getConnection(JdbcRepository.java:977)
... 19 more
-
12. Re: Running standalone - JBERET000601: Failed to get job xml file for job
cfang Aug 2, 2016 10:39 PM (in response to richardmoore)can you try running it from command line to have full control of the classpath? I think the important part is to have mysql jar in the classpath.
Or you can step through the code in Eclipse debugger.
-
13. Re: Running standalone - JBERET000601: Failed to get job xml file for job
richardmoore Aug 2, 2016 11:20 PM (in response to cfang)I ran a MySQL test job from my project and it connected and displayed all the rows in my table. I then displayed the classpath before trying to start the job with the following -
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((java.net.URLClassLoader)cl).getURLs();
for(URL url: urls){
System.out.println(url.getFile());
}
JobOperator jo = BatchRuntime.getJobOperator();
long id = jo.start("myjob", null);
System.out.println("Job id: " + id);
JobExecution execution = jo.getJobExecution(id);
Here is the results of the classpath display -
/C:/Users/Richard/workspace/JBeret/bin/
/C:/Users/Richard/workspace/development/jars/MySQL/v5.0.4/mysql-connector-java-5.0.4-bin.jar
/C:/Users/Richard/workspace/development/jars/java-batch/javabatch-1.0.1/javax.batch-api-1.0.1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/aalto-xml-0.9.11.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/asm-5.0.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/beanio-2.1.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/bson4jackson-2.4.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/cdi-api-1.1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/commons-codec-1.10.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/commons-compress-1.3.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/commons-io-2.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/commons-lang3-3.1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/de.flapdoodle.embed.mongo-1.46.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/de.flapdoodle.embed.process-1.40.1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/dom4j-1.6.1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/guava-18.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/h2-1.3.173.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/infinispan-commons-7.2.3.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/infinispan-core-7.2.3.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jackson-annotations-2.5.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jackson-core-2.5.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jackson-databind-2.5.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jackson-dataformat-csv-2.5.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jackson-dataformat-xml-2.5.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jackson-module-jaxb-annotations-2.5.4.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jandex-2.0.0.Beta3.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/javax.inject-1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/javax.transaction-api-1.2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jberet-core-1.3.0.Beta2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jberet-se-1.3.0.Beta2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jberet-support-1.3.0.Beta2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-annotations-api_1.2_spec-1.0.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-batch-api_1.0_spec-1.0.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-classfilewriter-1.1.2.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-interceptors-api_1.2_spec-1.0.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-jms-api_2.0_spec-1.0.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-logging-3.3.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-marshalling-1.4.10.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-marshalling-osgi-1.4.10.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jgroups-3.6.4.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jna-4.0.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/jna-platform-4.0.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/mongo-java-driver-3.0.3.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/mongojack-2.3.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/poi-3.12.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/poi-ooxml-3.12.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/poi-ooxml-schemas-3.12.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/stax2-api-4.0.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/super-csv-2.3.1.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/validation-api-1.1.0.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/weld-api-2.3.Beta2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/weld-core-2.3.0.Beta3.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/weld-se-2.3.0.Beta3.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/weld-spi-2.3.Beta2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/wildfly-security-manager-1.1.2.Final.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/xmlbeans-2.6.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/javax.ejb-api-3.2.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/hornetq-core-2.2.7.Final.jar
/C:/Users/Richard/workspace/development/jars/jasperreports/jasperreports-6.3.0/dist/jasperreports-6.3.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/kafka_2.10-0.10.0.0/libs/kafka-clients-0.10.0.0.jar
/C:/Users/Richard/workspace/development/jars/jberet/jberet-distribution-1.3.0.Beta2/lib/javax.ws.rs-api-2.0.jar
...
Exception in thread "main" java.util.ServiceConfigurationError: javax.batch.operations.JobOperator: Provider org.jberet.operations.JobOperatorImpl could not be instantiated
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$100(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at javax.batch.runtime.BatchRuntime$1.run(BatchRuntime.java:51)
at javax.batch.runtime.BatchRuntime$1.run(BatchRuntime.java:46)
at java.security.AccessController.doPrivileged(Native Method)
at javax.batch.runtime.BatchRuntime.getJobOperator(BatchRuntime.java:46)
at com.awginc.jberet.examples.JBeretTest.main(JBeretTest.java:24)
Caused by: javax.batch.operations.BatchRuntimeException: JBERET000622: Failed to obtain connection from jdbc:mysql://localhost:3306/db2pdba, {user=root, password=Marlene1966}
at org.jberet.repository.JdbcRepository.getConnection(JdbcRepository.java:979)
at org.jberet.repository.JdbcRepository.createTables(JdbcRepository.java:235)
at org.jberet.repository.JdbcRepository.<init>(JdbcRepository.java:158)
at org.jberet.repository.JdbcRepository.create(JdbcRepository.java:108)
at org.jberet.se.JobRepositoryFactory.getJobRepository(JobRepositoryFactory.java:52)
at org.jberet.se.BatchSEEnvironment.getJobRepository(BatchSEEnvironment.java:133)
at org.jberet.operations.JobOperatorImpl.<init>(JobOperatorImpl.java:94)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 8 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/db2pdba
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.jberet.repository.JdbcRepository.getConnection(JdbcRepository.java:977)
... 19 more
-
14. Re: Running standalone - JBERET000601: Failed to get job xml file for job
richardmoore Aug 3, 2016 8:46 AM (in response to cfang)I added the statement -
Class.forName("com.mysql.jdbc.Driver");
and it was able to find the MySQL database so I know it is in the classpath.