maven 整合ssh的时候报错,已经困扰一天。望伸手相助

发布于 2021-12-07 18:20:26 字数 24643 浏览 819 评论 13

用maven整合ssh框架的时候一直报错,搜索过很多答案,对比自己的配置,自己并无错误。

1.错误信息:

03-12 18:05:20[WARN]Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zhihuTopicAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.yll.myCrawler.processor.ZhiHuTopicProcessor cn.yll.myCrawler.action.ZhihuTopicAction.zhiHuProcessor; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
03-12 18:05:20[ERROR]Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zhihuTopicAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.yll.myCrawler.processor.ZhiHuTopicProcessor cn.yll.myCrawler.action.ZhihuTopicAction.zhiHuProcessor; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4739)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.yll.myCrawler.processor.ZhiHuTopicProcessor cn.yll.myCrawler.action.ZhihuTopicAction.zhiHuProcessor; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
	... 28 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:628)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597)
	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1445)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:445)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:423)
	at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:220)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1177)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
	... 30 more
Caused by: java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1397)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1344)
	... 40 more
三月 12, 2018 6:05:20 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zhihuTopicAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.yll.myCrawler.processor.ZhiHuTopicProcessor cn.yll.myCrawler.action.ZhihuTopicAction.zhiHuProcessor; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4739)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.yll.myCrawler.processor.ZhiHuTopicProcessor cn.yll.myCrawler.action.ZhihuTopicAction.zhiHuProcessor; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
	... 28 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.yll.myCrawler.dao.ZhiHuTopicDao] for bean with name 'zhiHuTopicDao' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:628)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597)
	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1445)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:445)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:423)
	at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:220)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1177)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
	... 30 more
Caused by: java.lang.ClassNotFoundException: cn.yll.myCrawler.dao.ZhiHuTopicDao
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1397)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1344)
	... 40 more

 

2.spring 配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
		  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
		  xmlns:context="http://www.springframework.org/schema/context"
		  xsi:schemaLocation="http://www.springframework.org/schema/beans 
		  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		  http://www.springframework.org/schema/aop 
		  http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		  http://www.springframework.org/schema/context
		  http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
    	<!-- 对类包进行扫描 -->
        <context:component-scan base-package="cn.yll.myCrawler.*"/>
    
        <!-- 启用注释驱动自动注入 -->
        <context:annotation-config/>
        
        
        
        
		<!--读取属性配置文件内容-->
		<context:property-placeholder location="classpath:db.properties"/>
		
		<!--配置c3p0数据源-->
		<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		    <property name="driverClass" value="${jdbc.driver}"/>
		    <property name="jdbcUrl" value="${jdbc.url}"/>
		    <property name="user" value="${jdbc.username}"/>
		    <property name="password" value="${jdbc.password}"/>
		</bean>
		
		<!--配置session工厂-->
		<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
		    <property name="dataSource" ref="dataSource"/>
		    <property name="configLocations" value="classpath:hibernate.cfg.xml"/>
		</bean>

	<!-- 配置事务管理器 -->
	<!-- <bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean> -->

	<!-- 配置事务的传播特性 -->
	<!-- <tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="insert*" propagation="REQUIRED" />
			<tx:method name="delete*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
			<tx:method name="*" read-only="true" />
		</tx:attributes>
	</tx:advice> -->

	<!-- 那些类的哪些方法参与事务 -->
	<!-- <aop:config>
		<aop:pointcut id="allManagerMethod" expression="execution(* shop.dao.*.*(..))" />
		<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" />
	</aop:config> -->
	
	<!-- <bean id="login_action" class=" cn.yll.myCrawler.action.LoginAction" ></bean> -->
	
	
	<bean id="zhihuTopicAction" class="cn.yll.myCrawler.action.ZhihuTopicAction"></bean>
	
	<bean id="zhiHuTopicService" class="cn.yll.myCrawler.service.ZhiHuTopicService"></bean>
	
	<bean id="zhiHuTopicDao" class="cn.yll.myCrawler.dao.ZhiHuTopicDao" ></bean>
	<bean id="zhiHuTopicProcessor" class="cn.yll.myCrawler.processor.ZhiHuTopicProcessor" ></bean>
	
</beans>

 

3.在bean中已经添加注解(这是其中一个,其他的配置也和这个一样)

@Component("zhiHuTopicProcessor")
public class ZhiHuTopicProcessor implements PageProcessor {
	
	private Site site=Site.me().setRetryTimes(3).setSleepTime(1000);
	//ZhiHuTopic属性
	private String topicTitle;
	private String topicUrl;
	private String topic_Description;
	private String topic_Questinos_count;
	private String topic_Followers_count;
	
	@Autowired
	private ZhiHuTopic zhiHuTopic;

4.我自己考虑过是否jar包冲突的问题,但是暂时没有解决。,这是pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>cn.yll</groupId>
  <artifactId>myCrawler</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>myCrawler Maven Webapp</name>
  <url>http://maven.apache.org</url>
  
	  <dependencies>
	  
	    <dependency>
	      <groupId>junit</groupId>
	      <artifactId>junit</artifactId>
	      <version>3.8.1</version>
	      <scope>test</scope>
	    </dependency>
	    
	    <!-- webmagic -->
	    <dependency>
			<groupId>us.codecraft</groupId>
			<artifactId>webmagic-core</artifactId>
			<version>0.7.3</version>
		</dependency>
		
		<dependency>
			<groupId>us.codecraft</groupId>
			<artifactId>webmagic-extension</artifactId>
			<version>0.7.3</version>
		</dependency>
		
		<!-- httpClient -->
	    <dependency>
	        <groupId>org.apache.httpcomponents</groupId>
	        <artifactId>httpclient</artifactId>
	        <version>4.5.3</version>
	    </dependency>
		
		<!-- JSON -->
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20150729</version>
		</dependency>
		
		<!-- JSOUP -->
		<dependency>
		    <groupId>org.jsoup</groupId>
		    <artifactId>jsoup</artifactId>
		    <version>1.9.1</version>
		</dependency>
		
		<!-- 添加SSH依赖 -->
		<!-- Struts2 -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-core</artifactId>
			<version>2.3.24</version>
		</dependency>

		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-spring-plugin</artifactId>
			<version>2.3.24.1</version>
			<exclusions>
	          <exclusion>
	            <groupId>org.springframework</groupId>
	            <artifactId>spring-beans</artifactId>
	          </exclusion>
	          <exclusion>
	            <groupId>org.springframework</groupId>
	            <artifactId>spring-core</artifactId>
	          </exclusion>
	          <exclusion>
	            <groupId>org.springframework</groupId>
	            <artifactId>spring-context</artifactId>
	          </exclusion>
	          
        </exclusions>
		</dependency>

		<!-- 添加Hibernate依赖 -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.2.2.Final</version>
		</dependency>

		<!-- spring框架依赖 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.2.4.RELEASE</version>
		</dependency>
		
		<!-- 包含了大量注解@Autowired等。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>4.2.4.RELEASE</version>
		</dependency>

		<!-- 包含SessionFactory org.springframework.orm.hibernate4.LocalSessionFactoryBean -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>4.2.4.RELEASE</version>
		</dependency>

		<!-- 包含ContextLoaderListener 监听器 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.2.4.RELEASE</version>
		</dependency>
		
        <!--  ApplicationContextInitializer -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.2.4.RELEASE</version>
		</dependency>
		
		<!-- mysql驱动 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.26</version>
		</dependency>
		
		<!-- c3p0数据源 -->
		<dependency>
			<groupId>c3p0</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.1.2</version>
		</dependency>
		
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.4</version>
		</dependency>

		<!-- 添加Log4J依赖 -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.6.1</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-nop</artifactId>
			<version>1.6.4</version>
		</dependency>

		<!-- 添加javassist -->
		<dependency>
			<groupId>javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.11.0.GA</version>
		</dependency>
		
		
	  </dependencies>
	  <build>
	    <finalName>myCrawler</finalName>
	  </build>
</project>

 

这个问题已经困扰我一天了,请指教,谢谢!!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

能否归途做我良人 2021-12-08 23:40:14

那应该和什么有关呢?

羁拥 2021-12-08 23:39:58

你项目的classoath下没有报出异常的那个类

筱武穆 2021-12-08 23:39:42

和配置没有关系

柳絮泡泡 2021-12-08 23:39:12

这个很明显,是类找不到,和spring没有关系。简单的说,就是类加载器找不到这个类的.class文件进行加载

飘然心甜 2021-12-08 23:37:56

我是用注解的方式。我在spring的配置文件中已经开启了注解,而且在对应的类上已经添加了注解

剑心龙吟 2021-12-08 23:37:29

你可以用简单的xml试试,即不用服务器加载配置,用ClassPathXmlApplicationContext手动加载,看看是否加载到了ZhiHuTopicDao

天涯离梦残月幽梦 2021-12-08 23:33:08

所以就是真的找不到原因么?

 

各自安好 2021-12-08 23:29:45

估计java文件没有编译过去

路还长,别太狂 2021-12-08 23:00:11

ZhiHuTopicDao ClassNotFound

如日中天 2021-12-08 22:31:03

容器都初始化失败了

少女净妖师 2021-12-08 22:12:12

那真的就是你的maven库有问题��

后知后觉 2021-12-08 17:06:16

引用来自“内存不够了”的评论

这种问题如果对配置不理解的话,直接重新百度配置吧

绝影如岚 2021-12-08 14:31:04

这种问题如果对配置不理解的话,直接重新百度配置吧

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文