Wildfly 8.2 not recognising spring module - spring

I am getting exception
Caused by: org.jboss.modules.ModuleNotFoundException: org.springframework.sp
ring:main"}}}}
I defined spring modules as per the link
http://www.javacodegeeks.com/2013/11/add-apache-camel-and-spring-as-jboss-modules-in-wildfly.html
but no use.

This issue is because typo in filename it is not modules.xml it should be module.xml

Related

Spring-Boot-Admin application not starting because of error creating bean with name adminHandlerMapping

I am following this blog to try out a Spring-Boot-Admin application. And when I run the app it fails with the below error:
Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'adminHandlerMapping' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerWebConfiguration$ServletRestApiConfirguation.class]:
Invocation of init method failed; nested exception is java.lang.StackOverflowError
I look further below and find these below lines:
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_231]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.2.1.RELEASE.jar:2.2.1.RELEASE]
Caused by: java.lang.StackOverflowError: null
at de.codecentric.boot.admin.server.web.servlet.AdminControllerHandlerMapping.withPrefix(AdminControllerHandlerMapping.java:48) ~[spring-boot-admin-server-2.1.0.jar:2.1.0]
at de.codecentric.boot.admin.server.web.servlet.AdminControllerHandlerMapping.registerHandlerMethod(AdminControllerHandlerMapping.java:44) ~[spring-boot-admin-server-2.1.0.jar:2.1.0]
Not sure if there is some circular dependency in the jars. Any idea please?
The comment by #the hand of NOD made me relook into my pom.xml file and the pom.xml file provided in the blog
The problem lies in the version number of the spring-boot-starter-parent. The tutorial uses a version 2.1.0.RELEASE whereas the latest one when you prepare a project from Spring Intializr is 2.2.1.RELEASE
I downgraded to 2.1.0.RELEASE and it worked! With 2.2.1.RELEASE there is some dependency that is going cyclic with spring-boot-admin-starter-server
P.S. It seems that the codecentric team is already working upon it and would release the 2.2.0 compliant version by 22 Nov 2019 (https://github.com/codecentric/spring-boot-admin/milestones)
It works for me upgrade spring-boot-admin-starter-admin to 2.2.4 and using
spring-boot-starter-parent 2.2.8.RELEASE, spring-boot-admin-starter-client 2.1.6 on service's pom

Websphere 8.5.5 - spring boot error: SpringServletContainerInitializer not a subtype

I have a spring boot application that works fine on Tomcat 8. When I try to deploy it on Websphere 8.5.5 with "Class loader order" set to "Classes loaded with local class loader first (parent last)" the application fails to start with the following exception:
... 73 more
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:242)
at java.util.ServiceLoader.access$300(ServiceLoader.java:192)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:380)
at java.util.ServiceLoader$1.next(ServiceLoader.java:456)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:537)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
... 74 more
Just adding my experience with this problem, looking around on the various answers to similar problems I found out that the problem could be caused by some javax-servlet related jar in the classpath. After some trial and error I noticed that the spring-boot-starter-web dependency has an inherited spring-boot-starter-tomcat dependency. Excludung this jar from the application classpath when deploying on Websphere 8.5.5 solved the problem.

Issue in Jboss 7.2.2 migration

I am deploying a WAR file to JBoss EAP 7.2.2. During deployment, I am getting
"Caused by: java.lang.IllegalArgumentException: Unable to load generated mapper class com.amadeus.jcp.services.ttr.display.structured.builder.response.selma.mapper.offer.DisplayTripCartResponseOfferQuotationMapperSelmaGeneratedClass"
which is caused by "Caused by: java.lang.ClassNotFoundException: com.amadeus.jcp.services.ttr.display.structured.builder.response.selma.mapper.offer.DisplayTripCartResponseOfferQuotationMapperSelmaGeneratedClass"
It is a selma generated class and available in a jar inside WEB-INF/lib.
Same WAR file is deploying successfully in JBoss EAP 7.1.
As per class loader hierarchy, it should be identified but not happening.
Anybody have any idea of this issue, please help.
Verified standalone.xml and jboss-deployment-structure.xml. Using same version before and after migration except for name space version upgrade to subsystems.
Using Java 1.8.0_191

Spring Boot application breaks after upgrade to Apache Derby 10.15 -- why?

During a round of SOUP upgrades in a Spring Boot application, I bumped Apache Derby from 10.14.1.0 to 10.15.1.3. Now the tests fail with this beauty (snipped, full stacktrace here):
Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource':
Invocation of init method failed
Caused by: java.lang.IllegalStateException:
Failed to replace DataSource with an embedded database for tests.
If you want an embedded database please put a supported one on the
classpath or tune the replace attribute of #AutoConfigureTestDatabase.
What is going here? Do I need to change any configuration?
Apache Derby requires Java 9 from 10.15.x on which Spring Boot does currently not support.
See also spring-boot#16433.
I just want to answer with what it took me to get Derby 15.2.0 to work with Spring Boot 2.4.4 with derby in embedded mode, on top of Java 11. Spring Boot 2.4.4 works out of the box with Derby 14, although you will get some warning as spring boot starts. Upgrading apache derby to 15.2.0 fixed that for me.
In pom, both derby and derbytools dependencies defined:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
Then in your apps properties file:
spring.datasource.driver-class-name=org.apache.derby.iapi.jdbc.AutoloadedDriver
Instead of:
spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver
After that, I now get a good startup of Spring Boot with no warnings or anything that raises concerns.

JAVA Classpath and jersey client

I had this problem for last few weeks and whenever i run a java application the following exception :
java.lang.NoClassDefFoundError: com/sun/jersey/core/util/FeaturesAndProperties
Caused by: java.lang.ClassNotFoundException:
com.sun.jersey.core.util.FeaturesAndProperties
The problem was jerseyclient.jar, jersey.jar and javax.ws.rs.jar was there in JDK classpath and also there a dependency shich had these files so the that caused this exception. Hope it helps someone !!!

Resources