鱼C论坛

 找回密码
 立即注册
查看: 3938|回复: 5

ssh整合,测试时一切正常,启动tomcat就显示找不到类

[复制链接]
发表于 2017-9-4 16:22:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
错误信息:java.lang.ClassNotFoundException: com.jdbc.mysql.Driver
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. 测试时可以操作数据库,但启动tomcat就是一堆错

  3. applicationContext.xml的配置

  4. <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd ">
  5.        
  6.        
  7.         <!-- 将sessionfactory配置到spring中 -->
  8.         <!-- 加载配置方案一:使用外部的hibernate.cfg.xml配置 -->
  9.         <!-- <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  10.                 <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
  11.         </bean> -->
  12.        
  13.         <!-- 读取配置文件 -->
  14.         <context:property-placeholder location="classpath:db.properties"/>
  15.         <!-- 配置c3p0连接池 -->
  16.         <bean name="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
  17.                 <property name="driverClass" value="${jdbc.driverClass}"></property>
  18.                 <property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
  19.                 <property name="user" value="${jdbc.user}"></property>
  20.                 <property name="password" value="${jdbc.password}"></property>
  21.         </bean>
  22.         <!-- 配置核心事物管理器 -->
  23.         <bean name="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
  24.                 <property name="sessionFactory" ref="sessionFactory"></property>
  25.         </bean>
  26.         <bean name="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  27.                 <!-- 将连接池注入到sessionfactory,hibernate会自动从连接池获取连接 -->
  28.                 <property name="dataSource" ref="dataSource"></property>
  29.                 <!-- 配置hibernate基本信息 -->
  30.                 <property name="hibernateProperties">
  31.                         <props>
  32.                                 <!--  必选配置
  33.                                 <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
  34.                                 <prop key="hibernate.connection.url">jdbc:mysql:///crm</prop>
  35.                                 <prop key="hibernate.connection.username">root</prop>
  36.                                 <prop key="hibernate.connection.password">123</prop> -->
  37.                                 <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
  38.                                  <!--可选配置-->
  39.                                 <prop key="hibernate.show_sql">true</prop>
  40.                                 <prop key="hibernate.format_sql">true</prop>
  41.                                 <prop key="hibernate.hbm2ddl.auto">update</prop>
  42.                         </props>
  43.                 </property>
  44.                 <!-- 引入orm元数据,指定orm元数据所在的包的路径,spring会自动读取包下的所有配置 -->
  45.                 <property name="mappingLocations">
  46.                                 <value>classpath:/com/tedu/domain/*.hbm.xml</value>
  47.                 </property>
  48.         </bean>
  49.        
  50.         <!-- 配置事务通知 -->
  51.         <!-- <tx:advice id="txAdvice" transaction-manager="transactionManager">
  52.                 <tx:attributes>
  53.                         以方法为单位,指定方法应用什么事务属性
  54.                                         isolation:隔离级别
  55.                                         propagation:传播行为
  56.                                         read-only:是否只读
  57.                        
  58.                         <tx:method name="save*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
  59.                         <tx:method name="persist*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
  60.                         <tx:method name="update*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
  61.                         <tx:method name="modify*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
  62.                         <tx:method name="delete*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
  63.                         <tx:method name="remove*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
  64.                         <tx:method name="get*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true"/>
  65.                         <tx:method name="find*" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="true"/>
  66.                 </tx:attributes>
  67.         </tx:advice> -->
  68.         <!-- 配置织入 -->
  69.         <!-- <aop:config>
  70.                 配置切入点表达式
  71.                 <aop:pointcut expression="execution(* com.tedu.service.impl.*ServiceImpl.*(..))" id="txPc"></aop:pointcut>
  72.                 配置切面:通知+切点
  73.                                 advice-ref:通知的名称
  74.                                 pointcut-ref:切点的名称
  75.                
  76.                 <aop:advisor advice-ref="txAdvice" pointcut-ref="txPc"/>
  77.         </aop:config> -->
  78.         <!-- 开启注解事物 -->
  79.         <tx:annotation-driven transaction-manager="transactionManager"/>
  80.         <!-- action
  81.                         Action的作用范围一定是多例的,这样才符合Struts2架构
  82.         -->
  83.         <bean name="userAction" class="com.tedu.web.action.UserAction" scope="prototype">
  84.                 <property name="userService" ref="userService"></property>
  85.         </bean>
  86.         <!-- service -->
  87.         <bean name="userService" class="com.tedu.service.impl.UserServiceImpl" >
  88.                 <property name="userDao" ref="userDao"></property>
  89.         </bean>
  90.         <!-- dao -->
  91.         <bean name="userDao" class="com.tedu.dao.impl.UserDaoImpl">
  92.                 <property name="sessionFactory" ref="sessionFactory"></property>
  93.         </bean>
  94. </beans>
复制代码



想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2017-9-4 16:22:37 | 显示全部楼层
哪位大神帮忙解决一下
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-9-4 23:52:59 | 显示全部楼层
可能是c3p0的版本原因
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-12-29 14:13:26 | 显示全部楼层
mysql  连接数据库的jar包是不是没有,要不就是数据库的链接没有写对
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-10-8 23:23:27 | 显示全部楼层
com.jdbc.mysql.Driver

这不很明显你没有导入mysql的驱动jar包吗???
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-10-16 10:38:51 | 显示全部楼层
你的驱动包
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-29 02:01

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表