[
https://issues.apache.org/jira/browse/FELIX-5563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16299990#comment-16299990
]
Frank Blom commented on FELIX-5563:
-----------------------------------
We can now reproduce the problem. We've made an standalone project in which the
exception occurs. I added it to the call.
The project starts a felix framework with a bit of configuration.
After the framework is started, fileinstall tries to install and start all the
bundles in the designated bundles folder.
In our case, the extension bundle.
It then restarts the framework, this can be seen in the logging and in the fact
that the remote shell disconnects when fileinstall does it's thing.
After that there are still references to the old bundlecontext that has been
made invalid.
In our product it is more complicated and the consequences are harder to
clarify but we think this is the core of our problem.
> 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,
> extensionbundletest.zip
>
>
> 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)