java.lang.ClassNotFoundException: com.demo.search.extractAbstract.service.ExtractAbstractServiceHandler

时间:2024-03-24 11:07:15

在利用 Spring 对 thrift 进行集成时,出现错误:

avax.servlet.ServletException: Servlet.init() for servlet search-nlp-service threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:)
java.lang.Thread.run(Thread.java:)
root cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extractAbstractThriftServer' defined in class path resource [application-thrift-context.xml]: Cannot resolve reference to bean 'ExtractAbstractServiceHandler' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.demo.search.extractAbstract.service.ExtractAbstractServiceHandler] for bean with name 'ExtractAbstractServiceHandler' defined in class path resource [application-thrift-context.xml]; nested exception is java.lang.ClassNotFoundException: com.demo.search.extractAbstract.service.ExtractAbstractServiceHandler
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory$.getObject(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:)
javax.servlet.GenericServlet.init(GenericServlet.java:)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:)
java.lang.Thread.run(Thread.java:)
root cause org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.demo.search.extractAbstract.service.ExtractAbstractServiceHandler] for bean with name 'ExtractAbstractServiceHandler' defined in class path resource [application-thrift-context.xml]; nested exception is java.lang.ClassNotFoundException: com.demo.search.extractAbstract.service.ExtractAbstractServiceHandler
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory$.getObject(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory$.getObject(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:)
javax.servlet.GenericServlet.init(GenericServlet.java:)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:)
java.lang.Thread.run(Thread.java:)
root cause java.lang.ClassNotFoundException: com.demo.search.extractAbstract.service.ExtractAbstractServiceHandler
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:)
org.springframework.util.ClassUtils.forName(ClassUtils.java:)
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory$.getObject(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:)
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory$.getObject(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:)
javax.servlet.GenericServlet.init(GenericServlet.java:)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:)
java.lang.Thread.run(Thread.java:)

解决办法:

把 eclipse 中其它工程关闭掉(或删除掉),重新运行程序,结果成功了。