Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSGi + Proxy + Interface #556

Closed
YulawOne opened this issue Nov 25, 2013 · 5 comments
Closed

OSGi + Proxy + Interface #556

YulawOne opened this issue Nov 25, 2013 · 5 comments

Comments

@YulawOne
Copy link

Have issue with creating lazy reference via ProxyToys on class which have implemented my interface in OSGi environment.

Has: java.lang.IllegalArgumentException: interface is not visible from class loader

Because when proxy creating, they use non OSGi classloader.

I think ProxyToys should use classloader which provided ObjectFactory.

// Sorry for my english

@evanchooly
Copy link
Member

can you provide a test case? i'm trying to get the osgi stuff fixed up but i haven't really used osgi for a few years now.

@YulawOne
Copy link
Author

Ok, i will make test case on weekend

@YulawOne
Copy link
Author

I gone deeper with debug this issue and reproduce this bug (may be not) without OSGi environment.
General problem was in generics in type of embedded class which contains reference (see below to view example).
As i read issue tracker that generics is not supported right now?
Look example how i got that error:

public interface IHasName {
    String getName();
}


@Entity("Person")
public class Person implements IHasName {
    @Id
    private ObjectId id;

    private String name;
    private int age;

    // Getters/Setters
}


@Embedded
public class NamedRef<T extends IHasName> {
    @Reference(lazy = true)
    private T ref;
    private String name;

    public PersonRef(T ref) {
        this.ref = ref;
        this.name = ref.getName();
    }

    // Getters/Setters
}

@Entity("PersonContainer")
public class PersonContainer {
    @Id
    private ObjectId id;

    private String something;

    @Embedded
    private NamedRef<Person> person;

    // Getters/Setters
}

@evanchooly
Copy link
Member

It looks like you might be running up against issues #552 and #553

@evanchooly
Copy link
Member

duplicate of #552 and #553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants