Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » How to import in Eclipse com.microsoft.azure.sdk.iot.device jar(ERROR The import com.microsoft cannot be resolved)
How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1793451] Wed, 08 August 2018 15:02 Go to next message
giuseppe ferro is currently offline giuseppe ferroFriend
Messages: 34
Registered: August 2016
Member
Hi all,

i wasn't able to build deployment package of my eclipse kura bundle, because of this follwing error:

# 8/8/18 4:38:14 PM CEST
# Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, Copyright IBM Corp 2000, 2015. All rights reserved.
ERROR in C:\Users\...\..\..\..\...\example.java
import com.microsoft.azure.sdk.iot.device.DeviceClient;
^^^^^^^^^^^^^
The import com.microsoft cannot be resolved

I have imported and added in the build path all necessary jar libs for use
DeviceClient;IotHubClientProtocol;IotHubEventCallback;IotHubStatusCode; classes.

import com.microsoft.azure.sdk.iot.device.DeviceClient;
import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol;
import com.microsoft.azure.sdk.iot.device.IotHubEventCallback;
import com.microsoft.azure.sdk.iot.device.IotHubStatusCode;

I have no error in example.java compilation but i cant't build and generate the example.dp from example.dpp.

Thanks in advance
Giuseppe
Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1793574 is a reply to message #1793451] Fri, 10 August 2018 12:33 Go to previous messageGo to next message
shubh wade is currently offline shubh wadeFriend
Messages: 28
Registered: July 2018
Junior Member
Hello

create lib folder in ur project and copy whichever jar you want and give path in manifest and build.properties file.

Like in menifest file.
Bundle-ClassPath: .,
lib/pi4j-core.jar

And build.properties file.

bin.includes = META-INF/,\
.,\
OSGI-INF/component.xml,\
lib/pi4j-core.jar
Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1793581 is a reply to message #1793574] Fri, 10 August 2018 13:36 Go to previous messageGo to next message
giuseppe ferro is currently offline giuseppe ferroFriend
Messages: 34
Registered: August 2016
Member
Hello,

thanks for your reply.

I have follwed your suggest.
Now I'm able to deploy kura bundle (example.dp)

I use kura 3.2.0 nonet for beaglebone black.
I have update config.ini file (/ot/eclipse/kura/kura/) -> added all new jar lib for example:

....reference\:file\:/root/kura_plugins_custom/iot-deps-0.6.1.jar@5\:start,reference\:file\:/root/kura_plugins_custom/iot-device-client-1.13.1.jar@5\:start,...

restart kura

When i install bundle i have a lot of errors like this: (/var/log/kura-console.log)

!STACK 0
java.lang.ClassNotFoundException: org.example.example.Example cannot be found by org.example.example_1.1.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.createInstance(ServiceComponent.java:493)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.createInstance(ServiceComponentProp.java:270)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:331)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)

Any other suggestions?
Thanks in advance
Giuseppe

Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1793638 is a reply to message #1793581] Mon, 13 August 2018 05:17 Go to previous messageGo to next message
shubh wade is currently offline shubh wadeFriend
Messages: 28
Registered: July 2018
Junior Member
Hello

Confirm once you have correctly added jar file path in manifest and build.properties file.Because this approach should be work. ClassNotFoundException mainly occurs when program could not find jar file or its class.
And I think No any need to change config.ini file.
just added path as i mention and deploy the dp file on kura.

[Updated on: Tue, 14 August 2018 07:29]

Report message to a moderator

Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1793907 is a reply to message #1793638] Mon, 20 August 2018 08:56 Go to previous messageGo to next message
giuseppe ferro is currently offline giuseppe ferroFriend
Messages: 34
Registered: August 2016
Member
Hello,

this is my MANIFEST build.properties:

output.. = target/classes/
bin.includes = META-INF/,\
OSGI-INF/,\
about.html,\
about_files/,\
lib_new/azure-storage-2.2.0.jar,\
lib_new/bcmail-jdk15on-1.53.jar,\
lib_new/bcpkix-jdk15on-1.53.jar,\
lib_new/bcprov-jdk15on-1.53.jar,\
lib_new/iot-deps-0.6.1.jar,\
lib_new/iot-device-client-1.13.1.jar,\
lib_new/security-provider-1.1.0.jar

additional.bundles = org.eclipse.osgi,\
org.eclipse.osgi.services,\
org.eclipse.osgi.util,\
org.eclipse.kura.api,\
slf4j.api
src.includes = about.html,\
about_files/
jre.compilation.profile = JavaSE-1.8

I was able to build the dp file in eclipse but when I deploy the dp file, i have always the java.lang.ClassNotFoundException
I have tried with and without modify config.ini

Thanks for help
Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1794133 is a reply to message #1793907] Fri, 24 August 2018 08:31 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 423
Registered: July 2015
Location: Italy
Senior Member
Hi,
the approach suggested by shubh wade seems correct. Maybe to double check that you have done correctly all the referencing, please compare to the way it was done for the Google Protobuf: https://github.com/eclipse/kura/tree/develop/kura/org.eclipse.kura.core.cloud

But the error I see seems more related to your wrapping code. So, double check that the final jar is correct and contains all the required classes.

Best regards,
Matteo
Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1794525 is a reply to message #1793574] Fri, 31 August 2018 20:27 Go to previous messageGo to next message
Terry Kilshaw is currently offline Terry KilshawFriend
Messages: 11
Registered: July 2009
Junior Member
Many thanks!

I searched the Eclipse dos for hours trying to figure this out.

cheers,

Terry
Re: How to import in Eclipse com.microsoft.azure.sdk.iot.device jar [message #1795039 is a reply to message #1794525] Thu, 13 September 2018 10:16 Go to previous message
giuseppe ferro is currently offline giuseppe ferroFriend
Messages: 34
Registered: August 2016
Member
Hi Terry,
can you explain to me how you didi it?
i'm stuck.

Thank you
Previous Topic:Wrong Deployment Package URL sent by DeploymentAgentService
Next Topic:Cannot install Kura for aarch64
Goto Forum:
  


Current Time: Thu Apr 25 22:57:57 GMT 2024

Powered by FUDForum. Page generated in 0.04396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top