1、HHH90000012: Recognized obsolete hibernate namespace
日志:2017-10-19 11:23:55 104 WARN org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver.resolveEntity(LocalXmlResourceResolver.java:75) - HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead. Support for obsolete DTD/XSD namespaces may be removed at any time.
解决办法:把所有.hbm.xml文件头中的.dtd文件链接修改
http://hibernate.sourceforge.net 修改为 http://www.hibernate.org
修改前 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 修改后 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/hibernate-mapping-3.0.dtd">
2、No qualifying bean of type 'org.springframework.scheduling.TaskScheduler' available
把日志配置修改成INFO
log4j.logger.org.springframework.scheduling = INFO
不改日志配置修改定时配置如下
<!-- 定时任务 --> <task:scheduler id="scheduler" pool-size="10"/> <task:annotation-driven scheduler="scheduler"/>
3、java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config
org.apache.jasper.JasperException: The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application
Java Jsp开发使用jstl标签
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
缺少jstl.jar和standard.jar
4、java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'user' available as request attribute
<sf:form commandName="user"> username:<sf:input path="username"/> password:<sf:input path="password"/> </sf:form>
form标签commandName设置为user,因此模型中必须要有一个key为user的对象,否则页面无法渲染。所以在controller中给模型追加属性为user的对象
@RequestMapping(value="/register", method=RequestMethod.GET) public String register(Model model) { User user = new User(); user.setUsername("wohu"); user.setPassword("wohu"); model.addAttribute(user); return "register"; }
5、org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): city.gaoxin.wzgx.dao.UserMapper.selectLoginUser
mapper的namespace写的不对,自己检查,我就只这个问题
mapper接口方法在xml文件中没有
mapper接口方法返回值和xml文件的返回结果不匹配
6、Eclipse JPA Project Change Event Handler
Neon: [Help > Installation Details > Installed Software]
Oxygen: [Preferences > Install/Update > Installed Software]
仅选择插件"Dali Java Persistence Tools -JPA Support" 点击 "uninstall"等到提示重启eclipse
7、Jackson反序列化异常、org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field
解决方式:给bean类追加注解@JsonIgnoreProperties(ignoreUnknown = true)
8、javax.xml.ws.soap.SOAPFaultException: Cannot create a secure XMLInputFactory
使用cxf开发java web service开发是出异常。
缺少jar包。stax2-api-3.1.4.jar 和 woodstox-core-5.0.3.jar
9、Hibernate启动非常慢问题
hibernate版本不同对dtd文件有影响,把*.hbm.xml文件头dtd地址换掉就好了。
原来的写法
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/hibernate-mapping-3.0.dtd">
修改为
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
就是修改为新地址 http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd 速度就快了
10、Maven警告 Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
在project下制定编码
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>