用的是spring+webwork开发框架
在tomcat发布的时候就报这个异常
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 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
我把那些jar包都放进去了 现在成了这个异常了,这是怎么回事了 有点郁闷啊
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
Caused by: java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration[org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
Caused by: java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
web.xml中配置如下:
<resource-ref>
<res-ref-name>数据库名</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
在tomcat中配置如下:
<Context path="/web的根目录名">
<Resource name="数据库名"
type="javax.sql.DataSource"
username="root" //用户名
password="root" //密码
driverClassName="com.mysql.jdbc.Driver"//数据库类型
maxIdle="10"
url="jdbc:mysql://localhost:3306/tarena" //数据库实例
maxActive="10"/>
</Context>
备注:以上配置是固定用法,可根据实际情况修改相应的参数值,但是参数类型请不要乱配。