1. java.lang.Exception: Socket bind failed: [730048] ?????????×???(Э?é/???????/???)????í??
原因:tomcat端口被占用。
解决方法:通过命令行找到是哪个程序占用了该端口,并关闭相应的程序。
开始–运行–cmd 进入命令提示符 输入netstat –ano|findstr “端口号”
果然8080端口被一个PID为4128的进程占用了,我们去任务管理器下看看到底是什么程序
我们将它结束掉,重新启动Tomcat,OK了
或Catalina里面其它的文件夹中也可能存在host-manager.xml,manager.xml这样的文件, 把它们都删除了就可以了。
4. org.hibernate.HibernateException: No CurrentSessionContext configured!
原因:hibernate.cfg.xml配置文件中current_session_context_class属性配置不正确
解决方法:在集成Hibernate的环境下(例如Jboss),要在hibernate.cfg.xml中session-factory段加入:
- <property name="current_session_context_class">jta</property>
- <span style="font-size:14px;"><property name="current_session_context_class">jta</property></span>
在不集成Hibernate的环境下(例如使用JDBC的独立应用程序),在hibernate.cfg.xml中session-factory段加入:
- <property name="current_session_context_class">thread</property>
- <span style="font-size:14px;"><property name="current_session_context_class">thread</property></span>
5. resource: org.hibernate.tutorial.domain.Event.hbm.xml not found
原因:hibernate.cfg.xml配置文件中的mapping标签中的resource属性的值填写错误
解决方法:hibernate.cfg.xml配置文件中的mapping标签中的resource属性的值一般对应的是domain对象的映射文件*.hbm.xml,注意前面的包名之间用‘/’分隔开