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,注意前面的包名之間用‘/’分隔開