OpenEJB
  1. OpenEJB
  2. OPENEJB-750

EJB 2 Entity bean with CMP field mapped to CMR field causes ClassFormatError

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0-beta-1, 3.0-beta-2
    • Fix Version/s: 3.0
    • Component/s: cmp2
    • Labels:
      None

      Description

      When deploying a CMP entity bean which has a many to one relationship, the following stack trace is produced when a class that is generated on the fly is loaded.

      This appears to be because the getter/setter for the field that links the entity to the parent is generated twice with the same signature - once as a regular CMP field, and once as a field that is participating in a CMR relationship.

      org.apache.openejb.OpenEJBException: Creating application failed: F:\Java\openejb-3.0-beta-1\apps\ejb-1.0.jar: Error building bean 'Contact'. Exception: class java.lang.ClassFormatError: Repetitive method name/signature in class file openejb/uk/me/jrg/jee/sample/ejb/Contact: Repetitive method name/signature in class file openejb/uk/me/jrg/jee/sample/ejb/Contact
      at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:558)
      at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:299)
      at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:207)
      at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:149)
      at org.apache.openejb.OpenEJB.init(OpenEJB.java:293)
      at org.apache.openejb.server.Server.init(Server.java:63)
      at org.apache.openejb.server.Main.initServer(Main.java:155)
      at org.apache.openejb.server.Main.main(Main.java:128)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.openejb.cli.MainImpl.main(MainImpl.java:151)
      at org.apache.openejb.cli.Bootstrap.main(Bootstrap.java:102)
      Caused by: org.apache.openejb.OpenEJBException: Error building bean 'Contact'. Exception: class java.lang.ClassFormatError: Repetitive method name/signature in class file openejb/uk/me/jrg/jee/sample/ejb/Contact: Repetitive method name/signature in class file openejb/uk/me/jrg/jee/sample/ejb/Contact
      at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:65)
      at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:431)
      ... 13 more
      Caused by: java.lang.ClassFormatError: Repetitive method name/signature in class file openejb/uk/me/jrg/jee/sample/ejb/Contact
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.load(EnterpriseBeanBuilder.java:415)
      at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.loadClass(EnterpriseBeanBuilder.java:395)
      at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.build(EnterpriseBeanBuilder.java:267)
      at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:53)
      ... 14 more

      1. OpenEJB_EJB2_CMR_Fix.patch
        0.6 kB
        Jonathan Gallimore
      2. ejb-1.0.jar
        17 kB
        Jonathan Gallimore

        Activity

        Hide
        Jonathan Gallimore added a comment -

        EJB-JAR that demonstrates the problem

        Show
        Jonathan Gallimore added a comment - EJB-JAR that demonstrates the problem
        Hide
        Jonathan Gallimore added a comment -

        This is a potential patch to fix this problem.

        Show
        Jonathan Gallimore added a comment - This is a potential patch to fix this problem.
        Hide
        Jonathan Gallimore added a comment -

        This also appears to happen when deploying the EJB-JAR from the Geronimo Bank sample (from v1.2), so I guess this isn't down to an error with my sample app.

        Show
        Jonathan Gallimore added a comment - This also appears to happen when deploying the EJB-JAR from the Geronimo Bank sample (from v1.2), so I guess this isn't down to an error with my sample app.
        Hide
        Dain Sundstrom added a comment -

        Committed revision 633321.

        Thanks for the patch!

        Show
        Dain Sundstrom added a comment - Committed revision 633321. Thanks for the patch!

          People

          • Assignee:
            Dain Sundstrom
            Reporter:
            Jonathan Gallimore
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development