ClassNotFoundException with Mockito 2 in OSGI - mockito

When I Try to run junit plugin tests in eclipse using Mockito 2 (version 2.0.54 beta), calling
org.mockito.Mockito.mock(Class<T>, MockSettings)
fails with stack trace above.
I manage to workaround the issue by doing this
ClassLoader loader = Tread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(Mockito.class.getClassLoader());
try {
org.mockito.Mockito.mock(Class<T>, MockSettings);
} finally {
Thread.currentThread().setContextClassLoader(loader)
}
That does not seems right, and requires lot of work to move from mockito 1 to mockito 2, is there any other way to be able to use mockito in osgi environment ?
java.lang.IllegalStateException: Error invoking java.lang.ClassLoader#findClass
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Resolved.loadClass(ClassInjector.java:401)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.inject(ClassInjector.java:210)
at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:204)
at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default.load(ClassLoadingStrategy.java:119)
at net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4350)
at org.mockito.internal.creation.bytebuddy.MockBytecodeGenerator.generateMockClass(MockBytecodeGenerator.java:60)
at org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator$CachedBytecodeGenerator.generate(CachingMockBytecodeGenerator.java:72)
at org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator$CachedBytecodeGenerator.getOrGenerateMockClass(CachingMockBytecodeGenerator.java:64)
at org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator.get(CachingMockBytecodeGenerator.java:27)
at org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createProxyClass(ByteBuddyMockMaker.java:54)
at org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:27)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:32)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:54)
at org.mockito.Mockito.mock(Mockito.java:1443)
at org.mockito.Mockito.mock(Mockito.java:1356)
... 45 more
Caused by: java.lang.NoClassDefFoundError: org/mockito/internal/creation/bytebuddy/MockMethodInterceptor$MockAccess
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Resolved.loadClass(ClassInjector.java:397)
... 59 more
Caused by: java.lang.ClassNotFoundException: org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$MockAccess
at java.lang.ClassLoader.findClass(ClassLoader.java:531)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at net.bytebuddy.dynamic.loading.MultipleParentClassLoader.loadClass(MultipleParentClassLoader.java:66)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 66 more

This problem is resolved in a recent build of Mockito.

Related

NullnessChecker Error: java.lang.NoSuchFieldError: RELEASE

I can't build my code with the checker framework anymore. When I comment out the checker framework annotation processor, my code compiles fine, so the problem isn't with my code. With the framework, I get this error message:
[ERROR] InvocationTargetException when invoking constructor for class
org.checkerframework.checker.nullness.KeyForAnnotatedTypeFactory; Underlying cause:
java.lang.NoSuchFieldError: RELEASE
Exception: java.lang.reflect.InvocationTargetException; Stack trace: sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
org.checkerframework.common.basetype.BaseTypeChecker.invokeConstructorFor(BaseTypeChecker.java:275)
org.checkerframework.common.basetype.BaseTypeVisitor.createTypeFactory(BaseTypeVisitor.java:261)
...
(Full stack trace is at the bottom.)
This stack trace doesn't reference anything in my code. It appears to be a bug in the nullness checker.
I'm using the current version of maven (3.6.3) and the maven compiler plug-in (3.8.1). I'm using JDK 1.8.
To see the pom.xml file and the code, check out the repository at https://github.com/SwingGuy1024/CheckerNoSuchFieldErrorBug
Here's a link to the pom file: https://github.com/SwingGuy1024/CheckerNoSuchFieldErrorBug/blob/master/pom.xml
To reproduce the bug using Maven, download the repository and type mvn clean install
Here's the full stack trace:
[ERROR] InvocationTargetException when invoking constructor for class org.checkerframework.checker.nullness.KeyForAnnotatedTypeFactory; Underlying cause: java.lang.NoSuchFieldError: RELEASE
Exception: java.lang.reflect.InvocationTargetException; Stack trace: sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
org.checkerframework.common.basetype.BaseTypeChecker.invokeConstructorFor(BaseTypeChecker.java:275)
org.checkerframework.common.basetype.BaseTypeVisitor.createTypeFactory(BaseTypeVisitor.java:261)
org.checkerframework.common.basetype.BaseTypeVisitor.<init>(BaseTypeVisitor.java:220)
org.checkerframework.common.basetype.BaseTypeVisitor.<init>(BaseTypeVisitor.java:209)
org.checkerframework.common.basetype.BaseTypeChecker.createSourceVisitor(BaseTypeChecker.java:224)
org.checkerframework.common.basetype.BaseTypeChecker.createSourceVisitor(BaseTypeChecker.java:85)
org.checkerframework.framework.source.SourceChecker.initChecker(SourceChecker.java:904)
org.checkerframework.common.basetype.BaseTypeChecker.initChecker(BaseTypeChecker.java:100)
org.checkerframework.common.basetype.BaseTypeChecker.initChecker(BaseTypeChecker.java:91)
org.checkerframework.framework.source.SourceChecker.typeProcessingStart(SourceChecker.java:860)
org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:157)
com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:681)
com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:111)
com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1342)
com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
com.sun.tools.javac.main.Main.compile(Main.java:523)
com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1134)
org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:187)
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Underlying Exception: java.lang.NoSuchFieldError: RELEASE; Stack trace: org.checkerframework.javacutil.PluginUtil.getReleaseValue(PluginUtil.java:617)
org.checkerframework.framework.stub.StubTypes.<init>(StubTypes.java:81)
org.checkerframework.framework.type.AnnotatedTypeFactory.<init>(AnnotatedTypeFactory.java:397)
org.checkerframework.framework.type.GenericAnnotatedTypeFactory.<init>(GenericAnnotatedTypeFactory.java:202)
org.checkerframework.checker.nullness.KeyForAnnotatedTypeFactory.<init>(KeyForAnnotatedTypeFactory.java:65)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
org.checkerframework.common.basetype.BaseTypeChecker.invokeConstructorFor(BaseTypeChecker.java:275)
org.checkerframework.common.basetype.BaseTypeVisitor.createTypeFactory(BaseTypeVisitor.java:261)
org.checkerframework.common.basetype.BaseTypeVisitor.<init>(BaseTypeVisitor.java:220)
org.checkerframework.common.basetype.BaseTypeVisitor.<init>(BaseTypeVisitor.java:209)
org.checkerframework.common.basetype.BaseTypeChecker.createSourceVisitor(BaseTypeChecker.java:224)
org.checkerframework.common.basetype.BaseTypeChecker.createSourceVisitor(BaseTypeChecker.java:85)
org.checkerframework.framework.source.SourceChecker.initChecker(SourceChecker.java:904)
org.checkerframework.common.basetype.BaseTypeChecker.initChecker(BaseTypeChecker.java:100)
org.checkerframework.common.basetype.BaseTypeChecker.initChecker(BaseTypeChecker.java:91)
org.checkerframework.framework.source.SourceChecker.typeProcessingStart(SourceChecker.java:860)
org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:157)
com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:681)
com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:111)
com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1342)
com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
com.sun.tools.javac.main.Main.compile(Main.java:523)
com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1134)
org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:187)
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
org.codehaus.classworlds.Launcher.main(Launcher.java:47)
The problem is an incorrect pom.xml file, caused by not following the instructions in the Checker Framework Manual.
Even after multiple fixes (see comments on the original post), the pom.xml file contains this nonsense line that overrides a correct line earlier in the file:
<errorProneJavac>.m2/repository/com/google/errorprone/${checkerVersion}:javac:jar</errorProneJavac>
When that line is present, the build yields java.lang.NoSuchFieldError: RELEASE.
Removing that line (that is, following the instructions in the manual) makes the project build.
Here is a diff that cleans up some of the wrong parts of the pom.xml file.

executing DynamoDB, jetty exception error

so i Installed the local version of dynamoDB
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html .
And after that, executed the command is mentioned in the same link
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
the thing is i get this error every time
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/handler/AbstractHandler
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.handler.AbstractHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
how do i get rid of this problem ?
Using Ubuntu 16.04, trying to make dynamoDB work for nodeJS
If you are using this for local development, I'd highly suggest using a docker image for dynamoDB - this will ensure that you don't need specific configuration on your linux flavor and it should work out of the box.
For me, https://hub.docker.com/r/dwmkerr/dynamodb/ does work quite well for my use case. If you don't have docker yet, here's a handy guide on how to install it for Ubuntu 16.04 - https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04

how to create Spring component for SpringContextProcessor with Nifi

I was trying to follow Oleg's demo in here: https://www.youtube.com/watch?v=F98NLule18I&t=1909s
And I pulled his si-demo from https://github.com/olegz/si-demo
But in Nifi 1.6.0, when SpringContextProcessor is configed with si-demo classpath and toNifiOnly.xml the processor yanks InvocationTargetException, and processor won't be properly initialized!
Are there any other demos or examples for creating a spring component for Nifi? Or how to fix this?
Here is the error message in log file:
2018-06-02 09:26:28,040 ERROR [Monitor Processore Lifecycle Thread-2] o.a.nifi.spring.SpringContextProcessor SpringContextProcessor[id=bc3dbcab-0163-1000-4b77-af4eab0c7c46] Failed to properly initialize Processor. If still scheduled to run, NiFi will attempt to initialize and run the Processor again after the 'Administrative Yield Duration' has elapsed. Failure is due to java.lang.reflect.InvocationTargetException: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor374.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:137)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:47)
at org.apache.nifi.controller.StandardProcessorNode.lambda$initiateStart$3(StandardProcessorNode.java:1455)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Failed while initializing Spring Application Context
at org.apache.nifi.spring.SpringContextProcessor.initializeSpringContext(SpringContextProcessor.java:239)
... 14 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to instantiate Spring Application Context. Config path: 'fromNifiOnly.xml'; Classpath: [[file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/slf4j-api-1.6.6.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/commons-logging-1.2.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/camel-spring-2.16.2.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/aopalliance-1.0.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-tx-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/camel-core-2.16.2.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-beans-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-core-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/jaxb-core-2.2.11.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-retry-1.1.2.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/si-demo-0.0.1-SNAPSHOT.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-aop-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-integration-core-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/jaxb-impl-2.2.11.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-expression-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-messaging-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/spring-context-4.2.4.RELEASE.jar, file:/Users/shuo/Projects/sts-workspace/si-demo/target/deps/]]
at org.apache.nifi.spring.SpringContextFactory.createSpringContextDelegate(SpringContextFactory.java:92)
at org.apache.nifi.spring.SpringContextProcessor.initializeSpringContext(SpringContextProcessor.java:236)
... 14 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.nifi.spring.SpringContextFactory.createSpringContextDelegate(SpringContextFactory.java:80)
... 15 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/support/ClassPathXmlApplicationContext
at org.apache.nifi.spring.bootstrap.SpringContextDelegate.<init>(SpringContextDelegate.java:72)
... 20 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.context.support.ClassPathXmlApplicationContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 21 common frames omitted
I have found out later that it is necessary to copy all the xml files to the deps folder to let it run!

Unable to deploy JavaFX application to Raspberry Pi

I want to deploy my javafx application on a raspberry pi from within IntelliJ (making debugging easier as well). For this purpose I installed the following plugin for embedded linux development: https://plugins.jetbrains.com/plugin/7738-embedded-linux-jvm-debugger-raspberry-pi-beaglebone-black-intel-galileo-ii-and-several-other-iot-devices-
I can connect to my Pi just fine. Deployment also works fine. However, once the following command is executed, something goes wrong:
Executing Command :sudo java -Dprism.verbose=true -cp classes:lib/'*' runnable.MainApp
A load of class files show up (such as classes/mypackage/MyClass.class), and eventually, I get the following stack-trace, and I'm not sure what to make of it.
The kernel version of the Pi is: Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.ClassNotFoundException: com.sun.prism.es2.ES2Pipeline
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
*** Fallback to Prism SW pipeline
And right after I get the following:
Prism pipeline name = com.sun.prism.sw.SWPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline
java.lang.UnsatisfiedLinkError: Can't load library: /home/pi/IdeaProjects/user_interface/arm/libprism_sw.so
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:201)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:94)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:39)
at com.sun.prism.sw.SWPipeline.lambda$static$472(SWPipeline.java:42)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:205)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:217)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more

java.lang.NoClassDefFoundError org.eclipse.jetty.server.Connector on Jetty

I have a java web app that uses Jetty embedded and when I try to run in a linux environment I have the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at br.com.teste.install.Launcher.work(Launcher.java:23)
at br.com.teste.install.Install.main(Install.java:14)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Connector
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 4 more
When I run exactly the same app in a windows environment this works without any error.
I have no ideia for what happen this.
Thanks for any help.

Resources