3 Replies Latest reply on Jan 23, 2004 11:32 AM by petrus

    invalid jbosscmp-jdbc.xml : WHY ?

    petrus Newbie

      I write a simple cmp bean, with xdoclet tags. One of the generated file, jbosscmp-jdbc.xml, always puts an exception when jboss parse it.
      I don't understand why.
      thanks for any help.

      Here is the exception trace :
      ------------------------------
      2004-01-23 11:16:28,400 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/Category,service=EJB
      org.jboss.deployment.DeploymentException: Invalid XML: file=jar:file:/C:/dev/jboss-3.2.2/server/biblio/tmp/deploy/tmp12609biblio.jar!/META-INF/jbosscmp-jdbc.xml
      at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:296)
      at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:247)
      at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.java:219)
      at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:203)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:74)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:676)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:372)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:320)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:343)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy41.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy12.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)


      The jbosscmp-jdbc.xml :
      ----------------------------
      (note : the space in the datasource tag is just added for this post)

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
      
      <jbosscmp-jdbc>
       <defaults>
       </defaults>
      
       <enterprise-beans>
      
       <!--
       To add beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
       that contains the <entity></entity> markup for those beans.
       -->
      
       <entity>
       <ejb-name>Category</ejb-name>
      < datasource>java:/MySqlDS< /datasource>
       <datasource-mapping>mySQL</datasource-mapping>
       <table-name>CATEGORIES</table-name>
      
       <cmp-field>
       <field-name>id</field-name>
       <column-name>CATEGORY_ID</column-name>
      
       <jdbc-type>INTEGER</jdbc-type>
       <sql-type>INTEGER</sql-type>
      
       <auto-increment/>
       </cmp-field>
       <cmp-field>
       <field-name>name</field-name>
       <column-name>CATEGORY_NAME</column-name>
      
       <jdbc-type>VARCHAR</jdbc-type>
       <sql-type>VARCHAR</sql-type>
      
       </cmp-field>
      
       </entity>
      
       </enterprise-beans>
      </jbosscmp-jdbc>


      the bean file :
      -----------------
      /*
       * Created on 22 janv. 2004
       */
      package ejb;
      
      import javax.ejb.CreateException;
      import javax.ejb.EntityBean;
      import javax.ejb.EntityContext;
      import javax.ejb.RemoveException;
      
      /**
       * @ejb:bean name="Category"
       * display-name="Category entity bean"
       * type="CMP"
       * cmp-version="2.x"
       * local-jndi-name="ejb/Category"
       * view-type="local"
       * schema="CategorySchema"
       * primkey-field="id"
       *
       * @ejb:persistence
       * table-name="CATEGORIES"
       *
       * @ejb:finder
       * view-type="local"
       * signature="java.util.Collection findAll()"
       * query="SELECT OBJECT(a) FROM CategorySchema AS a"
       *
       * @jboss:persistence
       * datasource="java:/MySqlDS"
       * datasource-mapping="mySQL"
       * table-name="CATEGORIES"
       *
       */
      
      public abstract class CategoryBean implements EntityBean {
      
       protected EntityContext _ctx;
      
       /**
       * @ejb.persistence
       * column-name="CATEGORY_ID"
       * jdbc-type="INTEGER"
       * sql-type="INTEGER"
       * @ejb.pk-field
       * @ejb.interface-method view-type="local"
       * @jboss.persistence
       * auto-increment="true"
       */
      
       public abstract String getId();
      
       /**
       * @ejb.persistence
       * column-name="CATEGORY_NAME"
       * jdbc-type="VARCHAR"
       * sql-type="VARCHAR"
       * @ejb.interface-method view-type="local"
       */
      
       public abstract String getName();
      
       /**
       * @ejb.interface-method view-type="local"
       */
       public abstract void setName(String name);
      
      
       public void setEntityContext(EntityContext ctx) {
       _ctx = ctx;
       }
      
       public void unsetEntityContext() {
       _ctx = null;
       }
      
       public void ejbActivate() {}
       public void ejbPassivate(){}
       public void ejbRemove() throws RemoveException {}
       public void ejbLoad() {}
       public void ejbStore() {}
      
       /**
       *
       * @ejb.create-method view-type="local"
       */
      
       public String ejbCreate(String name)
       throws CreateException {
       setName(name);
       return null;
       }
      
      }


        • 1. Re: invalid jbosscmp-jdbc.xml : WHY ?
          Darran Lofthouse Master

          Not sure how but the < entity > element that needs to wrap the entity bean description appears to be missing. (Or is that just the forum hiding it?)

          • 2. Re: invalid jbosscmp-jdbc.xml : WHY ?
            petrus Newbie

            Yes, the forum hides this tag, which is well placed in my file.

            • 3. Re: invalid jbosscmp-jdbc.xml : WHY ?
              petrus Newbie

              the <auto-increment/> tag is not supported.
              I work on jboss 3.2.2.

              error :
              2004-01-23 17:52:11,310 ERROR [org.jboss.metadata.XmlFileLoader] XmlFileLoader: File jar:file:/C:/dev/jboss-3.2.2/server/biblio/tmp/deploy/tmp20342biblio.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 29. Error message: Element type "auto-increment" must be declared.
              2004-01-23 17:52:11,310 ERROR [org.jboss.metadata.XmlFileLoader] XmlFileLoader: File jar:file:/C:/dev/jboss-3.2.2/server/biblio/tmp/deploy/tmp20342biblio.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 30. Error message: The content of element type "cmp-field" must match "(field-name,read-only?,read-time-out?,column-name?,not-null?,((jdbc-type,sql-type)|property+)?)".
              2