Ошибки генератора pojo odata restlet
Используя инструменты.net, я смог создать конечную точку службы ODATA, которая предоставляет устаревшую базу данных MSSQL. Затем я намеревался использовать odata4j для связи с ним. Однако, не имея поносов, я обратился к рестлету. Я сделал все сущности видимыми в сервисе, но когда я запускаю генератор рестлетов, он не генерирует pojos, говоря:
java.util.concurrent.TimeoutException
at org.restlet.ext.xml.SaxRepresentation.parse(SaxRepresentation.java:230)
at org.restlet.ext.odata.internal.edm.Metadata.<init>(Metadata.java:79)
at org.restlet.ext.odata.Service.getMetadata(Service.java:488)
at org.restlet.ext.odata.Generator.main(Generator.java:137)
...
Can't get the metadata for `http://localhost:53088/ODataService.svc/`
...
java.io.IOException: Couldn't parse the source representation: java.io.IOException: The thread blocked at the cyclic barrier has timed out.
at org.restlet.ext.xml.SaxRepresentation.parse(SaxRepresentation.java:238)
at org.restlet.ext.odata.internal.edm.Metadata.<init>(Metadata.java:79)
at org.restlet.ext.odata.Service.getMetadata(Service.java:488)
at org.restlet.ext.odata.Generator.main(Generator.java:137)
at xxx.model.generator.ModelGenerator.main(ModelGenerator.java:12)
Я решил сократить службу ODATA до единого простого объекта и попробовать генерацию кода, и это сработало! Но когда я включил больше сущностей, я получил ошибку разбора XML:
Can't get the metadata for `http://localhost:53088/ODataService.svc/`
java.io.IOException: Couldn't parse the source representation:\
org.xml.sax.SAXParseException: XML document structures must start and end within \
the same entity.
at org.restlet.ext.xml.SaxRepresentation.parse(SaxRepresentation.java:238)
at org.restlet.ext.odata.internal.edm.Metadata.<init>(Metadata.java:79)
at org.restlet.ext.odata.Service.getMetadata(Service.java:488)
at org.restlet.ext.odata.Generator.main(Generator.java:137)
at xxx.model.generator.ModelGenerator.main(ModelGenerator.java:12)
An error occurred:
Cannot retrieve the metadata.
В любом случае, кажется, что он не любит xml после некоторого количества объектов, а не любит определенный объект. Также XML из http://localhost:53088/ODataService.svc/$metadata
действует без ошибок.
Вот код генератора:
import org.restlet.ext.odata.Generator;
public class ModelGenerator
{
public static final String [] URL_WORKSPACE = { "http://localhost:53088/ODataService.svc/", "src/main/java/"};
public static void main(String[] args)
{
Generator.main(URL_WORKSPACE);
}
}
Вот мои подробности POM Maven:
<properties>
<org.odata4j.version>0.7.0</org.odata4j.version>
<org.restlet.version>2.1.4</org.restlet.version>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.odata4j</groupId>
<artifactId>odata4j-core</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>${org.restlet.version}</version>
</dependency>
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet.ext.odata</artifactId>
<version>${org.restlet.version}</version>
</dependency>
</dependencies>
Мы ценим любые предложения. Спасибо!