应该是初始化数据源出错了.严重: Initializing application data source Sql,
严重: Initializing application data source Sql
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:589)
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:807)
------解决方案--------------------应该是你说的那样。
ActionServlet.initModuleDataSources
------解决方案-------------------- <set-property property= "url " value= "jdbc:mysql://localhost/test " />
在这里要加上mysql数据库的端口,默认的是3306
<set-property property= "url " value= "jdbc:mysql://localhost:3306/test " />
------解决方案--------------------同意搂上
------解决方案--------------------Cannot load JDBC driver class 'com.mysql.jdbc.Driver
=============================
问题在这边,你看看你把JAR包加进去了没,要是加进去了话,再看看里面有没有这个类
com.mysql.jdbc.Driver
另:
我在google里找的资料,你可以参考一下:
====================================
1 我用的是eclipse-tomcat-mysql,故在我的struts-config.xml中准备连接 sql数据库,如下
<data-sources >
<data-source id= "DS " key= "myPool " type= "org.apache.commons.dbcp.BasicDataSource " >
<set-property property= "driverClassName " value= "com.mysql.jdbc.Driver " />
<set-property property= "url " value= "jdbc:mysql://localhost:3306/xy " />
<set-property property= "username " value= "root " />
<set-property property= "password " value= "690414 " />
<set-property property= "autoCommit " value= "true "/>
</data-source>
</data-sources>
出现错误提示,
Cannot load JDBC driver class 'com.mysql.jdbc.Driver '.
解决方法,网上大部分人要求将mysql-connector-java-5.0.4-bin.jar复制%tomcat%\common\lib下,事实上我也这样做了,最后还是不行,最终解决是将它复制到%jre%\lib下面去,问题解决.