[ 
https://issues.apache.org/jira/browse/FELIX-1538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748903#action_12748903
 ] 

Richard S. Hall commented on FELIX-1538:
----------------------------------------

I guess we are still missing something. I created this test case:

    public void testImportClassLoad2() throws Exception
    {
        try
        {
            InputStream is = 
this.getClass().getClassLoader().getResourceAsStream("jbosgi142-bundleX.jar");
            m_bundleA = 
getBundleContext().installBundle("jbosgi142-bundleX.jar", is);
            m_bundleA.start();
            is = 
this.getClass().getClassLoader().getResourceAsStream("jbosgi142-bundleA.jar");
            m_bundleB = 
getBundleContext().installBundle("jbosgi142-bundleA.jar", is);
            m_bundleB.start();
            is = 
this.getClass().getClassLoader().getResourceAsStream("jbosgi142-bundleB.jar");
            m_bundleC = 
getBundleContext().installBundle("jbosgi142-bundleB.jar", is);
            m_bundleC.start();

            Class clazz;
            try
            {
                clazz = 
m_bundleC.loadClass("org.jboss.test.osgi.jbosgi142.bundleX.BeanX");
            }
            catch (Exception ex)
            {
                assertTrue("Imported class should be visible.", false);
            }
            try
            {
                clazz = 
m_bundleA.loadClass("org.jboss.test.osgi.jbosgi142.bundleA.BeanA");
                assertTrue("Importer's class should NOT be visible.", false);
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
        }
        finally
        {
            cleanup();
        }
    }

Which works correctly. For the exception message I get:

      [bnd] java.lang.ClassNotFoundException: *** Class 
'org.jboss.test.osgi.jbosgi142.bundleA.BeanA' was not found because bundle 42 
does not import 'org.jboss.test.osgi.jbosgi142.bundleA' even though bundle 43 
does export it. To resolve this issue, add an import for 
'org.jboss.test.osgi.jbosgi142.bundleA' to bundle 42. ***

So, we still appear to be missing something. Are these classes somehow 
available through the class path?

> Exporter can load classes from importer
> ---------------------------------------
>
>                 Key: FELIX-1538
>                 URL: https://issues.apache.org/jira/browse/FELIX-1538
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-2.0.0
>            Reporter: Thomas Diesler
>         Attachments: jbosgi142-bundleA.jar, jbosgi142-bundleB.jar, 
> jbosgi142-bundleX.jar
>
>
> A imports X
> B imports X
> Can X load a class from A or B?
> Can A load a class from B and vice versa?
> testLoadClass(org.jboss.test.osgi.jbosgi142.OSGI142TestCase) Time elapsed: 
> 1.743 sec <<< FAILURE!
> java.lang.AssertionError: ClassNotFoundException expected for: 
> jbosgi142-bundleX loads org.jboss.test.osgi.jbosgi142.bundleA.BeanA
> at org.junit.Assert.fail(Assert.java:92)
> at 
> org.jboss.test.osgi.jbosgi142.OSGI142TestCase.assertBundleLoadClass(OSGI142TestCase.java:105)
> at 
> org.jboss.test.osgi.jbosgi142.OSGI142TestCase.testLoadClass(OSGI142TestCase.java:83)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to