在 Jboss 4 中部署时 XML 无效:jbosscmp-jdbc.xml?

发布于 2024-12-01 15:05:06 字数 2754 浏览 2 评论 0原文

我正在尝试部署我的 J2EE 应用程序。在我的应用程序中,我使用了 CMP,因此需要 jbosscmp-jdbc.xml 文件。然而,当我尝试在 Jboss 中部署我的应用程序时,出现以下异常:

 org.jboss.deployment.DeploymentException: Invalid XML:....
!/META-INF/jbosscmp-jdbc.xml; - nested throwable:
    ....
    The content of element type "entity" must match "(ejb-name,datasource?,datasource-mapping?,create-table?,remove-table?,post-table-create?,read-only?,read-time-out?,row-locking?,pk-constraint?,read-ahead?,list-cache-max?,clean-read-ahead-on-load?,fetch-size?,table-name?,cmp-field*,load-groups?,eager-load-group?,lazy-load-groups?,query*,unknown-pk?,entity-command?,optimistic-locking?,audit?)".)
    .......
    Caused by: org.xml.sax.SAXParseException: The content of element type "entity" must match "....

这是 jbosscmp-jdbc.xml 的内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd" >

<jbosscmp-jdbc>
    <defaults>
        <datasource>Java:/BeansDemoDB</datasource>
        <datasource-mapping>MS SQLSERVER</datasource-mapping>
        <create-table>false</create-table>
    </defaults>
    <enterprise-beans>
        <entity>
            <ejb-name>TUsers</ejb-name>
            <table-name>T_Users</table-name>
            <cmp-field>
                <field-name>username</field-name>
                <column-name>username</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>password</field-name>
                <column-name>password</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>role</field-name>
                <column-name>role</column-name>
            </cmp-field>
        </entity>
        <entity>
            <ejb-name>TStudents</ejb-name>
            <table-name>T_Students</table-name>
            <abstract-schema-name>TStudents</abstract-schema-name>
            <cmp-field>
                <field-name>studentID</field-name>
                <column-name>studentID</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>studentName</field-name>
                <column-name>studentName</column-name>
            </cmp-field>
        </entity>
    </enterprise-beans>
</jbosscmp-jdbc>

,我尝试在 Jboss 4 和 5 中部署,但遇到了相同的错误。 曾尝试用谷歌搜索这个但没有运气。 我的 jbosscmp-jdbc.xml 有什么问题?

I am trying to deploy my J2EE application. In my app, I used CMP so there is a need of jbosscmp-jdbc.xml file. Howerver, when I tried to deploy my app in the Jboss, I got the follwing exception:

 org.jboss.deployment.DeploymentException: Invalid XML:....
!/META-INF/jbosscmp-jdbc.xml; - nested throwable:
    ....
    The content of element type "entity" must match "(ejb-name,datasource?,datasource-mapping?,create-table?,remove-table?,post-table-create?,read-only?,read-time-out?,row-locking?,pk-constraint?,read-ahead?,list-cache-max?,clean-read-ahead-on-load?,fetch-size?,table-name?,cmp-field*,load-groups?,eager-load-group?,lazy-load-groups?,query*,unknown-pk?,entity-command?,optimistic-locking?,audit?)".)
    .......
    Caused by: org.xml.sax.SAXParseException: The content of element type "entity" must match "....

Here is the content of jbosscmp-jdbc.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd" >

<jbosscmp-jdbc>
    <defaults>
        <datasource>Java:/BeansDemoDB</datasource>
        <datasource-mapping>MS SQLSERVER</datasource-mapping>
        <create-table>false</create-table>
    </defaults>
    <enterprise-beans>
        <entity>
            <ejb-name>TUsers</ejb-name>
            <table-name>T_Users</table-name>
            <cmp-field>
                <field-name>username</field-name>
                <column-name>username</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>password</field-name>
                <column-name>password</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>role</field-name>
                <column-name>role</column-name>
            </cmp-field>
        </entity>
        <entity>
            <ejb-name>TStudents</ejb-name>
            <table-name>T_Students</table-name>
            <abstract-schema-name>TStudents</abstract-schema-name>
            <cmp-field>
                <field-name>studentID</field-name>
                <column-name>studentID</column-name>
            </cmp-field>
            <cmp-field>
                <field-name>studentName</field-name>
                <column-name>studentName</column-name>
            </cmp-field>
        </entity>
    </enterprise-beans>
</jbosscmp-jdbc>

I have tried to deploy in both Jboss 4 and 5, but got the same error.
Have tried to google this but no luck.
What's wrong with my jbosscmp-jdbc.xml?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不回头走下去 2024-12-08 15:05:06

在我的 jbosscmp-jdbc.xml 中发现错误,
删除实体 TStudents 中的元素:TStudents

感谢大家阅读我的问题。

Found bug in my jbosscmp-jdbc.xml,
Remove the element: <abstract-schema-name>TStudents</abstract-schema-name> in the entity TStudents.

Thanks all for reading my question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文