You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Frank Blom (JIRA)" <ji...@apache.org> on 2017/02/23 13:33:44 UTC

[jira] [Created] (FELIX-5563) Adding extension bundles causes wildfy/tomcat server to fail

Frank Blom created FELIX-5563:
---------------------------------

             Summary: Adding extension bundles causes wildfy/tomcat server to fail
                 Key: FELIX-5563
                 URL: https://issues.apache.org/jira/browse/FELIX-5563
             Project: Felix
          Issue Type: Bug
          Components: Framework
         Environment: wildfly - 10.0, tomcat - 8.5
            Reporter: Frank Blom


I am trying to implement extension bundles in the osgi container. We are using a wildfly and tomcat server. Starting the wildfly server with the added extension bundle causes the following errors:

1:

2017-02-22 14:36:55,916 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) Failed to install artifact: C:\ws\Servers\jboss\standalone\bundles\planon\ch.meschberger.sample.extension-0.0.1.jar: org.osgi.framework.BundleException: Could not create bundle object.

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) org.osgi.framework.BundleException: Could not create bundle object.

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.framework.Felix.installBundle(Felix.java:2960)

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1027)

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:941)

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:854)

2017-02-22 14:36:55,917 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)

2017-02-22 14:36:55,918 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)

2017-02-22 14:36:55,918 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) Caused by: java.lang.UnsupportedOperationException: Unable to add extension bundle to FrameworkClassLoader - Maybe not an URLClassLoader?

2017-02-22 14:36:55,918 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.framework.ExtensionManager.addExtensionBundle(ExtensionManager.java:397)

2017-02-22 14:36:55,918 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	at org.apache.felix.framework.Felix.installBundle(Felix.java:2926)

2017-02-22 14:36:55,918 INFO  [stdout] (fileinstall-C:\ws\Servers\jboss\standalone\bundles\planon) 	... 6 more

2:

2017-02-22 14:29:46,307 INFO  [stdout] (FelixStartLevel) Failed to install artifact: C:\ws\Servers\jboss\standalone\bundles\planon\ch.meschberger.sample.extension-0.0.1.jar: org.osgi.framework.BundleException: Could not create bundle object.

2017-02-22 14:29:46,308 INFO  [stdout] (FelixStartLevel) org.osgi.framework.BundleException: Could not create bundle object.

2017-02-22 14:29:46,308 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.Felix.installBundle(Felix.java:2960)

2017-02-22 14:29:46,308 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1027)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:941)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:854)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:224)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:252)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.fileinstall.internal.FileInstall.start(FileInstall.java:139)

2017-02-22 14:29:46,309 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)

2017-02-22 14:29:46,310 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.Felix.activateBundle(Felix.java:2154)

2017-02-22 14:29:46,310 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.Felix.startBundle(Felix.java:2072)

2017-02-22 14:29:46,310 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)

2017-02-22 14:29:46,310 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)

2017-02-22 14:29:46,310 INFO  [stdout] (FelixStartLevel) 	at java.lang.Thread.run(Thread.java:745)

2017-02-22 14:29:46,310 INFO  [stdout] (FelixStartLevel) Caused by: java.lang.UnsupportedOperationException: Unable to add extension bundle to FrameworkClassLoader - Maybe not an URLClassLoader?

2017-02-22 14:29:46,311 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.ExtensionManager.addExtensionBundle(ExtensionManager.java:397)

2017-02-22 14:29:46,311 INFO  [stdout] (FelixStartLevel) 	at org.apache.felix.framework.Felix.installBundle(Felix.java:2926)

2017-02-22 14:29:46,311 INFO  [stdout] (FelixStartLevel) 	... 14 more

It seems that it goes wrong in the extensionManager class around here:

{code:title=ExtensionManager.class|borderStyle=solid}
try
            {
                extensionManager = new ExtensionManager();

                Felix.m_secureAction.addURLToURLClassLoader(Felix.m_secureAction.createURL(
                    Felix.m_secureAction.createURL(null, "http:", extensionManager),
                    "http://felix.extensions:9/", extensionManager),
                    Felix.class.getClassLoader());
            }
{code}

And in the the addURLtoIRLClassLoader it expects a urlclassloader but this is not provided because of wildfly/tomcat. That happens here:

{code:title=SecureAction.class|borderStyle=solid}
public void addURLToURLClassLoader(URL extension, ClassLoader loader) throws Exception
    {
        if (System.getSecurityManager() != null)
        {
            Actions actions = (Actions) m_actions.get();
            actions.set(Actions.ADD_EXTENSION_URL_ACTION, extension, loader);
            try
            {
                AccessController.doPrivileged(actions, m_acc);
            }
            catch (PrivilegedActionException e)
            {
                throw e.getException();
            }
        }
        else
        {
            Method addURL =
                URLClassLoader.class.getDeclaredMethod("addURL",
                new Class[] {URL.class});
            addURL.setAccessible(true);
            addURL.invoke(loader, new Object[]{extension});
        }
    }
{code}

If you have any questions, let me know.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)