MyEclipse10+Struts2.1+Spring3.0+Hibernate3.3全注解框架问题

J2EE 码拜 10年前 (2015-04-04) 900次浏览 0个评论

     首先,我技术不是很好,一直在研究Liferay,突然间搭建SSH2遇见问题,发现自己无法下手,找不到解决方法,特来求助!勿怪!
    按照这个地址给的方案,搭建的环境:http://wenku.baidu.com/link?url=ScCzMjkXEna8Wv0ZfX4EjrBBvU2T81wvKXqnz101eUcWmleFbAKUOL12yd95tM1ws-gd1kbV2cFDkrzIM-bcbgYHvPNFvSayUiXLc1TOhui
    在进行action调用applicationContext.xml时,出现错误,但是在main中测试的时候正常:
    Cannot create JDBC driver of class “””” for connect URL “”jdbc:mysql://127.0.0.1:3306/sinosso””
        java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:278)
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2277)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2273)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1742)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782)

       我的代码是:
       public String execute() {
getData();
if (UserName.equals(“TF”) && PassWord.equals(“123”)){
System.out.println(“成功”);
return “SUCCESS”;

}else{
return “INPUT”;
}
}

private void getData() {
ApplicationContext context = new ClassPathXmlApplicationContext(
“applicationContext.xml”);
UserDAO dao = (UserDAO) context.getBean(“UserDAO”);
List<User> list = dao.findAll();
int n = list.size();
for (int i = 0; i < n; i++) {
User c = list.get(i);
String name = c.getUserName();
System.out.println(name);
}
}
     恳求帮助!

MyEclipse10+Struts2.1+Spring3.0+Hibernate3.3全注解框架问题
40分
估计 你的jdbc驱动类有问题
MyEclipse10+Struts2.1+Spring3.0+Hibernate3.3全注解框架问题
引用 1 楼 u011259029 的回复:

估计 你的jdbc驱动类有问题

好,我找个新的驱动试试吧,这个驱动在测试中是正常的。换个试试。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明MyEclipse10+Struts2.1+Spring3.0+Hibernate3.3全注解框架问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!