-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoClassDefFoundError: com/rabbitmq/client/impl/ConsumerDispatcher$6 #1122
Comments
Did you overwrite the jar file while the app was running? |
No. I just left it idle for few hours then we got this error. This actually puzzles me because I also get same error by just starting the app and let it be idle for few hours. |
Please see more logs below.
|
I can see the application context closing (and some exceptions that might be related but not necessarily harmful). Who closed the context (or killed the process)? Maybe your OS killed it? |
Hi, We tried to kill the process after seeing the previous exception thrown be ZipInflaterInputStream. So the exception during the closing of the context is the product of the previous NoClassDefFoundError. However, this NoClassDefFoundError does not happen when we are not using the SpringBoot launcher, which means we just jar our files and declare our custom class that contains the main method in the manifest. Also we have included all the third parties in the classpath. |
Hi, I tried running the app with -verbose:class option, there are a lot of class from my jars in the lib folder are not being loaded. one of them is ConsumerDispatcher$6 class from rabbbit client. Do you think this has something to do with the spring boot launcher? |
When you say "not being loaded" what do you mean? I think maybe you need to distil this down to a project that has the same problem but you can share. |
Works for me. But it's hard to reproduce when you don't share the code (or steps to reproduce). Maybe someone shutdown the broker in a nasty way? |
I can reproduce the class not found error if I
At this point the client needs to close its connection and tries to call the shutdown handler which requires it to load the class that has moved. Bang. I suggest that maybe you have (inadvertently?) done the same thing. Do you have a CI build that overwrites the JAR file for instance? See also #1106 (it's the same problem but he knows for sure how he caused it). |
Hi, You are perfectly right. I was able to duplicate it. Since the classes are lazy loaded by the class loader and the explanation in the issue #1119 where the libraries are indexed, this is the reason why when the single jar is updated, the classes that are to be loaded are nowhere to find. So basically, the problem was caused by the jar launcher. Thank you for the help. Now we can proceed to production running with Spring boot 1.1.1. Cheers to Spring boot. It is super lightweight and fast. |
Duplicates #1106 |
that's the exact behaviour I'm experiencing, can please elaborate on why and how can I fix it? |
I actually stumbled on similar problem independently of Spring Boot and I think it is a minor bug with RabbitMQ. The fundamental problem as @dsyer pointed out is some of Rabbits classes are not full loaded till shutdown. Netty had a similar issue IIRC but I believe they figured out a solution. Consequently the easy fix is to create a connection and possibly a queue (ie consumer dispatcher) immediately on bootup and then close immediately before extended rabbit usage such that all the classes used to shutdown a connection and channel are in memory. This is particularly useful if you have an uber flattened shaded jar that is built frequently (boot does something differently but still has the same problem)). |
In order to overcome this issue. spring-projects/spring-boot#1122
Hi,
We are 2 weeks before production and we are encountering the error below after sometime that the application is idle. We get no error if application is active processing messages from the Qpid broker. org.springframework.boot.loader.jar.ZipInflaterInputStream which is exploded in the classes jar create by the spring boot maven plugin does not seem to see the classes in the lib folder inside the jar.
The text was updated successfully, but these errors were encountered: