openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

java.lang.ClassNotFoundException #2440

Closed aryeharmon closed 6 years ago

aryeharmon commented 7 years ago

19:02:46.631 [ERROR] [org.openhab.binding.coolmasternet   ] - [binding.coolmasternet(160)] Could not load implementation object class org.openhab.binding.coolmasternet.internal.coolmasternetHandlerFactory
java.lang.ClassNotFoundException: org.openhab.binding.coolmasternet.internal.coolmasternetHandlerFactory cannot be found by org.openhab.binding.coolmasternet_2.1.0
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_131]
    at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:573)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
martinvw commented 7 years ago

I would assume this is because the name at https://github.com/openhab/openhab2-addons/blame/master/addons/binding/org.openhab.binding.coolmasternet/OSGI-INF/coolmasternetHandlerFactory.xml#L14 is wrong with the respect to upper case cs lower case. What platform do you run on?

aryeharmon commented 7 years ago

i am running on a mac

java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

martinvw commented 7 years ago

@projectgus do you have time to take a look at this, my suggestion might be the solution but there could also be another problem.

aryeharmon commented 7 years ago

@martinvw i tried what you suggested and got:

15:05:40.982 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing handler factory 'org.openhab.binding.coolmasternet.internal.CoolMasterNetHandlerFactory@676f89d0': org.eclipse.smarthome.core.thing.internal.ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge
java.lang.ClassCastException: org.eclipse.smarthome.core.thing.internal.ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge
    at org.openhab.binding.coolmasternet.internal.CoolMasterNetHandlerFactory.createHandler(CoolMasterNetHandlerFactory.java:47)[184:org.openhab.binding.coolmasternet:2.2.0.201707091119]
    at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:98)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
    at org.eclipse.smarthome.core.thing.internal.ThingManager.doRegisterHandler(ThingManager.java:606)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
aryeharmon commented 7 years ago

@martinvw actually i had to reconfigure my settings for some reason. So this worked. Thanks a lot. I will make a pull request later today.

projectgus commented 7 years ago

Thanks @martinvw, @aryeharmon . Apologies, I think as part of the original PR review I changed some class casing and I obviously missed a spot. If @aryeharmon deoesn't have time to send a PR then let me know and I can.

martinvw commented 7 years ago

@aryeharmon will you create the PR?

davidgraeff commented 7 years ago

Would be a perfect time to use annotations instead of manually creating the OSGi DS xmls.

RalfDrogge commented 7 years ago

After changing coolmasternetHandlerFactory.xml it works. image

martinvw commented 7 years ago

@projectgus can you make the PR, please also follow @davidgraeff his hint to use annotations instead, see for example https://github.com/openhab/openhab2-addons/pull/2673

@davidgraeff do you have a better example for @projectgus ?

phattyassid commented 7 years ago

I tried changing the name in the OSGi file but got the same error as aryeharmon. what specifically did you do to make it work that?

thanks!