0

I am following microservices tutorials from the link : https://github.com/sqshq/PiggyMetrics and I was able to successfully start the following services

  1. config
  2. registry
  3. gateway

In each services .yml file, I changed registry to localhost and config to localhost too.

but when I ran the "monitoring" service, I get the below error.

ava.lang.NoClassDefFoundError: org/springframework/messaging/converter/MessageConverter
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_151]
    at java.lang.ClassLoader.defineClass(Unknown Source) ~[na:1.8.0_151]
    at java.security.SecureClassLoader.defineClass(Unknown Source) ~[na:1.8.0_151]
    at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_151]
    at java.net.URLClassLoader.access$100(Unknown Source) ~[na:1.8.0_151]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_151]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_151]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_151]
    at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_151]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_151]
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_151]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_151]
    at org.springframework.integration.config.IntegrationRegistrar.registerDefaultDatatypeChannelMessageConverter(IntegrationRegistrar.java:425) ~[spring-integration-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.integration.config.IntegrationRegistrar.registerBeanDefinitions(IntegrationRegistrar.java:106) ~[spring-integration-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:358) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at java.util.LinkedHashMap.forEach(Unknown Source) ~[na:1.8.0_151]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:357) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:145) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
    at com.piggymetrics.monitoring.MonitoringApplication.main(MonitoringApplication.java:14) [classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.messaging.converter.MessageConverter
    at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_151]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_151]
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_151]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_151]
    ... 32 common frames omitted

Error: enter image description here

Below error while starting the "auth-service"

com.mongodb.MongoSocketException: auth-mongodb
    at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:59) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.SocketStream.open(SocketStream.java:57) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.6.4.jar:na]
    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:114) ~[mongodb-driver-core-3.6.4.jar:na]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_151]
Caused by: java.net.UnknownHostException: auth-mongodb
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_151]
    at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source) ~[na:1.8.0_151]
    at java.net.InetAddress.getAddressesFromNameService(Unknown Source) ~[na:1.8.0_151]
    at java.net.InetAddress.getAllByName0(Unknown Source) ~[na:1.8.0_151]
    at java.net.InetAddress.getAllByName(Unknown Source) ~[na:1.8.0_151]
    at java.net.InetAddress.getAllByName(Unknown Source) ~[na:1.8.0_151]
    at java.net.InetAddress.getByName(Unknown Source) ~[na:1.8.0_151]
    at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:186) ~[mongodb-driver-core-3.6.4.jar:na]
    ... 5 common frames omitted

2 Answers 2

1

I was able to figure out this issue. While building the whole source code, I checked the maven debug log closely and found the below error.

[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ monitoring ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\pc\Desktop\My_MicroServices\PPP\PiggyMetrics-master\monitoring\target\classes
[ERROR] error reading C:\Users\pc\.m2\repository\io\projectreactor\ipc\reactor-netty\0.7.8.RELEASE\reactor-netty-0.7.8.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\pc\.m2\repository\org\springframework\spring-messaging\5.0.7.RELEASE\spring-messaging-5.0.7.RELEASE.jar; invalid LOC header (bad signature)
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ monitoring ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ monitoring ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\pc\Desktop\My_MicroServices\PPP\PiggyMetrics-master\monitoring\target\test-classes
[ERROR] error reading C:\Users\pc\.m2\repository\io\projectreactor\ipc\reactor-netty\0.7.8.RELEASE\reactor-netty-0.7.8.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\pc\.m2\repository\org\springframework\spring-messaging\5.0.7.RELEASE\spring-messaging-5.0.7.RELEASE.jar; invalid LOC header (bad signature)

I deleted "spring-messaging-5.0.7.RELEASE.jar" and "reactor-netty-0.7.8.RELEASE.jar" from .m2 and rebuild the project. This time no build compiling error and even able to make the monitoring service up.

Done !

Sign up to request clarification or add additional context in comments.

Comments

0

Delete the whole .m2\repository\org\springframework folder and rebuild the again "mvn clean install " . It worked for me . This happens due to conflicting dependencies for same package .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.