java - Osgi Exception in Activator.start() -
i new start osgi code running java application not running osgi error reason 'import com.sun.codemodel' how resolve problem .
my activator class :
package deneme; import java.io.file; import java.net.url; import org.jsonschema2pojo.schemamapper; import org.osgi.framework.bundleactivator; import org.osgi.framework.bundlecontext; import com.sun.codemodel.jcodemodel; public class activator implements bundleactivator { /* * (non-javadoc) * @see org.osgi.framework.bundleactivator#start(org.osgi.framework.bundlecontext) */ public void start(bundlecontext context) throws exception { system.out.println("hello world!!"); string workingdir = system.getproperty("user.dir"); jcodemodel codemodel = new jcodemodel(); try { url sourcerota = new url("file:///c:/users/administrator/workspace/navsimkisa/rota_yeni.json"); url sourcekriter = new url("file:///c:/users/administrator/workspace/navsimkisa/kriter_yeni.json"); url sourcesabit = new url("file:///c:/users/administrator/workspace/navsimkisa/sabit_yeni.json"); new schemamapper().generate(codemodel, "classnamerota", "rota.entity", sourcerota); new schemamapper().generate(codemodel, "classnamekriter", "kriter.entity", sourcekriter); new schemamapper().generate(codemodel, "classnamesabit", "sabit.entity", sourcesabit); codemodel.build(new file(workingdir + "/src/main/java")); } catch (exception e) { // todo: handle exception } } /* * (non-javadoc) * @see org.osgi.framework.bundleactivator#stop(org.osgi.framework.bundlecontext) */ public void stop(bundlecontext context) throws exception { system.out.println("goodbye world!!"); } }
my error :
my error :hello world!! !session 2015-10-14 17:46:29.576 ----------------------------------------------- eclipse.buildid=unknown java.version=1.8.0_60 java.vendor=oracle corporation bootloader constants: os=win32, arch=x86_64, ws=win32, nl=en command-line arguments: -dev file:d:/navsim3o/.metadata/.plugins/org.eclipse.pde.core/new_configuration (1)/dev.properties -os win32 -ws win32 -arch x86_64 -consolelog -console !entry deneme 4 0 2015-10-14 17:46:30.794 !message frameworkevent error !stack 0 org.osgi.framework.bundleexception: exception in deneme.activator.start() of bundle deneme. @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:734) caused by: java.lang.classnotfoundexception: com.sun.codemodel.jcodemodel cannot found deneme_1.0.0.qualifier @ org.eclipse.osgi.internal.loader.bundleloader.findclassinternal(bundleloader.java:501) @ org.eclipse.osgi.internal.loader.bundleloader.findclass(bundleloader.java:421) root exception: java.lang.noclassdeffounderror: com/sun/codemodel/jcodemodel @ deneme.activator.start(activator.java:22) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl$1.run(bundlecontextimpl.java:711) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.startactivator(bundlecontextimpl.java:702) caused by: java.lang.classnotfoundexception: com.sun.codemodel.jcodemodel cannot found deneme_1.0.0.qualifier @ org.eclipse.osgi.internal.loader.bundleloader.findclassinternal(bundleloader.java:501) @ org.eclipse.osgi.internal.loader.bundleloader.findclass(bundleloader.java:421) @ org.eclipse.osgi.internal.loader.bundleloader.findclass(bundleloader.java:412) @ org.eclipse.osgi.internal.baseadaptor.defaultclassloader.loadclass(defaultclassloader.java:107) @ java.lang.classloader.loadclass(unknown source) ... 16 more
you first need export package com.sun.codemodel in system bundle. done framework property org.osgi.framework.system.packages.extra.
then need make sure own bundle define import using import-package in manifest.
hopefully library use not mess classloader should work right.
Comments
Post a Comment