2011-08-26 59 views
0

我想部署我的J2EE應用程序。在我的應用程序中,我使用了CMP,因此需要jbosscmp-jdbc.xml文件。 Howerver,當我試圖在JBoss部署我的應用程序,我得到了follwing例外:在Jboss 4中部署時,無效的XML:jbosscmp-jdbc.xml?

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

這裏是

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

我試圖在這兩個部署JBossCMP的-jdbc.xml中的內容Jboss 4和5,但得到了同樣的錯誤。 曾試圖谷歌這個,但沒有運氣。 我的jbosscmp-jdbc.xml有什麼問題?

回答

0

發現我的缺陷jbosscmp-jdbc.xml, 刪除實體TStudents中的元素:<abstract-schema-name>TStudents</abstract-schema-name>

感謝所有閱讀我的問題。