Jeff, Just ignore the spec violation errors right now. The code was just added and from what I understand it is currently just a copy of the CMP 1.1 verifier. I don't remember who is working on it, but he said that this was a known problem. Anyway, it should be fixed soon.
-dain Jeff Schnitzer wrote: > I am trying to deploy a simple test CMP 2.0 entity bean on a fresh build > of the jboss 3.0 CVS tree. My deployment descriptors are built with the > CVS version of XDoclet. I feel fairly certain that they are correct, > and yet I am getting a spec violation error complaining that "the > primkey-field must be one of the CMP fields of the entity". > > In addition, I get an error message which looks like the > jbosscmp-jdbc.xml is failing validation... but looking at the DTD, the > complaint must be erroneous. The DTD says that all elements within > "defaults" are optional. > > What's up? Can someone take a look at this and give me some > suggestions? This is a trivial bean... > > (as an aside, should I be posting questions like this here or in the > forums or both?) > > The error looks like this: > ------ > 01:12:34,837 INFO [EARDeployer] Init J2EE application: > file:/C:/src/jboss/jboss-all/build/output/jboss-3.0.0beta2/server/defaul > t/deploy/servertest2.ear > 01:12:35,860 INFO [EJBDeployer] > Bean : SomeEntity > Section: 10.8.1 > Warning: The primkey-field must be one of the CMP fields of the entity > bean. > > 01:12:35,950 INFO [EjbModule] Creating > 01:12:36,050 INFO [EjbModule] Deploying SomeEntity > 01:12:36,742 INFO [EjbModule] Deploying SomeSession > 01:12:37,533 ERROR [XmlFileLoader] XmlFileLoader: File > njar:file:/C:/src/jboss/jboss-all/build/output/jboss-3.0.0beta2/server/d > efault/tmp/deploy/C/src/jboss/jboss-all/build/output/jboss-3.0.0beta2/se > rver/default/deploy/servertest2.ear/71.servertest2.ear^/servertest2-ejb. > jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 7. Error message: > Element "defaults" requires additional elements. > ...lots more errors > ------ > > Yet the primkey-field appears to be set up just fine. Here is what my > EJB (with XDoclet tags) looks like: > > ------ > package ejb; > > import javax.ejb.*; > > /** > * @author Jeff Schnitzer > * > * @ejb:bean name="SomeEntity" > * view-type="local" > * type="CMP" > * local-jndi-name="ejb/SomeEntity" > * primkey-field="id" > * > * @ejb:pk class="java.lang.String" > * > * @ejb:transaction type="Supports" > * > * @ejb:home local-extends="javax.ejb.EJBLocalHome" > * @ejb:data-object extends="java.lang.Object" > * > * @ejb:finder signature="java.util.Collection findAll()" > * query="" > * > * @jboss:table-name something > */ > public abstract class SomeEntityEJB extends EntityBeanSupport > { > /** > * @ejb:pk-field > * @ejb:interface-method > * @ejb:persistent-field > * > * @jboss:column-name="id" > */ > public abstract String getId(); > > public abstract void setId(String id); > > /** > * @ejb:interface-method > * @ejb:persistent-field > * > * @jboss:column-name="foo" > */ > public abstract String getFoo(); > > public abstract void setFoo(String foo); > > /** > * @ejb:create-method > */ > public String ejbCreate(String id, String foo) throws > CreateException > { > this.setId(id); > this.setFoo(foo); > > // For CMP we always return null > return null; > } > > public void ejbPostCreate(String id, String foo) {} > } > ------ > > This produces a very normal looking ejb-jar.xml: > > ------ > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise > JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> > > <ejb-jar> > > <description>No Description</description> > <display-name>Generated by XDoclet</display-name> > > <enterprise-beans> > > <!-- Session Beans --> > <session id="SomeSession"> > <description><![CDATA[No Description.]]></description> > > <ejb-name>SomeSession</ejb-name> > > <home>ejb.SomeSessionHome</home> > <remote>ejb.SomeSession</remote> > <ejb-class>ejb.SomeSessionEJB</ejb-class> > <session-type>Stateless</session-type> > <transaction-type>Container</transaction-type> > > </session> > > <!-- > To add session beans that you have deployment descriptor info > for, add > a file to your merge directory called session-beans.xml that > contains > the <session></session> markup for those beans. > --> > > <!-- Entity Beans --> > <entity id="SomeEntity"> > <description><![CDATA[No Description.]]></description> > > <ejb-name>SomeEntity</ejb-name> > > <local-home>ejb.SomeEntityLocalHome</local-home> > <local>ejb.SomeEntityLocal</local> > > <ejb-class>ejb.SomeEntityCMP</ejb-class> > <persistence-type>Container</persistence-type> > <prim-key-class>java.lang.String</prim-key-class> > <reentrant>False</reentrant> > <cmp-version>2.x</cmp-version> > <abstract-schema-name>SomeEntity</abstract-schema-name> > <cmp-field> > <description><![CDATA[]]></description> > <field-name>id</field-name> > </cmp-field> > <cmp-field> > <description><![CDATA[]]></description> > <field-name>foo</field-name> > </cmp-field> > <primkey-field>id</primkey-field> > > <query> > <query-method> > <method-name>findAll</method-name> > <method-params> > </method-params> > </query-method> > <ejb-ql><![CDATA[]]></ejb-ql> > </query> > > </entity> > > <!-- > To add entity beans that you have deployment descriptor info for, > add > a file to your merge directory called session-beans.xml that > contains > the <entity></entity> markup for those beans. > --> > > <!-- Message Driven Beans --> > <!-- > To add message driven beans that you have deployment descriptor > info for, add > a file to your merge directory called message-driven-beans.xml > that contains > the <message-driven></message-driven> markup for those beans. > --> > > </enterprise-beans> > > <!-- Relationships --> > > <!-- Assembly Descriptor --> > <assembly-descriptor> > > <!-- finder permissions --> > > <!-- finder permissions --> > > <!-- transactions --> > <container-transaction> > <method> > <ejb-name>SomeEntity</ejb-name> > <method-name>*</method-name> > </method> > <trans-attribute>Supports</trans-attribute> > </container-transaction> > <container-transaction> > <method> > <ejb-name>SomeSession</ejb-name> > <method-name>*</method-name> > </method> > <trans-attribute>Required</trans-attribute> > </container-transaction> > > <!-- finder transactions --> > </assembly-descriptor> > > </ejb-jar> > ------ > > Here is my jbosscmp-jdbc.xml: > > ------ > <?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> > <datasource>java:/DefaultDS</datasource> > </defaults> > > <enterprise-beans> > > <entity> > <ejb-name>SomeEntity</ejb-name> > <table-name>something</table-name> > > <cmp-field> > <field-name>foo</field-name> > <column-name>foo</column-name> > </cmp-field> > <cmp-field> > <field-name>id</field-name> > <column-name>id</column-name> > </cmp-field> > > </entity> > > </enterprise-beans> > > </jbosscmp-jdbc> > ------ > > I'm completely baffled. > > Thanks in advance, > Jeff Schnitzer > [EMAIL PROTECTED] > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user