抽象类注入JedisPool失败

public abstract class BusinessIdGenerateAbstract implements Serializable{

protected JedisPool jedisPool;

protected void fromRedis(String idName,Queue queue){

    try {
        jedis = jedisPool.getResource();
        Map<String,String> model = jedis.hgetAll(idName);
        Long redisCurrentId = Long.valueOf(model.get("currentId"));
        for (int i = 1; i <= increase; i++) {
            redisCurrentId += 1;
            queue.offer(redisCurrentId);
        }
        model.put("currentId", String.valueOf(redisCurrentId));
        jedis.hmset(idName,model);
    } catch (Exception e) {
        e.printStackTrace();
        logger.error("fromRedis--failed");
    }finally{
        if(null != jedis) {
            jedisPool.returnResource(jedis);
        }
    }
}
//spring配置
 <bean id="businessIdGenerateAbstract" class="com.fangcang.sequence.entity.BusinessIdGenerateAbstract" abstract="true">
    <property name="jedisPool" ref="jedisPool"></property>
</bean>

<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
    <constructor-arg index="0" ref="jedisPoolConfig" />
    <constructor-arg index="1" value="${redis.ip}" />
    <constructor-arg index="2" value="${redis.port}" type="int"/>
    <constructor-arg index="3" value="${common.redis.timeout}" type="int"/>
    <constructor-arg index="4" value="${common.redis.password}" />
</bean>

<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
    <property name="maxIdle" value="${common.redis.maxIdle}"></property>
    <property name="minIdle" value="${common.redis.minIdle}"></property>
    <property name="maxTotal" value="${common.redis.maxTotal}"></property>
    <property name="maxWaitMillis" value="${common.redis.maxWait}"></property>
</bean>

启动Jboss后,调用方法时,报错,jedisPool is null

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
记录jedisPool注入的jedisPoolConfig的问题
最近在使用redis的时候遇到一个问题,记录一下jar包版本:    jedis-2.9.0.jar    commons-pool2-2.4.3.jar    spring-*-3.24.jar&amp;lt;context:property-placeholder ignore-unresolvable=&quot;true&quot; location=&quot;classpath:redis.properties&quot; /&amp;gt...
JedisPool
<p>rn <br />rn</p>rn<p>rn <p>rn 20周年限定一卡通!<span style="color:#337FE5;">可学Java全部课程</span>,仅售799元(原价7016元),<span style="color:#E53333;">还送漫威正版授权机械键盘+CSDN 20周年限量版T恤+智能编程助手!</span>rn </p>rn <p>rn 点此链接购买:rn </p>rn <table>rn <tbody>rn <tr>rn <td>rn <span style="color:#337FE5;"><a href="https://edu.csdn.net/topic/teachercard?utm_source=jsk20xqy" target="_blank">https://edu.csdn.net/topic/teachercard?utm_source=jsk20xqy</a><br />rn</span>rn </td>rn </tr>rn </tbody>rn </table>rn</p>rn<span>&nbsp;</span> rn<p>rn <br />rn</p>rn本阶段课程涵盖Java开发流行的自动化构建工具:Maven,版本控制系统:SVN和Git,容器虚拟化技术:Docker,权限模型:RBAC,集成测试:Jenkins,微服务架构:SpringCloud等核心内容。旨在应对各种实际开发情况下的的各种开发场景及业务的需要。
Jedis配置,项目启动注入JedisPool
Jedis配置,项目启动注入JedisPool @EnableAutoConfiguration @PropertySource("classpath:config.properties") @ConfigurationProperties(prefix = "redis") public class JedisConfig { /** * LOGGER */ ...
Spring boot JedisPool初始化失败的 解决方案
最近在开发中使用radis的时候遇到了这个问题 redis.clients.jedis.JedisPool.&amp;lt;init&amp;gt;(Lorg/apache/commons/pool2/impl/GenericObjectPoolConfig;Ljava/lang/String;IILjava/lang/String;ILjava/lang/String;Z)V从错误中我知道是 JedisPool...
注入失败
注入线程失败 显示0x000000 内存不能read 这是为什么 求解
jedisPool的使用
遇到的问题: 一开始做项目一直用的是jedis对象连接,今天发现自己上线的项目抛出了异常:JedisConnectionException: java.Net.SocketTimeoutException: Read timed和和java.lang.ClassCastException: [B cannot be cast to java.util.List。 异常解释: jedis的默认读取时...
JedisPool工具类
public class JedisPoolUtils {     private static JedisPool pool = null;     static{         //加载配置文件         InputStream in = JedisPoolUtils.class.getClassLoader().getResourceAsStream("redis.prope
@Resource注解失败之抽象类
太久没复习java基础知识了。今天在写代码的时候,把一个Service类写成abstract的,然后就开始报错了。。ERROR [org.springframework.web.context.ContextLoader] - &amp;lt;Context initialization failed&amp;gt;  org.springframework.beans.factory.BeanCreationE...
spring抽象类中注入bean
在使用spring的时候,有时由于设计的需要,需要使用抽象类(比如模板方法模式),但在抽象类中实现方法是需要依赖其他的接口或类的方法,这时就需要对依赖的接口或类进行注入,需要注意以下内容: 在抽象类中需要注入(@autowire),在继承了该抽象类的子类中同样需要再次注入。比如当前项目中,用户购买物品的模板抽象类中需要使用userservice,则在改抽象类中和道具服务类(实现了道具接口并继承了...
mapper注入失败
Error creating bean with name 'slideMapper' defined in file xxx新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富...
反射注入失败的原因!
因为前一段时时间公司没有什么新项目,个人闲着无聊就写自己人生中第一个框架(方便自己以后偷懒...)。可能是自己的技术还是不够吧,这期间遇到很多问题,而且网上基本找不到这种问题的答案,这也是我写这篇博文的原因。 下面来讲一下我在其中遇到主要的问题,注入失败(主要是对spring不熟悉造成的) 框架是通过配置文减里指定的类里面指定的方法去对页面静态化处理
SpringMVC+mybatis注入失败?
[code=html]org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ints.service.UserService com.ints.controller.UserController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ints.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)rn at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)rn at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)rn at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)rn at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)rn at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)rn at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)rn at javax.servlet.GenericServlet.init(GenericServlet.java:212)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)rn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)rn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ints.service.UserService com.ints.controller.UserController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ints.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)rn ... 34 morernCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ints.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)rn ... 36 morern2016-11-21 14:31:06,381 [main] ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed[/code]rnrnrnrnrn[img=https://img-bbs.csdn.net/upload/201611/21/1479710146_181811.png][/img]
DLL为何注入失败
环境:Win81 中文64bit, VS2014rn参考文档:rnWindows核心编程(第5版) 第22章rnhttp://blog.chinaunix.net/uid-26275986-id-3141902.htmlrnhttp://blog.chinaunix.net/uid-26275986-id-3141902.htmlrnrn要求结果:注入自己写的dll,看见一个弹出框rn [code=c] case DLL_PROCESS_ATTACH: rn // attach to process rn // return FALSE to fail DLL load rn MessageBoxA(0, "I am a dll!", "DLL Message", MB_OK | MB_ICONINFORMATION); rn break; [/code]rn实现结果:rn我分别尝试了 1. 自身进程 2. notepad.exe 3. mspaint.exe 4. calc.exe 5. winlogon.exe 6. firefox.exe 7 Alipaybsm.exe rn其中:1/2/3/4都成功了,能看见弹出框。rn 5在CreateRemoteThread()失败了,返回5. rn 6/7调用CreateRemoteThread()没失败,但是 WaitForSingleObject(hThread, INFINITE);这句立即返回WAIT_OBJECT_0。我没看见弹出框。rn 6/7运行在admin用户下rnrn疑问:rn 1. 为何6/7不能成功?rn 2. 如何让5成功?rnrn目前已无分可用,希望大家帮忙解答
spring 注入失败报错
报错代码片段: Error creating bean with name 'itemServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire...
springboot报错注入失败
2019-05-05 12:49:26.346 WARN 1900 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframewor...
Autowried注入失败
原因 在分布式开发中,在开发搜索系统时,发布Dubbo服务由于自己的糊涂,忘记, 设置web.xml文件了,难怪怎么修改Dubbo服务,都不会报错,spring容器都没初始化,服务没有发布成功。 在Web层才提示错误 org.springframework.beans.factory.BeanCreationException: Error creating bean with name
注入bean失败
1 . springboot+dubbo+zookeeper启动provider时报错RedisUtils注入失败 RedisUtils是以工具jar包依赖到shop-user工程中,该工程包含2个项目shop-user-provider和shop-user-consumer ,  配置application.yml没问题 ,  解决办法在主程序上加注解   @Import({RedisUti...
@autowire 注入失败
idea 启动报错  Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'WXCouponSupplyServ...
spring bean 注入失败
1.异常信息 2.有可能引起的原因: 1.在applicationContext-service.xml的配置文件里的包扫描不对 2.在web.xml里没有加载spring容器 3.分布式工程,使用dubbo通信,在服务层,或者消费层, 单词写错了 4.还有一种可能,有可能是pom 里的jar包冲突 当时我看了这些就去解决,但是都无效 这个异常属于bean创建异常,原因是我的xml的路径设...
注入bean失败异常
org.springframework.beans.factory.BeanCreationException: 注入 bean 失败异常 bean 注入失败的原因包括以下几种但不限于这几种: 对应的 bean 没有添加注解; 对应的 bean 添加注解错误,例如将 Spring 的@Service错选成 dubbo 的; 选择错误的自动注入方法等。 然后发现是注解少写了一个@Service,在U...
spring自动注入失败
启动没有报错,但是注入失败xxService的值为null。应该是哪里的问题搞了一下午都没有解决。。。
HttpSolrServer注入失败
[b]HttpSolrServer老是注入失败[/b]rn[color=#FF0000] Error creating bean with name 'itemServiceImp': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.solr.client.solrj.impl.HttpSolrServer com.taotao.search.service.imp.ItemServiceImp.httpSolrServer; nested exception is java.lang.NoClassDefFoundError: org/apache/http/entity/mime/content/ContentBodyrn[/color]rn[b]这是我的applicationContext-Service的配置文件[/b]rn[img=https://img-bbs.csdn.net/upload/201806/05/1528164070_275524.png][/img]rn[b]奇怪的是,我写的测试类中从ApplicationContext中能找到类并使用[/b]rn[img=https://img-bbs.csdn.net/upload/201806/05/1528164169_605601.png][/img]rn[b]而service死活注入不了[/b]rn[img=https://img-bbs.csdn.net/upload/201806/05/1528164252_703887.png][/img]rn[b]请问这到底是怎么回事?[/b]rn
spring 注入失败
web.xmlrnrnrn rn contextConfigLocationrn classpath:applicationContext-*.xmlrn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn dispatcherServletrn org.springframework.web.servlet.DispatcherServletrn rn contextConfigLocationrn /WEB-INF/profiles/applicationContext.xmlrn rn 1rn rn rn dispatcherServletrn *.dorn rnrnrn CloudServpagern rn index.htmlrn index.htmrn index.jsprn default.htmlrn default.htmrn default.jsprn rnrnrnapplicationContext.xmlrnrnrn rn rn rn org.springframework.web.servlet.view.JstlViewrn rn rn /WEB-INF/web/rn rn rn .jsprn rn rnrn rn rn rn rn loginActionrn loginActionrn loginActionrn loginActionrnrn roleActionrn roleActionrnrn houseActionrn houseActionrn houseActionrn rn rnrn rnrn rn rn rn rnrnrnrnapplicationContext-ibatis.xmlrnrnrnrnrn rn rn rn java:comp/env/jdbc/CloudServpagern rn rnrn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rnrnrnrn rn rn rn rn rn rn classpath:springSqlMapConfig.xmlrn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnapplicationContext-beans.xmlrnrnrn rn rn rnrn rn rn rn rnrn rn rn rn rnrnrnrnrn以上是我的spring配置文件rn下面是action 使用 对象时,发现对象没有注入,HouseBusiness为null。rnpublic class LoginAction extends MultiActionController rnrn private HouseBusiness housebusiness;rn rn public HouseBusiness getHousebusiness() rn return housebusiness;rn rnrn public void setHousebusiness(HouseBusiness housebusiness) rn this.housebusiness = housebusiness;rn rnrnibatis也注入失败rn严重: Servlet.service() for servlet dispatcherServlet threw exceptionrnjava.lang.IllegalArgumentException: No SqlMapClient specifiedrn
DLL注入失败 2
继续昨晚的调试。今天请教了一个高手,他觉得可能原因有:1.游戏有防护,防止读写——但是为啥CE和OD可以直接附加并分析呢?2.有的游戏不响应消息循环里的键盘消息,对其进行了屏蔽——不是很明白,如果是这样的话,游戏是怎么相应键盘消息的呢?比如说输入账号,或者是聊天?虽然不明白,但还是先尝试一下通过函数来提升一下注入进程的权限——结果还是失败,返回的错误码显示是 AdjustTokenPrivileg...
dubbo开发注入失败
dubbo开发时注入报错,以下是错误信息 Description: A component required a bean of type 'com.sangular.dolphin.api.item.AttributeServiceRemote' that could not be found. Action: Consider defining a bean of type 'co...
springmvc注入失败
注入失败的问题,感觉很头痛,而且经常是稀里糊涂的解决了,遇到了又不知道是哪里出了问题。这里总结几种出现该问题的解决方法,通常都是这些地方不注意造成的。 通常错误是这样。 可能出问题的地方: 1.忘记加注解 这个比较少见,都不会忘记,另外注解要加在实现类里面,不要加在接口里面(有的人还会犯这种问题)。 2.忘记打开注解方式 3.扫描的包不正确,或者是没有扫描到全部
autoware自动注入失败
注入失败,个人总结 有这么几点, 1:spring 配置文件没有扫描包 检查下有没有这句 2:你的被注入的类有没有被spring管理 也就是有没有加注解, 3,:还有一点是一般新手可能遇到的,就是给servlet注入,这点和第二点是一样的,就是servlet不是被spring管理的,而是被tomcat或者其他服务器容器管理的,两者使用的不是同一个对象,这时,如果需要在你的servlet中使用
线程注入失败
[code=C/C++]rn//Dll5.dll,要注入的dllrn#include rnBOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) rn rnrn switch (ul_reason_for_call) rnrn rnrn case DLL_PROCESS_ATTACH: rnrn MessageBox(0,"HelloWorld!","message",0); //弹个窗口rnrn break; rnrn case DLL_THREAD_ATTACH: rnrn break; rnrn case DLL_THREAD_DETACH: rnrn break; rnrn case DLL_PROCESS_DETACH: rnrn break; rnrn rnrn return TRUE; rnrn rnrn[/code]rnrnrn[code=C/C++]rn//注入程序程序最后提示注入成功了,但是确没有弹窗口.rn#include rn#include rnint main(int argc,char* argv[]) rn HWND hWin = NULL;rn HANDLE hProcess = NULL;rn HANDLE reMoteThread = NULL;rn unsigned long pid = 0;rn void* pointer = NULL;rn char* dllName = "Dll5.dll";rn PTHREAD_START_ROUTINE startAddress = NULL;rn hWin = FindWindow("notepad",NULL);//注入的是notepad.exe记事本,运行程序前,先打开记事本rn if(hWin == NULL) rn printf("找不到窗口!");rn return 0;rn rn GetWindowThreadProcessId(hWin,&pid);rn //printf("%d\n",pid);rn hProcess = OpenProcess(PROCESS_ALL_ACCESS,true,pid);rn if(hProcess == NULL) rn printf("无法打开进程!");rn return 0;rn rn pointer = VirtualAllocEx(hProcess,NULL,9,MEM_COMMIT,PAGE_READWRITE);rn// printf("%d",pointer);rn if (WriteProcessMemory(hProcess,pointer,dllName,9,NULL) == 0) rn printf("写入进程失败!");rn return 0;rn rn startAddress = (PTHREAD_START_ROUTINE )GetProcAddress(GetModuleHandle("kernel32"),"LoadLibraryW");rn if (startAddress == NULL) rn printf("无法获得loadliabrary的地址!");rn return 0;rn rn reMoteThread = CreateRemoteThread(hProcess,NULL,0,startAddress,pointer,0,NULL);rn if (reMoteThread == NULL) rn printf("创建远程线程失败!");rn CloseHandle(hProcess);rn return 0;rn rn VirtualFree(pointer,9,MEM_DECOMMIT);rn CloseHandle(reMoteThread);rn CloseHandle(hProcess);rn printf("远程线程注入成功!");rn return 0;rnrnrn[/code]
dll注入失败
rn使用了easyhook,rn1、 Config.Register("WowInjector App", "InjectedDll.dll", "DllInjector.exe");这一行出错,说什么the given user library "injecteddll.dll" is not strongly named;rnrn2、wowPid = procs[0].Id;居然是0,我多调试几次试试。。。rnrn3、我怎么知道注入成功没成功。。。rnrnrnusing System;rnusing System.Collections.Generic;rnusing System.Diagnostics;rnusing System.Runtime.Remoting;rnusing EasyHook;rnrnnamespace DllInjectorrnrn class Programrn rn public static string ChannelName;rnrn public class WoWInterface : MarshalByRefObjectrn rn public void IsInstalled(Int32 InClientPID)rn rn return;rn rnrn public void WriteConsole(String Write)rn rn Console.WriteLine(Write);rn rn rnrn static void Main(string[] args)rn rn Config.Register("WowInjector App", "InjectedDll.dll", "DllInjector.exe");rnrn int wowPid;rn Process[] procs = Process.GetProcessesByName("Wow.exe");rn wowPid = procs[0].Id;rnrn RemoteHooking.IpcCreateServer(ref ChannelName, WellKnownObjectMode.SingleCall);rn RemoteHooking.Inject(wowPid, InjectionOptions.Default, "InjectedDll.dll", "InjectedDll.dll", ChannelName);rn rn rnrn
service注入失败
首先报错误 空指针 rn[code=java]java.lang.NullPointerExceptionrn at action.UserRegisterAction.execute(UserRegisterAction.java:34)[/code]rn后来我测试 userService确实为nullrn[code=java]rnrn private IUserService userService;rn rn public String execute()rn System.out.println("进入");rn Map errors = this.validate(person,rpassword);rn request.setAttribute("errors", errors);rn if(errors.isEmpty())rn tryrn userService.create(person);[/code]rn配置文件看了许多都没看出错误 前2个都成功了 就第三个出错rn[code=java]rn rn rn rn rn rn rn rn rn [/code]
@autowired自动注入失败
Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'empMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.hdd.mapper.EmployeeMapper' available: ...rn怎么改啊?
ssm+shiro 注入失败
认证失败:Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should exten...
springMVC 注入dao失败
这是baseSercice:rnpublic abstract class BaseServiceImpl implements BaseService rn @Autowiredrn protected BaseDao baseDao;rnrnrnrnrn这是userService:rnrn@Service("userService")rnpublic class UserServiceImpl extends BaseServiceImpl implements UserServicern @Resource(name = "userDao")rn private UserDao usersDao;rnrnrn这是loginService:rnrn@Service("loginService")rnpublic class LoginServiceImpl extends BaseServiceImpl implements LoginServicern @Resource(name = "loginDao") rn private LoginDao loginDao;rnrn异常:rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.tian.dao.BaseDao com.tian.service.impl.BaseServiceImpl.baseDao; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tian.dao.BaseDao] is defined: expected single matching bean but found 2: loginDao,userDaorn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)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:5099)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5615)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)rn at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)rn at java.util.concurrent.FutureTask.run(FutureTask.java:266)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at java.lang.Thread.run(Thread.java:745)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.tian.dao.BaseDao com.tian.service.impl.BaseServiceImpl.baseDao; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tian.dao.BaseDao] is defined: expected single matching bean but found 2: loginDao,userDaorn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)rn ... 26 morernCaused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tian.dao.BaseDao] is defined: expected single matching bean but found 2: loginDao,userDaorn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)rn ... 28 morern三月 02, 2017 2:33:47 下午 org.apache.catalina.core.StandardContext listenerStartrn严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.tian.dao.BaseDao com.tian.service.impl.BaseServiceImpl.baseDao; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tian.dao.BaseDao] is defined: expected single matching bean but found 2: loginDao,userDaorn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)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:5099)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5615)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)rn at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)rn at java.util.concurrent.FutureTask.run(FutureTask.java:266)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at java.lang.Thread.run(Thread.java:745)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.tian.dao.BaseDao com.tian.service.impl.BaseServiceImpl.baseDao; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tian.dao.BaseDao] is defined: expected single matching bean but found 2: loginDao,userDaorn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)rn ... 26 morernCaused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tian.dao.BaseDao] is defined: expected single matching bean but found 2: loginDao,userDaornrn但是当我将userService和loginService中的继承去掉就不报错了,请问我要怎么在不去掉继承的情况解决这个问题rn
spring 注入失败!!!!!!!!
applicationContext.xmlrn[code=XML]rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnstruts.xmlrn[code=XML]rnrn rn rn rn rn rn rn[/code]rnloginAction.xmlrn[code=XML]rn rn rn rn /sendSuccss.jsprn rn rn rn[/code]rnweb.xmlrn[code=XML]rn rn contextConfigLocationrn rn /WEB-INF/applicationContext*.xmlrn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn[/code]rnUserServiceImpl.javarn[code=Java]rnpublic class UserServiceImpl implements UserService rn public UserDAO userDao;rnrn public UserDAO getUserDao() rn return userDao;rn rnrn public void setUserDao(UserDAO userDao) rn this.userDao = userDao;rn rn[/code]rnrn[code=Java]rnpackage com.quxiuna.struts.action.login;rnrnimport java.util.Map;rnrnimport com.opensymphony.xwork2.ActionContext;rnimport com.opensymphony.xwork2.ActionSupport;rnimport com.quxiuna.hibernate.po.RbacUser;rnimport com.quxiuna.service.UserService;rnimport com.quxiuna.util.Constants;rnrnpublic class LoginAction extends ActionSupport rn rn private static final long serialVersionUID = -1640288447822607013L;rn rn private String name;rn private String password;rn private String message;rn public UserService userService;rnrn public String getName() rn return name;rn rn rn public void setName(String name) rn this.name = name;rn rnrn public String getPassword() rn return password;rn rnrn public void setPassword(String password) rn this.password = password;rn rn rn @SuppressWarnings("unchecked")rn public String execute() rn RbacUser user = userService.login(name, password);rn if (user != null) rn ActionContext ctx = ActionContext.getContext(); rn Map session = ctx.getSession(); rn session.put(Constants.SESSSION_NAME, name);rn return SUCCESS;rn else rn message = "用户名或密码错误!"; rn return ERROR;rn rn rnrn public String getMessage() rn return message;rn rnrn public void setMessage(String message) rn this.message = message;rn rnrn public UserService getUserService() rn return userService;rn rnrn public void setUserService(UserService userService) rn this.userService = userService;rn rnrn[/code]rnrn报错rnjava.lang.NullPointerExceptionrn com.quxiuna.struts.action.login.LoginAction.execute(LoginAction.java:38)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn java.lang.reflect.Method.invoke(Unknown Source)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)rn …………………………………………rn …………………………………………
@Autowired注入失败
在spring-mybatis.xml/applicationcontext.xml中没有加 &lt;context:component-scan base-package=“com.xxx”/&gt;,
Spring 注入失败的原因
有一次写代码如下   ApplicationContext ctx = new ClassPathXmlApplicationContext(&quot;beans.xml&quot;);  HarborBusiness service = (HarborBusiness) ctx.getBean(&quot;harborBusiness&quot;);   总是报no bean named   查了半天没查出来了,后来把前一...
springMVC 注入对象失败
最近有空想学着自己搭建一个SpringMVC的项目,因为之前都没咋学习相关的知识,所以在搭建过程中遇到了很多问题,其中第一问题就折腾了我好长时间,现在把它记录下来。 我是跟着这个博客开始进行搭建的,http://jinnianshilongnian.iteye.com/blog/1594806 1、下载所需的包 spring相关的jar包,可以从这个网址进行下载 : http://re
Spring @Autowired注入失败
今天做项目的时候出现了个问题,异常简要信息如下rn[code=java]Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.yuansheng.jst.permission.service.IPermissionService] is defined: expected single matching bean but found 2: permissonService,IPermissionService[/code]rn接口:rn[code=java]public interface IPermissionService rn[/code]rn实现类:rn[code=java]@Servicernpublic class PermissonService implements IPermissionService rn @Autowiredrn private PermissionMapper permissionMapper;rn rn[/code]rn控制器rn[code=java]@Controllerrn@Path("/permission")rn@Consumes(MediaType.APPLICATION_FORM_URLENCODED)rn@Produces(MediaType.APPLICATION_JSON)rnpublic class PermissionResource rn private Logger logger = Logger.getLogger(this.getClass());rn @Autowiredrn private IPermissionService permissionService;rnrn[/code]rnrn之前一直是这么注入的,没想到会出错,仔细检查后发现是由于实现类的名称中少写了一个字幕i导致的,即PermissionService写成了PermissonService,修改后就正确了。rn那么问题来了,@AutoWired默认是byType注入的,即使我的类名写错,接口也只有一个实现类,为什么会注入失败?而且异常信息是扫描到了两个可注入的类,其中一个还是IPermissionService,那么如果我实现类的名称写正确的话,为什么就能正确注入了,而没有扫描到两个?
@Resource注入spring失败
普通的class中的代码rn1、@Resourcern private AdBannerService bannerService;rnrnAdBannerService为接口 提供了AdBannerServiceImpl实现类rnrn2、spring的配置:是一次性把整个包都注入的rn[color=#FF0000] rn [/color]rn运行List adBanners=bannerService.adBannerList();rn就会报NullpointException错误,框架是SSI的rn不知道为什么会注入失败?求解!rnrn rn
SpringBoot+Mybatis整合报,service注入失败,dao注入失败,
问题:com.sun.org.apache.xerces.internal.impl.XMLEntityScanner$1 会导致,报,service注入失败,dao注入失败, 学习springboot整合mybaits.,根据demo做. 看整个流程都没问题了,因为配置本身就不多. 配置文件主要东西都在application.properties中了.
相关热词 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天 c#func链接匿名方法 c#怎么创建文件夹 c#从键盘接收空格 c#da/ad c#部门请假管理系统 c#服务器socket c# 默认的访问修饰符