I am getting this error when I try to start the Spring Boot Application:
java: cannot access org.springframework.boot.SpringApplication bad class file: /repository/org/springframework/boot/spring-boot/3.0.1/spring-boot-3.0.1.jar!/org/springframework/boot/SpringApplication.class
class file has wrong version 61.0, should be 55.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
I had a look at the below SO question and it looks like this error happens when the Spring Boot version is 3.0.1. But I dont have that version mentioned in the build.gradle file.
java: cannot access org.springframework.boot.SpringApplication bad class file
here is the build.gradle file portion:
springCloudVersion = '2021.0.3'
springBootPluginVersion = '2.7.6'
sonarQubePluginVersion = '3.3'
gatlingPluginVersion = '3.8.4'
nebulaPublishingPluginVersion = '18.4.0'
nebulaReleasePluginVersion = '16.0.0'
jasyptSpringBootStarterVersion = '3.0.4'
Using Java 11.
I can also see that every time I build the project in IntelliJ, a spring boot 3.0.1 jar and its folder are created under the repository mentioned above ( even if I delete it). I can't see where is that version coming from. Any pointers will be greatly appreciated.
Related
Hello I'm trying to upgrade my spring boot version but getting following error,
I have tried enabling circulating reference from configuration but had no success the error is
escription:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.sql.init.dependency.DatabaseInitializationDependencyConfigurer.registerBeanDefinitions(DatabaseInitializationDependencyConfigurer.java:76)
The following method did not exist:
'org.springframework.beans.factory.support.BeanDefinitionBuilder org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition(java.lang.Class, java.util.function.Supplier)'
The method's class, org.springframework.beans.factory.support.BeanDefinitionBuilder, is available from the following locations:
jar:file:/Users/.m2/repository/org/springframework/spring-beans/5.3.5/spring-beans-5.3.5.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class
jar:file:/Users/.m2/repository/org/springframework/spring-beans/5.3.13/spring-beans-5.3.13.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class
The class hierarchy was loaded from the following locations:
org.springframework.beans.factory.support.BeanDefinitionBuilder: file:/Users/.m2/repository/org/springframework/spring-beans/5.3.5/spring-beans-5.3.5.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.BeanDefinitionBuilder
I just deleted my whole "m2" folder and built it from scratch, it seems maven looks at all possible versions from the repository and circulates through it. (In production mode I use Virtualization so there should be no problem)
My question is similar to this one (Spring boot application with apache axis) but I am running Spring Boot v2.2.6. When I execute the command
java -jar -Dspring.profiles.active=local myjar-0.0.1-SNAPSHOT.jar
I get the error
2021-06-01 00:41:53,152 myjar [http-nio-9090-exec-1] ERROR
org.apache.axis2.deployment.ModuleDeployer - deploy:94 - The addressing-1.6.3-classpath-
module.jar module, which is not valid, caused The /Users/xxxx/workspace/myjar/build/libs/myjar-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/addressing-1.6.3-classpath-
module.jar file cannot be found.
org.apache.axis2.AxisFault: The /Users/xxxx/workspace/.../build/libs/myjar-0.0.1-
SNAPSHOT.jar!/BOOT-INF/lib/addressing-1.6.3-classpath-module.jar file cannot be found.
I also have the relevant build.gradle snippet
api "org.apache.axis2:addressing:1.6.3:classpath-module"
api "org.apache.axis2:axis2:1.6.3"
api "org.apache.axis2:axis2-adb:1.6.3"
api "org.apache.axis2:axis2-transport-local:1.6.3"
api "org.apache.axis2:axis2-transport-http:1.6.3"
I confirmed that the file /Users/xxxx/workspace/myjar/build/libs/myjar-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/addressing-1.6.3-classpath-module.jar does exist. Can anyone help fix this issue?
It looks like Axis cannot cope with one jar file being nested inside another. For situations like this, you can configure Spring Boot to automatically unpack the nested jar when you start your application:
bootJar {
requiresUnpack '**/addressing-*-classpath-module.jar'
}
While running the application I was getting the following errors.
java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis2.description.AxisService
AxisService class is in axis2-kernel-1.6.2.jar file. Some of the classes from this jar are working fine without any issues, but some classes are throwing NoClassDefFoundError from this jar file at runtime. AxisService class is present in axis2-kernel-1.6.2.jar, even it throws error.
This is working fine in local machine. But error getting in Oracle r12 server.I have already set the class path for the jar file.
I am Using Java version is 1.6 and Apache axis2.1.6.2.
Had the same issue. I had included only jars that I needed to compile the application.
When I included everything from \axis2-1.6.2\lib\ folder, this exception were gone.
I had a similar problem using Tomcat and Axis2 and after a week finding out the error I realized there was a axis configuration problem. especifically my aplication can't instantiate the class which accedded to persistence layer. I include this parameter line:
<parameter name="ServiceTCCL">composite</parameter>
in services.xml file which is used by axis2 to work.
For more information see the comments in http://wso2.com/node/1131
Trying to test a jax rs Jersey application on WAS 6.1, I'm facing the following issue : Jersey needs asm 3.1, especially for the ClassReader class, but an uncompatible version of this class is loaded from WAS plugins directory.
the wrong class definition is loaded from :
file:/C:/Program Files/IBM/SDP70/runtimes/base_v61/plugins/com.ibm.wsfp.main_6.1.0.jar
If I run my application as it, I get a noSuchMethodError :
java.lang.NoSuchMethodError: org/objectweb/asm/ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
at com.sun.jersey.server.impl.container.config.AnnotatedClassScanner.analyzeClassFile(AnnotatedClassScanner.java:322)
at com.sun.jersey.server.impl.container.config.AnnotatedClassScanner.indexDir(AnnotatedClassScanner.java:271)
....
If I remove this jar from the plugins directory, my asm jar in 3.1 version is picked up and everything is fine.
So here is my question : what is the good way of dealing with this kind of situation ? Isn't there a way to tell the server to pick up my jar instead of its jar when I givi it to him ?
Complete problem description here.
Thank you,
Mathieu.
I am using IntelliJ and jus checked out working code from the svn.I am struggling to run the jar.
Its a simple core java Spring project.
Since I get the above error.I understand that the spring path is not set fine.
How do I handle it.?
private ApplicationContext appContext = new AnnotationConfigApplicationContext(ApplicationRepositoryConfiguration.class);
Application context file is a bean class here (#Bean annotation is used). I am not using a xml file.
It seems like you are running your project from command line. Run following command :
java -classpath spring.jar;spring-sec.jar,......so on com.example.UrMainClass
while specifying jar in command, make sure you provide complete path of jar. Also check this link https://stackoverflow.com/a/10122038/1065180