您的位置:首页 > 编程语言 > Java开发

eclipse开发中常见问题

2016-12-31 13:41 253 查看

1、端口被占用

Several ports (8005, 8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process
or change the port number(s).

说明:部署项目到tomcat的时候报端口被占用。

报这个错误的原因是你有另外一个tomcat实例正在运行,可以通过浏览器访问localhost:8080看是否出现tomcat默认猫界面查看;或者报tomcat默认的404not found页面,这两种情况都说明,你有另外一个tomcat正在运行。

解决办法:找到tomcat路径下的bin目录,如果是windows系统则执行shutdown.bat,如果是linux(unix)系统的话,则执行shutdown.sh。

如果以上方法不起作用,则关闭eclipse,杀死所有java或者javax进程。

如果你的确需要运行两个tomcat的话,你需要修改这个tomcat的端口号。

2、Could not get JDBC Connection

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver  '

### The error may exist in file [/Users/zhongshibo/Documents/workspace/storm/target/classes/com/zhongsb/base/mapping/UserMapper.xml]

### The error may involve com.zhongsb.base.IDao.IUserDao.selectByPrimaryKey

### The error occurred while executing a query

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver  '

    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)

    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)

    at com.sun.proxy.$Proxy14.selectOne(Unknown Source)

    at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)

    。。。

说明:Cannot load JDBC driver class 'com.mysql.jdbc.Driver  '

观察到url后面存在空格,删除jdbc.properties文件中的空格。问题解决。

3、retrieving archetypes has encountered a problem

http://blog.csdn.net/zhang5476499/article/details/51009022

下载碰到困难的同志们,可以在csdn寻找这个文件,有提供这个文件的下载。

4、编码指定重复

org.apache.jasper.JasperException: /WEB-INF/jsp/showUser.jsp (line: 2, column: 1) Page directive must not have multiple occurrences of pageencoding

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>


页面制定了两次编码,删除一个。

5、mybatis自动生成代码

Java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite

修改generatorConfig.xml配置文件中的数据库配置为自己的配置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: