Hello James,

Tuesday, May 07, 2002, 9:54:24 AM, you wrote:

How does your jbosscmp-jdbc.xml look like?
Does it contain <key-fields>? Does it contain empty <key-fields/>?
If so, you have to either remove <key-fields> or specify all
<key-field> elements correctly.

JR> Hello,

JR> I am running JBoss3.0.0RC2_Tomcat4.0.3 against Firebird 1.0 on Mac OS X 
JR> 10.1.4.  I was trying to deploy a simple Customer EJB which has a cmr to 
JR> a ShippingAddress.  I get the following error:

JR> org.jboss.deployment.DeploymentException: error in create of EjbModule: 
JR> file:/jboss-3.0.0RC2/server/default/deploy/ad-ejb.jar; - nested 
JR> throwable: (org.jboss.deployment.DeploymentException: Atleast one role 
JR> of a foreign-key mapped relationship must have key fields: 
JR> ejb-relation-name=Customer-DefaultShippingAddress)
JR>          at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:380)
JR>          at 
JR> org.jboss.deployment.MainDeployer.create(MainDeployer.java:651)
JR>          at 
JR> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:526)
JR>          at 
JR> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:490)
JR>          at java.lang.reflect.Method.invoke(Native Method)
JR>          at 
JR> org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
JR> (ReflectedMBeanDispatcher.java:284)
JR>          at 
JR> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
JR>          at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
JR>          at $Proxy4.deploy(Unknown Source)
JR>          at 
JR> org.jboss.deployment.scanner.URLDeploymentScanner.deploy
JR> (URLDeploymentScanner.java:405)
JR>          at 
JR> org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory
JR> (URLDeploymentScanner.java:586)
JR>          at 
JR> org.jboss.deployment.scanner.URLDeploymentScanner.scan
JR> (URLDeploymentScanner.java:465)
JR>          at 
JR> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(
JR> AbstractDeploymentScanner.java:202)
JR>          at 
JR> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run
JR> (AbstractDeploymentScanner.java:191)

JR> The cmr XML description:

JR>        <ejb-relation >
JR>           <ejb-relation-name>Customer-
JR> DefaultShippingAddress</ejb-relation-name>
JR>           <!-- unidirectional -->
JR>           <ejb-relationship-role >
JR>              <ejb-relationship-role-
name>>Customer-has-DefaultShippingAddress</ejb-relationship-role-name>
JR>              <multiplicity>One</multiplicity>
JR>              <relationship-role-source >
JR>                 <ejb-name>Customer</ejb-name>
JR>              </relationship-role-source>
JR>              <cmr-field >
JR>                 <cmr-field-name>defaultShippingAddress</cmr-field-name>
JR>              </cmr-field>
JR>           </ejb-relationship-role>
JR>           <ejb-relationship-role >
JR>              <ejb-relationship-role-
name>>DefaultShippingAddress-belongs-to-
JR> Customer</ejb-relationship-role-name>
JR>              <multiplicity>One</multiplicity>
JR>              <relationship-role-source >
JR>                 <ejb-name>Address</ejb-name>
JR>              </relationship-role-source>
JR>           </ejb-relationship-role>
JR>        </ejb-relation>

JR> Seems correct.  Does anyone know what "key" the deployer is 
JR> referencing?  XDoclet source is below.

JR> Thanks for any help,

JR> James Richards

JR> ++++++++++++++++++++

JR> package com.mycorp.ejb.customer;

JR> import javax.ejb.EntityBean;
JR> import javax.ejb.EntityContext;
JR> import javax.ejb.CreateException;

JR> import com.mycorp.ejb.address.AddressLocal;

JR> /**
JR>   * A general purpose Customer bean.
JR>   *
JR>   * Uses XDoclet based tagging: http://xdoclet.sourceforge.net
JR>   *
JR>   * @ejb:bean name="Customer"
JR>   *            type="CMP"
JR>   *            jndi-name="ejb/mycorp/Customer"
JR>   *            local-jndi-name="CustomerLocal"
JR>   *            view-type="both"
JR>   *            primkey-field="id"
JR>   *            cmp-version="2.x"
JR>   *            schema="Customer"
JR>   *
JR>   * @ejb:pk class="java.lang.Integer"
JR>   *
JR>   * @ejb:home generate="both"
JR>   *           remote-class="com.mycorp.ejb.customer.CustomerHome"
JR>   *           local-class="com.mycorp.ejb.customer.CustomerLocalHome"
JR>   *
JR>   * @jboss:table-name="customer"
JR>   * @jboss:create-table="true"
JR>   * @jboss:remove-table="true"
JR>   * @jboss:tuned-updates="true"
JR>   * @jboss:read-only="false"
JR>   *
JR>   */
JR> public abstract class CustomerBean implements EntityBean {

JR>      EntityContext context;

JR>      /**
JR>       * A customer must have shipping/billing addresses prior to creation.
JR>       *
JR>       * @ejb:create-method
JR>       */
JR>      public java.lang.Integer ejbCreate(Integer id,
JR>                                         AddressLocal defaultShipping
JR>                                        ) throws 
JR> javax.ejb.CreateException {
JR>         setId(id);
JR>         return null;
JR>      }

JR>      public void ejbPostCreate(Integer id,
JR>                                AddressLocal defaultShipping
JR>                               ) {
JR>         setDefaultShippingAddress(defaultShipping);
JR>      }

JR>      /**
JR>       * @ejb:pk-field
JR>       * @ejb:persistent-field
JR>       * @ejb:interface-method
JR>       */
JR>      public abstract Integer getId();
JR>      /**
JR>       * NOT a remote method
JR>       */
JR>      public abstract void setId(Integer id);


JR>      /**
JR>       * @ejb:interface-method
JR>       * @ejb:relation name="Customer-DefaultShippingAddress"
JR>       *               role-name="Customer-has-DefaultShippingAddress"
JR>       *               target-ejb="Address"
JR>       *               target-role-
JR> name="DefaultShippingAddress-belongs-to-Customer"
JR>       */
JR>      public abstract AddressLocal getDefaultShippingAddress();
JR>      /**
JR>       * @ejb:interface-method
JR>       */
JR>      public abstract void setDefaultShippingAddress(AddressLocal 
JR> shippingAddress);
JR> }


JR> _______________________________________________________________

JR> Have big pipes? SourceForge.net is looking for download mirrors. We supply
JR> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
JR> _______________________________________________
JR> JBoss-user mailing list
JR> [EMAIL PROTECTED]
JR> https://lists.sourceforge.net/lists/listinfo/jboss-user

-- 
Best regards,
 Alex                            mailto:[EMAIL PROTECTED]



_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to