real-logic / simple-binary-encoding

Simple Binary Encoding (SBE) - High Performance Message Codec
Apache License 2.0
3.08k stars 519 forks source link

about run SebTool error #934

Closed kuangtu closed 1 year ago

kuangtu commented 1 year ago

My simple-binary-encoding-master version is:1.27.1 Java version is:11.0.9 The Build Process is finished and output the jars. sbe-benchmarks/build/libs sbe-samples/build/libs sbe-tool/build/libs sbe-all/build/libs

But when I output source files with schema: simple-binary-encoding-master\sbe-samples\build\resources\main\example-schema.xml java -Dsbe.generate.ir=true -Dsbe.target.language=Cpp -Dsbe.target.namespace=sbe -Dsbe.output.dir=include/gen -Dsbe.errorLog=yes -jar sbe-all/build/libs/sbe-all-1.27.1-SNAPSHOT.jar C:\tmp\simple-binary-encoding-master\sbe-samples\build\resources\main\example-schema.xml

The Error is: ERROR: at could not find dimensionType: groupSizeEncoding ERROR: at could not find type: varAsciiEncoding ERROR: at could not find dimensionType: groupSizeEncoding ERROR: at could not find dimensionType: groupSizeEncoding ERROR: at could not find type: varStringEncoding ERROR: at could not find type: varStringEncoding ERROR: at could not find type: varAsciiEncoding Exception in thread "main" java.lang.IllegalStateException: had 7 errors at uk.co.real_logic.sbe.xml.ErrorHandler.checkIfShouldExit(ErrorHandler.java:107) at uk.co.real_logic.sbe.xml.XmlSchemaParser.parse(XmlSchemaParser.java:140) at uk.co.real_logic.sbe.SbeTool.parseSchema(SbeTool.java:331) at uk.co.real_logic.sbe.SbeTool.main(SbeTool.java:232)

I copy the types in common-types.xml into example-schema.xml. <?xml version="1.0" encoding="UTF-8"?> <sbe:messageSchema xmlns:sbe="http://fixprotocol.io/2016/sbe" xmlns:xi="http://www.w3.org/2001/XInclude" package="baseline" id="1" version="0" semanticVersion="5.2" description="Example base schema which can be extended." byteOrder="littleEndian">

It generates source files and it's ok. Is there anything wrong? Thanks
officialspicey commented 1 year ago

ran into the exact issue. was able to output all the .jar files. But when I run the same command you have, i get this error:

$ java -Dsbe.generate.ir=true -Dsbe.target.language=Cpp -Dsbe.target.namespace=sbe -Dsbe.output.dir=include/gen -Dsbe.errorLog=yes -jar sbe-all/build/libs/sbe-all-1.27.1-SNAPSHOT.jar C:\tmp\simple-binary-encoding-master\sbe-samples\build\resources\main\example-schema.xml
Error: Could not find or load main class .generate.ir=true
Caused by: java.lang.ClassNotFoundException: /generate/ir=true

I do, however get the same Exceptions as you when I use a different command.

mjpt777 commented 1 year ago

Can you try with -jar ... as the first argument?

vyazelenko commented 1 year ago

@kuangtu Your error is due to the XSD includes not being resolved. You can fix it by adding the -Dsbe.xinclude.aware=true option before the -jar.

vyazelenko commented 1 year ago

@officialspicey It looks like you are seeing some sort of shell issue or a copy paste error which results in removal of the -Dsbe prefix from the system properties. Which renders the command invalid, i.e.:

$ java .generate.ir=true .target.language=Cpp .target.namespace=sbe .output.dir=include/gen .errorLog=yes -jar sbe-all/build/libs/sbe-all-1.27.1-SNAPSHOT.jar ...

See my reply in #935.

kuangtu commented 1 year ago

@kuangtu Your error is due to the XSD includes not being resolved. You can fix it by adding the -Dsbe.xinclude.aware=true option before the -jar.

It works, Thanks!

Scalaaaaaa commented 1 month ago

在types里增加下面的配置就可以了,

<composite name="groupSizeEncoding">
<type name="blockLength" primitiveType="uint16"/>
<type name="numInGroup" primitiveType="uint16"/>
<type name="numGroups" primitiveType="uint16" />
<type name="numVarDataFields" primitiveType="uint32" />
</composite>