Tag Archives: the bean cannot be found error

The spring project is normal locally, and the bean cannot be found error is thrown when entering the docker container

The error message is as follows:

1
Error creating bean with name 'messageServiceImpl': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.qianxiao.blogwebscoket.service.impl.MessageServiceImpl] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@41cf53f9]

The two environments are not local development

1
2
3
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) Client VM (build 25.281-b09, mixed mode, sharing)

docker container environment

1
2
3
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

Looks like there is nothing wrong with this version

But when I add @Service annotation to the MessageServiceImpl class, I get an error at runtime.

Remove the @Service annotation and start normally

I have been looking for a problem for a long time; in the end, the problem lies in the use of the CallBack callback parameter in this implementation class. It is normal to remove this parameter and compile and restart! ! !