You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/08/17 13:33:14 UTC
[GitHub] [beam] nek4life opened a new issue, #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
nek4life opened a new issue, #22756:
URL: https://github.com/apache/beam/issues/22756
### What happened?
### What happened?
I'm trying to use the XmlIO SDK to parse XML and receiving the following error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
I'm using Java 17 as it says I can use Java 17 here on the quickstart page
https://beam.apache.org/get-started/quickstart-java/
> Download and install the [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/index.html) version 8, 11, or 17. Verify that the [JAVA_HOME](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars001.html) environment variable is set and points to your JDK installation.
I've added the Jakarta dependencies in order to use jaxb
```
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.0</version>
<scope>runtime</scope>
</dependency>
```
I believe the error is because the XmlIO SDK has not been updated to include the Jakarta dependancies since they have been moved to.
Here is an example of my pipeline
```
public class OrdersToBigQuery {
public interface OrdersToBigQueryOptions extends PipelineOptions {
@Description("File input path")
@Default.String("order.xml")
String getInputPath();
void setInputPath(String value);
}
public static void main(String[] args) {
PipelineOptionsFactory.register(OrdersToBigQueryOptions.class);
OrdersToBigQueryOptions options =
PipelineOptionsFactory.fromArgs(args).as(OrdersToBigQueryOptions.class);
Pipeline p = Pipeline.create(options);
p.apply("Read XML", XmlIO.<ComplexTypeOrder>read()
.from(options.getInputPath())
.withRootElement("orders")
.withRecordElement("order")
.withRecordClass(ComplexTypeOrder.class)
);
}
}
```
### Issue Priority
Priority: 2
### Issue Component
Component: io-java-xml
### Issue Priority
Priority: 2
### Issue Component
Component: io-java-xml
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey commented on issue #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Posted by GitBox <gi...@apache.org>.
johnjcasey commented on issue #22756:
URL: https://github.com/apache/beam/issues/22756#issuecomment-1232020475
That issue seems likely. If you manually include those dependencies, does it resolve the issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nek4life commented on issue #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Posted by GitBox <gi...@apache.org>.
nek4life commented on issue #22756:
URL: https://github.com/apache/beam/issues/22756#issuecomment-1232040671
@johnjcasey I'm not sure I follow. Do you mean include the jars for the javax/xml/bind? I need the new jars for the classes I generated from an xsd. Is it possible to have both?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey commented on issue #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Posted by GitBox <gi...@apache.org>.
johnjcasey commented on issue #22756:
URL: https://github.com/apache/beam/issues/22756#issuecomment-1232047334
If you include the jakarta libs that were removed from the JDK specifically, does that solve the issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nek4life commented on issue #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Posted by GitBox <gi...@apache.org>.
nek4life commented on issue #22756:
URL: https://github.com/apache/beam/issues/22756#issuecomment-1232145096
No problem. Appreciate you taking a look. I did add the following in addition to the other two dependencies
```
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.3</version>
</dependency>
```
And my program is able to run. I'm not that familiar with Beam so I'm trying to figure out how to write my xml to a file to make sure something is happening.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nek4life commented on issue #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Posted by GitBox <gi...@apache.org>.
nek4life commented on issue #22756:
URL: https://github.com/apache/beam/issues/22756#issuecomment-1232051242
No that does not. I referenced that I had included them in the original post. The error is appears because the imports that are used in the XmlIO package reference javax and the namespace changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] johnjcasey commented on issue #22756: [Bug]: XmlIO Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
Posted by GitBox <gi...@apache.org>.
johnjcasey commented on issue #22756:
URL: https://github.com/apache/beam/issues/22756#issuecomment-1232110452
Ah, sorry I misunderstood. I'll take a look at it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org