java web空指针,java - Web服务中的Java空指针异常@autowired [重复] - 堆栈内存溢出
错误:domain.SpeakerRecog.test上的java.lang.NullPointerException
SpeakerMapper为null, speakermapper.insertUserAndEnrollmentId(userid, enrollmentid)出错speakermapper.insertUserAndEnrollmentId(userid, enrollmentid)它抛出Java空指针异常。 数据源是在控制台中创建的。 我尝试添加诸如@Configuration , implements类的注释,但仍无法正常工作。 我试图将数据插入localhost中数据库的表中。 它与线程“为什么我的Spring @Autowired字段为null为何”不同。 因为我没有创建新的构造函数,但是我遵循了那里给出的建议,但是它仍然无法正常工作
WebService Java文件:
package domain;
import javax.jws.WebMethod;
import javax.jws.WebService;
import mapper.Speakermapper;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import org.springframework.beans.factory.annotation.Autowired;
@WebService(serviceName = "SpeakerRecognitionWS")
public class SpeakerRecog extends SpringBeanAutowiringSupport{
@Autowired
private Speakermapper speakermapper;
@WebMethod
public String test(){
String userid = "111";
String enrollmentid = "111";
try{
speakermapper.insertUserAndEnrollmentId(userid, enrollmentid);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
这是Speakermapper.java文件:
package mapper;
import org.apache.ibatis.annotations.Param;
public interface Speakermapper {
public void insertUserAndEnrollmentId(@Param("userid") String userid,
@Param("enrollmentid") String enrollmentid);
}
**这里是Speakermapper.xml:
Insert into SpeakerIds
(userid, enrollmentid)
Values (#{userid}, #{enrollmentid})
**这里是applicationContext.xml:此xml是否存在错误。 我不知道。
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation= "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
java web空指针,java - Web服务中的Java空指针异常@autowired [重复] - 堆栈内存溢出相关推荐
- android studio 本地html,android - 从当前HTML文件Android Studio中打开本地HTML文件? - 堆栈内存溢出...
我在Android Studio上制作了一个WebView应用. 它会正确打开我的默认索引HTML页面 @Override protected void onCreate(Bundle savedIn ...
- java中方法未定义_java - Java SE中的未定义方法错误 - 堆栈内存溢出
我为该问题写了一个代码http://www.spoj.com/problems/PRIME1/ ,该代码的作用是将输入以字符串形式输入,然后将split()拆分为两个整数,并存储在该数组中.然后返回到 ...
- java 字符串转utc时间_java - 如何转换UTC日期字符串并删除Java中的T和Z? - 堆栈内存溢出...
TL;博士 Instant.parse( "2018-05-23T23:18:31.000Z" ) // Parse this String in standard ISO 860 ...
- pdfbox java.lang.outofmemoryerror_java - PDFBox 2.0.1挂起渲染pdf页面 - 堆栈内存溢出
可以在Java 8 VM中重现该问题. 正如@Tilman在他的回答中已经提到的,这是Java 8使用与以前的Java版本不同的颜色管理系统引入的一个问题. 通过使用新的色彩管理系统分析VM行为,可以 ...
- java ftp 关闭连接_java - 使用Java Apache FTPClient进行FTP TLS获取“握手时远程主机关闭连接”[重复] - 堆栈内存溢出...
我在Windows 10 64x上为FTP TLS(org.apache.commons.net.ftp)运行了一个Java(1.8)程序: FTPSClient ftpClient = new FT ...
- java自带的unpack闪退,java - 使用requiresUnpack无法正常使用Maven构建的Spring Boot JAR - 堆栈内存溢出...
我的POM看起来像这样: xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/ ...
- flyingsaucer转换多个html,java - 使用FlyingSaucer将包含阿拉伯字符的HTML页面转换为PDF - 堆栈内存溢出...
我想使用FlyingSaucer将包含阿拉伯字符的HTML页面转换为PDF文件,但生成的PDF不包含组合字符并向后打印输出. HTML: جميع الحقوق Java摘录: String inpu ...
- java多属性的map_java - 具有多个参数的MapStruct QualifiedByName - 堆栈内存溢出
目前,MapStruct不支持具有多个源属性的映射方法. 但是,在您的情况下,您可以使用1.2.0中的@Context . 根据我的理解, projId和code就像映射的帮助器一样,它们不用于映射目 ...
- java 图片有损压缩_java - 用有损jpeg压缩多页tiff图像 - 堆栈内存溢出
将图像从16位减少到8位. 假设您有一个byte []变量plane16,在其中您有图像的所有像素. 注意 :我的byte [] plane16从16位图像获取数据,但是byte为8bit = 1by ...
最新文章
- python从入门到精通学习笔记_Python从入门到精通之基础概念
- 2.2 Spring属性注入-构造方法
- 【haproxy初始化】init_haproxy.sh
- Spring Boot 面试题整理
- C语言hmacsha1,在C中执行hmac sha1
- 没有弃用 Sun 拥抱 HP/Linux,亚马逊或已倒闭!
- 惊,Java 字符串拼接竟然有这么多玩法!| CSDN 原力计划
- 业务数据分析学习笔记--Lesson1
- win10桌面管理文件收纳_处女座福音 整理Win10桌面图标新玩法
- 一键轻松去除抖音火山等短视频水印~
- 最简单的正版Win10重装系统教程
- 微信公众号获取定位地图(有经纬度)
- SQL Server over()
- 使用RRDTOOL进行绘图
- 京东商品图片下载工具1.0 springboot版
- Postgressql获取当前系统的年份及上一年和下一年
- source命令用法
- 大型医院分诊系统源码 排队叫号系统源码 C#源码
- ubuntu16.04使用小觅相机
- LInux环境安装flasher插件