jcustenborder / xjc-kafka-connect-plugin

Kafka Connect plugin to extend code generated by xjc to produce Kafka Connect Schemas and Structs.
3 stars 7 forks source link

XMLTransform failing with NullPointerException #17

Open venkywg opened 4 years ago

venkywg commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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