SSM 遇到的java.lang.NullPointerException问题 10C

报错
java.lang.NullPointerException
** at com.archives.controller.sysmanage.DepartmentController.doPageData(DepartmentController.java:38)
** at com.archives.controller.sy****smanage.DepartmentController.initHome(DepartmentController.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

mapper.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >




























resultType="Integer">
select count(*) as cnt
from userinfo,dept
and userinfo.deptid = dept.deptid

and userinfo.loginname = #{loginname}


and userinfo.realname = #{realname}


and dept.deptname = #{deptname}


resultMap="userdeptMap">
select userinfo.loginid
, userinfo.loginname
, userinfo.realname
, dept.deptname
, dept.deptid
from userinfo,dept
where userinfo.deptid = dept.deptid
limit #{offsetindex},#{pageCount}


controller.java文件
package com.archives.controller.sysmanage;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.archives.common.Constant;
import com.archives.entity.Menu;
import com.archives.entity.UserDept;
import com.archives.entity.UserInfo;
import com.archives.model.A0104Model;
import com.archives.service.HomeService;
import com.archives.service.UserDeptService;

@Controller
@RequestMapping("/department")
public class DepartmentController {

UserDeptService userdeptService;
@RequestMapping("/init")
public String initHome(HttpServletRequest request) {
    A0104Model model=new A0104Model();
    model.setCurPage(1);
    model.setPageCount(Constant.PAGE_COUNT);
    对应的错误行**doPageData(request,model);**
    return "department";

}
private void doPageData(HttpServletRequest request, A0104Model model) {
    // TODO Auto-generated method stub
    int cnt = userdeptService.selectUserDeptCount(model);
    int totalPage = 0;
    if(cnt%Constant.PAGE_COUNT == 0) {
        totalPage = cnt/Constant.PAGE_COUNT;
    }else {
        totalPage = cnt/Constant.PAGE_COUNT + 1;
    }
    model.setTotalPage(totalPage);
    model.setOffsetindex((model.getCurPage() - 1) * Constant.PAGE_COUNT);
    model.setPageCount(Constant.PAGE_COUNT);
    对应的错误行**List<UserDept> userdeptduiyList=userdeptService.selectUserDeptList(model);**
    request.setAttribute("userdeptList", userdeptList);
    request.setAttribute("model", model);
}

}
model.java文件
package com.archives.model;

public class A0104Model {

private String loginname;
private String realname;
private String deptname;
public String getLoginname() {
    return loginname;
}
public void setLoginname(String loginname) {
    this.loginname = loginname;
}
public String getRealname() {
    return realname;
}
public void setRealname(String realname) {
    this.realname = realname;
}
public String getDeptname() {
    return deptname;
}
public void setDeptname(String deptname) {
    this.deptname = deptname;
}
public int getCurPage() {
    return curPage;
}
public void setCurPage(int curPage) {
    this.curPage = curPage;
}
public int getTotalPage() {
    return totalPage;
}
public void setTotalPage(int totalPage) {
    this.totalPage = totalPage;
}
public int getOffsetindex() {
    return offsetindex;
}
public void setOffsetindex(int offsetindex) {
    this.offsetindex = offsetindex;
}
public int getPageCount() {
    return pageCount;
}
public void setPageCount(int pageCount) {
    this.pageCount = pageCount;
}
private int curPage;
private int totalPage;

private int offsetindex;
private int pageCount;

}
Dao
package com.archives.dao;

import java.util.List;

import com.archives.entity.UserDept;
import com.archives.model.A0104Model;

public interface UserDeptDao {

UserDeptDao getUserDeptByName(String loginname);
int selectUserDeptCount(A0104Model model);
List<UserDept> selectUserDeptList(A0104Model model);

}
service
package com.archives.service;

import java.util.List;

import com.archives.entity.UserDept;
import com.archives.model.A0104Model;

public interface UserDeptService {
int selectUserDeptCount(A0104Model model);
List selectUserDeptList(A0104Model model);
}

serviceImpl
package com.archives.service;

import java.util.List;

import com.archives.dao.UserDeptDao;
import com.archives.entity.UserDept;
import com.archives.model.A0104Model;

public class UserDeptServiceImpl implements UserDeptService {

UserDeptDao  userdeptDao;

@Override
public int selectUserDeptCount(A0104Model model) {
    // TODO Auto-generated method stub
    int cnt=userdeptDao.selectUserDeptCount(model);
    return cnt;
}

@Override
public List<UserDept> selectUserDeptList(A0104Model model) {
    // TODO Auto-generated method stub
    List<UserDept> userdeptList =userdeptDao.selectUserDeptList(model);
    return userdeptList;
}

}
UserDept.java
package com.archives.entity;

public class UserDept {

private int deptid;
private String deptname;
private String telephone;
private String fax;
private String managerid;
private String remark;
public String getTelephone() {
    return telephone;
}
public void setTelephone(String telephone) {
    this.telephone = telephone;
}
public String getFax() {
    return fax;
}
public void setFax(String fax) {
    this.fax = fax;
}
public String getManagerid() {
    return managerid;
}
public void setManagerid(String managerid) {
    this.managerid = managerid;
}
public String getRemark() {
    return remark;
}
public void setRemark(String remark) {
    this.remark = remark;
}
public int getDeptid() {
    return deptid;
}
public void setDeptid(int deptid) {
    this.deptid = deptid;
}
public String getDeptname() {
    return deptname;
}
public void setDeptname(String deptname) {
    this.deptname = deptname;
}
public String getLoginid() {
    return loginid;
}
public void setLoginid(String loginid) {
    this.loginid = loginid;
}
public String getLoginname() {
    return loginname;
}
public void setLoginname(String loginname) {
    this.loginname = loginname;
}
public String getRealname() {
    return realname;
}
public void setRealname(String realname) {
    this.realname = realname;
}
private String loginid;
private String loginname;
private String realname;

}

14个回答

java.lang.NullPointerException
at com.archives.controller.sysmanage.DepartmentController.doPageData(DepartmentController.java:38)
at com.archives.controller.sy****smanage.DepartmentController.initHome(DepartmentController.java:32)

DepartmentController这个类的38行和32行报空指针,可以从本地debug下,跟踪一下数据,看哪个数据为空,做一下判空处理就好了

我看了上面的回答,讲你没有通过注解注入,这个。。。spring的注入方式太多了,不一定要死磕注解
spring4推荐使用构造注入,你可以试试
像使用@Autowire属性注入都是不推荐的,当然大部分情况程序都正常的

出现异常,多试试debug断点调试,看哪里为空

UserDeptDao userdeptDao; 这个对象没有采用注入吧@Autowired或@Resource

GHQZWW
扶琴 空指针是经常会报错的一个异常,也可以说是小错误,可能是你的返回值的问题,也有可能是你需要的 new 的对象,你忘记new了,还可能是你xml文件中的控件没有找到。把这几点看看应该就差不多了
接近 2 年之前 回复
weixin_37705192
悟笙 与楼主意见相同
接近 2 年之前 回复
csdn_shj
csdn_shj UserDeptService userdeptService; 还有这个
接近 2 年之前 回复

and userinfo.loginname = #{loginname} 、realname deptname 这三个参数取值的时候做下判断

and userinfo.loginname = #{loginname}

zyh18511041004
jokingZY 回复weixin_39125267: 你看下下面的截图 评论代码显示不出来我也不知道怎么回事给你截了一张图
接近 2 年之前 回复
weixin_39125267
weixin_39125267 在哪里添加这个判断?
接近 2 年之前 回复


and userinfo.loginname = #{loginname}


图片说明

持久层没有打注解,也可能是你的服务名称和路径配置错误

UserDeptDao userdeptDao;
改为:
@Resource
private UserDeptDao userdeptDao;

空指针异常如果是启动错误请查看sp配置文件

图片说明 这句上面加注解@Autowired

在java编程中,我们经常会遇到java.lang.NullPointerException,对于刚入门的程序员常常不知道为什么会出现这种错误,也不清楚如何查找出这种错误的具体地方,这里将教新手如何找出错误。

工具/原料
JDK
eclipse
方法/步骤
当有异常出现时,如果程序员没有将对其进行异常处理,那么异常将会出现在控制台上,如下面的控制台信息:
Exception in thread "main" java.lang.NullPointerException
at Main.f(Main.java:11)
at Main.main(Main.java:7)
第一行给出了是异常的原因,NullPointerException,这相当于c和c++里的空指针,所以必须处理,否则程序运行时会出错。
接下来的几行给出了出错的程序调用,指出了Main.java的11行出现java.lang.NullPointerException异常,但是具体的原因还得从调用的代码上去查找,这里是Main.java的第7行传递了null导致的
java.lang.NullPointerException异常分析
java.lang.NullPointerException异常分析
java.lang.NullPointerException异常出现的原因必定是出现了null,所以我们可以在代码中插入判断语句(也可以用调试的方法去查找),现在我在代码中插入
if(str==null)
System.out.println("这里的str值是null");
java.lang.NullPointerException异常分析
运行修改后的代码,出现了以下信息,其中我们判断如果str为null,就让它输出的提示信息,按照该方法我们可以判断出NullPointerException的具体原因,至于我们要如何对其修改,这根据程序的需求进行处理。可以用if判断是否为null,如果为null,就给出用户相关的提示信息,避免程序运行时出现出错。
java.lang.NullPointerException异常分析

共14条数据 1 尾页
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SSM框架—java.lang.NullPointerException,空指针异常处理
在测试SSM项目时,一直报空指针异常,明明配置文件与代码都没有错,为什么会这样呢? 五月 30, 2018 1:17:53 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [GoodShop] in context with path [/goshop] threw...
MyBatis 遇到java.lang.NullPointerException
014-06-07 15:11:25,794 [com.psa.pd.sera.biz.process.VesselProcessor.retrieveConnectionByServiceInfoUIList(VesselProcessor.java:356)] ERROR - Unknown exceptionrnorg.apache.ibatis.exceptions.PersistenceException: rn### Error querying database. Cause: java.lang.NullPointerExceptionrn### Cause: java.lang.NullPointerExceptionrn at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
SSM框架整合遇到的问题
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘orderDaoImpl’: Unsatisfied dependency expressed through field ‘template’; nested exception is org.sprin...
ssm挖坑,遇到的问题
1 报了一个错误:找不到org.springframework.web.servlet.DispatcherServlet,开始以为spring4.0.2不包含这个,后来仔细查看也没有,就选择另一个版本,最后发现其实是maven没有下载完整。删除重新下载即可。 2 要学会maven 仓库,可以删除和复制,慢慢完善,不用每次都去下载 3 出现问题的时候要多看日志,仔细分析,避免胡乱猜测
ssm框架搭建遇到的问题
ssm的搭建就不说了  网上教程多的是现在就说说ssm搭建过程中遇到的问题其实按照网上的教程一步步搭建就行了 刚刚搭建好后pom.xml会有叉叉 按网上说的做就搞定问题是之后 java resource有个红叉叉 然而目录下并没有什么错误 如图报错显示如下这个问题搞了我两天  还是在大神的帮助之下才解决了在商务找方法的过程中  我知道了这个问题是由于java编译器 maven版本的不对应造成的根据...
ssm遇到的问题
1、无法创建spring bean配置文件(spring Bean Definition)        说明maven项目不是spring  需要在pom文件中导入spring的jar包            Maven Repository中搜索spring bean            &amp;lt;!-- https://mvnrepository.com/artifact/org.sprin...
ssm项目遇到的问题
1、jsp显示不出来,查看jdk和tomcat的版本; 2、log4j.properties配置文件要放到src下面,放到子文件夹不起作用;(目前没找到配置文件路径的修改方法) 3、如果要在服务器tomcat中部署项目,jar包必须放到lib根目录下,lib下面不能建子文件夹。
ssm框架遇到的问题
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mapperScanner' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactoryBeanName'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'initialSize'; nested exception is java.lang.NumberFormatException: For input string: "$initialSize"rn
ssm框架整合遇到的问题
闲来无事,自己从头搭建一个ssm框架,把自己遇到的问题贴出来 这个搭建的步骤我是借鉴一个大神的来码的,感谢这位大神 这是他的博客地址  http://blog.csdn.net/zhshulin/article/details/37956105 在测试的时候我遇到了一个小问题 1.Error querying database.  Cause: org.springframework.jd
SSM遇到的问题汇总
最近在学SSM框架,今天照着网上的教程做了个登录的小例子,结果出现了很多问题,记录一下 先贴上教程网址http://www.cnblogs.com/alivn/p/4795995.html 1.eclipse加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.6 参考:http://blog.
SSM环境搭建遇到的问题
SSM环境搭建遇到的问题已解决SVNspringmvc整合部分测试未解决测试springmvc整合过程 已解决 SVN 右键maven项目,选择Team/share project,未出现share project界面。 解决方法:重新安装svn插件。参考以下博文:https://blog.csdn.net/rilaohn/article/details/70312827 在此感谢原作者。 spr...
SSM框架遇到的问题
SSM框架 WEB-INF下的JSP是不能通过URL直接访问的       http://blog.csdn.net/cai_eternal/article/details/53344183 关于ssm框架下怎么访问WEB-INF下的静态文件 http://blog.sina.com.cn/s/blog_13d23d8a80102x4jh.html
ssm整合遇到的问题
在这次做小整合项目中我在我的Controller中写了两个方法,分别是按照名称查询和查询全部,并用 @RequestMapping(name = &quot;list&quot;) 和 @RequestMapping(name = &quot;findAll&quot;)分别标记了这两个方法之后运行出现HTTP Status 500 – Internal Server Error Type Exception Report Messa...
Java gui编程中遇到的问题 java.lang.NullPointerException
我在我的GUI程序中定义了rnJLabel[][] label = new JLabel[4][6];rn但是后面我用到label[0][0].setsetText("1");rn时就总是异常java.lang.NullPointerExceptionrn这个有什么问题么?rn还有就是我用这条语句System.out.println(label.length);rn的时候得到的输出值只有4,只有它的行值,为什么不是24呢?rn我是一名初学者还望有知道的不吝赐教,不胜感激。
ssm框架整合时遇到的问题
这是我在整合struts2,mybatis,spring时遇到的一些问题,在此分享出来,并记录下来供参考. 第一个问题和解决方式: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. 异常
SSM项目搭建时遇到的问题
具体搭建过程请参考:http://blog.csdn.net/zhshulin/article/details/37956105 下面是我在搭建的过程中遇到的一些问题及解决方法,仅供参考: 1、缺少commons-pool包,报错如下: 此处解决方案就是在pol.xml文件中引入该包     commons-pool     commons-pool     1.5.5
学习SSM遇到的问题及解决方案
1. 前台往后台传值,后台接受方式原先是一个一个的接收值,并用单个值进行操作改进:将数据封装,用对象的方式传值接收,用对象.属性的方式操作2.Service包存在的作用Controller 是可以直接和Mapper 对应,但后期维护不易Service 降低耦合性,对业务逻辑的更改提供便利...
整合SSM框架遇到的问题
1.dao文件名字和对应的mapper文件名字不一样,以及&amp;lt;mapper&amp;gt;标签里面的napespace属性值不一样七月 04, 2018 1:23:57 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [springmvc] in context with...
ssm + ajax过程中遇到的问题
问题1:html文件中的静态资源无法访问(下面红色标记的部分无法访问) 问题2:ajax代码的url部分无法访问(下面红色标记的部分无法访问)
搭建SSM项目遇到的问题
问题一,引用引入的c3p0-3.0.1jar包报错有该包中有两个命名重复的bean,在数据源中引用报错,可能是jar问题。后来换了其他连接数据源的方式。 问题二,maven项目出现红色感叹后,项目引用的jar包文件损坏,清空maven本地仓库,再重新下载引入,重新build项目
ssm框架中遇到的问题
无法创建spring bean配置文件(spring Bean Definition)说明maven项目不是spring  需要在pom文件中导入spring的jar包Maven Repository中搜索spring bean&amp;lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-beans --&amp;gt;&amp;lt;...
ssm开发 jdk1.8遇到的问题
[img=https://img-bbs.csdn.net/upload/201708/17/1502932546_89163.png][/img]rnrn用JDK1.8所遇到的问题rn而用jdk1.7或者更低版本就没问题,这个是啥原因呢?
SSM框架中常遇到的问题
在web.xml中缺少Spring的监听器 在web.xml中添加 &amp;lt;!-- Spring监听器 --&amp;gt; &amp;lt;listener&amp;gt; &amp;lt;listener-class&amp;gt;org.springframework.web.context.ContextLoaderListener&amp;lt;/listener-...
SSM连接Oracle12C遇到的问题
SSM连接Oracle12C遇到的问题 作为简单记录 1、遇到问题 解决方法: 将spring-mybatis.xml文件中数据库配置链接修改 原来配置: 修改后配置: 将:修改为 / 2、ORA-28040: 没有匹配的验证协议 一般为JAR包问题 因为环境用得是JDK1.8所以将JAR包更换为 ojdbc8_g.jar 链接: https://pan.baidu.com/s/192pZZ...
idea 搭建ssm遇到的问题
昨天花了一晚上的时间,参考下面博客地址,来搭建SSM框架,其中遇到了不少问题,我把所有的问题都记录的下来。 http://blog.csdn.net/gebitan505/article/details/44455235/#comments   1.Failed to load ApplicationContext,IOException parsing XML document from
java.lang.nullpointerException的问题
照着书上抄的B_树的例子,两个文件BayerTree.java和Example10_4.javarn[img=https://img-bbs.csdn.net/upload/201509/04/1441342716_295846.jpg][/img]rnBayerTree.javarn[code=java]public class BayerTreernrn private int m; //m为B_树的阶rn private BayerTreeNode bt; rn // bt为树根指针rn final int MaxKey=1000;rn //关键字为最大值标记rn private class BayerTreeNodern //B_树中的节点定义rn int keyNum; //关键字的个数域rn BayerTreeNode parent; //父节点指针rn Object []key=new Object[m+1]; //保存n个关键字的域rn rn BayerTreeNode []ptr=new BayerTreeNode[m+1];rn // 保存n+1个指向子树的指针rn int []rec=new int[m+1];rn //保存记录的下标位置rn rn public BayerTree(int mm)rn rn m=mm;rn bt=null; //构造方法rn rn public void clear()rn rn bt=null; //清除B_树rn rn public int getM()rn rn return m; //返回阶数rn rn public int countKey()rn rn return countKey(bt); //rn rn public int countNode()rn return countNode(bt);rnrn public int depth()rn return depth(bt);rnrn public void print()rn rn print(bt);rn System.out.println();rn rnrn public boolean insert(Object k,int num)rn //向B_树中插入元素rn if(bt==null)rn rn bt=new BayerTreeNode();rn bt.keyNum=1;rn bt.parent=null;rn bt.key[1]=k;rn bt.key[2]=MaxKey;rn bt.rec[1]=num;rn bt.ptr[0]=bt.ptr[1]=null;rn return true;rn rn int i=0;rn BayerTreeNode xp=bt,p=null;rn while(xp!=null)rn rn i=1;rn while(((Comparable)k).compareTo(xp.key[i])>0)rn i++;rn if(((Comparable)k).compareTo(xp.key[i])==0) rn return false;rn else rn p=xp;xp=xp.ptr[i-1];rn rn BayerTreeNode ap=null;rn while(true)rn rn int j,c;rn for(j=p.keyNum;j>=i;j--)rn rn p.key[j+1]=p.key[j];rn p.rec[j+1]=p.rec[j];rn p.ptr[j+1]=p.ptr[j];rn rn p.key[i]=k;rn p.rec[i]=num;rn p.ptr[i]=ap;rn p.keyNum++;rn if(p.keyNum<=m-1)rn rn p.key[p.keyNum+1]=MaxKey; rn return true;rn rn c=(m%2!=0? (m+1)/2 : m/2);rnrn ap=new BayerTreeNode();rn ap.keyNum=m-c;rn ap.parent=p.parent;rn for(j=1;j0)rn i++;rn //whilern rnrn public int search(Object k)rn // 从B_树种查找关键字为k的记录的存储位置rn int i;rn BayerTreeNode p=bt;rn while(p!=null)rn rn i=1;rn while(((Comparable)k).compareTo(p.key[i])>0)rn i++;rn if(((Comparable)k).compareTo(p.key[i])==0)rn return p.rec[i];rn else rn p=p.ptr[i-1];rn rn return -1;rn rnrn private int countKey(BayerTreeNode btn)rn //求B_树中所有关键字的总数rn if(btn==null)rn return 0;rn elsern rn int c=0;rn for(int i=0;i<=btn.keyNum;i++)rn c+=countKey(btn.ptr[i]);rn return c+btn.keyNum;rn rn rn private int countNode(BayerTreeNode btn)rn //求B_树中所有节点数rn if(btn==null)rn return 0;rn elsern rn int c=0;rn for(int i=0;i<=btn.keyNum;i++)rn c+=countNode(btn.ptr[i]);rn return c+1;rn rn rn private int depth(BayerTreeNode btn)rn //求B_树中所有关键字的总数rn if(btn==null)rn return 0;rn else return 1+depth(btn.ptr[0]);rn rn rn private void print(BayerTreeNode btn)rn //中序遍历B_树中所有关键字和记录的存储位置rn if(btn!=null)rn rn print(btn.ptr[0]);rn for(int i=1;i<=btn.keyNum;i++)rn rn System.out.print("("+btn.key[i]+","+btn.rec[i]+")");rn print(btn.ptr[i]);rn rn rn rnrn[/code]rnExample10_4.javarn[code=java]public class Example10_4rnrn public static void main(String [] args)rn rn Integer []a=18,46,58,32,65,24,50,38,35,rn 47,82,93,20,33,48,15,26,44,78;rn BayerTree t=new BayerTree(5);rn for(int i=0;i
java.lang.NullPointerException问题
大家帮我看看运行时出现了这个错误, 这是为什么呢rnorg.apache.jasper.JasperException: Exception in JSP: /cook/login.jsp:6rnrn3: String UserName = "", UserEMail = "", LoginDate = "";rn4: Cookie temp = null;rn5: Cookie[] cookies = request.getCookies();rn6: int cookielen = cookies.length;rn7: rn8: for (int i = 0; i < cookielen; i++) rn9: temp = cookies[i];rnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnroot cause rnrnjava.lang.NullPointerExceptionrn org.apache.jsp.cook.login_jsp._jspService(login_jsp.java:48)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrn<%@ page language="java" contentType="text/html;charset=gb2312"%>rn<%rn String UserName = "", UserEMail = "", LoginDate = "";rn Cookie temp = null;rn Cookie[] cookies = request.getCookies();rn int cookielen = cookies.length;rnrn for (int i = 0; i < cookielen; i++) rn temp = cookies[i];rn if (temp.getName().equals("Name")) rn UserName = temp.getValue();rn else if (temp.getName().equals("E_Mail")) rn UserEMail = temp.getValue();rn else if (temp.getName().equals("LoginDate")) rn LoginDate = temp.getValue();rn rn rn int tmplen = LoginDate.length();rn boolean FirstLogin;rn if (tmplen != 0) rn FirstLogin = false;rn else rn FirstLogin = true;rn rn%>rnrnrnrn rnrn Cookie 有效时间的设置rnrn rnrnrn rn Cookie有效时间的设置 rn rn <% rn if(FirstLogin==true)rn rn %>rn rn 首度登陆的朋友请输入EMAILrn <% rn rn elsern rn %>rn 欢迎再次光临,您曾于<%= LoginDate %>rn <%rn rn %>rn rn rn 姓名:rn rn rn E-Mailrn rn rn rn rn rn rn rn rnrn
Java.lang.NullPointerException 的问题
我做一个查询分页程序,查询条件是2个,一个是下拉框,一个是文本框。rn查询出的结果很多,要进行分页,这时候就出现问题了。rn第一个页面能正常显示,然后 下一页 就不能显示了。rn指示这一行出错:rnexception rnorg.apache.jasper.JasperException: Exception in JSP: /query/chaxunref1.jsp:157rn157: String txt=new String(request.getParameter("txfield").trim().getBytes("ISO-8859-1"));rnroot cause rnjava.lang.NullPointerExceptionrn org.apache.jsp.query.chaxunref1_jsp._jspService(chaxunref1_jsp.java:217)rnrn好像是第二次request时,出现的问题。各位帮忙看看吧,谢谢了。。rn
java.lang.NullPointerException 的问题
java.lang.NullPointerExceptionrnrn出现了这个异常,很多次都出现这个问题。rnorg.apache.jasper.JasperException: Exception in JSP: /action.jsp:12rnrn<%rn9: String cif=request.getParameter("fl");//保存查询字段rn10: HardWare hw=(HardWare)session.getAttribute("hw");rn11: if(!cif.equals("null"))rn12: hw.setCif(cif);rn13: rn14: String qvalue=(request.getParameter("search"));//查询关键字,并将其值通过中文处理,即用户输入中文可以正确识别rn15: if(qvalue!=null)rnrn……rn%>rnrn在上面的html 中代码如下“rnrnrn rn 请输入关键字查找: rn rn 所有资讯rn 国内快讯rn 国际快讯rn 市场行情rn 新产品新技术rn rn rnrnrn为什么出现这样的问题,要怎样处理呢?高手指点下!谢谢rn
java.lang.NullPointerException的问题
照着书写的一个“设置窗体标题栏图标”。但是运行的时候提示java.lang.NullPointerException。rn代码如下:rn[code=java]rnpackage thirdthChapter;rnrnrnimport java.awt.BorderLayout;rnimport java.awt.EventQueue;rnimport java.awt.Image;rnimport java.awt.Toolkit;rnimport java.net.URL;rnimport javax.swing.ImageIcon;rnimport javax.swing.JFrame;rnimport javax.swing.JPanel;rnimport javax.swing.border.EmptyBorder;rnimport javax.swing.JButton;rnimport java.awt.event.ActionListener;rnimport java.awt.event.ActionEvent;rnimport javax.swing.UIManager;rnrnpublic class FrameIcon extends JFrame rn rn /**rn * rn */rn private static final long serialVersionUID = 317032021100672658L;rn private JPanel contentPane;rn private JButton button1;rn private JButton button2;rn private JButton button3;rn private JButton button4;rn rn /**rn * Launch the application.rn */rn public static void main(String[] args) rn try rn UIManagerrn .setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");rn catch (Throwable e) rn e.printStackTrace();rn rn EventQueue.invokeLater(new Runnable() rn public void run() rn try rn FrameIcon frame = new FrameIcon();rn frame.setVisible(true);rn catch (Exception e) rn e.printStackTrace();rn rn rn );rn rn rn /**rn * Create the frame.rn */rn public FrameIcon() rn setResizable(false);rn setTitle("\u6307\u5B9A\u7A97\u4F53\u6807\u9898\u680F\u56FE\u6807");rn setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn setBounds(100, 100, 535, 348);rn contentPane = new JPanel();rn contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));rn contentPane.setLayout(new BorderLayout(0, 0));rn setContentPane(contentPane);rn rn BackgroundPanel backgroundPanel = new BackgroundPanel();rn URL resource = getClass().getResource("D:/Documents/Pictures/background.jpg");rn Image image = new ImageIcon(resource).getImage();rn backgroundPanel.setImage(image);rn contentPane.add(backgroundPanel, BorderLayout.CENTER);rn rn JPanel panel = new JPanel();rn panel.setOpaque(false);rn panel.setBounds(45, 212, 447, 54);rn backgroundPanel.add(panel);rn rn button1 = new JButton("\u56FE\u68071");rn button1.setIcon(new ImageIcon(getClass().getResource("icon1.png")));rn button1.addActionListener(new ActionListener() rn public void actionPerformed(ActionEvent e) rn do_button_actionPerformed(e);rn rn );rn panel.add(button1);rn rn button2 = new JButton("\u56FE\u68072");rn panel.add(button2);rn button2.setIcon(new ImageIcon(getClass().getResource("icon2.png")));rn button2.addActionListener(new ActionListener() rn public void actionPerformed(ActionEvent e) rn do_button_actionPerformed(e);rn rn );rn rn button3 = new JButton("\u56FE\u68073");rn panel.add(button3);rn button3.setIcon(new ImageIcon(getClass().getResource("icon3.png")));rn button3.addActionListener(new ActionListener() rn public void actionPerformed(ActionEvent e) rn do_button_actionPerformed(e);rn rn );rn rn button4 = new JButton("\u56FE\u68074");rn panel.add(button4);rn button4.setIcon(new ImageIcon(getClass().getResource("icon4.png")));rn button4.addActionListener(new ActionListener() rn public void actionPerformed(ActionEvent e) rn do_button_actionPerformed(e);rn rn );rn rn rn protected void do_button_actionPerformed(ActionEvent e) rn String resource = "";// 定义图标文件名称变量rn if (e.getSource() == button1)// 确定用户单击的按钮rn resource = "icon1.png";// 确定按钮对应的图标文件rn if (e.getSource() == button2)rn resource = "icon2.png";rn if (e.getSource() == button3)rn resource = "icon3.png";rn if (e.getSource() == button4)rn resource = "icon4.png";rn URL url = getClass().getResource(resource);// 获取图标文件路径rn setIconImage(Toolkit.getDefaultToolkit().getImage(url));// 设置窗体的图标rn rnrnrn[/code]rnrn错误信息提示如下:rnjava.lang.NullPointerExceptionrn at javax.swing.ImageIcon.(ImageIcon.java:205)rnrn //感觉这两句是关键rn at thirdthChapter.FrameIcon.(FrameIcon.java:67)rn at thirdthChapter.FrameIcon$1.run(FrameIcon.java:43)rnrnrn at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)rn at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)rn at java.awt.EventQueue.access$000(EventQueue.java:101)rn at java.awt.EventQueue$3.run(EventQueue.java:666)rn at java.awt.EventQueue$3.run(EventQueue.java:664)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)rn at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)rn at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)rn at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)rn at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)rn at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)rn at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)rn at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)rnrnrn请帮忙看看,哪出的问题啊 谢谢
java.lang.NullPointerException的问题??
这是action中的文件,debug到这里List list = SpeakforServingService.getAll(dc);就报空指针了,谢谢各位帮忙看下!rn报错信息如下:rn[code=Java]2009-09-22 14:38:35,125 WARN [http-8082-4] (RequestProcessor.java:528) WARN - Unhandled Exception thrown: class java.lang.NullPointerExceptionrn2009-9-22 14:38:37 org.apache.catalina.core.ApplicationContext logrn信息: java.lang.NullPointerException[/code]rnrnaction的代码:rn[code=Java]public ActionForward execute(ActionMapping mapping,rn ActionForm form, HttpServletRequest request,rn HttpServletResponse response) throws Exception rn rn ServicesForm servicesForm = (ServicesForm) form;rnrn String names = request.getParameter("names");rn DetachedCriteria dc = DetachedCriteriarn .forClass(Services.class);rn if (names != null && !names.equals("")) rn dc.add(Restrictions.like("names", names,rn MatchMode.ANYWHERE));rn rn List list = SpeakforServingService.getAll(dc);rn int totalrow = list.size();rn int perpagerow = servicesForm.getPerpagerow();rn int currentpage = servicesForm.getCurrentpage();rn if (currentpage == 0) rn servicesForm.setCurrentpage(1);rn rn int start = (currentpage - 1) * perpagerow;rn List pageList = SpeakforServingService.findPageList(dc,rn start, perpagerow);rn servicesForm.setTotalrow(totalrow);rnrn request.setAttribute("servicesList", pageList);rn request.setAttribute("servicesForm", servicesForm);rn request.setAttribute("names", names);rn return mapping.findForward("toSpeakfor");rn rnrn[/code]rnrndebug到这个地方:[color=#FF0000]List list = SpeakforServingService.getAll(dc);[/color]就报错了!
java.lang.NullPointerException 问题
用myeclipse10.0 刚开始的时候是可以的~ 之后把.metadata文件夹删掉 重新导入项目之后,可以正常编译,但是运行的时候,页面无法显示,会提示java.lang.NullPointerException 这样的错误:rn具体错误如下:rnHTTP Status 500 -rnrntype Exception reportrnrnmessagernrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexceptionrnrnorg.apache.jasper.JasperException: java.lang.NullPointerExceptionrn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:55)rnroot causernrnjava.lang.NullPointerExceptionrn org.apache.jsp.login_jsp._jspInit(login_jsp.java:27)rn org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)rn org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:55)rnnote The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.rnrnrnlogin.jsp 第27行代码如下:rn rnrnrnrn请各位大神帮帮忙~ 看看问题可能出现在哪里~ 刚开始做JAVA 菜鸟一枚~~ 希望各位能够说的简单点~ rnrn谢谢~~~
SSM框架遇到的乱码问题
原因 解决 post get 原因 浏览器以某种编码发送请求(通常UTF-8),服务器接收请求,按照服务器的编码方式解码(tomcat默认ISO8859-1)。 这样前后端编码方式不一致导致乱码问题。 解决 tomcat中get和post处理不一样,乱码问题处理也不一样。 post web.xml中配置过滤器。 &amp;lt;filter...
ssm遇到的第一个错误
http://bbs.csdn.net/topics/392030533?page=1#post-401664548
ssm遇到的第一个难关
先来报错内容rn Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemsController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iteamsServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'itemsMapper' must be of type [com.itheima.ms.mapper.ItemsMapper], but was actually of type [com.sun.proxy.$Proxy16]rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:307)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)rn at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4792)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)rn at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:629)rn at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1839)rn at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)rn at java.util.concurrent.FutureTask.run(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn at java.lang.Thread.run(Unknown Source)rnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iteamsServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'itemsMapper' must be of type [com.itheima.ms.mapper.ItemsMapper], but was actually of type [com.sun.proxy.$Proxy16]rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:307)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1014)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:957)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:855)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:441)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:419)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:544)rn at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:155)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:304)rn ... 26 morernCaused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'itemsMapper' must be of type [com.itheima.ms.mapper.ItemsMapper], but was actually of type [com.sun.proxy.$Proxy16]rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:376)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:445)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:419)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:544)rn at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:155)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)rn at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:304)rn ... 42 more
SSM项目遇到的乱码问题
项目小记:SSM框架遇到的乱码问题 在整合Spring+springmvc+mybatis的时候遇到的乱码坑,做下笔记。 1)在web.xml里面需要配置过滤器 &lt;filter&gt; &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.springfra...
ssm中遇到的报错
错误总是能让人成长的最快。今天重新用maven搭建ssm框架,身为小白的我,又被各种报错虐。真的是报错虐我千百遍,我待报错如初恋。话不多说上报错:     1、错误:找不到oracle驱动          原因: maven中央仓库对oracle驱动包支持不是很好,可以手动添加驱动包到仓库         解决方法:1.1查看本机oracle的版本     执行如下命令sqlplus  
SSM框架整合遇到的一些问题。
HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating cl...
ssm项目遇到的一些问题
spring单元测试 真的是个坑 ,报错原因是因为spring版本的冲突,遇到错的兄弟可以看下自己的maven 目录下所有的 org.spring下的jar包是不是版本都一样,尤其时spring-test. 数据库重新自增 //方法① USE 数据库名 DELETE FROM 表名 ALTER TABLE 表名 auto_increment = 1;、 //方法② USE 数据...
SSM框架开发遇到的错误
本人小白一枚 刚学完SSM框架 用eclipse按照例子敲了个网站 运行出来没有css样式 在chrome也没有 上图求教[img=https://img-bbs.csdn.net/upload/201807/26/1532596274_15529.png][/img]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数