7 Replies Latest reply on Apr 5, 2002 5:49 PM by tim

    CMP2 in JBoss3

    Miguel Newbie


      Does anybody have experience with JBoss3's new EJB2 CMP implementation ? Which release would you recommend to try out ? How do you check it out from cvs ?
      (commandline would be helpful)



        • 1. Re: CMP2 in JBoss3
          marc fleury Master

          EJB 2.0 is almost done and finished. The best is to check it out from CVS (instructions on the developers website). Your testing and documenting is appreciated, it should be fairly stable already, the developers have been banging on it for quite a while.

          You can also try MVCSoft's stuff it is pretty advanced

          • 2. Re: CMP2 in JBoss3
            tim Newbie

            It says in the J2EE 1.3 tutorial:

            ... for other beans, the key's value is arbitrary--provided that it's unique. With container-managed persistence, these key values can be generated automatically by the EJB container. To take advantage of this feature, an entity bean must meet these requirements:

            * In the deployment descriptor, the primary key class is defined as a java.lang.Object. The primary key field is not specified.
            * In the home interface, the argument of the findByPrimaryKey method must be a java.lang.Object.
            * In the entity bean class, the return type of the ejbCreate method must be a java.lang.Object.

            In these entity beans, the primary key values are in an internal field that only the EJB container can access. You cannot associate the primary key with a persistent field or any other instance variable. However, you can fetch the bean's primary key by invoking the getPrimaryKey method, and you can locate the bean by invoking its findByPrimaryKey method.

            This didn't seem to work in JBoss3. Did I do something wrong, or is it NYI?

            • 3. Re: CMP2 in JBoss3
              David Jencks Master

              NYI but Dain says soon.

              • 4. Re: CMP2 in JBoss3
                tim Newbie

                Thanks. BTW, since you are looking for user testing, here is another one...

                When trying a CMR accessor from a client, I get the following:

                java.lang.reflect.UndeclaredThrowableException: java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet
                at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
                at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
                at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
                at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
                at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:174)
                at org.jboss.proxy.ejb.GenericProxy.invoke(GenericProxy.java:182)
                at org.jboss.proxy.ejb.EntityProxy.invoke(EntityProxy.java:132)
                at $Proxy5.getEvents(Unknown Source)
                at picturecalendar.ejb.user.UserTest.testCreateAndFindByAndRemove(UserTest.java:63)

                Surely this doesn't mean CMR fields can only be accessed through the local interface! Another NYI, or am I losing it?

                While I am here, thanks and congratulations to all of the developers of JBoss. An excellent tool, no doubt dragging up the level of J2EE expertise throughout the Java community.

                • 5. Re: CMP2 in JBoss3
                  Stephen Coy Novice

                  From section 10.3.2 of the spec:

                  "Container-managed relationships can exist only among entity beans within the same local relationship
                  scope, as defined by the relationships element in the deployment descriptor. Container-managed
                  relationships are defined in terms of the local interfaces of the related beans."

                  • 6. Re: CMP2 in JBoss3
                    Sebastian Newbie

                    HI guys...

                    I wrote two entity beans and a client. one entity bean has a cmr field (one to many)
                    public abstract Collection getDestinationIPs();
                    that points to the other one with only two fields fk and ip

                    ... and now i try to call the localbean1.getCollection() method to obtain the all the ips from bean2..... and i am using local interfaces between the beans ... but i have the same output here

                    08:43:40,836 ERROR [JRMPInvoker] operation failed
                    java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet
                    at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
                    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
                    at java.rmi.MarshalledObject.(MarshalledObject.java:95)
                    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:369)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
                    at sun.rmi.transport.Transport$1.run(Transport.java:152)
                    at java.security.AccessController.doPrivileged(Native Method)
                    at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
                    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
                    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
                    at java.lang.Thread.run(Thread.java:484)

                    where is the prob???


                    • 7. Re: CMP2 in JBoss3
                      tim Newbie


                      Thanks for the quote from the spec, but does that mean that CMR fields can only be accessed from within the same JAR as the CMP EJBs? In other words, by other EJBs in the JAR?

                      It seems pretty silly if you have to package all the beans into the same JAR, and worse still if you cannot access CMR fields from clients (such as Web Server located JavaBeans) without an intervening Session Bean.

                      BTW, I see you are located in Sydney. I am from the US but flying tonight to Melbourne to work there for six months.