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/12/12 15:24:01 UTC

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

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

Frank Blom commented on FELIX-5563:
-----------------------------------

So far we have tried a few different scenarios.

When the extension bundle is added through the felix shell by executing the install file:path\to\bundle.jar command, the extension bundle resolves and the application works as expected.

When the extension bundle is copied at runtime to the directory watched by apache.felix.fileinstall, the exception java.lang.IllegalStateException: Invalid BundleContext is thrown.

This error is thrown when the framework is restarting the apache.felix.http.bridge bundle. The bundlecontext that is invalid is the apache.felix.framework bundle.
When looking into the osgi container on Tomcat the bundle states are as expected, the extension bundle is resolved and the rest is active, so it looks fine.
Still the application is not working.

When using a clean standalone application with the standard bundles, adding the extension bundle is no problem.

The next step is to test in a clean webapp.

> 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: Improvement
>          Components: Framework
>    Affects Versions: framework-5.6.2
>         Environment: wildfly - 10.0, tomcat - 8.5
>            Reporter: Frank Blom
>            Assignee: Karl Pauls
>            Priority: Minor
>             Fix For: framework-5.6.12
>
>         Attachments: com.planon.sample.extension-0.0.1.jar
>
>
> 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.4.14#64029)