[color=red]警告: Could not bind factory to 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[/color]
hibernate.cfg.xml文件中session-factory的name属性问题:
因为在Netbeans里自动生成的hibernate.cfg.xml配置文件里,<session-factory></session-factory>里定义了name属性,并为其赋值,由此产生[color=red]javax.naming.NoInitialContextException[/color]
解决方法:
去掉<session-factory></session-factory>里的name属性,OK!