Unsatisfied link error for libvirt - java

I am trying to connect kvm through java using the code present at
https://libvirt.org/java.html
When I try to connect i receive the below error
2016-04-23 21:18:17.960 ERROR 6359 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.UnsatisfiedLinkError: Unable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory] with root cause
java.lang.UnsatisfiedLinkError: Unable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166) ~[jna-3.3.0.jar!/:3.3.0 (b0)]
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239) ~[jna-3.3.0.jar!/:3.3.0 (b0)]
at com.sun.jna.Library$Handler.<init>(Library.java:140) ~[jna-3.3.0.jar!/:3.3.0 (b0)]
at com.sun.jna.Native.loadLibrary(Native.java:393) ~[jna-3.3.0.jar!/:3.3.0
I have libvirt installed on ubuntu
libvirtd --version
libvirtd (libvirt) 1.2.2
And my build.gradle is
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.libvirt:libvirt:0.5.1')
compile('net.java.dev.jna:jna:3.3.0')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Has anyone faced similar issue.

since you are on linux this exception is thrown when your application attempts to load a native library like .so.in this case JVM is looking in both the PATH environment variable and the java.library.path system property.
.to fix this exception you need to set path for that library u are trying to load. just like you set path for java.

Related

java.lang.ClassNotFoundException: javax.sql.rowset.RowSetProvider

I'm running a Gradle project in Docker and when I try to hit an endpoint through Postman I receive the following error. When I run it locally through Gradle it works fine and I can hit the endpoint no problem.
SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax.sql.rowset.RowSetProvider] with root cause
java.lang.ClassNotFoundException: javax.sql.rowset.RowSetProvider
I've tried adding the Gradle dependency implementation 'javax.sql:rowset:1.0.1' but had no success as it throws a Gradle build error Could not find javax.sql.rowset:com.springsource.javax.sql.rowset:1.0.1.

ASM ClassReader failed to parse class file

My spring application compiled with java 1.8 in local system where it's working fine without any issues, but when I deploy the application on the server where java-11 configured, giving an error message in server start-up
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem:
Failed to read candidate component class: URL
[jar:file:/app/apache-tomcat-9.0.46/webapps/planDeTravail/WEB-INF/lib/rna-1.20.jar!/com/DoRnaHistory.class];
nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file -
probably due to a new Java class file version that isn't supported yet: class path resource [java/io/Serializable.class];
nested exception is java.lang.IllegalArgumentException
Offending resource: class path resource [META-INF/spring/rna-spring-context.xml]; nested exception
is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably
due to a new Java class file version that isn't supported yet: class path resource [java/io/Serializable.class];
nested exception is java.lang.IllegalArgumentException
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68
My spring application running in 3.2.16.RELEASE
Could anyone please help me to find the root cause and solution of the issue?
I changed my JRE version back to 8 when using <org.springframework.version>5.2.0.RELEASE</org.springframework.version>
In Intellij i also changed the app configuration to run with JRE 8.

How to correctly specify spring config as VM argument in eclipse

I have the following application.yml file
plaintext:
server:
port: 8085
I am trying to run the application on eclipse but I get following error:
Exception encountered during context initialization - cancelling refresh attempt: Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'plaintext.server.port' in string value "${plaintext.server.port}"
I dont think I am specifying my spring config correctly.
The application.yml is located in folder src/main/resources.
I put the following as VM argument when running in eclipse:
-Dspring.config.name="src/main/resources/application.yml"

IntelliJ: SpringBoot-gradle application fails with "Could not open ServletContext resource"

A spring boot application (uses gradle) setup in IntelliJ starts up properly with no exceptions. However, on hitting it with requests via browser/postman throws Internal Server Error.
The application works perfect when started from commandline via
./gradlew bootRun
The exception stack trace says:
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
I suspect something is not right (on classpath) when the application is started from inside IntelliJ - 14.
Any pointers are appreciated.

Cannot run Xuggler on linux

I have a problem running Xuggler on linux:
08:43:05.550 [main] WARN com.xuggle.ferry.JNILibrary - Failure: library load of library: xuggle; url: /tmp/xuggle/xuggle2624685369771797713.tmp; error: java.lang.UnsatisfiedLinkError: /tmp/xuggle/xuggle2624685369771797713.tmp: /tmp/xuggle/xuggle2624685369771797713.tmp: failed to map segment from shared object: Operation not permitted
08:43:05.565 [main] ERROR com.xuggle.ferry.JNILibraryLoader - Could not load library: xuggle; version: 5; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
Exception in thread "main" java.lang.UnsatisfiedLinkError: no xuggle in java.library.path
Same JAR works fine on Windows.
I tried to include xuggler-5.4.jar, 5.2.jar, I also tried to make maven project and to compile with maven, the problem persists.
Here is the CLASSPATH, so you can see I also included lately in the classpath the jar
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64//jre/lib/ext:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64//lib/tools.jar:/home/baidoc/libs/xuggle-xuggler-5.4.jar

Categories

Resources