Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-750

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0-beta-1, 3.0-beta-2
    • 3.0
    • cmp2
    • 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

      Attachments

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

        Activity

          People

            dain Dain Sundstrom
            jgallimore Jonathan Gallimore
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: