在 Jboss 4 中部署时 XML 无效:jbosscmp-jdbc.xml?
我正在尝试部署我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的
jbosscmp-jdbc.xml
中发现错误,删除实体
TStudents
中的元素:TStudents
。感谢大家阅读我的问题。
Found bug in my
jbosscmp-jdbc.xml
,Remove the element:
<abstract-schema-name>TStudents</abstract-schema-name>
in the entityTStudents
.Thanks all for reading my question.