[2.5.4] OSGI Core overrides - possible?

18 views
Skip to first unread message

Nathan Keiter

unread,
Jan 30, 2015, 2:23:45 PM1/30/15
to dot...@googlegroups.com

I was excited to see this was possible.  So I followed the example to try overriding the EmailFactory class with our version.

 

It seems the bundleContext is null?  What’s going on?

 

dotcms.log:

 

[30/01/15 14:16:34:744 EST]  INFO osgi.Activator: Got to start( BundleContext )

[30/01/15 14:16:34:799 EST] ERROR osgi.Activator: Error injecting context for overriding

java.lang.NullPointerException

          at com.dotmarketing.osgi.UrlOsgiClassLoader.<init>(UrlOsgiClassLoader.java:46)

          at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:274)

          at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:241)

          at com.dotmarketing.osgi.GenericBundleActivator.publishBundleServices(GenericBundleActivator.java:124)

          at edu.gettysburg.nkeiter.override.com.dotmarketing.factories.osgi.Activator.start(Activator.java:17)

          at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)

          at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)

          at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)

          at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1175)

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1153)

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:458)

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)

wrapper.log:

 

INFO   | jvm 1    | 2015/01/30 14:21:03 | ERROR: Bundle Override of com.dotmarketing.factories.EmailFactory [45] Error starting/stopping bundle. (org.osgi.framework.BundleException: Activator start error in bundle Override of com.dotmarketing.factories.EmailFactory [45].)

INFO   | jvm 1    | 2015/01/30 14:21:03 | java.lang.NullPointerException

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at com.dotmarketing.osgi.UrlOsgiClassLoader.<init>(UrlOsgiClassLoader.java:46)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:274)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:241)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at com.dotmarketing.osgi.GenericBundleActivator.publishBundleServices(GenericBundleActivator.java:124)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at edu.gettysburg.nkeiter.override.com.dotmarketing.factories.osgi.Activator.start(Activator.java:17)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1483)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:334)

INFO   | jvm 1    | 2015/01/30 14:21:03 |        at java.lang.Thread.run(Thread.java:744)

 

Nathan

 

Nathan I. Keiter

Lead Network Applications Programmer

DataSystems

Gettysburg College

Campus Box 2453

717-337-6993

 

Measure your success by the level of service you provide.

Si hoc legere scis nimium eruditionis habes.

 

Nathan Keiter

unread,
Jan 30, 2015, 2:34:24 PM1/30/15
to dot...@googlegroups.com

I have tried this with a total of 3 simple single class override plugins.  Same result…

 

Nathan

 

Nathan I. Keiter

Lead Network Applications Programmer

DataSystems

Gettysburg College

Campus Box 2453

717-337-6993

 

Measure your success by the level of service you provide.

Si hoc legere scis nimium eruditionis habes.

 

--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
Visit this group at http://groups.google.com/group/dotcms.
For more options, visit https://groups.google.com/d/optout.

Nathan Keiter

unread,
Jan 30, 2015, 3:14:12 PM1/30/15
to dot...@googlegroups.com

Here’s a Gist example of one of these: https://gist.github.com/nkeiter/58b44710d621c45c4df8

 

It seems publishBundleServices( BundleContext ) is encountering a null value for the context.

 

But this is what the provided example is doing?  So why isn’t it working?

Nathan Keiter

unread,
Jan 30, 2015, 3:33:50 PM1/30/15
to dot...@googlegroups.com

For what it’s worth… replacing publishBundleServices( BundleContext ) with initializeServices( BundleContext ) seems to work just fine.

 

I guess the provided example is wrong.

 

dotcms.log:

 

[30/01/15 15:30:58:515 EST]  INFO osgi.Activator: Got to start( BundleContext )

[30/01/15 15:30:58:526 EST]  INFO factories.EmailFactory: EmailFactory.verifyOverride() Override of EmailFactory.java verified!

Nathan Keiter

unread,
Jan 30, 2015, 4:47:19 PM1/30/15
to dot...@googlegroups.com

Here’s a Gist of the working example: https://gist.github.com/nkeiter/340479cf4194aee7eab3

Reply all
Reply to author
Forward
0 new messages