工厂模式出现异常(ClassNotFoundException)
发布时间
阅读量:
阅读量
今天在学习工厂模式相关内容时,当讲解到解耦这一概念时,自己按照教程编写代码却始终遇到ClassNotFoundException的异常提示,对此感到困惑不已。经过多次反复的调试与验证,最终发现自身存在一个极为基础性的错误。
java.lang.ClassNotFoundException: swu/twj/dao/impl/UserDaoImpl;
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at swu.twj.factory.BeanFactory.getBean(BeanFactory.java:24)
at swu.twj.service.impl.UserServiceImpl.<init>(UserServiceImpl.java:12)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62
全部评论 (0)
还没有任何评论哟~
