I have written a simple Java bluetooth server copied from the example here digital hacks blog... Simple spp server...
I have included the following in my executable jar
<dependency>
<groupId>net.sf.bluecove</groupId>
<artifactId>bluecove</artifactId>
<version>2.1.0</version>
</dependency>
<!-- bluecove-gpl required to run bluecove on Linux-->
<dependency>
<groupId>net.sf.bluecove</groupId>
<artifactId>bluecove-gpl</artifactId>
<version>2.1.0</version>
</dependency>
<!-- http://mvnrepository.com/artifact/net.sf.bluecove/bluecove-emu -->
<dependency>
<groupId>net.sf.bluecove</groupId>
<artifactId>bluecove-emu</artifactId>
<version>2.1.0</version>
</dependency>
I have installed the following library on my pi
apt-get install libbluetooth-dev
When i run my app as follows, i get missing library error
pi#raspberrypi:~/workspace/bluetooth-server $ java -jar /tmp/btoothserver-1.0-SNAPSHOT-jar-with- dependencies.jar
Native Library bluecove_arm not available
Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove L ibrary bluecove not available
at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries( ...
... javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
at com.myapp.bluetoothserver.App.main(App.java:60)
Any help much appreciated
Related
Framework: Quarkus
JVM: OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
OS: macOS Monterey, Chip: M2
Command to get this error: mvn clean package -Pnative -DskipTests
When building a native image I faced this error:
Error: Discovered a type for which getDeclaringClass0 cannot be called:
org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass$Enum. This error is reported at image build time because class org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass$Enum is registered for linking at image build time by command line
com.oracle.svm.core.util.UserError$UserException: Discovered a type for which getDeclaringClass0 cannot be called: org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass$Enum. This error is reported at image build time because class org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass$Enum is registered for linking at image build time by command line
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:776)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:578)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Discovered a type for which getDeclaringClass0 cannot be called: org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass$Enum. This error is reported at image build time because class org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass$Enum is registered for linking at image build time by command line
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.SVMHost.handleLinkageError(SVMHost.java:444)
My problem is, when I'm trying to find the implementation of this class, I did not find anything. I know if I find the implementation and I add it to pom and reflect-config.json my problem be solved.
I tried to add
--initialize-at-run-time=org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass
into pom and this line into reflect-config.json
{
"name": "org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STConformanceClass"
}
Update:
The problem is solved this way:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-lite</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-full</artifactId>
<version>5.2.3</version>
</dependency>
I tried to list the ECS clusters using the code as follow:
AmazonECS = amazonECS AmazonECSClientBuilder.standard().withRegion(region).withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build():
amazonECS.listClusters();
However, it gave the error
java.lang.NoSuchFieldError: CLIENT_ENDPOINT
The error stack is something like this:
com.amazonaws.services.ecs.AmazonECSClient in executeListClusters at
line 2220 com.amazonaws.services.ecs.AmazonECSClient in listClusters
at line 2202 com.amazonaws.services.ecs.AmazonECSClient in
listClusters at line 2245
I am not too sure why this error occurred as the other Amazon services did not give me any similar error whatsoever and I have set the region previously based on the client's preference. Any ideas?
Thanks to Nagaraj Trantri the error is caused by the version mismatched of the AWS SDK that I have according to https://github.com/aws/aws-sdk-java/issues/2509#issuecomment-779370672
I had different version for SQS and S3 in pom.xml. After I updated those to same versions, it worked.
It depends on where to look for these versions mismatch.
I am using spark to connect to secrets manager and thus we have 2 places to look at.
My Application dependencies (build.gradle)
spark.yarn.jars
The versions in the above 2 places should match and then it started working
Use this in the pom.xml file. Error is caused due to mismatch in the 'com.amazonaws' dependency versions declared in the pom.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.739</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sts</artifactId>
</dependency>
</dependencies>
How build GraalVM JVM for Java 11?
(I don't see any official distributives only java 8)
Not currently.
From this GitHub issue, it seems that it will be ready around the end of February, 2019. However, Java 11 does include support for the Graal compiler, which can be enabled with the following flags:
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
Edit: According to that GitHub issue, it looks like Graal 19.3 will be released on November 19, 2019, which should include Java 11 support.
Yes the new version of GraalVM 19.3.0 supports Java 11.
please go to the below link for more information
https://medium.com/graalvm/graalvm-19-3-0-dfdb6f4ec8ed
I am using java12 and i just added these dependencies to my project and it works fine
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.js/js -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.js/js-scriptengine -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.compiler/compiler -->
<dependency>
<groupId>org.graalvm.compiler</groupId>
<artifactId>compiler</artifactId>
<version>19.1.1</version>
</dependency>
</dependencies>
I am using Windows10, eclipse-neon with JDK1.8 version,
I am getting the following exception.
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.bytedeco.javacpp.Loader.load(Loader.java:385)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2719)
at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:391)
at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:385)
at com.segment.processor.AudioMain.main(ApacheMathAudioMain.java:20)
Error getting static method ID of org/bytedeco/javacpp/Loader/putMemberOffset
here are the dependencies I am using in my pom.xml
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>ffmpeg</artifactId>
<version>3.0.2-1.2</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>3.1.0-1.2</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>0.10</version>
</dependency>
First problem
Your versions don't match. org.bytedeco.javacpp in version 0.10 is from Dec 2014, while all your other versions are from May 2016. You need to use version 1.2 of org.bytedeco.javacpp, or better yet, update all dependencies to the latest version.
You can see the versions here:
org.bytedeco.javacpp-presets » opencv
org.bytedeco.javacpp-presets » ffmpeg
org.bytedeco » javacv
org.bytedeco » javacpp
Second problem
You include the dependencies for Java code only, but you don't include the dependencies for native code (both opencv and ffmpeg are native libraries). You need to include opencv-platform and ffmpeg-platform instead:
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv-platform</artifactId>
<version>3.4.1-1.4.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>3.4.2-1.4.1</version>
</dependency>
This will make Maven download and include opencv and ffmpeg libraries for Android, Linux, MacOS and Windows, both x86 and x64.
java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
Actual cause of error is different versions of dependencies. That's why javacpp package failed during mapping of classes.
Follow these step to resolve this problem:
Download latest version of Javacv library package from here
Copy these three .jar files into libs folder
ffmpeg.jar
javacv.jar
javacpp.jar
Create jniLibs folder in app\src\main
Now, create four different folders for different architectures
arm64-v8a
armeabi
armeabi-v7a
x86
Change extension of these two files ffmpeg-android-arm.jar, ffmpeg-android-x86.jar to .zip then unzip both folders and Copy .so files for each architecture and paste in its respected directory. Your resultant directory should be look like this
Add .jar dependencies in your gradle file as follows:
implementation files('libs/ffmpeg.jar')
implementation files('libs/javacpp.jar')
implementation files('libs/javacv.jar')```
Thanks for reading :)
Try to update the dependencies with the latest versions and check whether class exists in that or not
https://mvnrepository.com/artifact/org.bytedeco/javacv/1.4.1
https://mvnrepository.com/artifact/org.bytedeco.javacpp-presets/ffmpeg/3.4.2-1.4.1
https://mvnrepository.com/artifact/org.bytedeco.javacpp-presets/opencv/3.4.1-1.4.1
This means that the class is there at compiletime but missing at runtime. You have a couple of options:
Always execute with a Maven plugin.
Include the library in the classpath when running.
Use the Maven Shade plugin to make an Uber-Jar which includes dependencies.
I hope this helps!
Getting this error while trying to connect facebook chat using smack.
jars used smack 3.3.1.jar,smackx 3.3.1.jar
Exception in thread "main" java.lang.AbstractMethodError: org.jivesoftware.smackx.ServiceDiscoveryManager$1.connectionCreated(Lorg/jivesoftware/smack/Connection;)V
at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:652)
at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:604)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1022)
at com.FacebookChatSample.main(FacebookChatSample.java:30)
I've had the same problem. Turned out that I didn't put the right package in my pom.xml
I used the following Maven dependency :
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smack</artifactId>
<version>3.1.0</version>
</dependency>
and it gave me the error when I tried to connect to my server. When I changed it to :
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smackx</artifactId>
<version>3.2.1</version>
</dependency>
it worked.
Note : smack dependency was another entry from the beggining and should be left this way:
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack</artifactId>
<version>3.2.1</version>
</dependency>
Note 2 : I didn't explixitly use anything from smackx, it is used in XMPPConnection.initConnection() there where it tries to inform all the ConnectionCreationListener listeners that a connection has just been established.