by
0
5
3,309
1
Top 1% !
Popular
Famous
Specified
OpenSource
Popularity: 3845th place
Created
Modified Nov 14, 2013
No tags for this snippet yet.
JVMjre6
LanguageJava
LicenseMIT_X11
TechnologyOSGi

Apache Cayenne: correctly load classes under OSGI environment

This step is required to correctly use Cayenne framework under OSGi environment.
Simply adjust the class-loading issues that can arise in OSGi.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/12313/Apache-Cayenne--correctly-load-classes-u?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
private void initCayenneClasses() { String packageName = "myPackage.with.cayenne.autogenerated.classes"; List<Class<?>> classes = getClassesOfPackage(FrameworkUtil.getBundle(this.getClass()), packageName); for (Class<?> cl : classes) { ClassRegistry.unRegisterClass(cl); } for (Class<?> cl : classes) { ClassRegistry.registerClass(cl); } }

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus