Uploaded image for project: 'XBean'
  1. XBean
  2. XBEAN-193

Wrong separator for JarArchives

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.8, 3.9
    • 3.9
    • finder
    • None
    • Windows,
      OpenEjb 4.0.0-beta-2-SNAPSHOT (using XBean 3.8)

    Description

      Hello everybody,

      Problem:
      I'm using Apache TomEE from OpenEjb 4.0.0-beta-2-SNAPSHOT which uses the within the openejb-core the xbean-finder (3.8) for classloading purposes.

      I created a web archive which has a simple dependency to a jar. I defined an injectionpoint within a servlet. This injectionpoint points to a class which is located within the jar archive. The deployment of the web archive fails with an unsatisfied dependency exception because classloader isn't able to load the classes from the jar.

      I've found out that the JarArchive class (package org.apache.xbean.finder.archive) uses "File.separatorChar" in order to replace "." within the private method addClassName.
      As I know, the separator within a jar entry has to be '/'. "File.separatorChar" returns on a windows machine '\' instead. This behaviour causes the deployment problem.

      Solution:

      Instead of (JarArchive):
      className = className.replace(File.separatorChar, '.');

      it has to look something like this:
      className = className.replace('/', '.');

      The Archive class (org.apache.xbean.finder.archive) has to be changed for the unit tests

      Instead of:
      String name = clazz.getName().replace('.', File.separatorChar) + ".class";

      we need something like this:
      String name = clazz.getName().replace('.', '/') + ".class";

      Best regards,
      Mart Köhler

      Attachments

        1. jararchive_separator.patch
          2 kB
          Mart Köhler

        Activity

          People

            Unassigned Unassigned
            mkoehler Mart Köhler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: