Details
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