OpenEJB 4.6.0 does not start with jdk8 - java-8

I'm using OpenEJB in my JUnit tests. It worked fine with jdk7. Unfortunately, it does not start with jdk1.8.0. Any ideas?
C:\javaapps\jdk1.8.0\bin\java
...
10:31:11 SEVERE org.apache.openejb.util.OpenEJBErrorHandler handleUnknownError FATAL ERROR: Unknown error in Assembler. Please send the following stack trace and this message to users#openejb.apache.org :
java.lang.IllegalArgumentException
at org.apache.xbean.asm4.ClassReader.<init>(Unknown Source)
at org.apache.xbean.asm4.ClassReader.<init>(Unknown Source)
at org.apache.xbean.asm4.ClassReader.<init>(Unknown Source)
at org.apache.openejb.util.AnnotationFinder.readClassDef(AnnotationFinder.java:297)
at org.apache.openejb.util.AnnotationFinder.find(AnnotationFinder.java:163)
at org.apache.openejb.config.DeploymentLoader.checkAnnotations(DeploymentLoader.java:1871)
at org.apache.openejb.config.DeploymentLoader.discoverModuleType(DeploymentLoader.java:1782)
at org.apache.openejb.config.DeploymentsResolver.processUrls(DeploymentsResolver.java:388)
at org.apache.openejb.config.DeploymentsResolver.loadFromClasspath(DeploymentsResolver.java:301)
at org.apache.openejb.config.ConfigurationFactory.getModulesFromClassPath(ConfigurationFactory.java:647)
at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:524)
at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:575)
at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:429)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:408)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:148)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:65)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:296)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:276)

yeah, asm used is not compatible with java 8 yeat, should be the case pretty soon btw, hope to get it for 4.7.0

i would guess that the asm library supplied with EJB is not java8 compatible. the java class file format has some new features, and it looks like asm4 is having some problems with it.

Related

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniavutil in java.library.path:

I am getting the following error while adding and testing javaCV to project in intellij in ubuntu 22.04. I hava read the documentation(https://github.com/bytedeco/javacv) but didn't understand what to do extactly. What I have done for adding javaCV to project is,
File -> Project Structure -> Module -> dependencies (+ add dependencies)
then selected javacpp.jar, javacv.jar, opencv.jar and ffmpeg.jar from the 'javacv-platform-1.5.7-bin' folder which I downloaded.
This is the output which I get after running a code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniavutil in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:848)
at java.base/java.lang.System.loadLibrary(System.java:2015)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1800)
at org.bytedeco.javacpp.Loader.load(Loader.java:1402)
at org.bytedeco.javacpp.Loader.load(Loader.java:1214)
at org.bytedeco.javacpp.Loader.load(Loader.java:1190)
at org.bytedeco.ffmpeg.global.avutil.<clinit>(avutil.java:14)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:488)
at java.base/java.lang.Class.forName(Class.java:467)
at org.bytedeco.javacpp.Loader.load(Loader.java:1269)
at org.bytedeco.javacpp.Loader.load(Loader.java:1214)
at org.bytedeco.javacpp.Loader.load(Loader.java:1190)
at org.bytedeco.ffmpeg.avformat.Read_packet_Pointer_BytePointer_int.<clinit>(Read_packet_Pointer_BytePointer_int.java:45)
at org.bytedeco.javacv.FFmpegFrameGrabber.<clinit>(FFmpegFrameGrabber.java:362)
at com.cooltrickshome.MovieToImage.convertMovietoJPG(MovieToImage.java:31)
at com.cooltrickshome.MovieToImage.main(MovieToImage.java:25)
Caused by: java.lang.UnsatisfiedLinkError: Could not find jniavutil in class, module, and library paths.
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1767)
... 14 more
Process finished with exit code 1
Can anyone tell the exact steps to follow to add javaCV to the project in intellij ?
I have a similar problem as it failed to find the the library. I ends up build my own ffmpeg, and copying the dylib files in jniLibs, and adding a line like System.loadLibrary("avutil.57") in the static scope.
another way could be setting up the library path:
-Djava.library.path=/Users/xxx/ffmpeg-java-samples/src/main/jniLibs
Since you are in Ubuntu, up to this point, it should be able to fix your issue. However, for the mac, the end result the exception message changes to
tried:'/Users/xxx/ffmpeg-java-samples/src/main/jniLibs/libavutil.57.dylib',
but hitting to another issue: (mach-o file, but is an incompatible
architecture (have (arm64), need (x86_64)))
I am still figuring out the ffmpeg for mac M1 chip part.
after making sure the following jar file, it seems running:
export CLZPATH=$CLZPATH:$JARROOT/org/bytedeco/javacpp/1.5.8/javacpp-1.5.8.jar
export CLZPATH=$CLZPATH:$JARROOT/org/bytedeco/javacpp-presets/ffmpeg/4.1-1.4.4/ffmpeg-4.1-1.4.4.jar
export CLZPATH=$CLZPATH:$JARROOT/org/bytedeco/javacpp-presets/ffmpeg/4.1-1.4.4/ffmpeg-4.1-1.4.4-macosx-x86_64.jar

Grails application response.outputStream << fails since upgrade to Grails 3.3

I have a Grails application that I have recently upgraded to 3.3 from 2.5. Generally things are working but today we ran across a problem that seems to be shared by others but I cannot find a solution.
In a controller I have a method that appends a string to the response.outputStream.
The code now appears as
response.status = OK.value()
response.contentType = 'text/csv;charset=UTF-8'
response.setHeader "Content-disposition", "attachment; filename=rcCandidate.csv"
response.outputStream << converted
response.outputStream.flush()
response.outputStream.close()
based on a suggestion found here
http://sergiodelamo.es/grails-tips-how-to-output-csv-from-a-grails-3-controller/
This code executes just fine on my test environment
$ grails -version
| Grails Version: 3.3.5
| Groovy Version: 2.4.15
| JVM Version: 1.8.0_162
but fails badly on the production server
$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
$ apt list | grep tomcat
tomcat7/trusty-security,trusty-updates,now 7.0.52-1ubuntu0.13 all [installed]
The failures are reported starting with:
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/WriteListener
followed by a stack trace, then this
Caused by: java.lang.NoClassDefFoundError: javax/servlet/WriteListener
then more stack trace and similar messages about WriteListener
I have seen suggestions to replace this line
provided "org.springframework.boot:spring-boot-starter-tomcat"
with
compile "org.springframework.boot:spring-boot-starter-tomcat"
But as pointed out here
https://docs.grails.org/latest/guide/deployment.html
that is not a good idea, and indeed when I tried it, tomcat did not start up.
I believe I've read somewhere that I might be able to cure this problem by replacing Tomcat7 with Tomcat8; however right now I'm running Ubuntu 14.04 on the server and Tomcat8 is not on offer in the repositories, so it's not quite straightforward to test that.
Does anyone have any suggestions for me? Thanks in advance.
You can fix this by adding #CompileStatic to your method, but that is not always feasible. We have fixed this problem in our applications by adding a static utility method:
#CompileStatic
public static sendResponseData(ServletOutputStream outputStream, String s) { // but this could be byte[] s or InputStream s or whatever you need
outputStream << s
}
and then calling that instead of the left shift operation.
You may need to add additional method signatures so that they can be statically compiled but the concept is the same. If I recall correctly, the left shift operator here uses some annotation or something (clearly I don't remember details!) that is not included by default (on Tomcat 7) but is also not needed.
Note that we also added
#CompileStatic
public static flushOutputStream(ServletOutputStream outputStream) {
outputStream.flush()
}
for convenience since that one has to be statically compiled as well.

Eclipse Oxygen fails to run - org.eclipse.swt.SWTException: Invalid thread access

I have following problem: my eclipse Oxygen fails to run(error attached).
Everything is fine on fresh instalation, when I run it just after downloading (tested on 1a september and 2 december). However, when i restart my computer, eclipse won't start again unless i will reinstall it.
I have cleared both eclipse cache as same as my project (even fetched fresh version from repo), workspace and eclipse instalation place is also fresh.
I have read e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=475392, https://bugs.eclipse.org/bugs/show_bug.cgi?id=514895 and other related posts, didn't help though.
Any idea? I am working on windows 10 64 bit, and JDK 9.0.1+11. My only plugin is BndTools 3.5, latest, project requires java 8 (current runtime jdk is 152).
Problem started on friday, 15 dec after running my project and resolving dependencies at example bnd project (http://enroute.osgi.org/tutorial_base/600-testing.html) at the same time. Couldn't run eclipse after that.
However, i did it before and didn't meet any problems (i mean opening example and running it). Also, I have cleared p2, mvn and bnd cache.
Below mentioned stack from eclipse .log:
!SESSION 2017-12-18 16:47:57.660 -----------------------------------------------
eclipse.buildId=4.7.2.M20171123-0800
java.version=9.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pl_PL
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY org.eclipse.osgi 4 0 2017-12-18 16:47:59.711
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4533)
at org.eclipse.swt.SWT.error(SWT.java:4448)
at org.eclipse.swt.SWT.error(SWT.java:4419)
at org.eclipse.swt.widgets.Display.error(Display.java:1263)
at org.eclipse.swt.widgets.Display.checkDevice(Display.java:767)
at org.eclipse.swt.widgets.Display.addListener(Display.java:628)
at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.<init>(IDEWorkbenchAdvisor.java:187)
at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.<init>(IDEWorkbenchAdvisor.java:195)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
Diff between fresh and dirty instalation
Update
After flushing whole system, problem gone for a while, however came back again, so it eliminates OS influence in my opinion.
As Struarf mentioned in his answer, deletion of configuration/org.eclipse.osgi templorary solves problem.
Nevertheless, when i have installed oxygen 2, I noticed that this problem is much more rarer than before (actually now 2nd time for 2 weeks, whether before was with each possible occasion), so maybe it comes in a good way...
I've just commented on bug 477247. I'm getting a similar exception (on OSX). What allows me to start Eclipse without reinstalling is to delete the configuration/org.eclipse.osgi folder. It looked like a bundle cache, and deleting such caches has worked elsewhere for me. Hopefully this might also provide a clue for the devs.
You seem to hit bug 477247. Until now, Eclipse developers were not able to reproduce the issue, maybe you can help them by adding steps to reproduce to the bug, or any other useful details.

Test Case failures with a java.lang.ArrayIndexOutOfBoundsException: 28526 with JDK 8 and terracotta 3.4.0

I currently moved maven java code from jdk7 to jdk8 which uses terracotta and was working properly but after changing it to jdk8 , my test cases are getting failed. I am getting following error and I didn't get any clues through searching.
java.lang.ArrayIndexOutOfBoundsException: 28526
at com.tc.asm.ClassReader.readClass(ClassReader.java:2015)
at com.tc.asm.ClassReader.getClassName(ClassReader.java:229)
at com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo.getClassInfo(AsmClassInfo.java:305)
at com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo.createClassInfoFromStream(AsmClassInfo.java:717)
at com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo.getClassInfo(AsmClassInfo.java:256)
at com.tc.aspectwerkz.reflect.impl.asm.AsmClassInfo.getInterfaces(AsmClassInfo.java:558)
at com.tc.aspectwerkz.expression.regexp.TypePattern.matchInterfaces(TypePattern.java:147)
at com.tc.aspectwerkz.expression.regexp.TypePattern.matchInterfaces(TypePattern.java:147)
at com.tc.aspectwerkz.expression.regexp.TypePattern.matchSuperClasses(TypePattern.java:120)
at com.tc.aspectwerkz.expression.regexp.TypePattern.matchType(TypePattern.java:92)
at com.tc.aspectwerkz.expression.ExpressionVisitor.visit(ExpressionVisitor.java:437)
at com.tc.aspectwerkz.expression.ast.ASTClassPattern.jjtAccept(ASTClassPattern.java:24)
at com.tc.aspectwerkz.expression.ExpressionVisitor.visitAnnotatedNode(ExpressionVisitor.java:1016)
at com.tc.aspectwerkz.expression.ExpressionVisitor.visit(ExpressionVisitor.java:237)
at com.tc.aspectwerkz.expression.ast.ASTWithin.jjtAccept(ASTWithin.java:22)
at com.tc.aspectwerkz.expression.ExpressionVisitor.visit(ExpressionVisitor.java:100)
at com.tc.aspectwerkz.expression.ast.ASTExpression.jjtAccept(ASTExpression.java:22)
at com.tc.aspectwerkz.expression.ExpressionVisitor.visit(ExpressionVisitor.java:88)
at com.tc.aspectwerkz.expression.ExpressionVisitor.match(ExpressionVisitor.java:74)
at com.tc.object.config.ClassExpressionMatcherImpl.match(ClassExpressionMatcherImpl.java:24)
at com.tc.object.config.CompoundExpressionMatcher.match(CompoundExpressionMatcher.java:18)
at com.tc.object.config.StandardDSOClientConfigHelperImpl.shouldBeAdapted(StandardDSOClientConfigHelperImpl.java:1242)
at com.tc.object.bytecode.hook.impl.DefaultWeavingStrategy.transformInternal(DefaultWeavingStrategy.java:184)
at com.tc.object.bytecode.hook.impl.DefaultWeavingStrategy.transform(DefaultWeavingStrategy.java:134)
at com.tc.object.bytecode.hook.impl.DSOContextImpl.preProcess(DSOContextImpl.java:288)
at com.tc.object.bytecode.hook.impl.DSOContextImpl.transform(DSOContextImpl.java:392)
at org.terracotta.express.ClusteredStateLoader.transform(ClusteredStateLoader.java:124)
at org.terracotta.express.ClusteredStateLoader.loadClass(ClusteredStateLoader.java:83)
at org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory$1.call(TerracottaClusteredInstanceFactory.java:319)
at org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory$1.call(TerracottaClusteredInstanceFactory.java:317)
at org.terracotta.api.Terracotta.lookupOrCreateRoot(Terracotta.java:47)
at org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory.getStoreRoot(TerracottaClusteredInstanceFactory.java:316)
at org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory.getStoreMapForCacheManager(TerracottaClusteredInstanceFactory.java:77)
at org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory.getOrCreateStore(TerracottaClusteredInstanceFactory.java:68)
at org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory.createStore(TerracottaClusteredInstanceFactory.java:64)
at net.sf.ehcache.terracotta.StandaloneTerracottaClusteredInstanceFactory.createStore(StandaloneTerracottaClusteredInstanceFactory.java:40)
Thank you
As stated in one of the comments, Terracotta 3.4.0 is not Java 8 compatible and given the way the old Terracotta version worked, this is not a surprise.
You will have to update to a later version if you must have Java 8 support.
The exact version will depend on the usage you are making of Terracotta - if you need DSO support, you have to stick with the 3.7.x line.
For Ehcache support, it is recommended to upgraded to the latest version in the 4.3.x line.

Running Typesafe Activator 1.2.10 on OSX Maverick error

I have just downloaded Typesafe Activator 1.2.10-minimal on Mac OSX Maverick. When I try to run it using any command, I get the following error:
java.lang.UnsatisfiedLinkError: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt/liblwawt.dylib: dlopen(/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt/liblwawt.dylib, 1): Library not loaded: #rpath/libosxapp.dylib
Referenced from: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt/liblwawt.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1872)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1653)
at java.awt.Toolkit.<clinit>(Toolkit.java:1682)
at java.awt.Desktop.isDesktopSupported(Desktop.java:169)
at activator.ActivatorLauncher.openDocs(ActivatorLauncher.scala:55)
at activator.ActivatorLauncher.displayHelp(ActivatorLauncher.scala:72)
at activator.ActivatorLauncher.run(ActivatorLauncher.scala:32)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:129)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:19)
at xsbt.boot.Boot$.runImpl(Boot.scala:44)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.UnsatisfiedLinkError: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt/liblwawt.dylib: dlopen(/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt/liblwawt.dylib, 1): Library not loaded: #rpath/libosxapp.dylib
Referenced from: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt/liblwawt.dylib
Reason: image not found
What could be wrong?
Thanks,
Suriyanto
Copying libosxapp.dylib from /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib to /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/lwawt solved the issue for me. Seems like #rpath looks in only lwawt folder, not in lib folder. Issue had happened to me after installing jdk7 after jdk8.
This does not look like a Scala- or Activator-specific problem, but rather like a problem with your JDK. It is looking for libosxapp.dylib on the run-path search paths, but doesn't find it.
That most likely means that either your JDK installation is broken, or there is some problem with your environment settings (I'm just guessing here, but I think something like DYLD_LIBRARY_PATH might have an impact).
Does /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/libosxapp.dylib exist? If not, that's the problem. You might want to reinstall your JDK then.
Does everything else run fine on that JDK?
Have you tried it with another JDK, e.g. Java 8 (not that Activator would require Java 8, but that would be an easy way to try it on another JDK).

Resources