隨筆 - 6  文章 - 129  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827240
          • 排名 - 49

          最新評論

          閱讀排行榜

          評論排行榜

          異常信息:
          08:02:56,329  WARN SessionFactoryObjectFactory:123 - Could not unbind factory from JNDI
          javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
              at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
              at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
              at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
              at javax.naming.InitialContext.unbind(InitialContext.java:416)
              at org.hibernate.impl.SessionFactoryObjectFactory.removeInstance(SessionFactoryObjectFactory.java:116)
              at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:806)
              at org.hibernate.test.junit.UserTest.tearDown(UserTest.java:43)
              at junit.framework.TestCase.runBare(TestCase.java:130)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:118)
              at junit.framework.TestSuite.runTest(TestSuite.java:208)
              at junit.framework.TestSuite.run(TestSuite.java:203)
              at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
              at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
          很奇怪我的項(xiàng)目并沒有使用到JNDI,但是卻拋出JNDI相關(guān)的異常信息。
          原來是Hibernate的配置文件hibernate.cfg.xml有問題
          <hibernate-configuration>
              <session-factory name="foo">
                  <property name="hibernate.connection.url">jdbc:oracle:thin:@10.240.144.25:1521:MES</property>
                  <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
                  <property name="hibernate.connection.username">*****</property>
                  <property name="hibernate.connection.password">*****</property>
                  <property name="dialect">org.hibernate.dialect.OracleDialect</property>
                  <property name="show_sql">true</property>
                  
                  <mapping resource="org/hibernate/test/User.hbm.xml"/>
                  
              </session-factory>
          </hibernate-configuration>

          原因:<seesion-factory>元素多了屬性 name.
          這樣,hibernate會試圖把這個(gè)sessionfacotry注冊到JNDI中去


          posted on 2011-07-05 08:12 Ke 閱讀(1551) 評論(0)  編輯  收藏 所屬分類: hibernate
          主站蜘蛛池模板: 乐至县| 治多县| 静海县| 巴彦淖尔市| 徐闻县| 乐清市| 清镇市| 隆回县| 石城县| 红安县| 镶黄旗| 天峨县| 白河县| 阿克苏市| 博罗县| 独山县| 名山县| 罗定市| 桓台县| 宁海县| 柯坪县| 荥经县| 安泽县| 丁青县| 闸北区| 牟定县| 郑州市| 拉孜县| 彭泽县| 息烽县| 高唐县| 黔西县| 伊金霍洛旗| 武鸣县| 威宁| 长葛市| 梁山县| 周至县| 南溪县| 曲周县| 胶南市|