I need to compile a an eclipse RCP using maven+tycho, at the moment everything is working fine, as I configured this on my local PC.
When switching to production-building configuration, it fails, the only difference being java version used.
Works with: Java jdk1.8.0_25
Fails with: Java jdk1.6.0_45
Error message:
ATTENTION: Error injecting: org.eclipse.tycho.core.p2.P2ArtifactRepositoryLayout
java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.p2.P2ArtifactRepositoryLayout not present
...
...
...
Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/tycho/core/p2/P2ArtifactRepositoryLayout : Unsupported major.minor version 52.0
I can provide the full error stack if needed, but the error message seems pretty explicit already. Still, didn't find anything about it on the web, because it feels strange that this can't be done using java 1.6.
When using java jdk 8, I don't have any errors and the build is working fine till the end.
Recent versions of Tycho require Java 8 (.class file version 52.0 means Java 8). You can, however, still build against an older Java (and run tests with an older Java) using a feature called toolchains. That way, mvn runs on Java 8, while your code is compiled against Java 6.
Related
I am upgrading
(JDK 8 + spring boot application (2.1.0.RELEASE)) TO
(JDK 14 + spring boot application (2.3.3.RELEASE))
I am using --enable-preview as part of java command but it silently fails. can't see any logger stmts either. --verbose option is not throwing any error nor warning.
any help?
Thanks for responses. Here are more details.
I use maven to compile and use java directly to run it (thru a shell script) java -jar ./target/fat_00.1.jar
Why I am doing both (spring FM + JDK) at same time?
upgrading JDK kind of forced me to upgrade SFM 2.1 to 2.3 (latest)
what else I tried?
I tried "--enable-preview" while compiling (by changing maven pom maven-compiler-plugin plugin) and adding to "java" command prompt
** java -verbose --enable-preview -jar ./target/fat_00.1.jar**
But none of them give any clue. biggest problem is my spring application exits without any error.
IF I upgrade ONLY spring FW keeping JDK1.8 I get following error:
findById(java.lang.Long) in com.model.repository.MyRepository clashes with findById(ID) in org.springframework.data.repository.CrudRepository
I understand the error its throwing, but does it mean it has no backward compatibility?
How do I find what's going on? without any error thrown anywhere, it is really frustrating.
We are moving from Java 8 to 11 on a project using jaxb. As it has been removed from the JDK, it has to be included separately, which I have done via gradle config:
compile("javax.xml.bind:jaxb-api:2.2.11")
compile("com.sun.xml.bind:jaxb-core:2.2.11")
compile("com.sun.xml.bind:jaxb-impl:2.2.11")
I am able to run the project, however compileJava gradle job throws errors:
Errors occurred while build effective model from C:\Users\.\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-core\2.2.11\db0f76866c6b1e50084e03ee8cf9ce6b19becdb3\jaxb-core-2.2.11.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-core:2.2.11
Errors occurred while build effective model from C:\Users\.\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-impl\2.2.11\2d4b554997fd01d1a2233b1529b22fc9ecc0cf5c\jaxb-impl-2.2.11.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-impl:2.2.11
The job finishes and there is a jar created, however when run on production server it stops with this error:
java.lang.NoClassDefFoundError: javax/xml/bind/Unmarshaller$Listener
I'm using Spring Boot v1.5.6 and gradle 4.8.1
The solution is to use a newer version of the jaxb libraries. 2.3.0 is no longer using tools.jar.
I'm currently migrating a project from java 8 to java 11, and have been using Sonar scanner, with gradle, to send the code to SonaQube. After migrating to Open JDK 11, I amd getting the following error when running the gradle sonarqube tasks:
java.lang.IllegalArgumentException: Unsupported class file major version 55
I have read online that the scanner should be run with jdk 8, even though the analysis can be run on an version of java files, but have not been able to figure this out.
Ideally, I would be able to run gradle sonarqube with the Java 11 JDK. I found another question seeming to have success with Java 11 using Maven, but their error is different, and I don't think their solution would apply to me.
Is this problem solvable, or will I need to wait for Sonar Scanner to have support for JDK 11?
If someone like me this will helpful.
Source code Java 8(55), with jenkins and sonarqube scanner.
My error was
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
.....
java.lang.IllegalArgumentException: Unsupported class file major version 55
Check this link : Why does sonar-scanner force the usage of the embedded JRE?
And Change your sonnar-scanner.bat or sonnar-scanner.sh
use_embedded_jre=false
I have a server kit that I'm trying to test on the java9 JDK (found here, I'm using the 64-bit Linux version), however I'm encountering the following error shortly after startup:
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:533)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:186)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:476)
The server kit starts without issue when using java8. Somehow I need to tell the runtime system to include the javax.xml.bind module, however I'm new to java9 and don't know how to do this short of recompiling the entire server kit into a module and adding a dependency on the javax.xml.bind module. Is there a way to resolve this error that doesn't require me to recompile the server kit into a module?
Java EE modules are shipped with the JDK but not resolved by default and java.xml.bind is one of them. In such cases they need to be included explicitly with --add-modules.
In your case, launch with --add-modules java.xml.bind.
I'm trying to use IBM Rational Application Developer version 9.0 with WebSphere Application Server v7.0 running Java 1.6 and use JAX-RS with org.glassfish.jersey version 2.6. This is not a maven project, so I created another maven project, added the root dependencies there and built it so it pulled down all of the jars. I moved them over into my non-maven project.
When I run the project, I start the server (or try to hit a resource) I get the following error message: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/glassfish/jersey/jackson/internal/JacksonAutoDiscoverable, offset=6
I have a different application that successfully uses jersey deployed WAS7 on this same machine. I've compared the project and server configurations and see no major difference, particularly no difference in the Installed JRE", Execution Environments or Java Compiler Compliance Level (all using 1.6).
Even though the maven project is using jersey 2.6, I have also tried other lower jersey versions in the non-maven project to see if it's an issue with the dependencies being built for 1.7 but that doesn't seem to be the case at all.
Here is the list of dependencies I have in my library:
aopalliance-repackaged-2.2.0.jar
hk2-api-2.2.0.jar
hk2-locator-2.2.0.jar
hk2-utils-2.2.0.jar
jackson-core-asl-1.9.13.jar
jackson-jaxrs-1.9.13.jar
jackson-mapper-asl-1.9.13.jar
jackson-xc-1.9.13.jar
javassist-3.18.1-GA.jar
javax.annotation-api-1.2.jar
javax.inject-2.2.0.jar
javax.ws.rs-api-2.0.jar
jersey-client-2.6.jar
jersey-common-2.6.jar
jersey-container-servlet-core-2.6.jar
jersey-guava-2.6.jar
jersey-media-json-jackson-2.6.jar
jersey-server-2.6.jar
osgi-resource-locator-1.0.1.jar
validation-api-1.1.0.Final.jar