public static void main(String[] args) {
// TODO Auto-generated method stub
String[] arguments =
{ "http://services.odata.org/V4/Northwind/Northwind.svc/",
"src/com" };
Generator.main(arguments);
}
输出:
---------------------------
OData client code generator
---------------------------
step 1 - check parameters
step 2 - check the ouput directory
step 3 - get the metadata descriptor
Starting the internal HTTP client
Get the metadata for http://services.odata.org/V4/Northwind/Northwind.svc/ at http://services.odata.org/V4/Northwind/Northwind.svc/$metadata
Starting the internal HTTP client
step 4 - generate source code
Starting the internal HTTP client
Get the metadata for http://services.odata.org/V4/Northwind/Northwind.svc/ at http://services.odata.org/V4/Northwind/Northwind.svc/$metadata
Starting the internal HTTP client
Stopping the internal HTTP client
Stopping the internal HTTP client
Stopping the internal HTTP client
Stopping the internal HTTP client
Error executing FreeMarker template
FreeMarker template error:
get(importedJavaClasses) failed on instance of org.restlet.ext.odata.internal.edm.EntityType. See cause exception.
The failing instruction (FTL stack trace):
----------
==> #list type.importedJavaClasses?sort a... [in template "template" at line 29, column 1]
----------
Java stack trace (for programmers):
----------
freemarker.template.TemplateModelException: [... Exception message was already printed; see it above ...]
at freemarker.ext.beans.BeanModel.get(BeanModel.java:222)
at freemarker.core.Dot._eval(Dot.java:76)
at freemarker.core.Expression.eval(Expression.java:111)
at freemarker.core.SequenceBuiltins$SequenceBuiltIn._eval(SequenceBuiltins.java:94)
at freemarker.core.Expression.eval(Expression.java:111)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.Environment.visitAndTransform(Environment.java:377)
at freemarker.core.CompressedBlock.accept(CompressedBlock.java:73)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.process(Environment.java:243)
at freemarker.template.Template.process(Template.java:277)
at org.restlet.ext.freemarker.TemplateRepresentation.write(TemplateRepresentation.java:315)
at org.restlet.representation.CharacterRepresentation.write(CharacterRepresentation.java:67)
at org.restlet.ext.odata.Generator.generate(Generator.java:283)
at org.restlet.ext.odata.Generator.main(Generator.java:140)
at com.MainMethod.main(MainMethod.java:14)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:912)
at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:275)
at freemarker.ext.beans.BeanModel.get(BeanModel.java:182)
... 20 more
Caused by: java.lang.NullPointerException
at org.restlet.ext.odata.internal.edm.EntityType.getImportedJavaClasses(EntityType.java:121)
... 27 more
An error occurred:
Cannot generate the source code in directory: src\com
Please check that you provide the following parameters:
- Valid URI for the remote service
- Valid directory path where to generate the files
- Valid name for the generated service class (optional)
我的书架
可能是什么问题?
感谢。
答案 0 :(得分:1)
我看到你使用带有restlet OData扩展的OData v4服务。此扩展目前仅支持旧版本的OData(v2和v3)。
我知道正在为支持这个最新版本或OData做出贡献。
我几乎可以肯定这是你问题的原因......
希望它有所帮助, 亨利