黑马程序员技术交流社区

标题: javaweb开发的黑马旅游网第一部分 注册用户 报错 [打印本页]

作者: huayixi    时间: 2019-7-12 20:01
标题: javaweb开发的黑马旅游网第一部分 注册用户 报错
按照老师的做完注册用户之后,一注册用户就报错。。。但是老师的没有报错,而且maven导入这个阶段做好之后的文件,也是报这个错误。。。
java.lang.NullPointerException
        at java.util.Properties$LineReader.readLine(Properties.java:434)
        at java.util.Properties.load0(Properties.java:353)
        at java.util.Properties.load(Properties.java:341)
        at cn.itcast.travel.util.JDBCUtils.<clinit>(JDBCUtils.java:31)
        at cn.itcast.travel.dao.impl.UserDaoImpl.<init>(UserDaoImpl.java:13)
        at cn.itcast.travel.service.impl.UserServiceImpl.<init>(UserServiceImpl.java:10)
        at cn.itcast.travel.web.servlet.RegistUserServlet.doPost(RegistUserServlet.java:34)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
七月 12, 2019 7:49:48 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [cn.itcast.travel.web.servlet.RegistUserServlet] in context with path [/travel] threw exception
java.lang.IllegalArgumentException: Property 'dataSource' is required
        at org.springframework.jdbc.support.JdbcAccessor.afterPropertiesSet(JdbcAccessor.java:135)
        at org.springframework.jdbc.core.JdbcTemplate.<init>(JdbcTemplate.java:169)
        at cn.itcast.travel.dao.impl.UserDaoImpl.<init>(UserDaoImpl.java:13)
        at cn.itcast.travel.service.impl.UserServiceImpl.<init>(UserServiceImpl.java:10)
        at cn.itcast.travel.web.servlet.RegistUserServlet.doPost(RegistUserServlet.java:34)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
作者: o.玲.o    时间: 2019-7-13 14:20
空指针异常,可能是数据库连接异常,没有数据过去,建议测试下,或者看下配置文件有没有错
作者: jojob    时间: 2019-11-11 01:19
兄弟,你这个应该是jdbcUtils工具类的路径出了问题,多了一个/,所造成的,下次遇到这样的问题,可以多测试,比如建议可以先测试工具类,测通了,再写其他的看看。




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2