XML:The processing instruction must begin with the name of the target

在刚刚学习Hibernate时运行出现了下边的错误:

Exception in thread "main" org.hibernate.MappingException: Could not read mappings from resource: com/j2ee/hibernate/User.hbm.xml
    at org.hibernate.cfg.Configuration.addClass(Configuration.java:506)
    at com.j2ee.hibernate.UserClient.<init>(UserClient.java:10)
    at com.j2ee.hibernate.UserClient.main(UserClient.java:55)
Caused by: org.hibernate.MappingException: Could not parse mapping document in input stream
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:431)
    at org.hibernate.cfg.Configuration.addClass(Configuration.java:503)
    ... 2 more
Caused by: org.dom4j.DocumentException: Error on line 1 of document  : The processing instruction must begin with the name of the target. Nested exception: The processing instruction must begin with the name of the target.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
    ... 3 more

发现是**.hbm.xml文件的错误如图:

**.hbm.xml错误

点击错误提醒,错误提示为:

The processing instruction must begin with the name of the target

解决方法:将?与xml之间的空格消除,就能顺利运行了。

希望能帮到各位小伙伴......

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值