SUN的JAVA 程序员认证考试

那些在某位置插入XX语句有几句可以通过编译的题目,有哪些常见的错误原因
比如这句插入会编译失败,因为抽象类不能创建实例

0、 需要标识符
a) 不在函数内
1、 非法表达式开始
b) 可能:丢失括号 .
2. no data found
a) 可能:setInt(1,100)中,没有100这个值
3. 找不到符号
a) 可能:没导入包
4. 指定了无效URL
a) 可能:数据库名或IP错误,即连接出错
5. 类路径没有找到
a) 可能: ClassNotFoundException: oracle.jdbc.driver.OracleDriver
b) 原因: 一般是指包名写错,或者没有import包,或者没有在类路径中找到jar文件
c) 解决: 没有加载Oracle驱动jar,在.bash_profile中把ojdbc14.jar加进来
6. 空指针异常
a) 可能: 数据源错误 比如数据库名或IP错误
7. 不能执行查询
a) 可能: 数据库中表的问题,比如列名不存在
8. invalid identity
a) 可能: 列名出错
9. 若在数据库中创建了 两个sequence ,运行时出现异常可能是先后执行了多次select语句,导致与原有的序列号产生冲突
10. 表名或列名不存在
a) 可能:表不存在或者没有插入数据到表中
11. 不支持的类,类的版本错误
a) 可能:没有导入jdk5.0,或者编译器仍为1.4
12. MappingNotFoundException
a) Maybe: In the Eclipse Not refersh , or not exist in the dirctory
13. HibernateException: /hibernate.cfg.xml not found
a) Maybe1: hibernate.cfg.xml not in the root directory
b) Maybe2: Could not parse configuration .
c) resolve: database not connect or use another database
14. ConstraintViolationException
a) Maybe: used a not true database
15. 驱动没有找到 或者 JDBC Driver not found
可能:连接数据库的驱动jar包不存在或者版本不一致,比如将旧的版本换成新的会造成该类错误
16. 空指针异常 , java.lang.NullPointerException
a) 可能1:数据库连接出错,比如在hibernate.cfg.xml中的数据错误会导致异常。
17. 数据插入异常 ,GenericJDBCException: could not insert
a) 可能1:没有建立表或者表中没有任何数据
b) 可能2:插入数据后没有执行提交语句:commit
18. LazyInitializationException 或者延迟加载异常
a) 可能1:没有在查询语句中加fetch
19. IdentifierGenerationException
a) 可能1:高位表没有初始化(比如hi_value中没有记录)
20. could not initialize a collection: [hibernate.entity.Role.modules#32768] Syntax error: Encountered "-" at line 1, column 132.
a) 错误原因:<set name="modules" table="module-role" lazy="false">红色字部分中“-”为非法字符,替换为module_role
21. could not insert collection rows: [hibernate.entity.Module.roles#1]
在Module.hbm.xml文件的如下配置中加入inverse=”true”
<set name="roles" table="module_role" inverse="true">
22.在部署Struts时,出现如下错误信息:
HTTP Status 404 - Servlet action is not available
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-03-21
不明白你的意思。。。。
第2个回答  2012-12-22
R
在选择3G 培训机构的时候要最起码的了解一些情况,
比如师是否有线上真实的应用?教学设备如何?是不是真正的先 就 业后 付款?
华夏 博大3G学 院,
很好,采用PC机教学。看看吧