2 Replies Latest reply on Aug 29, 2002 10:34 AM by Dzidas

    Element "defaults" does not allow "type-mappings" here.

    Dzidas Newbie

      Hi,
      I have interest problem. I think this problem is in jbosscmp-jdbc.xml. My first version was without default
      datasouce.

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

      <ejb-name>AuctionBean</ejb-name>
      <table-name>Auction</table-name>

      <cmp-field>
      <field-name>auc_id</field-name>
      <column-name>auc_id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>user_id</field-name>
      <column-name>user_id</column-name> <not-null/>
      </cmp-field>
      <cmp-field>
      <field-name>auc_name</field-name>
      <column-name>auc_name</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>auc_descr</field-name>
      <column-name>auc_descr</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>auc_start_price</field-name>
      <column-name>auc_start_price</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>auc_end_price</field-name>
      <column-name>auc_end_price</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>auc_start_date</field-name>
      <column-name>auc_start_date</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>auc_end_date</field-name>
      <column-name>auc_end_date</column-name>
      </cmp-field>

      </enterprise-beans>
      </jbosscmp-jdbc>
      But I was getting error:
      2002-08-29 13:17:02,297 ERROR [org.jboss.ejb.EjbModule] Initialization failed
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCTypeFactory.createTypeSimple(JDBCTypeFactory.java:113)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCTypeFactory.getJDBCType(JDBCTypeFactory.java:75)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.(JDBCAbstractCMPFieldBridge.java:61)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.(JDBCCMP2xFieldBridge.java:44)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.createCMPField(JDBCEntityBridge.java:281)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.loadCMPFields(JDBCEntityBridge.java:148)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.(JDBCEntityBridge.java:108)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManager.java:332)
      at org.jboss.ejb.plugins.CMPPersistenceManager.create(CMPPersistenceManager.java:155)
      at org.jboss.ejb.EntityContainer.create(EntityContainer.java:337)
      at org.jboss.ejb.Container.invoke(Container.java:789)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
      at $Proxy6.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:272)
      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:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy30.create(Unknown Source)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:392)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:134)
      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:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
      at $Proxy6.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:272)
      at org.jboss.system.ServiceController.create(ServiceController.java:212)
      at sun.reflect.GeneratedMethodAccessor3.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:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy5.create(Unknown Source)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:380)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
      at sun.reflect.GeneratedMethodAccessor9.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:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:586)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:465)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:202)


      If I put this code

      <!--
      java:/dtsDS
      <datasource-mapping>Oracle8</datasource-mapping>
      -->
      java:/PostgresDS
      <datasource-mapping>PostgreSQL</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <read-ahead>
      on-load
      <read-ahead>


      I will get error:

      2002-08-29 14:07:10,233 INFO [org.jboss.ejb.EjbModule] Deploying AuctionBean
      2002-08-29 14:07:10,263 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.create: []
      2002-08-29 14:07:10,303 DEBUG [org.jboss.proxy.ejb.ProxyFactory] Bound jmxName=jboss.j2ee:service=EJB,jndiName=AuctionBean, hash=1287510318into Registry
      2002-08-29 14:07:10,303 DEBUG [org.jboss.proxy.ejb.ProxyFactory] Proxy Factory for AuctionBean initialized
      2002-08-29 14:07:10,303 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.AuctionBean] Initializing CMP plugin for AuctionBean
      2002-08-29 14:07:10,393 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.AuctionBean] Loading standardjbosscmp-jdbc.xml : file:/C:/bean2/jboss/server/default/conf/standardjbosscmp-jdbc.xml
      2002-08-29 14:07:10,553 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.AuctionBean] jar:file:/C:/bean2/jboss/server/default/tmp/deploy/server/default/deploy/auction3.jar/86.auction3.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults
      2002-08-29 14:07:10,583 ERROR [org.jboss.metadata.XmlFileLoader] File file:/C:/bean2/jboss/server/default/tmp/deploy/server/default/deploy/auction3.jar/86.auction3.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 7. Error message:
      org.xml.sax.SAXParseException: Element "defaults" does not allow "type-mappings" here.
      at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
      at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(ValidatingParser.java:349)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1317)
      at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
      at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
      at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
      at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
      at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
      at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
      at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:86)
      at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:257)
      at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.java:226)
      at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:211)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:74)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:601)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManager.java:321)
      at org.jboss.ejb.plugins.CMPPersistenceManager.create(CMPPersistenceManager.java:155)
      at org.jboss.ejb.EntityContainer.create(EntityContainer.java:337)
      at org.jboss.ejb.Container.invoke(Container.java:789)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
      at $Proxy6.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:272)
      at sun.reflect.GeneratedMethodAccessor21.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:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy50.create(Unknown Source)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:392)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:134)
      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:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
      at $Proxy6.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:272)
      at org.jboss.system.ServiceController.create(ServiceController.java:212)
      at sun.reflect.GeneratedMethodAccessor3.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:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy5.create(Unknown Source)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:380)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
      at sun.reflect.GeneratedMethodAccessor9.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:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:586)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:465)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:202)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      2002-08-29 14:07:10,914 ERROR [org.jboss.metadata.XmlFileLoader] File file:/C:/bean2/jboss/server/default/tmp/deploy/server/default/deploy/auction3.jar/86.auction3.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 7. Error message:
      org.xml.sax.SAXParseException: Element "type-mappings" does not allow text.

      Thanks

        • 1. Re: Element "defaults" does not allow "type-mappings" here.
          Alexander Lepekhine Newbie

          Be careful. You didn't close <read-ahead> tag.
          Regards, Alexander

          • 2. Re: Element "defaults" does not allow "type-mappings" here.
            Dzidas Newbie

            My final good version is:
            (but I don't undersand, why don't work another version...)

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


            java:/PostgresDS
            <datasource-mapping>PostgreSQL</datasource-mapping>


            <enterprise-beans>

            <ejb-name>AuctionBean</ejb-name>
            <table-name>Auction</table-name>

            <cmp-field>
            <field-name>auc_id</field-name>
            <column-name>auc_id</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>user_id</field-name>
            <column-name>user_id</column-name> <not-null/>
            </cmp-field>
            <cmp-field>
            <field-name>auc_name</field-name>
            <column-name>auc_name</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>auc_descr</field-name>
            <column-name>auc_descr</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>auc_start_price</field-name>
            <column-name>auc_start_price</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>auc_end_price</field-name>
            <column-name>auc_end_price</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>auc_start_date</field-name>
            <column-name>auc_start_date</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>auc_end_date</field-name>
            <column-name>auc_end_date</column-name>
            </cmp-field>

            </enterprise-beans>
            </jbosscmp-jdbc>