Java中遇到的异常目录

java.security.spec.InvalidKeySpecException: Password is not ASCII    

PbeEncrypter pbe = new PbeEncrypter(password.replaceAll("\r\n", ""));字符串中的换行符引起

 javax.crypto.BadPaddingException: Given final block not properly padded

Input length must be multiple of 8 when decrypting with padded cipher 输入密文长度不正确时引起

 

spring 整合Redis 出现 afterPropertiesSet signature: ()V) Incompatible argument to function 解决办法

 正在做SpringMVC+Redis整合的练习

 使用的是 spring-data-redis 和 Jedis

 配置好之后出现了以下错误:

Caused by: java.lang.VerifyError: (class: org/springframework/data/redis/connection/jedis/JedisConnectionFactory, method: afterPropertiesSet signature: ()V) Incompatible argument to function

    at java.lang.Class.getDeclaredConstructors0(Native Method)

    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)

    at java.lang.Class.getConstructor0(Unknown Source)

    at java.lang.Class.getDeclaredConstructor(Unknown Source)

    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)

 这个错误时jar包冲突引起的,其中:jedis-2.4.1.jar 和 spring-data-redis-1.0.1.RELEASE.jar 无法搭配使用

 解决办法:jedis-2.4.1.jar 和 spring-data-redis-1.3.4.RELEASE.jar 

 

 

Throwing argument name 'ex' was not bound in advice arguments
解决方法把相关ex的aspect类都干掉

Rejected bean name : no URL paths identified
只是一些提示,或者是一些 冲突

What you're seeing is a clash between <mvc:annotation-driven /> and the explicit bean definition of DefaultAnnotationHandlerMapping.

When you add <mvc:annotation-driven />, Spring declares its own DefaultAnnotationHandlerMapping, and because it appears before your own one, it gets priority. Your interceptor is registered with your DefaultAnnotationHandlerMapping, but that never actually get called.
It DEBUG logging, disable DEBUG log for the org.springframework classes... It is just for troubleshouting.
but it's true that it does not affect the project anyway :')

 

 

org.apache.shiro.authc.AuthenticationException: Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - zhang, rememberMe=false].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).

Caused by: java.lang.IllegalStateException: Configuration error:  No realms have been configured!  One or more realms must be present to execute an authentication attempt.
这个错误呢?


shiro.ini文件先用后缀先用.txt,编写好了之后改成.ini就可以

 

java.lang.ClassNotFoundException: xxxx at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassL...

 

 

 

 

没有找到该类,说明没有编译成功
1.可能是环境变量配置有问题
2.jar包有错误,查看jar是否有漏或者重新导入jar包
3.可能你用了不存在的类
4.版本不一致,jdk的版本

 

redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream;

jedis中报的异常
这是由于多个jedis同时读写造成的
我这里报错的原因是同时ajax异步请求,同时操作资源造成的,改为async:"false"之后就不报异常了

 

 

com.microsoft.sqlserver.jdbc.SQLServerException: 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'xxxxxxx' 中的标识列插入显式值。

 当 IDENTITY_INSERT 设置为 OFF 时,不能为表中的标识列插入显式值

对于这个异常可以从两个角度来处理:A:数据库执行语句  B:直接修改NHibernate中持久化类映射配置文件id节点

A数据库执行语句:

问题描述:当在数据库表主键设计为 (Orderid  int identity primary key),相对这个主键IDENTITY_INSERT默认设置为OFF,就是不能够显示插入主键id的值,例子如下:
insert into OrderList(id,OrderName) values(4520,'电子传票订单')

执行上面语句会提示一个错误:
服务器: 消息 544,级别 16,状态 1,行 1
当 IDENTITY_INSERT 设置为 OFF 时,不能向表 'OrderList' 中的标识列插入显式值。

其中关于主键一条记录,当我们想把这条记录的id设置成我们自定义的4520时出现上面的错误,如果我们添加一些设置,修改方法如下:
--允许将显式值插入表的标识列中 ON-允许  OFF-不允许
set identity_insert OrderList ON--打开

insert into OrderList(id,ordername,createdate)
values(4520,'set',getdate())

set identity_insert OrderList OFF--关闭

在执行这个插入语句时多了一个设置,该设置的语法是
--设置语法:

SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF }
允许将显式值插入表的标识列中

参数说明:
database:针对数据库
table:针对某张表

ON:允许插入显式值插入 标识列
OFF:不允许

注意:
当 <wbr>IDENTITY_INSERT <wbr>设置为 <wbr>OFF <wbr>时,不能为表中的标识列插入显式值
--问题注意

(1)任何时候,会话中只有一个表的 IDENTITY_INSERT 属性可以设置为 ON。如果某个表已将此属性设置为 ON,并且为另一个表发出了 SET IDENTITY_INSERT ON 语句,则 Microsoft® SQL Server™ 返回一个错误信息,指出 SET IDENTITY_INSERT 已设置为 ON 并报告此属性已设置为 ON 的表

(2)如果插入值大于表的当前标识值,则 SQL Server 自动将新插入值作为当前标识值使用

(3)SET IDENTITY_INSERT 的设置是在执行或运行时设置,而不是在分析时设置

上面执行语句中:把要执行的语句前后加上该设置,当然上面针对事一条记录插入操作,在这条记录插入操作后,如果再次插入数据时,没有启用该设置,Orderid主键列会根据上面自定义表示4520,自动增长到4521.这个操作很灵活关键看个人怎么利用.

The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

 

 

警告: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [xxxx.xxx.xxx.class] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
1在开发中遇到,原因是由于在写service层时候没有继承对应的接口

2springmvc-servlet.xml的问题,换成原来的没问题了,可能是文件编码问题

result="{"errorMessage":"update失败java.lang.Exception: avc","hasErrors":"true","data":null,"success":"false}"
收到的result不是json格式额,而是多了双引号,导致不能result.hasErrors使用
原来在响应的时候设置内容类型为text/plain
应该设置成application/json
response.setContentType("application/json; charset=utf-8");

 

<%@ taglib prefix="s" uri="/struts-tags" %>
报错:Can not find the tag library descriptor for "/struts-tags"

缺少struts的包

 

 

Invalid location of tag 解决办法分析

 

在jsp页面使用标签过程中有时候不注意规则的话,eclipse会提示一些错误,下面针对这些错误提出相应的解决办法:

 

<form></form>标签

1. Invalid location of tag (form)

  form 应该写到table外面去,并且form标签里面也不能套form标签。
<style></style>
2. Invalid location of tag (style)
  style应该写在head里面。
<script></script>
3. Invalid location of tag (script)
  script应该写到body,head里面。

4.Attribute name(Name) uses wrong case character
  虽说HTML不区分大小写,但是在eclipse里面,大写的话就报错,所以要改成小写吧。

 

 

net.sf.json

joson.fromObject(obj);

传入的对象中存在Date数据类型报这样的问题:

java.lang.reflect.InvocationTargetException

 

spring中报这样的异常

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxxxxx' is defined 检查配置文件,检查其他问题

hadoop程序运行时的异常,与环境有关,没有影响程序的继续执行

16/12/02 14:33:16 INFO hdfs.DFSClient: Exception in createBlockOutputStream
java.io.IOException: Bad connect ack with firstBadLink as 192.168.1.38:50010

lock中获取监视器错误

java.lang.IllegalMonitorStateException

 

 

json编码中遇到的问题
jsonStr = objectMapper.writeValueAsString(obj);引入包jackson-mapper-asl

The method writeValueAsString(Object) from the type ObjectMapper refers to the missing type JsonGenerationException

JsonGenerationException在哪,引入包jackson-mapper-asl

 

resin服务异常,重启服务

java.lang.NoClassDefFoundError: Could not initialize class com.caucho.env.shutdown.ExitCode
                                        at com.caucho.env.shutdown.ShutdownSystem.shutdownOutOfMemory(ShutdownSystem.java:167)
                                        at com.caucho.server.webapp.ErrorPageManager.sendServletErrorImpl(ErrorPageManager.java:289)
                                        at com.caucho.server.webapp.ErrorPageManager.sendServletError(ErrorPageManager.java:195)
                                        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:158)
                                        at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
                                        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
                                        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)
                                        at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1309)
                                        at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1265)
                                        at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1249)
                                        at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1157)
                                        at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:956)
                                        at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)
                                        at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
                                        at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
                                        at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)
                                        at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
                                        at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)

 

Caused by: java.io.IOException: Data truncation: Data too long for column 'word' at row 1

修改表的结构字段类型

    
Comparator没有指定参数类型,提示type safety: Unchecked invocation sort
Collections.sort(modelList,new Comparator<BaikeClassModel>() {

                @Override
                public int compare(BaikeClassModel o1, BaikeClassModel o2) {
                    return o1.getTypeId().compareTo(o2.getTypeId());
                }
            });

 BigDecimal中使用divide方法的时候报出的异常

Non-terminating decimal expansion; no exact representable decimal result.

解决方法

指定取舍的位数和进位的策略

转载于:https://my.oschina.net/iioschina/blog/737843

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值