参考:http://www.blogjava.net/keweibo/articles/353676.html
错误: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
原因:hibernate.cfg.xml中的session-factory标签多了name属性,hibernate会试图把这个sessionfacotry注册到JNDI中去,而却找不大JNDI的配置
解决方法一:添加配置
在hibernate.cfg.xml添加如下配置
<property name="hibernate.jndi.class">org.jnp.interfaces.NamingContextFactory</property>
<property name="hibernate.jndi.url">localhost:1099</property>
解决方法二:去session-factory标签的name属性