Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read XML data without spring-tx in the classpath #4132

Closed
fmbenhassine opened this issue Jun 15, 2022 · 0 comments
Closed

Unable to read XML data without spring-tx in the classpath #4132

fmbenhassine opened this issue Jun 15, 2022 · 0 comments
Labels
for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line in: infrastructure type: bug
Milestone

Comments

@fmbenhassine
Copy link
Contributor

Bug description

Trying to read an XML file and unmarshall data to domain objects with spring-oxm/xstream does not work without having spring-tx in the classpath. The attached minimal complete example works as expected when spring-tx is in the classpath but fails with the following exception when spring-tx is not in the classpath:

java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessResourceFailureException
    at org.springframework.batch.item.xml.StaxEventItemReader.doOpen (StaxEventItemReader.java:241)
    at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open (AbstractItemCountingItemStreamItemReader.java:150)
    at com.example.demo.DemoApplication.main (DemoApplication.java:31)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataAccessResourceFailureException
    at java.net.URLClassLoader.findClass (URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:418)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:351)
    at org.springframework.batch.item.xml.StaxEventItemReader.doOpen (StaxEventItemReader.java:241)
    at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open (AbstractItemCountingItemStreamItemReader.java:150)
    at com.example.demo.DemoApplication.main (DemoApplication.java:31)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:748)

Environment

  • Java 8
  • Spring Batch version: 4.3.6
  • Spring Framework version: 5.3.20

Steps to reproduce

See the attached minimal complete example.

From an IDE

Load the project and run the com.example.demo.DemoApplication without any argument.

From the CLI

$> mvn package
$> mvn exec:java -Dexec.mainClass=com.example.demo.DemoApplication

Expected behavior

spring-tx should not be required to read an XML file.

Minimal Complete Reproducible example

issue-spring-oxm-without-spring-tx.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line in: infrastructure type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant