I have simple jar which includes the class MainClass with static start and stop methods. When I use JDK6 and Prunsrv my service starts and stops successfully. When I switch to JDK I get this error when I start the service:
java.lang.UnsupportedClassVersionError: org/serv/MainClass : Unsupported major.minor version 52.0
How can I resolve this problem?
I've encountered this before.
It's usually due to the Java classes being compiled for one Java version (i.e. JSE 8) but they are ran with another (i.e. JSE 6).
Check your paths and make sure the appropriate version of the JVM is running the code.
See also:
Unsupported major.minor version 52.0
Java Unsupported major.minor version 52.0 error Minecraft
Related
We were using axis2 1.7.9 and axiom 1.2.22 in our application along with commons-httpclient 3.1. We tried removing commons-httpclient 3.1 from our application and since commons-httpclient is required by axis2 1.7.9 we had to upgrade axis2 to its latest version 1.8.0 and in process of upgrading axis2 to 1.8.0 we also upgraded axiom to 1.3.0 but when we are running our application we get below error.
org.apache.axiom.soap.SOAPProcessingException: org.apache.axiom.om.impl.llom.OMElementImpl is not allowed as a child of org.apache.axiom.soap.impl.llom.soap11.SOAP11HeaderImpl
at org.apache.axiom.soap.impl.mixin.AxiomSOAPElementSupport.ajc$interMethod$org_apache_axiom_soap_impl_mixin_AxiomSOAPElementSupport$org_apache_axiom_soap_impl_intf_AxiomSOAPElement$checkChild(AxiomSOAPElementSupport.aj:35)
at org.apache.axiom.soap.impl.llom.SOAPElement.checkChild(SOAPElement.java:1)
at org.apache.axiom.om.impl.mixin.AxiomContainerSupport.ajc$interMethod$org_apache_axiom_om_impl_mixin_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$prepareNewChild(AxiomContainerSupport.aj:160)
at org.apache.axiom.om.impl.llom.OMElementImpl.prepareNewChild(OMElementImpl.java:1)
at org.apache.axiom.om.impl.mixin.AxiomContainerSupport.ajc$interMethodDispatch1$org_apache_axiom_om_impl_mixin_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$prepareNewChild(AxiomContainerSupport.aj)
at org.apache.axiom.om.impl.mixin.AxiomContainerSupport.ajc$interMethod$org_apache_axiom_om_impl_mixin_AxiomContainerSupport$org_apache_axiom_om_impl_intf_AxiomContainer$addChild(AxiomContainerSupport.aj:166)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:1)
at org.apache.axis2.client.ServiceClient.addHeadersToEnvelope(ServiceClient.java:673)
we checked and found that SOAP11HeaderImpl is child of OMElementImpl.
I am not sure why above exception is thrown.
This should be fixed by https://github.com/apache/ws-axiom/commit/2d9b87f40d3851fbf0f78fe4949190f15a7977ec. There may be a simple workaround (namely to create a SOAPHeaderBlock instead of an OMElement), but unfortunately the stack trace you provided is too short to tell that.
The complete error is something like:
Exception in thread "main" java.lang.UnsupportedClassVersionError:edu/stanford/nlp/tagger/maxent/MaxentTagger: Unsupported major.minor version 52.0`
There are two ways to solve it, Easiest way is to download and update latest version of JRE in the system which is running java code.
Using the following dependencies (amongst others, the bundle is supposed to be installed to AEM 6.1)
runtime is java8
maven-scr-plugin 1.15.0
org.apache.felix.scr.annotations: 1.9.8
org.apache.felix.scr.ds-annotations: 1.2.8
I get this exception
Caused by: org.apache.felix.scrplugin.SCRDescriptorException: Unable to scan class files: ...
(Class file format probably not supported by ASM ?)
at org.apache.felix.scrplugin.helper.ClassScanner.processClass(ClassScanner.java:219)
at org.apache.felix.scrplugin.helper.ClassScanner.process(ClassScanner.java:161)
at org.apache.felix.scrplugin.helper.ClassScanner.scanSources(ClassScanner.java:146)
at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:146)
at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:221)
... 22 more
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.(Unknown Source)
at org.objectweb.asm.ClassReader.(Unknown Source)
at org.objectweb.asm.ClassReader.(Unknown Source)
at org.apache.felix.scrplugin.helper.ClassScanner.processClass(ClassScanner.java:201)
The class in question does not contain any osgi annotations at all, but is merely imported in some other #Component annotated classes.
Did anyone encounter this and found a solution?
I ran into this issue today. This happens when you are running maven-scr-plugin with scanClasses=true option. Older versions of maven-scr-plugin cannot scan classfile generated by java8. you will have to either switch to a newer version of scr plugin (I upgraded to 1.22) or set you maven-compiler-plugin target config to 1.7
I found out that my Felix SCR Annotation Processor plugin that I installed to my Intellij as a prerequisite to using the aem-ide-tooling-4-intellij from headwirecom is causing the issue. It was working for quite a while until today suddenly giving me an issue in running my unit tests (needless to say, there were no changes made in my java, mvn versions or in my IDE).
This forced me to update my java version, intellij version but didn't fix the issue. But disabled the SCR annotation plugin fixed it.
As you can see, this plugin is really old (2014). I hope they will release a newer version soon.
I have created new Play + Scala project using latest typesafe activator and when trying to import in IntelliJ IDE I was getting below error,
info] Loading project definition from E:\Personal\Scala Workspace\DeployZip\project
E:\Personal\Scala Workspace\DeployZip\build.sbt:18: error: not found: value routesGenerator
routesGenerator := InjectedRoutesGenerator
^
[error] Type error in expression
Consult IDE log for more details (Help | Show Log)
What are the possible reasons for this error?
I have installed jdk 1.8 and now I am able to create project successfully without any error.
But when I tried to run play application using
activator run
I was getting below error now,
java.lang.UnsupportedClassVersionError: org/webjars/WebJarExtractor$Cache : Unsupported major.minor version 51.0
According to this article, I think Unsupported major.minor version 51.0 means that your play application were compiled with Java 1.7 (version 51), but you have Java 1.8 (version 52) installed instead, so you got this error. I'd suggest that you refer to this article for how you could switch between different Java versions.
I was having the error that said Unsupported major.minor version 52.0, and after I installed the latest one (Java 1.8) it was solved.
Hope this helps.
Here is what I've done to solve the issue. Even if you install the java 1.8 it is not sufficient. You have to update the 'path' and 'JAVA_HOME'.
After you install, try to set the jdk1.8 path in the PATH of the environment variables. Also make sure that if you have other versions of the java in the PATH then put the jdk 1.8 path prior to the previous version of java. Or just in case put it in the very beginning of the paths.
I had this same issue. Everything worked after I upgraded Intellij to the latest version (maybe my outdated version used JDK1.7, while activator used 1.8?).
I'm trying to overload the GWT "Date_CustomFieldSerializer" ( GWT 2.5.1 with maven2 and java1.6 ).
I've read that it is possible to overload a serializer by creating the same package structure inside your own project.
In my case I reproduce the package com.google.gwt.user.client.rpc.core.java.util to overload the class Date_CustomFieldSerializer but it does not seem to work well.
When serializing the Date, GWT Date_CustomSerializer is used but when the Date is deserialized my own "Date_CustomSerializer" is used.
If I delete the compiled Date_CustomFieldSerializer.class off gwt-user.jar and gwt-servlet.jar then my own Date_CustomFieldSerializer is always used but this is a bad solution, I am after a clean way to say to GWT that uses my own serializer always.
For delvelopment I use jetty and maven with the gwt-maven-plugin and in production mode I use weblogic.
I try to compile my own version of GWT but it fails when I try to run it, the server says:
[ERROR] Unable to initialize static dispatcher
java.lang.UnsupportedClassVersionError: com/google/gwt/core/client/JavaScriptObject$ : Unsupported major.minor version 51.0
How can I set it up to use my own serializer without GWT custom compilation?
Is your version first on the classpath?
It'a the version of Java.
You must compile the GWT Jar and your class with the same version of java.
The version 51 is the Java 7 version. (How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version)
But the GWT must be compiled with java 6.
You must set your java source to 1.6