Invalid XML: jbosscmp-jdbc.xml while deploy in Jboss 4?
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 tr开发者_开发问答ied 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?
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.
精彩评论