zoukankan      html  css  js  c++  java
  • org.hibernate.service.jndi.JndiException: Error parsing JNDI name []

    我的hibernate.cfg.xml文件如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                             "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
     <session-factory name="">
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      <property name="connection.autocommit">true</property>
      <property name="connection.useUnicode">true</property>
      <property name="connection.characterEncoding">UTF-8</property>
      <property name="hibernate.current_session_context_class">thread</property>
      <property name="show_sql">true</property>
      <property name="format_sql">true</property>
      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&amp;amp;characterEncoding=utf8</property>
      <property name="hibernate.connection.username">root</property>
      <property name="hibernate.connection.password">123456</property>
      <property name="hibernate.hbm2ddl.auto">update</property>
      <mapping resource="com/main/News.hbm.xml"/>
     </session-factory>
    </hibernate-configuration>

    其中红色字体的部分导致的异常。

    若<session-factory>配置了name属性,却没有配置JNDI,则会报错。

    解决方案:删除name属性 或者 配置JNDI

  • 相关阅读:
    centos7修改网卡名称
    xtrabackup备份恢复过程
    centos 设置删除提示
    cetos6 安装samba共享文件夹
    centos 安装cacti监控
    centos6 搭建hdwiki
    centos6.8安装superctl 后台管理工具
    centos6.5 安装ansible,管理多台服务器
    CreateParams作用及重写
    c# 获取当前应用程序的路径
  • 原文地址:https://www.cnblogs.com/agindage/p/4680712.html
Copyright © 2011-2022 走看看