Spring Cloud Starter Eureka Setup - spring-cloud

I try to setup Spring Cloud Eureka by following a tutorial link on Spring.io. I get the server up, but not its client. The tutorial uses Spring Boot 1.5.9.RELEASE. But there isn't the version of Spring Cloud Starter Eureka on http://mvnrepository.com/. So, I try 1.4.0 and 2.0.0.M2. I get
09:15:41.027 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError:
org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:166)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.example.gateway.GatewayApplication.main(GatewayApplication.java:30)
What do I do wrong?
I use Gradle for the build tool.

The artifact has been renamed to spring-cloud-starter-netflix-eureka-client for Spring Cloud Finchley and Spring Boot 2

Related

which spring-data-mongodb version is supported by Spring-boot 2.3.4 because I am getting this error while server startup locally

Failed to introspect Class [org.springframework.data.mongodb.config.MongoConfigurationSupport] from ClassLoader
java.lang.NoClassDefFoundError: org/springframework/data/support/IsNewStrategyFactory
Caused by: java.lang.ClassNotFoundException: org.springframework.data.support.IsNewStrategyFactory
Dependency versions are listed in an appendix of Spring Boot's reference documentation. In that appendix can see that Spring Boot 2.3.4.RELEASE uses 3.0.4.RELEASE of org.springframework.data:spring-data-mongodb by default.
If you use Spring Boot's dependency management, either by inheriting from spring-boot-starter-parent or importing spring-boot-dependencies, you can declare a dependency without a version and Spring Boot's dependency management will give you the correct version automatically. You can learn more about this in the reference documentation.

Ojdbc8 jars upgrade to 21.1.0.0 throws Nosuchmethod exception UCPservletContextListener init

Ojdbc8, ons, ucp jars are upgraded to 21.1.0.0 version. When trying to start the app on tomcat server, it's throwing Nosuchmethod exception. Logged in the Tomcat's localhost.log file. Application tries to establish DB connection during startup itself.
01-Jun-2021 15:59:56.641 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 3 Spring WebApplication Initializers detected on classpath
01-Jun-2021 16:00:05.365 INFO localhost-startStop-1 org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
01-Jun-2021 16:00:19.397 SEVERE localhost-startStop-1 org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class [oracle.ucp.jdbc.UCPServletContextListener]
java.lang.NoSuchMethodException: oracle.ucp.jdbc.UCPServletContextListener.init
at java.lang.class.getConstructor(Unknown Source)
This is a known issue with ucp.jar in 21.1. It will be fixed in 21.3 when it's released. In the meantime, you can remove this class from the ucp.jar:
oracle/ucp/jdbc/UCPServletContextListener.class
From my experience, if you put jdbc/ucp jars to Tomcat's lib (which is recommended for productive system) and set provided scope for them in Maven, the problem will disappear.
Another option could be setting metadata-complete="true" in web.xml (read more here and here)
if you are using spring boot then you can use
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
this dependency or update your maven project.

NoClassDefFoundError Fop Library when deployed in Prod Server - Jdeveloper 11 Oracle ADF

Oracle Jdeveloper (Version 11.1.1.6.0) building ADF application that generate PDF file using Apache FOP Library. My Application runs local web server. But when deploy in production server, below NoClassDefFoundError exception is showing and failing to generate PDF file.
Exception output:
<code>
javax.el.ELException: java.lang.NoClassDefFoundError: org/apache/avalon/framework/configuration/ConfigurationException
at com.sun.el.parser.AstValue.invoke(AstValue.java:191)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
...
...
Caused by: java.lang.NoClassDefFoundError: org/apache/avalon/framework/configuration/ConfigurationException
at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:153)
at org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:177)
...
...
Caused by: java.lang.ClassNotFoundException: org.apache.avalon.framework.configuration.ConfigurationException
...
...
</code>
A NoClassDefFoundError with a caused by ClassNoFoundException points to a missing library on the server. Have you checked your deployment artifact (the EAR) if it contains all the needed FOP jars?
If all jars are part of the EAR (or better the WAR inside the EAR), you need to tell the Weblogic Server to load the jars from your deployment first before looking into jars already on the server. See https://tompeez.wordpress.com/2015/06/06/pitfalls-when-using-newer-versioned-libraries-than-shipped-with-jdeveloper-or-weblogic-server/ for more info on that.

Spring Boot Admin 2.0.1 minimum Spring Boot version

Which is the minimum version of Spring Boot compatible with Spring Boot Admin 2.0.1?
I have a project which uses Spring Boot 1.5.8 and I would like to use Spring Boot Admin last version but it results in:
Caused by: java.lang.ClassNotFoundException: org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 27 more
You can integrate spring boot admin 2.0 with 1.5.X and 2.0 . Follow these steps for spring boot 1.X
1. Add this dependency in your pom
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.7</version>
</dependency>
2. Add spring boot admin URL in application properties
spring.boot.admin.url: http://localhost:7777
spring.boot.admin.api-path: instances
For full project check my project
References:
https://github.com/codecentric/spring-boot-admin/issues/802
http://codecentric.github.io/spring-boot-admin/current/#monitoring-spring-boot-1.5.x
Spring Boot Admin 2.0.1 at least requires Spring Boot 2.0.2

Unable to call JAX-WS client deployed on JBoss 7.1.1

I have a generated jax-ws web service client that runs fine when I run it as a java standalone project. However if I add it to a web application (war) deployed on JBoss 7.1.1 and call the web service it throws the following exception:
Caused by: java.lang.NoClassDefFoundError: com/ctc/wstx/io/DefaultInputResolver
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:628)
at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:324)
at __redirected.__XMLInputFactory.createXMLStreamReader(__XMLInputFactory.java:139) [jboss-modules.jar:1.1.1.GA]
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1176)
at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:104)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:795)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1493)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1401)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:648)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:461)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:364)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
at $Proxy189.getcodelists(Unknown Source)
Idea what I may be missing?
As the error says, the App server is unable to find the said class file. Is it possible in your standalone app your classpath has the library but JBoss AS 7 is unable to find it.
If you can isolate where this library is, you can either bundle it with your WAR file or create a jboss_module to satisfy the dependency.
Good luck!