java的javassm框架登录注册搭建问题

查看:1459|回复:3
Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
缺少aopalliance-1.0.jar
Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
缺少aspectjweaver-1.7.1.jar
Caused by: java.io.FileNotFoundException: class path resource [jdbc.properties] cannot be opened because it does not exist
src下缺少jdbc.properties
Caused by: java.lang.ClassNotFoundException: mons.dbcp.BasicDataSource
缺少以下jar
commons-dbcp.jar
commons-pool.jar
commons-collections.jar
Caused by: java.lang.ClassNotFoundException: org.mybatis.spring.SqlSessionFactoryBean
缺少以下jar
mybatis-spring-1.0.1.jar
Caused by: mons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.jdbc.sqlserver.SQLServerDriver'
jdbc.driverClassName的写的有问题,应该是“com.microsoft.sqlserver.jdbc.SQLServerDriver”,而且只保留sqljdbc4.jar,删除sqljdbc.jar
Eclipse版本与jdk版本不匹配时,报如下错误信息
[url=eclipse_error01.png]eclipse_error01.png[/url]
你说的是应该有这些jar但是还报没有jar的错误是吗?
你可以清理一下项目、
这个项目是不是你导入的、你可以在重新导入及jar、
搭建这个我还是建议你用STS
太阳光芒万丈却不及蜡烛只为一人照亮、、、
引用:原帖由 IT妖姬 于
16:42 发表
你说的是应该有这些jar但是还报没有jar的错误是吗?
你可以清理一下项目、
这个项目是不是你导入的、你可以在重新导入及jar、
搭建这个我还是建议你用STS ... 额,他这应该是分享吧~
感谢分享,另外最后的图片不对,你重新编辑下战斗伊始——Spring
Spring是为解决企业应用程序开发复杂性而创建的一个Java开源框架。本步骤将介绍Spring的特点、IoC和AOP的概念及应用,以及Spring事务管理的内容。
转战阵地——SpringMVC
SpringMVC为我们提供了一个基于组件和松耦合的MVC实现框架。在本步骤中,我们将学习SpringMVC的基本使用,以及如何在项目中应用SpringMVC拦截器。
再下一城——MyBatis
MyBatis 是支持普通SQL查询、存储过程和高级映射的优秀持久层框架。本步骤将通过案例介绍MyBatis的常见应用。
终极目标——整合案例
本步骤介绍如何使用SpringMVC+Spring+MyBatis实现秒杀系统案例。
Copyright (C)
All Rights Reserved | 京ICP备 号-2SSM框架搭建+实际java小例子+最主要的配置文件_ASP.NET技巧_动态网站制作指南
SSM框架搭建+实际java小例子+最主要的配置文件
来源:人气:393
&?xml version=&1.0& encoding=&UTF-8&?&
&web-app xmlns:xsi=&http://www.w3.org/2001/XMLSchema-instance&
&& &xmlns=&http://xmlns.jcp.org/xml/ns/ee&
&& &xsi:schemaLocation=&http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd&
&& &id=&WebApp_ID& version=&3.1&&
&& &&display-name&travel&/display-name&
&& &&welcome-file-list&
&& &&& &&welcome-file&index.&/welcome-file&
&& &&/welcome-file-list&
&& &&filter&
&& &&& &&filter-name&struts&/filter-name&
&& &&& &&filter-class&org.apache.struts2.dispatcher.ng.filter.StrutsepareAndExecuteFilter&/filter-class&
&& &&/filter&
&& &&filter-mapping&
&& &&& &&filter-name&struts&/filter-name&
&& &&& &&url-pattern&/*&/url-pattern&
&& &&/filter-mapping&
&& &&listener&
&& &&& &&listener-class&org.springframework.web.context.ContextLoaderListener&/listener-class&
&& &&/listener&
&& &&listener&
&& &&& &&listener-class&org.springframework.web.context.request.RequestContextListener&/listener-class&
&& &&/listener&
&/web-app&
Context.xml
&?xml version=&1.0& encoding=&UTF-8&?&
&!-- Spring配置文件的根元素,使用spring-beans-3.0.xsd语义约束 --&
&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:tx=&http://www.springframework.org/schema/tx& xmlns:jdbc=&http://www.springframework.org/schema/jdbc&
&& &xmlns:context=&http://www.springframework.org/schema/context&
&& &xsi:schemaLocation=&
&&&& http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
&&&& http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
&&&& http://www.springframework.org/schema/jdbc
&&&& http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
&&&& http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
&&&& http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&&
&& &&!-- 注解配置 --&
&& &&context:annotation-config /&
&& &&!-- 注解配置 :注解哪些包,一般情况下是所有的包 --&
&& &&context:component-scan base-package=&&&&/context:component-scan&
&& &&!-- 1. 数据源 : DriverManagerDataSource --&
&& &&bean id=&dataSource&
&& &&& &class=&org.springframework.jdbc.datasource.DriverManagerDataSource&&
&& &&& &&property name=&driverClassName& value=&com..jdbc.Driver& /&
&& &&& &&property name=&url& value=&jdbc:mysql://localhost:3306/travel& /&& &!-- 名 --&
&& &&& &&property name=&username& value=&root& /&
&& &&& &&property name=&pass& value=&8023& /&
&& &&/bean&
&& &&!-- 2. mybatis的Sql的工厂: SqlSessionFactoryBean dataSource / typeAliasesPackage --&
&& &&bean id=&sqlSessionFactory& class=&org.mybatis.spring.SqlSessionFactoryBean&&
&& &&& &&property name=&dataSource& ref=&dataSource& /&& &!-- 依靠上面的数据源(第一点) --&
&& &&& &&property name=&typeAliasesPackage& value=&.model& /&& &!-- value值为所有的model里面的实体类 --&
&& &&/bean&
&& &&!-- 3. mybatis自动扫描加载Sql映射文件 : MapperScannerConfigurer sqlSessionFactory
&& &&& &/ basePackage --&
&& &&bean class=&org.mybatis.spring.mapper.MapperScannerConfigurer&&
&& &&& &&property name=&basePackage& value=&.dao& /&& &!-- value值为所有的dao里面的类 --&
&& &&& &&property name=&sqlSessionFactory& ref=&sqlSessionFactory& /&& &!-- 依靠第二点 --&
&& &&/bean&
&& &&!-- 4. 事务管理 : DataSourceTransactionManager --&
&& &&bean id=&txManager&
&& &&& &class=&org.springframework.jdbc.datasource.DataSourceTransactionManager&&
&& &&& &&property name=&dataSource& ref=&dataSource& /&
&& &&/bean&
&& &&!-- 5. 使用声明式事务 --&
&& &&tx:annotation-driven transaction-manager=&txManager& /&
struts.xml
&?xml version=&1.0& encoding=&UTF-8& ?&
&!DOCTYPE struts PUBLIC
&& &&-//Apache Software Foundation//DTD Struts Configuration 2.3//EN&
&& &&http://struts.apache.org/dtds/struts-2.3.dtd&&
&& &&!-- 用户 --&
&& &&package name=&user_manage& extends=&struts-default&&
&& &&& &&action name=&user-*& class=&userAction& method=&{1}&&
&& &&& &&& &&result name=&loginSuccess&&/index.jsp&/result&
&& &&& &&& &&result name=&loginError&&/login.jsp&/result&
&& &&& &&& &&result name=&registerSuccess&&/login.jsp&/result&
&& &&& &&& &&result name=&getUseuccess&&/userList.jsp&/result&
&& &&& &&& &&result name=&editUserSuccess&&/index.jsp&/result&
&& &&& &&& &&result name=&editUserFail&&/editUser.jsp&/result&
&& &&& &&& &&result name=&logoutSuccess&&/login.jsp&/result&
&& &&& &&/action&
&& &&/package&
&& &&!-- 旅游产品 --&
&& &&package name=&product_manage& extends=&struts-default&&
&& &&& &&action name=&product-*& class=&productAction& method=&{1}&&
&& &&& &&& &&result name=&getProductsSuccess&&/onsale_0.jsp&/result&
&& &&& &&& &&result name=&searchProductsSuccess&&/onsale_0.jsp&/result&
&& &&& &&& &&result name=&getHistoryScanSuccess&&/onsale_0.jsp&/result&
&& &&& &&& &&result name=&loginError&&/login.jsp&/result&
&& &&& &&& &&result name=&input&&/index.jsp&/result&
&& &&& &&/action&
&& &&/package&
log4j.properties\uFF0C
log4j.rootLogger=DEBUG, Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.logger.java.sql.ResultSet=INFO
log4j.logger.org.apache=INFO
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
Action.java
@Scope(&request&)
@Controller(&userAction&)
public class UserAction extends ActionSupport implements ServletRequestAware {
&& &private static final long serialVersionUID = 1L;
......@Autowired
&& &@Qualifier(&userService&)
&& &private UserService userS
&& &public HttpServletR
&& &@Override
&& &public void setServletRequest(HttpServletRequest request) {
&& &&& &this.request =
......HttpSession session = request.getSession();
&?xml version=&1.0& encoding=&UTF-8&?&
&!DOCTYPE mapper PUBLIC &-//mybatis.org//DTD Mapper 3.0//EN& &http://mybatis.org/dtd/mybatis-3-mapper.dtd&&
&mapper namespace=&.dao.EstimateDao&&
&& &&resultMap type=&Estimate& id=&estimateMap&&
&& &&& &&id column=&estimate_id& property=&estimateId& /&
&& &&& &&result column=&estimate_content& property=&estimateContent& /&
&& &&& &&result column=&estimate_state& property=&estimateState&/&
&& &&& &&association property=&user& column=&user_id& select=&.dao.UserDao.getUserByUserId&/&
&& &&/resultMap&
&&& &!-- 根据帖子Id获取该帖子的获赞数 --&
&& &&select id=&getGoodNumByTopicId& parameterType=&int& resultType=&int&&
&& &&& &select count(*)
&& &&& &from
&& &&& &travel_estimate
&& &&& &where
&& &&& &&& &topic_id = #{id}
&& &&& &and estimate_content = 'good'
&& &&/select&
优质网站模板&& 您当前的位置:
【Java技术】SSM框架配置步骤
更新时间: 10:01 &来源:源码时代
现在是比较常用的框架有ssm,既是SpringMVC、Spring及MyBatis
确定需要集成版本
mybatis-3.2.1
spring-framework-3.2.0.RELEASE
Spring3.2先和MyBatis3.2集成
创建web动态工程:注意classpath路径
添加Spring3.2+MyBatis3.2 mysql驱动共计30个jar文件
18个spring相关的jar文件
MyBatis3.2 版本共9个jar文件
包含mysql驱动共28个jar文件
jstl 2个jar 文件共计30个jar文件
jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql:///ssm
jdbc.username=root
jdbc.password=admin
log4j.properties
写配置文件的流程:
数据库连接配置文件-&DataSource-&SqlSessionFactory-&Mapper-&Service-&Controller
spring配置文件
UserMapper
也可以在接口里面定义主键的MyBatis映射
UserMapper.xml
UserServiceImpl
Spring3.2+SpringMVC3.2
spring配置文件
UserController
webapp/WEB-INF/views/user.jsp
至此,集成完成,在此基础上可再添加其他功能。
成都源代码教育咨询有限公司&&&您需要以后才能回答,未注册用户请先。

我要回帖

更多关于 java ssm框架搭建 的文章

 

随机推荐