restlet odata pojo发电机错误

时间:2013-10-16 21:39:10

标签: java xml maven odata restlet

使用.net工具,我已经能够创建一个暴露旧MSSQL数据库的ODATA服务端点。我打算然后使用odata4j与它进行通信。然而,由于缺乏pojos,我转向重新安排。我在服务中看到了所有实体,但是当我运行restlet生成器时,它无法生成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,而不是不喜欢特定的实体。来自http://localhost:53088/ODataService.svc/$metadata的XML也是有效的,没有错误。

这是生成器代码:

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);
    }
}

以下是我的maven POM详细信息:

    <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>

任何建议将不胜感激。谢谢!

0 个答案:

没有答案