BUG Community

Welcome! Log In

Forums BUG SDK java.lang.NoClassDefFoundError on startup

Subscribe to java.lang.NoClassDefFoundError on startup  19 posts, 8 voices

Log in to reply to this topic
 
May 4, 2008 9:55am
Img_missing_medium Tuxinator 6 posts

I was using the "SimpleGUI" app as my guide to constructing my app with the LCD module but I get this error and from what I can tell it's a Bug SDK related error:


java.lang.NoClassDefFoundError: com/buglabs/application/AbstractServiceTracker
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findOwnClass(BundleClassLoader.java:630)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findClass(BundleClassLoader.java:567)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at carbug.Activator.start(Activator.java:20)
at ch.ethz.iks.concierge.framework.BundleImpl.startBundle(BundleImpl.java:446)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.setLevel(Framework.java:2464)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.access$0(Framework.java:2424)
at ch.ethz.iks.concierge.framework.Framework.startup(Framework.java:484)
at ch.ethz.iks.concierge.framework.Framework.main(Framework.java:314)
Caused by: java.lang.ClassNotFoundException: com.buglabs.application.AbstractServiceTracker
at ch.ethz.iks.concierge.framework.BundleClassLoader.findClass(BundleClassLoader.java:600)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 13 more
org.osgi.framework.BundleException: Error starting bundle Bundle [16]: file:/C:/Users/Me/workspace/.metadata/.plugins/com.buglabs.osgi.concierge.runtime/bundles/CarBug_1.0.0.jar
at ch.ethz.iks.concierge.framework.BundleImpl.startBundle(BundleImpl.java:460)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.setLevel(Framework.java:2464)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.access$0(Framework.java:2424)
at ch.ethz.iks.concierge.framework.Framework.startup(Framework.java:484)
at ch.ethz.iks.concierge.framework.Framework.main(Framework.java:314)


This does not happen in the "SimpleGUI" app I downloaded and if I comment out my code in the start() method in my Activator class it doesn't throw this error so I'm guessing it's something wrong with my code. My Activator code looks like this:


public void start(BundleContext context) throws Exception {
//Create the service tracker and run it.
ctc = new CarBugServiceTracker(context);
Filter f = context.createFilter(ServiceFilterGenerator.generateServiceFilter(ctc.getServices()));
st = new ServiceTracker(context, f, ctc);
st.open();
}

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
ctc.stop();
}


Any help appriciated.
May 4, 2008 2:49pm
Medium Bug Labs team kschultz 107 posts

Generally I do not touch anything in the activator class. I have so far been able to create all my apps leaving the activator class as boilerplate I don’t mess with. Exceptional cases may arise, but so far I think the best practice is to make the hook to your actual application from the doStart() method of the service tracker class. Activator basically runs when you start up the bundle, and it is sitting on the BUG but doesn’t have the modules it needs yet. Once the OSGi runtime knows that you have all the modules/services you need, it calls the doStart() method. By commenting out the start() method in the activator, it is never even registering with the OSGi runtime in the first place. So the code is further down the codes path, do you want to post more code? Or maybe just upload it to bugnet and I can look at it.

May 4, 2008 9:09pm
Img_missing_medium Tuxinator 6 posts

kschultz
Generally I do not touch anything in the activator class. I have so far been able to create all my apps leaving the activator class as boilerplate I don't mess with. Exceptional cases may arise, but so far I think the best practice is to make the hook to your actual application from the doStart() method of the service tracker class. Activator basically runs when you start up the bundle, and it is sitting on the BUG but doesn't have the modules it needs yet. Once the OSGi runtime knows that you have all the modules/services you need, it calls the doStart() method. By commenting out the start() method in the activator, it is never even registering with the OSGi runtime in the first place. So the code is further down the codes path, do you want to post more code? Or maybe just upload it to bugnet and I can look at it.


Thanks for your reply. I haven't read all of the OSGI "About the OSGi Service Platform" white paper yet so sorry if it's covered in that topic.

From your reply does that mean I can have an empty start method in the Activator class and just start my applications in the service tracker? Looking at the code samples there are usually instantiations for the service tracker like in the second quote in my first post.

The error points the fault at line 20 in my Activator class which is:
ctc = new CarBugServiceTracker(context);
the first line in my start method in the Activator class.

Also are there any articles describing the architecture and process of a program for the bug like you mentioned the doStart() is called when all the services / modules exists?
May 5, 2008 3:07pm
Img_missing_medium akravets 25 posts

Hey Tuxinator,


From your reply does that mean I can have an empty start method in the Activator class and just start my applications in the service tracker?


That's right. The work that your application is doing will happen in the service tracker. The start() method in Activator should not be empty though because it does an import work of starting the tracker. By starting tracker in the Activator you basically saying that I need these services to run my application, let tracker do the tracking of the services. When services needed are available, tracker's doStart() method will be called and your application will start. You can "see" how this works by placing a brake point in the tracker's doStart() method and when services for particular application are available, stepping through the code.

Also, since bug applications are really OSGi bundles they work just like OSGi bundles. Thus you can get OSGi specification from http://www.osgi.org/Specifications/HomePage and read first few chapters to get familiar with the framework. Since reading specifications could be a bit daunting for some people, Neil Bartlett did everyone a huge favor by starting writing his own book on OSGi, you can find the latest chapters here: http://neilbartlett.name/blog/osgibook/.
May 5, 2008 4:39pm
Medium Bug Labs team kschultz 107 posts

Tuxinator

Thanks for your reply. I haven't read all of the OSGI "About the OSGi Service Platform" white paper yet so sorry if it's covered in that topic.

From your reply does that mean I can have an empty start method in the Activator class and just start my applications in the service tracker? Looking at the code samples there are usually instantiations for the service tracker like in the second quote in my first post.


Don't worry, I couldn't really make it through the OSGi spec either. The way that Dragonfly generates the Activator class is all you will need. The start method had some stuff in it, but don't worry about editing it. It is autogeneratered, and later on you can look at it and understand it but for now it is unimportant.

Alex is right about the break point, often times you will get errors that point to places other than where they are actually failing. It is definately worth the time to learn how to use the Eclipse debugger, I had never used an IDE debugger before writing my BUG apps but it was a HUGE time saver and is helping me a lot this semester now that I am writing much more complex programs at school. This tutorial helps although it has about 5 times more techniques than you probably need.

http://www.linuxdevices.com/articles/AT6046208714.html

If I have a program that is crashing during execution I set a break point before where the failure is occuring, and then just step over lines and step into functions until I find where it crashes.

If I have a program that runs but is giving me the wrong output, I set a break point and step over and into stuff while watching the values of the variables change.

Thats really all there is to it, but it is amazingly powerful.
May 5, 2008 5:34pm
Img_missing_medium akravets 25 posts

Yeah, debugger in Eclipse is just great, a real time saver. I don’t know what I would be doing without it :)
Also, just an FYI if you are going to read OSGi specifications – we are at release 3.

May 6, 2008 8:37pm
Img_missing_medium Tuxinator 6 posts

akravets

Since reading specifications could be a bit daunting for some people, Neil Bartlett did everyone a huge favor by starting writing his own book on OSGi, you can find the latest chapters here: http://neilbartlett.name/blog/osgibook/.


Great stuff thanks for the link. I understand the framework a bit better now but I'm still having problems. Here is my Activator class:



public class Activator implements BundleActivator {

private CarBugServiceTracker stc;
private ServiceTracker st;

public void start(BundleContext context) throws Exception {
// TODO Auto-generated method stub
stc = new CarBugServiceTracker(context);

/*Filter f = context.createFilter(ServiceFilterGenerator.generateServiceFilter(stc.getServices()));
st = new ServiceTracker(context, f, stc);
st.open();*/

System.out.println("activator started");
}

public void stop(BundleContext context) throws Exception {
// TODO Auto-generated method stub
//stc.stop();
System.out.println("activator stopped");
}
}


and my ServiceTracker class:


public class CarBugServiceTracker extends AbstractServiceTracker {

private CarBugApp application;

public CarBugServiceTracker(BundleContext context) {
super(context);
}

/**
* Determines if the application can start.
*/
public boolean canStart() {
return super.canStart();
}

/**
* If canStart returns true
* this method is called to start the application.
* Place your fun logic here.
*/
public void doStart() {
System.out.println("starting");
}

/**
* Called when a service that this application depends is unregistered.
*/
public void doStop() {
System.out.println("stopping");
}

/**
* Allows the user to set the service dependencies by
* adding them to services list returned by getServices().
* i.e.nl getServices().add(MyService.class.getName());
*/
public void initServices() { //getServices().add("com.buglabs.bug.module.lcd.pub.IModuleDisplay");
}
}


Most of the code doesn't do anything but print to console but I still get the error "
java.lang.NoClassDefFoundError" which I posted in my first post. The error occurs when I'm instantiating the ServiceTracker class:

stc = new CarBugServiceTracker(context);

and it doesn't print "activator started" which is the last line in the start() method of the Activator class.

kschultz

he way that Dragonfly generates the Activator class is all you will need. The start method had some stuff in it, but don't worry about editing it. It is autogeneratered, and later on you can look at it and understand it but for now it is unimportant.


Your IDE generates the code for you? When I created my project using the Dragonfly perspective in Eclipse it only generated the start() and stop() methods but they are empty with a TODO comment. Is this right because it sounds like your IDE fills it in for you?
May 6, 2008 9:53pm
Medium Bug Labs team finsprings 268 posts

Check your app’s MANIFEST.MF (it’s under META-INF). If you click on the last tab, also named MAINFEST.MF, do you see com.buglabs.application in the Import-Package section? If not, add it and try running your application again.

(I took a functioning application, removed that entry from my manifest and got the exact same class error you have when I ran it.)

May 7, 2008 7:27am
Img_missing_medium Tuxinator 6 posts

finsprings
Check your app's MANIFEST.MF (it's under META-INF). If you click on the last tab, also named MAINFEST.MF, do you see com.buglabs.application in the Import-Package section? If not, add it and try running your application again.

(I took a functioning application, removed that entry from my manifest and got the exact same class error you have when I ran it.)


Thank you. It was the manefest problem and it didn't have the import-package statement.
May 7, 2008 9:32am
Medium Bug Labs team kschultz 107 posts


kschultz

he way that Dragonfly generates the Activator class is all you will need. The start method had some stuff in it, but don't worry about editing it. It is autogeneratered, and later on you can look at it and understand it but for now it is unimportant.


Your IDE generates the code for you? When I created my project using the Dragonfly perspective in Eclipse it only generated the start() and stop() methods but they are empty with a TODO comment. Is this right because it sounds like your IDE fills it in for you?


Ok I know where all this is stemming from then, when you create a new project there is a list of services in the center of the screen, you have to highlight the modules you want. So there is a button to start a Virtual BUG, you plug in the modules you want your app to use, and Dragonfly will generate all the OSGi based on that. I think there are detailed instructions somewhere, I'm on a computer without Dragonfly installed so I can't give you detailed directions at the moment. This is a common mistake I make when I'm rushing I skip right over that and end up with just an activator class. The activator, manifest.mf, and the servicetracker should all be generated for you and then all you have to do is hook into your application from the doStart() method of the servicetracker.
May 7, 2008 1:26pm
Img_missing_medium akravets 25 posts

Here are the instructions on what Kevin was talking about: http://bugcommunity.com/wiki/index.php/Create_a_basic_application_with_the_Motion_Sensor_module

Also, the reason service tacker is there is so your application can run when certain requirements exist. For example, let say in order for service A to function property service B must be present in the system. If I try to execute service A without B present then my application will not work. But if I have a service tracker that will track for presence of service B, then when service B becomes available my service A will be happy and do its thing.
May 8, 2008 10:27am
Img_missing_medium Tuxinator 6 posts

[quote="kschultz"]

Ok I know where all this is stemming from then, when you create a new project there is a list of services in the center of the screen, you have to highlight the modules you want. So there is a button to start a Virtual BUG, you plug in the modules you want your app to use, and Dragonfly will generate all the OSGi based on that. I think there are detailed instructions somewhere, I'm on a computer without Dragonfly installed so I can't give you detailed directions at the moment. This is a common mistake I make when I'm rushing I skip right over that and end up with just an activator class. The activator, manifest.mf, and the servicetracker should all be generated for you and then all you have to do is hook into your application from the doStart() method of the servicetracker.


I see your point. When I created the project I gave it a name clicked on finish instead of next. The following screen is very good in allowing you to select and generate the classes for you. Maybe in future releases disabling the finish button until you get to the last screen? If people only want to create an empty project they can just click next and then finish without starting the Virtual Bug and selecting the services.
akravets

Here are the instructions on what Kevin was talking about: http://bugcommunity.com/wiki/index.php/Create_a_basic_application_with_the_Motion_Sensor_module

Also, the reason service tacker is there is so your application can run when certain requirements exist. For example, let say in order for service A to function property service B must be present in the system. If I try to execute service A without B present then my application will not work. But if I have a service tracker that will track for presence of service B, then when service B becomes available my service A will be happy and do its thing.


Is this true for when a service becomes unavailable as well but instead of calling start it would call stop? I take it services can include software and hardware services?
May 8, 2008 10:47am
Medium Bug Labs team kschultz 107 posts

Tuxinator

Is this true for when a service becomes unavailable as well but instead of calling start it would call stop? I take it services can include software and hardware services?


Correct, that is how the modules can be hot swapable, because the OSGi stuff handles the "life cycle" management. OSGI services can be hardware or software. A good example is my GPSUtilities package, it is a software service accessed the same way as a hardware module (or really I guess the hardware modules work like software services since OSGi was first for software only). Also the services are independant of the hardware, i.e. we could create a IPositionProvider based on a technology other than GPS that would be possible, or if we wanted to create a module that had a camera and a GPS, both could be offered up by one module. For right now when there are only 4 modules and a handful of software services the OSGi stuff might not seem necessary, but when we have 50 modules and there are 100 software services on BUGnet it will be worth the added complexity because it allows software to be independent of the hardware configuration.
Sep 15, 2012 4:27am
User_img_not_found_05_med xiao123 35 posts

Celine Handbags 2012 There are affluence associated with at broad prices clothes providers just about all through the nation. It is accessible to locate all of them in your breadth or college the net. Nevertheless, it is accessible to acquisition the greatest offers whenever you abundance through Hard anodized cookware appearance at broad prices producers. One of these simple at broad prices providers in the arena is in fact CausewayMall, that is additionally the at broad prices on the internet retail centermost acceptable acutely recammended Celine Outlet.

Lots of the absolute shops at broad prices ladies accouterment is in fact fabricated up of things that accept some fun designs. You will acquisition off-shoulder or even drop-shoulder tops. There are Celine Bags several blouses that accept balloon-sleeves, although Shop Celine Bags some cover big bows. Apart from at broad celine auction bag prices appearance fabric, there’s aswell add-ons. These types of add-ons tend to be fabricated up of socks as able-bodied as caps. You’re provided forth with styles for archetype checky socks or even adjustable socks.

Anklet bracelets tend to be a part of the best as able-bodied as occurring articles aural the appearance business these days. You will acquisition accordingly assorted kinds of all of them currently accessible which they may be accepted as the aspect business aural the appearance marketplace. These types of could be produced from a amount of abstracts such as types of steel, bedrock or even Celine Luggage Bag Tote fabric, and so on. These types of are accessible in just about all admeasurement and shapes.

Oct 3, 2012 2:39am
User_img_not_found_02_med wunai 103 posts

Thanks to the answers was possible to Tods shoes evaluate the intensity of use and the question of the distinction in purchasing. Women need a bag to carry their belongings, that’s for sure. Leather bags, women nowTods UK  have the flexibility and class beyond what I ever thought. The serious fashion lovers will love the leather bags thanks to its versatility, high quality and elegant style. With brands like Tod tods women shoes, Cole Haan,Tods Outlet   Rebecca Minkoff, among many others, is nothing but leather bags and upscale beyond amazing. Hogan shoes outlet The design is based on a conceptLouis Vuitton UK of minimal interference between your feet and the floor.

Oct 24, 2012 1:41am
User_img_not_found_01_med qazqazqaz 469 posts

As a perfect combination of classic and modern fashion,Coach Outlet Online Julia Bags can show the customers'unique personality.Tiffany UK grabbed the globe, stands out as the celeb on their favorite stars luxury type, granted an innovative simple move the pavement luxury, complete with luxury.In terms of the quality and superior design that make more and more customers are satisfied to Coach Factory Online.Welcome!hat experts claim Coach Outlet Online shopping is in the changes they are available in.As long as you open our Coach Factory Outlet webpage, you will view various Coach New Arrivals which are the most popular also the most fashionable in this year.On the date when the Louis Vuitton UK on sale, all people will pour into the stores. At this time, it on the booths will be wiped out, and only one or two days the seller will declare that there is no stock anymore.

Oct 24, 2012 4:09am
User_img_not_found_01_med qazqazqaz 469 posts

Remember that the right accessories can enhance your alluring look with your Canada Goose Parkas Outlet.Baggy, ovoid shaped Canada Goose Jackets Outlet that are rounded around the shoulders look fabulous and can be a perfect match for you.This excellent conviction so that you class gets to amateur Canada Goose Outlet In a number of Parka, for example Young Canada Goose affordable Cardigan.Luxury has always been synonymous with fur and leather and this year a faux fur Canada Goose Jackets Outlet will surely be the key piece of your wardrobe.

Nov 7, 2012 12:43am
User_img_not_found_06_med luoqi 117 posts

cheap jordan
shoes

told WPVI earlier in the week. In addition to her injury, she has
cuts and bruises on her arm and and fake
designer handbags
and hand.The video was taken at Sunday’s Puerto Rican
Day video shows a crowd of blue-shirted police officers standing in in cheap moncler jackets in the
middle of a street, around a car. Someone the left appears to throw something
resembling silly string or or cheap
replica designer handbags
or a liquid on the cops. An officer in a
shirt rushes out of the crowd and punches Gusman in in

cheap moncler
jackets

in the face and then hit her in the back the head.She fellsto
the ground where two officers apprehended her her cheap replica designer handbags her and
led her off. As she passed the camera, can be seen streaming down her
face.Josey, 39, has had had

cheap moncler
jackets

had 13 complaints made against him over his career, ranging
allegations of verbal abuse to physical abuse.Lark Voorhies and 5 5 moncler jackets men 5
Bipolar Stars’Saved by the Bell’ Star & More Bipolar SHEILA MARIKAR Oct. 4,
2012 — Lark Voorhies’ life has has knockoff handbags has taken a
downturn since her days as Lisa Turtle “Saved by the Bell.” Her mom, Tricia,
recently told People People moncler outlet People
magazine that the 38-year-old actress is battling bipolar disorder.”There things
that have traumatized her,” she said. “I care deeply deeply

moncler jackets
men

deeply about my daughter and I want her to resume life.”People also
interviewed Voorhies, who shares a home with her her cheap jordans for sale
her mother and denied that she has a mental disorder. no,” she said, when asked
if she’s bipolar. “We’re alive alive moncler outlet alive in a
major time of all-in-all prophecy.”According to the Voorhies stared into space
and mumbled “to herself or to to fake
designer handbags
to others who weren’t there” during the interview.
When asked explain her behavior, Voorhies said, “I have a strong spiritual
spiritual

cheap moncler
jackets

spiritual sense. You caught me in moments of pray.”Asked whether
not she’s bipolar, Voorhies told ABCNews.com, “no comment.”If she is is jordan 11 is bipolar,
she’s in good company: Obama Back Day After Debate DefeatObama Heads Wisconsin
As Romney Looks Looks

jordan concord

Jan 27, 2013 12:10am
User_img_not_found_06_med luoqi 117 posts

cheap Christian
Louboutin

from St. James Palace said in a statement.”Their Royal
Highnesses looked after so wonderfully well at all times by everybody everybody
Christian Louboutin
Outlet
everybody at King Edward VII Hospital, and their thoughts and are
with Jacintha Saldanha’s family, friends and colleagues at this this

cheap replica designer
handbags

this very sad time,” the statement said.Police were called to
address near the hospital at about 9:35 a.m. GT today today

cheap replica
handbags

today to “reports of a woman found unconscious,” according to
statement from Scotland Yard.The woman was pronounced dead at the the Christian Louboutin
Outlet
the scene. “Inquiries continue to establish the circumstances
of the Next of kin have been informed,” the statement said.Circumstances of of
cheap replica designer
handbags
of the death being investigated, but are not suspicious at
stage, according to police.The duchess spent three days at the the Christian Louboutin
Outlet
the hospital undergoing treatment for hyperemesis gravidarum,
severe or debilitating and vomiting. She was released from the hospital on
Thursday Thursday cheap
designer handbags
Thursday morning.Nurse Found Dead After Being Hoaxed
by Fake Queen PrinceThe Tuesday morning prank call came from Australian DJ’s Mel
Mel cheap Christian
Louboutin
Mel Greig and Michael Christian. They impersonated the royals,
complete exaggerated accents. They even enlisted two co-workers to bark like
like cheap designer
handbags
like the queen’s pet corgis.The Sydney radio station,
2DayFM, could be immediately reached for comment.The Twitter accounts of both
radio radio

replica designer
handbags

radio personalities have been deactivated, but it is unknown
when accounts were shut down. The DJ’s are being heavily criticized criticized
replica designer
handbags
criticized on Twitter, with many people calling for them to or
be fired.”I’m just after my granddaughter, Kate. I want want