Ljava.lang.Integer;cannot be cast to java.lang.Integer:JPA查询参数设置请教

我在使用JPA时,使用如下查询语句:
Query query = em.createQuery(select bean from Content bean where bean.departmentId in (:departmentIds));
然后设置参数:
query.setParameter("departmentIds", departmentIds);
这个departmentIds是Integer[]型的。
程序运行时:提示 [Ljava.lang.Integer;cannot be cast to java.lang.Integer
请问大侠们,这是什么原因?

1个回答

提示 [Ljava.lang.Integer;cannot be cast to java.lang.Integer
---表示要传进一个Integer类型,但是你传了一个Integer数组
解决
在query.setParameter("departmentIds", departmentIds); 中参数
departmentIds要手动拼接成字符串 departmentIds="1,2,3,4";

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
convert [Ljava.lang.Integer; to interface java.util.List
Cannot convert [Ljava.lang.Integer;@6ecec5 of type class [Ljava.lang.Integer; to interface java.util.List
String cannot be cast to [Ljava.lang.Object
Object[] againstObj = (Object[])anaginstList.get(0); anaginstList.get(0) 是一个List 取得List的第一个对象。 把这个对象转为Object数组。然后就报异常 java.lang.String cannot be cast to [Ljava.lang.Object;
求问该怎么解决[Ljava.lang.String;@2c1e6b这个问题
import java.util.*; public class B35 { public static void main(String[] args) { String[] str = new String[10]; int[] m = new int[10]; Random random = new Random(); for(int i =0;i<10;i++){ m[i] = random.nextInt(1); str[i] =Arrays.toString(m); } StringBuffer sb = new StringBuffer(); for(int i = 0;i<10;i++){ sb.append(str); } System.out.println(sb.toString()); 结果出现[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b[Ljava.lang.String;@2c1e6b 请问是怎么回事,该怎么解决啊,我想输出来由0和1组成的字符串
hibernate cannot be cast to [Ljava.lang.Object
问题是这样的 我用的是hibernate 框架做数据访问 因为用到spring security,我的用户实体类SysUser 实现了spring security的接口UserDetails SysUser.java代码如下 [code="java"] @Entity @Table(name="sys_user") @org.hibernate.annotations.Proxy(lazy = false) public class SysUser implements java.io.Serializable ,UserDetails{ private Integer userId; private String uloginName; private String upassword; //其他property及相关setter getter略 //实现UserDetails接口方法 @Override @Transient public Collection<? extends GrantedAuthority> getAuthorities() { // TODO Auto-generated method stub return null; } @Override @Transient public String getPassword() { // TODO Auto-generated method stub return this.upassword; } @Override @Transient public String getUsername() { // TODO Auto-generated method stub return this.uloginName; } @Override @Transient public boolean isAccountNonExpired() { // TODO Auto-generated method stub return true; } @Override @Transient public boolean isAccountNonLocked() { // TODO Auto-generated method stub return true; } @Override @Transient public boolean isCredentialsNonExpired() { // TODO Auto-generated method stub return true; } @Override @Transient public boolean isEnabled() { // TODO Auto-generated method stub return this.ustatus==0?true:false; } [/code] 我的dao类 数据访问方法如下 SysUserDaoHbnImpl.java [code="java"] @Repository("sysUserDao") public class SysUserDaoHbnImpl implements SysUserDao{ private static final Log log = LogFactory.getLog(SysUserDao.class); private SessionFactory sessionFactory; @Autowired public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @SuppressWarnings("unchecked") @Cacheable(cacheName = "baseCache") public List<SysUser> selectRecordForPage(QueryPara<SysUser> qp) { // TODO Auto-generated method stub //处理分页开始 List<SysUser> result=null; try { Criteria criteria = this.sessionFactory.getCurrentSession().createCriteria(qp.getClazz()); List<Criterion> list=qp.getCriterions(); if (list != null) { if(list.size()>0) { //Set<String> keys = map.keySet(); for (Criterion cri : list) { criteria.add(cri); } } } // 获取根据条件分页查询的总行数 //System.out.println("获取根据条件分页查询的总行数"); int rowCount = ((Number) criteria.setProjection( Projections.rowCount()).uniqueResult()).intValue(); criteria.setProjection(null); qp.setRecordcount(rowCount); qp.setPagecount((qp.getRecordcount()+qp.getPagesize() - 1)/qp.getPagesize()); if(qp.getPageNo()>qp.getPagecount()) { qp.setPageNo(qp.getPagecount()); } if(qp.getPageNo()<1) { qp.setPageNo(1); } List<Order> list2=qp.getOrders(); if (list2 != null) { if(list2.size()>0) { //Set<String> keys = map2.keySet(); for (Order ord : list2) { criteria.addOrder(ord);//(Restrictions.like(key, map2.get(key))); } } } criteria.setFirstResult((qp.getPageNo() - 1) * qp.getPagesize()); criteria.setMaxResults(qp.getPagesize()); result = (List<SysUser>)criteria.list(); } catch (RuntimeException re) { log.error(re.getMessage()); } return result; //处理分页结束 } } [/code] 服务层代码略,负责调用SysUserDaoHbnImpl.java的selectRecordForPage方法 我的控制器 负责调用服务层用户数据分页方法,然后服务层继续调用数据访问层SysUserDaoHbnImpl.java的selectRecordForPage方法 我的控制器UserController.java调用方法如下 [code="java"] @RequestMapping(value={"/List"},method=RequestMethod.GET) public String list( @RequestParam(value="page", defaultValue="1") int page, @RequestParam(value="perPage", defaultValue="30") int perPage, ModelMap modelMap) { QueryPara<SysUser> qp=new QueryPara<SysUser>(); qp.setClazz(SysUser.class); qp.setPagesize(perPage); qp.setPageNo(page); modelMap.put("userlist", this.sysUserService.selectRecordForPage(qp)); modelMap.put("QueryPara", qp); return "UserManager/List"; } [/code] 我的视图userlist.jsp里面的java代码如下 [code="java"] List<SysUser> list=(List<SysUser>)request.getAttribute("userlist"); if(list.size()>0) { Iterator<SysUser> it=list.iterator(); SysUser sysUser=null; while(it.hasNext()) { sysUser=(SysUser)it.next(); //此处抛出异常:java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [SysUser] } [/code] 我运行系统,打开显示用户数据页面,SysUserDaoHbnImpl.java数据分页方法selectRecordForPage我设置断点都没有抛出异常,就在视图页面sysUser=(SysUser)it.next(); 这个地方抛出异常java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [SysUser] 请问高手 这是什么原因,应该如何修改呢,不胜感谢 附上我的测试情况: (一)第一种情况,在原来系统里面SysUser.java没有实现UserDetails(spring security里面的一个接口)接口时, 用户数据显示视图userlist.jsp是显示正常的,可以看到用户数据 (问题是 现在SysUser.java实现接口UserDetails,怎么在视图层sysUser=(SysUser)it.next()就出问题? ) (二) 第二种情况,当我把SysUserDaoHbnImpl.java数据分页方法selectRecordForPage里面的下面代码部分做如下修改的时候 运行正常 [code="java"] //注释下面代码 //int rowCount = ((Number) criteria.setProjection( //Projections.rowCount()).uniqueResult()).intValue(); // criteria.setProjection(null); //手动设置int rowCount值 int rowCount=1;//我用户表目前实际只有一个用户 [/code] 注释掉上面的Projections相关代码后,userlist.jsp页面也是运行正常的
[Ljava.lang.Object;]: No default constructor found
Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate **[[Ljava.lang.Object;]: No default constructor found; **nested exception is java.lang.NoSuchMethodException: [Ljava.lang.Object;.<init>()] with root cause java.lang.NoSuchMethodException: [Ljava.lang.Object;.<init>() 我在做一个网站开发,我希望在Cotroller层中传入Object类型的可变参数,就一直报这个错误,请问该怎么解决呢?以下是我的代码: ``` //可变参数做查询 //localhost/detailsss/?detail=徐国权&detail=12 @RequestMapping("/detailsss/") public String queryDetails(Model model,Object...detail){ try { Object consume = null; List<Object> list = new ArrayList<>(); for(Object obj : detail){ if(obj instanceof String){ consume = new String(((String) obj).getBytes("iso-8859-1"),"utf-8"); } else if(obj instanceof Integer){ consume = (int)obj; } else if(obj instanceof Date){ consume = (Date)obj; } else if(obj instanceof Time){ consume = (Time)obj; }else{ consume = obj; } list.add(consume); } //调用service的方法 List<Detailed> details = comsumeService.queryDetails(list); model.addAttribute("details",details); return "comsume_info"; } catch (Exception e) { e.printStackTrace(); return "err"; } } ```
java.lang.NoSuchMethodError: ..Ljava/lang/Integer;
2015-2-27 13:21:47 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet default threw exception java.lang.NoSuchMethodError: cn.act.ict.software.domain.Tablestaff.getLeavingDayCnt()Ljava/lang/Integer; at cn.act.ict.software.action.LeavingotAction.leavingot_requestBySelf(LeavingotAction.java:562) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[Ljava.lang.Object;
Map<String, Object> paras = new HashMap<String, Object>(); //List<Map<String,Object>> listCostingRegisterMes = new ArrayList<Map<String,Object>>(); String hql="from SmpsupplyCostingRegister a join a.costingType costingType where a.workNum = '"+workNum+"'"; List<Map<String,Object>> listCostingRegists = dataDao.find(hql, paras); if (listCostingRegists.size()>0) { for (int i = 0; i < listCostingRegists.size(); i++) { Map<String,Object> suppliersMap = listCostingRegists.get(i); HSSFRow row = s.createRow(i + 1); HSSFCell workNumValue = row.createCell(0); HSSFCell workNameValue = row.createCell(1); HSSFCell costingTypeNameValue = row.createCell(2); HSSFCell residualCostValue = row.createCell(3); HSSFCell controlCostsValue = row.createCell(4); HSSFCell costChangeValue = row.createCell(5); HSSFCell totalCostValue = row.createCell(6); HSSFCell purchaseTotalValue = row.createCell(7); HSSFCell confirmationAddValue = row.createCell(8); HSSFCell disconfirmationAddValue = row.createCell(9); HSSFCell addMoneyNoValue = row.createCell(10); workNumValue.setCellValue(vObject(suppliersMap.get("workNum"))); workNameValue.setCellValue(vObject(suppliersMap.get("workName"))); costingTypeNameValue.setCellValue(vObject(suppliersMap.get("name"))); residualCostValue.setCellValue(vObject(suppliersMap.get("residualCost"))); controlCostsValue.setCellValue(vObject(suppliersMap.get("controlCosts"))); costChangeValue.setCellValue(vObject(suppliersMap.get("costChange"))); totalCostValue.setCellValue(vObject(suppliersMap.get("totalCost"))); purchaseTotalValue.setCellValue(vObject(suppliersMap.get("purchaseTotal"))); confirmationAddValue.setCellValue(vObject(suppliersMap.get("confirmationAdd"))); disconfirmationAddValue.setCellValue(vObject(suppliersMap.get("disconfirmationAdd"))); addMoneyNoValue.setCellValue(vObject(suppliersMap.get("addMoneyNo"))); } } wb.write(fos); fos.close(); ``` [Ljava.lang.Object; cannot be cast to java.util.Map 为什么总是报数据类型转换错误?要怎么解决啊? ```
请教:有人知道springMVC配置文件报错,但是不影响项目启动。报错信息如下:
Error occured processing XML '[Ljava.lang.String; cannot be cast to java.lang.String'. See Error Log for more details![图片说明](https://img-ask.csdn.net/upload/201610/11/1476158976_345034.png)
急!ssh项目出错Error setting value [[Ljava.lang.String;@1597a48]
## spring:4.1.5 ## struts2:2.3.20 ## hibernate:4.3.8 spring和struts已配置验证码的action **Tomcat启动后没错误,进入到注册页面也没错误,点四位验证码更换时(如图)** ![图片说明](https://img-ask.csdn.net/upload/201504/17/1429253521_910834.png) **myeclipse的Console报如下错误:** WARN OgnlValueStack:68 - Error setting value [[Ljava.lang.String;@1597a48] with expression [1429250952505] java.lang.NumberFormatException: For input string: "1429250952505" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:495) at java.lang.Integer.valueOf(Integer.java:556) at ognl.OgnlParserTokenManager.makeInt(OgnlParserTokenManager.java:63) at ognl.OgnlParserTokenManager.TokenLexicalActions(OgnlParserTokenManager.java:1624) at ognl.OgnlParserTokenManager.getNextToken(OgnlParserTokenManager.java:1498) at ognl.OgnlParser.jj_ntk(OgnlParser.java:3099) ...... ================================================= 注册页面jsp: ``` <tr> <th> <span class="requiredField">*</span>验证码: </th> <td> <span class="fieldSet"> <input type="text" id="checkcode" name="checkcode" class="text captcha" maxlength="4" autocomplete="off"/> <img id="checkImage" class="captchaImage" src="${pageContext.request.contextPath}/checkImage.action" onclick="changeImage()" title="点击更换验证码"/> </span> </td> </tr> ``` 切换验证码的js代码: ``` function changeImage(){ var img = document.getElementById("checkImage"); img.src="${pageContext.request.contextPath}/checkImage.action?" + new Date().getTime(); } ``` action代码: ``` import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.util.Random; import javax.imageio.ImageIO; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; /** * 验证码Action类 * @author donny * @E-mail donnymoving@gmail.com * @version 2015-4-17 上午12:04:16 */ public class CheckImageAction extends ActionSupport { @Override public String execute() throws Exception { int width = 120; int height = 30; // 步骤一 绘制一张内存中图片 BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // 步骤二 图片绘制背景颜色 ---通过绘图对象 Graphics graphics = bufferedImage.getGraphics();// 得到画图对象 --- 画笔 // 绘制任何图形之前 都必须指定一个颜色 graphics.setColor(getRandColor(200, 250)); graphics.fillRect(0, 0, width, height); // 步骤三 绘制边框 graphics.setColor(Color.WHITE); graphics.drawRect(0, 0, width - 1, height - 1); // 步骤四 四个随机数字 Graphics2D graphics2d = (Graphics2D) graphics; // 设置输出字体 graphics2d.setFont(new Font("宋体", Font.BOLD, 18)); String words ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; Random random = new Random();// 生成随机数 // 定义StringBuffer StringBuffer sb = new StringBuffer(); // 定义x坐标 int x = 10; for (int i = 0; i < 4; i++) { // 随机颜色 graphics2d.setColor(new Color(20 + random.nextInt(110), 20 + random .nextInt(110), 20 + random.nextInt(110))); // 旋转 -30 --- 30度 int jiaodu = random.nextInt(60) - 30; // 换算弧度 double theta = jiaodu * Math.PI / 180; // 生成一个随机数字 int index = random.nextInt(words.length()); // 生成随机数 0 到 length - 1 // 获得字母数字 char c = words.charAt(index); sb.append(c); // 将c 输出到图片 graphics2d.rotate(theta, x, 20); graphics2d.drawString(String.valueOf(c), x, 20); graphics2d.rotate(-theta, x, 20); x += 30; } // 将生成的字母存入到session中 ServletActionContext.getRequest().getSession().setAttribute("checkcode", sb.toString()); // 步骤五 绘制干扰线 graphics.setColor(getRandColor(160, 200)); int x1; int x2; int y1; int y2; for (int i = 0; i < 30; i++) { x1 = random.nextInt(width); x2 = random.nextInt(12); y1 = random.nextInt(height); y2 = random.nextInt(12); graphics.drawLine(x1, y1, x1 + x2, x2 + y2); } // 将上面图片输出到浏览器 ImageIO graphics.dispose();// 释放资源 ImageIO.write(bufferedImage, "jpg", ServletActionContext.getResponse() .getOutputStream()); return NONE; } /** * 取其某一范围的color * * @param fc * int 范围参数1 * @param bc * int 范围参数2 * @return Color */ private Color getRandColor(int fc, int bc) { // 取其随机颜色 Random random = new Random(); if (fc > 255) { fc = 255; } if (bc > 255) { bc = 255; } int r = fc + random.nextInt(bc - fc); int g = fc + random.nextInt(bc - fc); int b = fc + random.nextInt(bc - fc); return new Color(r, g, b); } } ``` struts配置: ![图片说明](https://img-ask.csdn.net/upload/201504/17/1429260370_810846.png) 没有result,因为验证码不需要跳转页面,execute()返回NONE,只起显示作用。
Struts2的action方法报类型转换错误
最近刚学Struts2框架,在写删除action时遇到了类型转换问题,求大神开解,万分感谢! action代码如下: public String del(){ ActionContext context=ActionContext.getContext(); Map params=context.getParameters(); String stu_id=(String) params.get("stu_id"); new StudentDao().delStu(stu_id); return "success"; } 运行时报这个错: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
我用自己maven打的jar包里面的工具包报OGNL错误
错误位置代码: ``` Object o = session.get(Constants.MANAGER_USER); ``` 使用Constants的时候出现错误,急求啊! 错误如下: ``` Key "location" was not found on instance of ognl.MethodFailedException. Introspection information for the class is: {reason=java.beans.PropertyDescriptor[name=reason; propertyType=class java.lang.Throwable; readMethod=public java.lang.Throwable ognl.OgnlException.getReason()], getClass=public final native java.lang.Class java.lang.Object.getClass(), getLocalizedMessage=public java.lang.String java.lang.Throwable.getLocalizedMessage(), cause=java.beans.PropertyDescriptor[name=cause; propertyType=class java.lang.Throwable; readMethod=public synchronized java.lang.Throwable java.lang.Throwable.getCause()], java.lang.Object@20f2097b={public ognl.Evaluation ognl.OgnlException.getEvaluation()=[Ljava.lang.Class;@351d3546, public java.lang.String java.lang.Throwable.getLocalizedMessage()=[Ljava.lang.Class;@2e8d3d8f, public java.lang.String ognl.OgnlException.toString()=[Ljava.lang.Class;@253d3df4, public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)=[Ljava.lang.Class;@376d7802, public java.lang.String java.lang.Throwable.getMessage()=[Ljava.lang.Class;@6b06ccac, public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@2c20f506, public boolean java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@603eafeb, public synchronized java.lang.Throwable java.lang.Throwable.getCause()=[Ljava.lang.Class;@3ccf6686, public void ognl.OgnlException.setEvaluation(ognl.Evaluation)=[Ljava.lang.Class;@6171ae1f, public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])=[Ljava.lang.Class;@4a52fff2, public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()=[Ljava.lang.Class;@5f8640a4, public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable)=[Ljava.lang.Class;@183af684, public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()=[Ljava.lang.Class;@7457b2ca, public java.lang.Throwable ognl.OgnlException.getReason()=[Ljava.lang.Class;@29276edd, public final native java.lang.Class java.lang.Object.getClass()=[Ljava.lang.Class;@4449883d, public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()=[Ljava.lang.Class;@b88c8e6}, getCause=public synchronized java.lang.Throwable java.lang.Throwable.getCause(), evaluation=java.beans.PropertyDescriptor[name=evaluation; propertyType=class ognl.Evaluation; readMethod=public ognl.Evaluation ognl.OgnlException.getEvaluation()], getStackTrace=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(), addSuppressed=public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable), hashCode=public native int java.lang.Object.hashCode(), getSuppressed=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed(), suppressed=java.beans.PropertyDescriptor[name=suppressed; propertyType=class [Ljava.lang.Throwable;; readMethod=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()], stackTrace=java.beans.PropertyDescriptor[name=stackTrace; propertyType=class [Ljava.lang.StackTraceElement;; readMethod=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()], class=java.beans.PropertyDescriptor[name=class; propertyType=class java.lang.Class; readMethod=public final native java.lang.Class java.lang.Object.getClass()], getEvaluation=public ognl.Evaluation ognl.OgnlException.getEvaluation(), localizedMessage=java.beans.PropertyDescriptor[name=localizedMessage; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getLocalizedMessage()], printStackTrace=freemarker.ext.beans.OverloadedMethods@4200fabf, java.lang.Object@71ff185a=freemarker.ext.beans.OverloadedMethods@504335a4, getReason=public java.lang.Throwable ognl.OgnlException.getReason(), initCause=public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable), getMessage=public java.lang.String java.lang.Throwable.getMessage(), message=java.beans.PropertyDescriptor[name=message; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getMessage()], setEvaluation=public void ognl.OgnlException.setEvaluation(ognl.Evaluation), setStackTrace=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]), equals=public boolean java.lang.Object.equals(java.lang.Object), toString=public java.lang.String ognl.OgnlException.toString(), fillInStackTrace=public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()} 2017-07-09 12:02:15,839 [http-apr-8080-exec-6] DEBUG [freemarker.beans] - Key "location" was not found on instance of java.lang.NoSuchFieldError. Introspection information for the class is: {getClass=public final native java.lang.Class java.lang.Object.getClass(), localizedMessage=java.beans.PropertyDescriptor[name=localizedMessage; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getLocalizedMessage()], printStackTrace=freemarker.ext.beans.OverloadedMethods@419b5593, getLocalizedMessage=public java.lang.String java.lang.Throwable.getLocalizedMessage(), java.lang.Object@71ff185a=freemarker.ext.beans.OverloadedMethods@556c0a17, initCause=public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable), cause=java.beans.PropertyDescriptor[name=cause; propertyType=class java.lang.Throwable; readMethod=public synchronized java.lang.Throwable java.lang.Throwable.getCause()], java.lang.Object@20f2097b={public java.lang.String java.lang.Throwable.getLocalizedMessage()=[Ljava.lang.Class;@45a9bb16, public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)=[Ljava.lang.Class;@72b70fee, public java.lang.String java.lang.Throwable.getMessage()=[Ljava.lang.Class;@691bebe6, public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@5c926860, public boolean java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@546b09ef, public synchronized java.lang.Throwable java.lang.Throwable.getCause()=[Ljava.lang.Class;@1ee9b4f3, public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])=[Ljava.lang.Class;@281b2813, public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()=[Ljava.lang.Class;@67858418, public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable)=[Ljava.lang.Class;@6badcd76, public java.lang.String java.lang.Throwable.toString()=[Ljava.lang.Class;@38b0b2dc, public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()=[Ljava.lang.Class;@499a4e69, public final native java.lang.Class java.lang.Object.getClass()=[Ljava.lang.Class;@2f4b606, public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()=[Ljava.lang.Class;@7b70d53}, getMessage=public java.lang.String java.lang.Throwable.getMessage(), message=java.beans.PropertyDescriptor[name=message; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getMessage()], getCause=public synchronized java.lang.Throwable java.lang.Throwable.getCause(), setStackTrace=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]), getStackTrace=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(), addSuppressed=public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable), hashCode=public native int java.lang.Object.hashCode(), equals=public boolean java.lang.Object.equals(java.lang.Object), toString=public java.lang.String java.lang.Throwable.toString(), getSuppressed=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed(), suppressed=java.beans.PropertyDescriptor[name=suppressed; propertyType=class [Ljava.lang.Throwable;; readMethod=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()], stackTrace=java.beans.PropertyDescriptor[name=stackTrace; propertyType=class [Ljava.lang.StackTraceElement;; readMethod=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()], class=java.beans.PropertyDescriptor[name=class; propertyType=class java.lang.Class; readMethod=public final native java.lang.Class java.lang.Object.getClass()], fillInStackTrace=public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()} ```
target is null for setProperty(null, "JGrade", [Ljava.lang.String;@578dfb)
错误描述: Error setting value ognl.OgnlException: target is null for setProperty(null, "JGrade", [Ljava.lang.String;@578dfb) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651) at ognl.ASTProperty.setValueBody(ASTProperty.java:101) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.ASTChain.setValueBody(ASTChain.java:172) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.Ognl.setValue(Ognl.java:476) at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:273) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)
java泛型异常,如何解决
public static <AnyType extends Comparable<? super AnyType>> AnyType[] mergesort(AnyType[] a,AnyType[] b) { int i=0; int j=0; int index=0; AnyType[] tmp=(AnyType[]) new Comparable[a.length+b.length]; while(i<a.length&&j<b.length){ if(a[i].compareTo(b[j])<0) { tmp[index]=a[i]; i++; index++; } else{ tmp[index]=b[j]; j++; index++; } } return tmp; } public static void main(String[] args){ Integer a[]={1,13,24,26}; Integer b[]={2,15,27,28}; Integer[] tmp= (Integer[])mergesort(a, b); System.out.println(tmp); } } 结果:Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Comparable; cannot be cast to [Ljava.lang.Integer; at testcc.mergeSort.main(mergeSort.java:58) 求问如何解决
target is null for setProperty(null, "passwords", [Ljava.lang.String;@17587f0)
我都设置set方法了啊!找不到究竟是哪里出错了? 2011-10-10 16:09:19,518 [com.opensymphony.xwork2.ognl.OgnlValueStack]-[WARN] Error setting expression 'UserInfo.passwords' with value '[Ljava.lang.String;@17587f0' ognl.OgnlException: target is null for setProperty(null, "passwords", [Ljava.lang.String;@17587f0) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2219) at ognl.ASTProperty.setValueBody(ASTProperty.java:127) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.ASTChain.setValueBody(ASTChain.java:227) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.Ognl.setValue(Ognl.java:737) at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:161) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:149) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:276) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) 2011-10-10 16:09:19,523 [com.opensymphony.xwork2.ognl.OgnlValueStack]-[WARN] Error setting expression 'UserInfo.userid' with value '[Ljava.lang.String;@7b139b' ognl.OgnlException: target is null for setProperty(null, "userid", [Ljava.lang.String;@7b139b) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2219) at ognl.ASTProperty.setValueBody(ASTProperty.java:127) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.ASTChain.setValueBody(ASTChain.java:227) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.Ognl.setValue(Ognl.java:737) at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:161) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:149) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:276) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) [img]http://dl.iteye.com/upload/attachment/567179/7b8dc94e-6e9b-3564-9c49-3db9508a86db.png[/img] [img]http://dl.iteye.com/upload/attachment/567181/e1b0efe5-903d-363a-a1da-eac0281f84c1.png[/img]
kafka启动报错,java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.multi(Ljava/lang/Iterable;Lorg/apache/zookeeper/AsyncCallback$MultiCallback;Ljava/lang/Object;)V
试过很多方法,降级zk使其和kafka依赖的版本保持一致; zk3.414 ,kafka2.3 删除了scala的环境变量,依然不行; java_home只有一个 java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.multi(Ljava/lang/Iterable;Lorg/apache/zookeeper/AsyncCallback$MultiCallback;Ljava/lang/Object;)V at kafka.zookeeper.ZooKeeperClient.send(ZooKeeperClient.scala:238) at kafka.zookeeper.ZooKeeperClient.$anonfun$handleRequests$2(ZooKeeperClient.scala:160) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253) at kafka.utils.CoreUtils$.inReadLock(CoreUtils.scala:259) at kafka.zookeeper.ZooKeeperClient.$anonfun$handleRequests$1(ZooKeeperClient.scala:160) at kafka.zookeeper.ZooKeeperClient.$anonfun$handleRequests$1$adapted(ZooKeeperClient.scala:156) at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62) at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49) at kafka.zookeeper.ZooKeeperClient.handleRequests(ZooKeeperClient.scala:156) at kafka.zk.KafkaZkClient.retryRequestsUntilConnected(KafkaZkClient.scala:1660) at kafka.zk.KafkaZkClient.retryRequestsUntilConnected(KafkaZkClient.scala:1647) at kafka.zk.KafkaZkClient.retryRequestUntilConnected(KafkaZkClient.scala:1642) at kafka.zk.KafkaZkClient$CheckedEphemeral.create(KafkaZkClient.scala:1712) at kafka.zk.KafkaZkClient.checkedEphemeralCreate(KafkaZkClient.scala:1689) at kafka.zk.KafkaZkClient.registerBroker(KafkaZkClient.scala:97) at kafka.server.KafkaServer.startup(KafkaServer.scala:262) at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38) at kafka.Kafka$.main(Kafka.scala:84) at kafka.Kafka.main(Kafka.scala)
Java怎么实现泛型数据的比较
```Java public class ArrayImplementation <Element> implements Iterable<Element>{ private Element [] list; public ArrayImplementation (final int initSize) { list = (Element[]) new Object[initSize]; this.size = initSize; } private boolean increaseSorted() { for (int i=1;i<length;i++) { if (list[i].compareTo(list[i-1])<0) { return false; } } return true; } } ``` 我如何让Element使用compareTo方法? 如果我写成 ```Java public class ArrayImplementation <Element extends Comparable> implements Iterable<Element>{ public ArrayImplementation (final int initSize) { list = (Element[]) new Object[initSize]; this.size = initSize; } private boolean increaseSorted() { for (int i=1;i<length;i++) { if (list[i].compareTo(list[i-1])<0) { return false; } } return true; } } ``` 让Element继承Comparable,就会报错 ``` Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Comparable; ``` 我要怎么写呢?
调用String里的split函数 结果为什么是是这样
这是代码片段: String test = isolationResult; System.out.println(test); System.out.println(test.split("\\s")); 这是结果: [Ljava.lang.String;@7cbde6 好/a 的/ude1 [Ljava.lang.String;@1977b9b 老/a 是/vshi 连/ulian 不/d 上网/v 卧/vi 槽/ng [Ljava.lang.String;@340101 可以/v 删除/v 吗/y ?/ww [Ljava.lang.String;@2e1f1f
struts2验证错误
为什么还是提示: Error setting expression 'graduation' with value '[Ljava.lang.String;@1458dcb' ognl.MethodFailedException: Method "setGraduation" failed for object com.shnu.action.RegisterAction@e391c4 [java.lang.NoSuchMethodException: com.shnu.action.RegisterAction.setGraduation([Ljava.lang.String;)] 警告: Error setting expression 'birthday' with value '[Ljava.lang.String;@76f2e8' ognl.MethodFailedException: Method "setBirthday" failed for object com.shnu.action.RegisterAction@e391c4 [java.lang.NoSuchMethodException: com.shnu.action.RegisterAction.setBirthday([Ljava.lang.String;)]
mac系统 intelliJ IDEA调用Maple接口,出现java.lang.UnsatisfiedLinkError和Reason: image not found问题
近期实验室配置项目环境,在macos系统上使用IDEA调用Maple接口 这是我的VM options ``` -ea -Djava.library.path="/Library/Frameworks/Maple.framework/Versions/2017/bin.APPLE_UNIVERSAL_OSX" -Xms1024m -Xmx6144m -XX:-UseGCOverheadLimit -XX:SurvivorRatio=8 -XX:+AggressiveOpts -Xss10m -Dfile.encoding=UTF-8 ``` 出现以下报错 ``` java.lang.UnsatisfiedLinkError: /Library/Frameworks/Maple.framework/Versions/2017/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib: dlopen(/Library/Frameworks/Maple.framework/Versions/2017/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib, 1): Library not loaded: @rpath/libhf.dylib Referenced from: /Library/Frameworks/Maple.framework/Versions/2017/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib Reason: image not found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1861) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at com.maplesoft.openmaple.Engine.<clinit>(Unknown Source) at edu.uestc.auto.reasoning.core.maple.MapleEngineNOCache.<init>(MapleEngineNOCache.java:46) at edu.uestc.auto.reasoning.core.maple.thread.v2.MapleEngineThread.run(MapleEngineThread.java:40) Exception in thread "maple-evaluate-work" java.lang.UnsatisfiedLinkError: com.maplesoft.openmaple.Engine.getKernel([Ljava/lang/String;Lcom/maplesoft/openmaple/EngineCallBacks;Ljava/lang/Object;Ljava/lang/Object;)J at com.maplesoft.openmaple.Engine.getKernel(Native Method) at com.maplesoft.openmaple.Engine.<init>(Unknown Source) at edu.uestc.auto.reasoning.core.maple.MapleEngineNOCache.<init>(MapleEngineNOCache.java:46) at edu.uestc.auto.reasoning.core.maple.thread.v2.MapleEngineThread.run(MapleEngineThread.java:40) ``` 有人知道怎么解决吗?
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
相关热词 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件 c#注册dll文件 c#安装.net
立即提问