j-easy / easy-batch

The simple, stupid batch framework for Java
https://github.com/j-easy/easy-batch/wiki
MIT License
611 stars 199 forks source link

easy-batch-xml package javax.xml.bind doesn't exist #377

Closed aaryadewa closed 4 years ago

aaryadewa commented 4 years ago

I am following the tutorial in this page. Using java 1.8 (openjdk or zulu) and found error message package javax.xml.bind does not exist.

How to solve this issue?

fmbenhassine commented 4 years ago

I am following the tutorial in this page.

The link redirects to the tutorials index page, which tutorial are you referring to?

That error would happen with Java 11 (the version that removed xml from the jdk) but not with Java 8. Are you sure you are using Java 8? How are you running the tutorial?

fmbenhassine commented 4 years ago

@aaryadewa Any update on this?

fmbenhassine commented 4 years ago

If I'm not mistaken I guess you are referring to the csv to xml tutorial as this is the only tutorial using xml APIs. I tried to follow the same instructions as in the getting started guide in a fresh docker container and the tutorial works as expected:

$ docker run --rm -it maven:3-openjdk-8 bash
Unable to find image 'maven:3-openjdk-8' locally
3-openjdk-8: Pulling from library/maven
e9afc4f90ab0: Pull complete
989e6b19a265: Pull complete
af14b6c2f878: Pull complete
5573c4b30949: Pull complete
fb1a405f128d: Pull complete
197b0f525c26: Pull complete
f133ed18caca: Pull complete
76b86c130108: Pull complete
361ef542fa03: Pull complete
6103e19fae57: Pull complete
Digest: sha256:6b3fb49b3b9a83212f88fde92a8eb85e7232706167bdc8cbc1a44144520d86dd
Status: Downloaded newer image for maven:3-openjdk-8
root@8e7beb5bd027:/# java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
root@8e7beb5bd027:/# git clone https://github.com/j-easy/easy-batch.git
Cloning into 'easy-batch'...
remote: Enumerating objects: 426, done.
remote: Counting objects: 100% (426/426), done.
remote: Compressing objects: 100% (229/229), done.
remote: Total 45877 (delta 108), reused 337 (delta 60), pack-reused 45451
Receiving objects: 100% (45877/45877), 26.05 MiB | 3.25 MiB/s, done.
Resolving deltas: 100% (18704/18704), done.
root@8e7beb5bd027:/# cd easy-batch && mvn install && cd easy-batch-tutorials
[INFO] Scanning for projects...

...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:32 min
[INFO] Finished at: 2020-07-12T21:35:36Z
[INFO] ------------------------------------------------------------------------
root@8e7beb5bd027:/easy-batch/easy-batch-tutorials# mvn exec:java -PrunCsv2xmlTutorial
[INFO] Scanning for projects...

...

[pool-2-thread-1] INFO org.jeasy.batch.core.job.BatchJob - Job 'job' starting
[pool-2-thread-1] INFO org.jeasy.batch.core.job.BatchJob - Job 'job' started
[pool-2-thread-1] INFO org.jeasy.batch.core.job.BatchJob - Job 'job' stopping
[pool-2-thread-1] INFO org.jeasy.batch.core.job.BatchJob - Job 'job' finished with status COMPLETED in 47ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.942 s
[INFO] Finished at: 2020-07-12T21:35:47Z
[INFO] ------------------------------------------------------------------------
root@8e7beb5bd027:/easy-batch/easy-batch-tutorials# cat target/tweets.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tweets>
<tweet><id>1</id><message>easy batch rocks! #EasyBatch</message><user>foo</user></tweet>
<tweet><id>2</id><message>@foo I do confirm :-)</message><user>bar</user></tweet>
<tweet><id>3</id><message>@foo @bar Is it really easy?</message><user>baz</user></tweet>
<tweet><id>4</id><message>@foo @bar @baz yeah! kinda KISS framework</message><user>toto</user></tweet>
</tweets>
root@8e7beb5bd027:/easy-batch/easy-batch-tutorials#

Please provide more details about the error and the steps to reproduce it and I will take a look. Thank you upfront.