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

XMLTransform failing with NullPointerException #17

Open
venkywg opened this issue Oct 6, 2020 · 4 comments
Open

XMLTransform failing with NullPointerException #17

venkywg opened this issue Oct 6, 2020 · 4 comments

Comments

@venkywg
Copy link

venkywg commented Oct 6, 2020

I'm trying to use jcustenborder's XmlTransform to convert XML to AVRO.

It fails with NullPointerException. It doesn't give cause for the NullPointer.
Can you please help me with fixing this error.

I'm passing the config
transforms.xmlToAvro.package = com.github.jcustenborder.kafka.connect.transform.xml.model
transforms.xmlToAvro.schema.path = [path/test.xsd]
transforms.xmlToAvro.type = class com.github.jcustenborder.kafka.connect.transform.xml.FromXml$Value
transforms.xmlToAvro.xjc.options.automatic.name.conflict.resolution.enabled = true
transforms.xmlToAvro.xjc.options.strict.check.enabled = true
transforms.xmlToAvro.xjc.options.verbose.enabled = true

It fails with the error

ERROR Failed to start task dev-XATest-0 (org.apache.kafka.connect.runtime.Worker)
org.apache.kafka.connect.errors.ConnectException: java.lang.NullPointerException
at org.apache.kafka.connect.runtime.ConnectorConfig.transformations(ConnectorConfig.java:264)
at org.apache.kafka.connect.runtime.Worker.buildWorkerTask(Worker.java:520)
at org.apache.kafka.connect.runtime.Worker.startTask(Worker.java:472)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.startTask(DistributedHerder.java:1147)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.access$1600(DistributedHerder.java:126)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$12.call(DistributedHerder.java:1162)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$12.call(DistributedHerder.java:1158)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at com.github.jcustenborder.kafka.connect.transform.xml.XSDCompiler.compileContext(XSDCompiler.java:146)
at com.github.jcustenborder.kafka.connect.transform.xml.FromXml.configure(FromXml.java:130)
at org.apache.kafka.connect.runtime.ConnectorConfig.transformations(ConnectorConfig.java:261)

@jcustenborder
Copy link
Owner

@venkywg What is the difference between this issue and the other one you opened? #16 It's not too easy to reproduce without a sample of XML and the XSD.

@venkywg
Copy link
Author

venkywg commented Oct 7, 2020

Sorry, I opened two by mistake. Let's delete 16. Ok. Basically, in Confluent Cloud Connect VM, we installed the jar.
/opt/confluent/share/confluent-hub-components/jcustenborder-kafka-connect-transform-xml-0.1.0.18/lib
I'm trying to use the Transform with JMSSourceConnector.
It parses the XSD, it generates classes in /tmp.
Later, it fails with the NullPointerException. No cause or info given in the Error.
I was wondering if it writes in that lib directory and tried giving all permissions on that directory. Still didn't work.

I tried with our xsd as well as the sample Book xsd given by you. Same error. Please advise.

@venkywg
Copy link
Author

venkywg commented Oct 7, 2020

When I used books.xsd, the following java files were created in /tmp

BookForm.java
ObjectFactory.java
BooksForm.java
package-info.java

Later, it failed with the NullPointerException described above.

@venkywg
Copy link
Author

venkywg commented Oct 14, 2020

I used note.xsd and note.xml with fileStreamSource connector and did log:TRACE

Please find attached the note.xsd , note.xml, trace.txt, note.java and the objectfactory.java

xml_transform_trace.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants