与类型转换没有关系,读出来的数据是null 所以显示为格式化异常,我将产生上面异常的那段语句去掉 还是会出现下面的异常 java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at cn.toget.hy2004.datamodule.DatabaseConnectFactory.loadDriverClass(DatabaseConnectFactory.java:43) at cn.toget.hy2004.datamodule.DatabaseConnectFactory.getConnSvg(DatabaseConnectFactory.java:78) at cn.toget.hy2004.datamodule.SvgDatabaseModel.<init>(SvgDatabaseModel.java:41) at cn.toget.hy2004.svg.SVGSupervisory.<init>(SVGSupervisory.java:49) at cn.toget.hy2004.view.MainFrame.<init>(MainFrame.java:391) at cn.toget.hy2004.main.HY2004App.main(HY2004App.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.continueLaunch(Unknown Source) at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source) at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
本机运行正常
java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at cn.toget.hy2004.datamodule.DatabaseConnectFactory.loadDriverClass(DatabaseConnectFactory.java:43)
at cn.toget.hy2004.datamodule.DatabaseConnectFactory.getConnSvg(DatabaseConnectFactory.java:78)
at cn.toget.hy2004.datamodule.SvgDatabaseModel.<init>(SvgDatabaseModel.java:41)
at cn.toget.hy2004.svg.SVGSupervisory.<init>(SVGSupervisory.java:49)
at cn.toget.hy2004.view.MainFrame.<init>(MainFrame.java:391)
at cn.toget.hy2004.main.HY2004App.main(HY2004App.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)