Hello Francesco,

you have declared cmr accessors as remote methods while relationships
are allowed only for local interfaces.

alex

Tuesday, October 08, 2002, 4:48:15 PM, you wrote:

FM> I get an exception:

FM> java.rmi.ServerException: RemoteException occurred in server thread; nested
FM> exception is:

FM> java.rmi.ServerException: EJBException:; nested exception is:

FM> javax.ejb.EJBException: null; CausedByException is:

FM> Method is not a known CMP field accessor, CMR field accessor, or ejbSelect
FM> method: methodName=setParent; nested exception is:

FM> javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field
FM> accessor, or ejbSelect method: methodName=setParent

FM> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)

FM> at sun.rmi.transport.Transport$1.run(Transport.java:148)

FM> at java.security.AccessController.doPrivileged(Native Method)

FM> at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

FM> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

FM> at
FM> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:7
FM> 01)

FM> at java.lang.Thread.run(Thread.java:536)

FM> at
FM> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteC
FM> all.java:247)

FM> at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)

FM> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)

FM> at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)

FM> at
FM> org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProx
FM> y.java:128)

FM> at
FM> org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)

FM> at
FM> org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73
FM> )

FM> at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)

FM> at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:116)

FM> at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

FM> at $Proxy2.createSubFolder(Unknown Source)

FM> at net.indaco.krakow.client.Main.main(Main.java:39)

FM> Caused by: java.rmi.ServerException: EJBException:; nested exception is:

FM> javax.ejb.EJBException: null; CausedByException is:

FM> Method is not a known CMP field accessor, CMR field accessor, or ejbSelect
FM> method: methodName=setParent; nested exception is:

FM> javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field
FM> accessor, or ejbSelect method: methodName=setParent

FM> at
FM> org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:355
FM> )

FM> at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:207)

FM> at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)

FM> at org.jboss.ejb.Container.invoke(Container.java:720)

FM> at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)

FM> at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)

FM> at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:370)

FM> at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)

FM> at
FM> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
FM> .java:25)

FM> at java.lang.reflect.Method.invoke(Method.java:324)

FM> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

FM> at sun.rmi.transport.Transport$1.run(Transport.java:148)

FM> at java.security.AccessController.doPrivileged(Native Method)

FM> at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

FM> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

FM> at
FM> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:7
FM> 01)

FM> at java.lang.Thread.run(Thread.java:536)

FM> Caused by: javax.ejb.EJBException: null; CausedByException is:

FM> Method is not a known CMP field accessor, CMR field accessor, or ejbSelect
FM> method: methodName=setParent; nested exception is:

FM> javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field
FM> accessor, or ejbSelect method: methodName=setParent

FM> at
FM> net.indaco.cesati.catalogue.domain.bean.FolderBean.createSubFolder(FolderBea
FM> n.java:147)

FM> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

FM> at
FM> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
FM> )

FM> at
FM> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
FM> .java:25)

FM> at java.lang.reflect.Method.invoke(Method.java:324)

FM> at
FM> org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.ja
FM> va:1191)

FM> at
FM> org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationIn
FM> terceptor.java:95)

FM> at
FM> org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchron
FM> izationInterceptor.java:308)

FM> at
FM> org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
FM> edConnectionInterceptor.java:186)

FM> at
FM> org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterce
FM> ptor.java:152)

FM> at
FM> org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.jav
FM> a:107)

FM> at
FM> org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterce
FM> ptor.java:69)

FM> at
FM> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
FM> .java:107)

FM> at
FM> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
FM> java:178)

FM> at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)

FM> at
FM> org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:13
FM> 0)

FM> at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)

FM> ... 15 more

FM> Finished executing

FM> Here is jbosscmp-jdbc.xml

FM>     <ejb-relation>
FM>       <ejb-relation-name>folder-parentfolder</ejb-relation-name>
FM>       <foreign-key-mapping/>
FM>       <ejb-relationship-role>

FM> <ejb-relationship-role-name>one-folder-has-many-folders</ejb-relationship-ro
le-name>>
FM>           <key-fields>
FM>              <key-field>
FM>                <field-name>id</field-name>
FM>                <column-name>parent</column-name>
FM>              </key-field>
FM>           </key-fields>
FM>       </ejb-relationship-role>
FM>       <ejb-relationship-role>

FM> <ejb-relationship-role-name>one-folder-has-one-parentfolder</ejb-relationshi
p-role-name>>
FM>           <key-fields/>
FM>       </ejb-relationship-role>
FM>     </ejb-relation>

FM> ejb-jar.xml:
FM>       <entity >
FM>          <description><![CDATA[No Description.]]></description>

FM>          <ejb-name>CesatiFolder</ejb-name>


FM> <home>net.indaco.cesati.catalogue.domain.interfaces.CesatiFolderHome</home>

FM> <remote>net.indaco.cesati.catalogue.domain.interfaces.CesatiFolder</remote>


FM> <ejb-class>net.indaco.cesati.catalogue.domain.bean.CesatiFolderCMP</ejb-clas
s>>
FM>          <persistence-type>Container</persistence-type>
FM>          <prim-key-class>java.lang.Integer</prim-key-class>
FM>          <reentrant>False</reentrant>
FM>          <cmp-version>2.x</cmp-version>
FM>          <abstract-schema-name>CesatiFolder</abstract-schema-name>
FM>          <cmp-field >
FM>             <description><![CDATA[]]></description>
FM>             <field-name>name</field-name>
FM>          </cmp-field>
FM>          <cmp-field >
FM>             <description><![CDATA[]]></description>
FM>             <field-name>id</field-name>
FM>          </cmp-field>
FM>          <cmp-field >
FM>             <description><![CDATA[]]></description>
FM>             <field-name>catalogue</field-name>
FM>          </cmp-field>
FM>          <primkey-field>id</primkey-field>

FM>          <query>
FM>             <query-method>
FM>                <method-name>findRootFolder</method-name>
FM>                <method-params>
FM>                   <method-param>java.lang.String</method-param>
FM>                </method-params>
FM>             </query-method>
FM>             <result-type-mapping>Remote</result-type-mapping>
FM>             <ejb-ql><![CDATA[SELECT OBJECT(c) FROM CesatiFolder c WHERE
FM> c.parent is null and c.catalogue = ?1]]></ejb-ql>
FM>          </query>

FM>       </entity>


FM>       <ejb-relation >
FM>          <ejb-relation-name>folder-parentfolder</ejb-relation-name>
FM>          <!-- bidirectional -->
FM>          <ejb-relationship-role >

FM> <ejb-relationship-role-name>one-folder-has-many-folders</ejb-relationship-ro
le-name>>
FM>             <multiplicity>One</multiplicity>
FM>             <relationship-role-source >
FM>                <ejb-name>CesatiFolder</ejb-name>
FM>             </relationship-role-source>
FM>             <cmr-field >
FM>                <cmr-field-name>folders</cmr-field-name>
FM>                <cmr-field-type>java.util.Collection</cmr-field-type>
FM>             </cmr-field>
FM>          </ejb-relationship-role>
FM>          <ejb-relationship-role >

FM> <ejb-relationship-role-name>one-folder-has-one-parentfolder</ejb-relationshi
p-role-name>>
FM>             <multiplicity>Many</multiplicity>
FM>             <relationship-role-source >
FM>                <ejb-name>CesatiFolder</ejb-name>
FM>             </relationship-role-source>
FM>             <cmr-field >
FM>                <cmr-field-name>parent</cmr-field-name>
FM>             </cmr-field>
FM>          </ejb-relationship-role>
FM>       </ejb-relation>

FM> and FolderBean.java (I use xdoclet):

FM> package net.indaco.cesati.catalogue.domain.bean;

FM> import net.indaco.cesati.catalogue.domain.interfaces.CesatiFolder;
FM> import net.indaco.cesati.catalogue.domain.interfaces.CesatiFolderHome;
FM> import java.util.Collection;
FM> import java.util.ArrayList;

FM> /**
FM>  * @ejb:bean
FM>  *   local-jndi-name="cesati/Folder"
FM>  *   name="CesatiFolder"
FM>  * @ejb:persistence
FM>  *    table-name="cesatifolder"
FM>  * @ejb:finder signature="Collection findRootFolder(java.lang.String
FM> catalogue)"
FM>  *    unchecked="true"
FM>  *    query="SELECT OBJECT(c) FROM CesatiFolder c WHERE c.parent is null and
FM> c.catalogue = ?1"
FM>  *    result-type-mapping="Remote"
FM>  * @jboss:remove-table "true"
FM>  * @ejb:util generate="physical"
FM>  * @jboss:tuned-updates "false"
FM>  * @jboss:read-only "false"
FM>  *
FM>  */


FM> public abstract class FolderBean extends
FM> net.indaco.krakow.catalogue.domain.bean.AbstractFolderBean {

FM>    /**
FM>     * @ejb:interface-method view-type="remote"
FM>     * @ejb:relation
FM>     *    name="folder-parentfolder"
FM>     *    role-name="one-folder-has-many-folders"
FM>     *
FM>     */
FM>    public abstract java.util.Collection getFolders();

FM>    /**
FM>     * @ejb:interface-method view-type="remote"
FM>     */
FM>    public abstract void setFolders(java.util.Collection folders);

FM>    /**
FM>     * @ejb:interface-method view-type="remote"
FM>     * @ejb:relation
FM>     *    name="folder-parentfolder"
FM>     *    role-name="one-folder-has-one-parentfolder"
FM>     * @jboss:relation related-pk-field="id"
FM>     *                 fk-column="parent"
FM>     */

FM>    public abstract CesatiFolder getParent();

FM>    /**
FM>     * @ejb:interface-method view-type="remote"
FM>     */
FM>    public abstract void setParent(CesatiFolder parent);

FM>    /**
FM>     * @ejb:interface-method view-type="remote"
FM>     */
FM>   public CesatiFolder createSubFolder() {
FM>     CesatiFolderHome home =
FM> (CesatiFolderHome)this._entityContext.getEJBHome();
FM>     try {
FM>       CesatiFolder folder = (CesatiFolder)home.create(this.getCatalogue());
FM> /*
FM>       if(this.getFolders() == null) {
FM>         Collection coll = new ArrayList();
FM>         coll.add(folder);
FM>         this.setFolders(coll);
FM>       }
FM> */
FM>       folder.setParent((CesatiFolder)this._entityContext.getEJBObject());
FM> //// EXCEPTION IS THROWN HERE
FM>       return folder;
FM>     }
FM>     catch(java.rmi.RemoteException e) {
FM>       throw new javax.ejb.EJBException(e);
FM>     }
FM>     catch(javax.ejb.CreateException e) {
FM>       throw new javax.ejb.EJBException(e);
FM>     }
FM>   }
FM> }


FM> Any idea?
FM> Thx
FM> Francesco Marsoni


-- 
Best regards,
 Alex Loubyansky




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to